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
378a84c9
Commit
378a84c9
authored
5 years ago
by
Stefan Reck
Browse files
Options
Downloads
Patches
Plain Diff
Minor.
parent
9e69e74a
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
orcasong_contrib/data_tools/shuffle/shuffle_h5.py
+17
-7
17 additions, 7 deletions
orcasong_contrib/data_tools/shuffle/shuffle_h5.py
orcasong_plag/util/split_conc.py
+10
-6
10 additions, 6 deletions
orcasong_plag/util/split_conc.py
with
27 additions
and
13 deletions
orcasong_contrib/data_tools/shuffle/shuffle_h5.py
+
17
−
7
View file @
378a84c9
...
...
@@ -124,6 +124,21 @@ def parse_input():
return
input_files_list
,
delete
,
chunksize
,
complib
,
complevel
,
legacy_mode
def
get_filepath_output
(
filepath_input
,
shuffle
,
event_skipper
):
"""
Get the filename of the shuffled / rebalanced output file as a str.
"""
filepath_input_without_ext
=
os
.
path
.
splitext
(
filepath_input
)[
0
]
fname_adtn
=
''
if
shuffle
:
fname_adtn
+=
'
_shuffled
'
if
event_skipper
is
not
None
:
fname_adtn
+=
'
_reb
'
filepath_output
=
filepath_input_without_ext
+
fname_adtn
+
"
.h5
"
return
filepath_output
def
shuffle_h5
(
filepath_input
,
tool
=
False
,
seed
=
42
,
delete
=
False
,
chunksize
=
None
,
complib
=
None
,
complevel
=
None
,
legacy_mode
=
False
,
shuffle
=
True
,
event_skipper
=
None
,
filepath_output
=
None
):
...
...
@@ -189,13 +204,8 @@ def shuffle_h5(filepath_input, tool=False, seed=42, delete=False, chunksize=None
complevel
=
None
if
filepath_output
is
None
:
filepath_input_without_ext
=
os
.
path
.
splitext
(
filepath_input
)[
0
]
fname_adtn
=
''
if
shuffle
:
fname_adtn
+=
'
_shuffled
'
if
event_skipper
is
not
None
:
fname_adtn
+=
'
_reb
'
filepath_output
=
filepath_input_without_ext
+
fname_adtn
+
"
.h5
"
filepath_output
=
get_filepath_output
(
filepath_input
,
shuffle
,
event_skipper
)
if
not
legacy_mode
:
# set random km3pipe (=numpy) seed
...
...
This diff is collapsed.
Click to expand it.
orcasong_plag/util/split_conc.py
+
10
−
6
View file @
378a84c9
...
...
@@ -13,12 +13,14 @@ Example:
[
{
'
file_list
'
: array([
'
file_2.h5
'
, file_1.h5]), dtype=
'
<U69
'
),
'
output_filepath
'
:
'
test_train_0.h5
'
'
file_list
'
: array([
'
file_2.h5
'
, file_1.h5]),
'
output_filepath
'
:
'
test_train_0.h5
'
,
'
is_train
'
: True,
},
{
'
file_list
'
: array([
'
file_4.h5
'
,
'
file_0.h5
'
]), dtype=
'
<U69
'
),
'
output_filepath
'
:
'
test_val_0.h5
'
'
file_list
'
: array([
'
file_4.h5
'
,
'
file_0.h5
'
]),
'
output_filepath
'
:
'
test_val_0.h5
'
,
'
is_train
'
: False,
},
]
...
...
@@ -136,7 +138,8 @@ def get_split(folder, outfile_basestr, n_train_files=1, n_val_files=1,
output_filepath
=
"
{}_train_{}.h5
"
.
format
(
outfile_basestr
,
i
)
job_dict
=
{
"
file_list
"
:
job_files
,
"
output_filepath
"
:
output_filepath
"
output_filepath
"
:
output_filepath
,
"
is_train
"
:
True
,
}
jobs
.
append
(
job_dict
)
...
...
@@ -144,7 +147,8 @@ def get_split(folder, outfile_basestr, n_train_files=1, n_val_files=1,
output_filepath
=
"
{}_val_{}.h5
"
.
format
(
outfile_basestr
,
i
)
job_dict
=
{
"
file_list
"
:
job_files
,
"
output_filepath
"
:
output_filepath
"
output_filepath
"
:
output_filepath
,
"
is_train
"
:
False
,
}
jobs
.
append
(
job_dict
)
...
...
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