Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OrcaSong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Learning
OrcaSong
Commits
54e27cb9
Commit
54e27cb9
authored
3 years ago
by
Stefan Reck
Browse files
Options
Downloads
Patches
Plain Diff
added loading tomls from examples
parent
c33bfa56
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/getting_started.rst
+4
-1
4 additions, 1 deletion
docs/getting_started.rst
orcasong/from_toml.py
+13
-1
13 additions, 1 deletion
orcasong/from_toml.py
with
17 additions
and
2 deletions
docs/getting_started.rst
+
4
−
1
View file @
54e27cb9
...
...
@@ -29,7 +29,10 @@ If you have an orcasong config file, you can use it via the command line like th
orcasong run aanet_file.h5 orcasong_config.toml --detx_file detector.detx
Check out the git repo here https://git.km3net.de/ml/OrcaSong/-/tree/master/examples for some examples of config files.
For some examples of config files you can check out the git repo here
https://git.km3net.de/ml/OrcaSong/-/tree/master/examples .
These can be loaded from the command line by using the prefix
``orcasong:`` before the filename, e.g. ``orcasong:orcasong_bundle_mupage.toml``.
Alternatively, you can use the python frontend of orcasong.
See :ref:`orcasong_page` for instructions on how to do this.
...
...
This diff is collapsed.
Click to expand it.
orcasong/from_toml.py
+
13
−
1
View file @
54e27cb9
import
os
from
pathlib
import
Path
import
toml
import
orcasong.core
import
orcasong.extractors
as
extractors
...
...
@@ -24,7 +26,9 @@ def add_parser_run(subparsers):
"
run
"
,
description
=
'
Produce a dl file from an aanet file.
'
)
parser
.
add_argument
(
'
infile
'
,
type
=
str
,
help
=
"
Aanet file in h5 format.
"
)
parser
.
add_argument
(
'
toml_file
'
,
type
=
str
,
help
=
"
Orcasong configuration in toml format.
"
)
parser
.
add_argument
(
'
toml_file
'
,
type
=
str
,
help
=
(
"
Orcasong configuration in toml format. Use prefix
'
orcasong:
'
to load
"
"
a toml from OrcaSong/examples.
"
))
parser
.
add_argument
(
'
--detx_file
'
,
type
=
str
,
default
=
None
,
help
=
(
"
Optional detx file to calibrate on the fly. Can not be used if a
"
"
detx_file has also been given in the toml file.
"
))
...
...
@@ -39,6 +43,8 @@ def run_orcasong(infile, toml_file, detx_file=None, outfile=None):
def
setup_processor
(
infile
,
toml_file
,
detx_file
=
None
):
if
toml_file
.
startswith
(
"
orcasong:
"
):
toml_file
=
_get_from_examples
(
toml_file
[
9
:])
cfg
=
toml
.
load
(
toml_file
)
processor
=
_get_verbose
(
cfg
.
pop
(
"
mode
"
),
MODES
)
...
...
@@ -64,3 +70,9 @@ def _get_verbose(key, d):
if
key
not
in
d
:
raise
KeyError
(
f
"
Unknown key
'
{
key
}
'
(available:
{
list
(
d
.
keys
())
}
)
"
)
return
d
[
key
]
def
_get_from_examples
(
filename
):
direc
=
os
.
path
.
join
(
Path
(
orcasong
.
core
.
__file__
).
parents
[
1
],
"
examples
"
)
files
=
{
file
:
os
.
path
.
join
(
direc
,
file
)
for
file
in
os
.
listdir
(
direc
)}
return
_get_verbose
(
filename
,
files
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment