Skip to content

Commit

Permalink
Write out dnn_version, update test data
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuen committed Feb 26, 2025
1 parent d36ec94 commit 3731bb5
Show file tree
Hide file tree
Showing 75 changed files with 53 additions and 27 deletions.
1 change: 1 addition & 0 deletions dnn_reco/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def main(config_files, output_folder, data_settings, logs, log_level):
# Export package versions and git hash
# ------------------------------------
version_control = {
"dnn_reco_version": config["dnn_reco_version"],
"git_short_sha": config["git_short_sha"],
"git_sha": config["git_sha"],
"git_origin": config["git_origin"],
Expand Down
29 changes: 15 additions & 14 deletions dnn_reco/settings/setup_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import numpy as np
import tensorflow as tf

import dnn_reco
from dnn_reco import misc
from dnn_reco.settings.yaml import yaml_loader
from dnn_reco.settings import version_control

Expand Down Expand Up @@ -230,24 +232,23 @@ def _setup_config(self):
config["np_float_precision"] = getattr(np, config["float_precision"])

# check for version mismatch of dnn-reco (only major version)
if "pip_installed_packages" in config:
for pkg_name, version in config["pip_installed_packages"]:
if pkg_name == "dnn-reco":
restore_version = version
break
for pkg_name, version in version_control.installed_packages:
if pkg_name == "dnn-reco":
this_version = version
break

if "dnn_reco_version" in config:
restore_version = config["dnn_reco_version"]
restore_major = int(restore_version.split(".")[0])
this_major = int(this_version.split(".")[0])
if this_major != restore_major:
if restore_version != dnn_reco.__version__:
misc.print_warning(
f"Resoring model with version {restore_version}. "
f"Version of dnn-reco is {dnn_reco.__version__}."
)
if dnn_reco.__version_major__ != restore_major:
raise ValueError(
"Version mismatch of dnn-reco. The model was created with "
f"version {restore_version}, but version is {this_version} "
"Mismatch of major version number of dnn-reco. "
f"The model was created with version {restore_version}, "
f"but version is {dnn_reco.__version__} "
"is currently being used."
)
else:
config["dnn_reco_version"] = dnn_reco.__version__

# get git repo information
config["git_short_sha"] = str(version_control.short_sha)
Expand Down
2 changes: 1 addition & 1 deletion tests_manual/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def error(msg):
]

dir_original = os.path.join(
SCRIPT_DIR, "test_data/dnn_reco_test_01_base_v2_0_0_dev"
SCRIPT_DIR, "test_data/dnn_reco_test_01_base_v2_0_0"
)
test_dirs = glob.glob(os.path.join(SCRIPT_DIR, "test_data/*"))
test_dirs.remove(dir_original)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ processing_steps:
- ModuleClass: ic3_processing.modules.labels.primary.add_weighted_primary
ModuleKwargs: {}
- ModuleClass: ic3_processing.modules.pulses.cleaning.apply_time_window_cleaning
ModuleKwargs: {}
ModuleKwargs:
InputResponse: OfflinePulses
OutputResponse: SplitInIceDSTPulsesTWCleaning6000ns
- ModuleClass: ic3_labels.labels.modules.modules.MCLabelsCascades
ModuleKwargs:
ExtendBoundary: -60
Expand Down

0 comments on commit 3731bb5

Please sign in to comment.