Skip to content

24 implement better way to avoid overwriting h5 files#83

Merged
jwaiton merged 14 commits into
nu-ZOO:mainfrom
Tedsmith100:24-implement-better-way-to-avoid-overwriting-h5-files
May 11, 2026
Merged

24 implement better way to avoid overwriting h5 files#83
jwaiton merged 14 commits into
nu-ZOO:mainfrom
Tedsmith100:24-implement-better-way-to-avoid-overwriting-h5-files

Conversation

@Tedsmith100
Copy link
Copy Markdown
Contributor

Changed h5 file overwriting to append datetime to saved filenames. Appends '_YYYYMMDD_HHMMSS' to file names plus '_N' in the unlikely case of duplicates.

increase threshold and add warning to counter
Use timestamp naming  in file creation when overwrite is false. Have user input to double check overwriting.
@Tedsmith100 Tedsmith100 requested a review from a team May 8, 2026 15:01
Copy link
Copy Markdown
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Just a few minor tweaks :)

Comment thread packs/tests/proc_test.py
Comment on lines +160 to +163
assert found_path != data_path
assert found_path.endswith('.h5')
assert re.search(r'_\d{8}_\d{6}', found_path), "Expected datetime stamp in filename"
assert not os.path.exists(found_path), "Path should not already exist"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer direct testing, which is fine but it should be noted.

Comment thread packs/proc/processing_utils.py Outdated
Comment thread packs/tests/processing_test.py
Comment thread packs/tests/proc_test.py
instead of a local variable
mock fixed datetime for module
Comment thread packs/tests/proc_test.py
Comment on lines -71 to 80
# run processing pack decode
run_pack = [sys.executable, MULE_dir + "/bin/mule", "proc", config_path]
subprocess.run(run_pack)
# check that the resulting dataframe is as expected

assert load_evt_info(save_path).equals(load_evt_info(comparison_path))
assert load_rwf_info(save_path, samples).equals(load_rwf_info(comparison_path, samples))

finally:
# rewrite config file to original state
with open(config_path, "w") as f:
f.write(original_content)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put these comments back naughty naughty

Comment thread packs/tests/proc_test.py Outdated
@Tedsmith100 Tedsmith100 force-pushed the 24-implement-better-way-to-avoid-overwriting-h5-files branch from 73bc0b9 to e0bbdbf Compare May 11, 2026 15:22
Copy link
Copy Markdown
Member

@jwaiton jwaiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR implements a nicer way yo avoid overwriting h5 files, and includes datetime nomenclature for the created files, good work!

@jwaiton jwaiton merged commit 5fb075f into nu-ZOO:main May 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants