Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KerasROOTClassification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Nikolai.Hartmann
KerasROOTClassification
Commits
58e11537
Commit
58e11537
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Patches
Plain Diff
Adding option data_dir to automatically reuse (via hard or symlink) previously created arrays
parent
2434384a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit.py
+15
-0
15 additions, 0 deletions
toolkit.py
with
15 additions
and
0 deletions
toolkit.py
+
15
−
0
View file @
58e11537
...
...
@@ -75,6 +75,11 @@ class ClassificationProject(object):
:param weight_expr: expression to weight the events in the loss function
:param data_dir: if given, load the data from a previous project with the given name
instead of creating it from trees. If the data is on the same
disk (and the filesystem supports it), hard links will be used,
otherwise symlinks.
:param identifiers: list of branches or expressions that uniquely
identify events. This is used to store the list of training
events, such that they can be marked later on, for example when
...
...
@@ -152,6 +157,7 @@ class ClassificationProject(object):
def
_init_from_args
(
self
,
name
,
signal_trees
,
bkg_trees
,
branches
,
weight_expr
,
data_dir
=
None
,
identifiers
=
None
,
selection
=
None
,
layers
=
3
,
...
...
@@ -179,6 +185,7 @@ class ClassificationProject(object):
self
.
branches
=
branches
self
.
weight_expr
=
weight_expr
self
.
selection
=
selection
self
.
data_dir
=
data_dir
if
identifiers
is
None
:
identifiers
=
[]
self
.
identifiers
=
identifiers
...
...
@@ -363,6 +370,14 @@ class ClassificationProject(object):
dataset_names
=
self
.
dataset_names
for
dataset_name
in
dataset_names
:
filename
=
os
.
path
.
join
(
self
.
project_dir
,
dataset_name
+
"
.h5
"
)
if
(
self
.
data_dir
is
not
None
)
and
(
not
os
.
path
.
exists
(
filename
)):
srcpath
=
os
.
path
.
join
(
self
.
data_dir
,
dataset_name
+
"
.h5
"
)
try
:
os
.
link
(
srcpath
,
filename
)
logger
.
info
(
"
Created hardlink from {} to {}
"
.
format
(
srcpath
,
filename
))
except
OSError
:
os
.
symlink
(
srcpath
,
filename
)
logger
.
info
(
"
Created symlink from {} to {}
"
.
format
(
srcpath
,
filename
))
logger
.
info
(
"
Trying to load {} from {}
"
.
format
(
dataset_name
,
filename
))
with
h5py
.
File
(
filename
)
as
hf
:
setattr
(
self
,
dataset_name
,
hf
[
dataset_name
][:])
...
...
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