Streak Finder algorithm for CBD experiment #2

Merged
augustin_s merged 46 commits from ext-dorofe_e/dap:chapman into main 2025-07-14 11:18:07 +02:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit a10c70028f - Show all commits

View File

@@ -112,7 +112,7 @@ options:
Input parameters:
* `'do_whitefield_correction': 1/0` - Specifies whether to do in-place white field correction.
* `'wf_data_file': str` - Path to the hdf5 file with corrected white field image.
* `'wf_dataset': str` - Name of the dataset containing white field image in the hdf5 file.
* `'wf_dataset': str` [Optional] - Name of the dataset containing white field image in the hdf5 file, default is `"data/data"`.
* `'wf_method': 'div'|'sub'` - Method of white field correction - either division or subtraction is supported.
Algorithm Output:

View File

@@ -53,11 +53,12 @@ def calc_apply_whitefield_correction(results, data):
f"{params_required=}")
return
wf_dataset = results.get("wf_dataset", "data/data")
# TODO: cache white field data, only reload if file changed
# maybe store checksum in results as "_checksum"
try:
with h5py.File(wf_data_file, "r") as wfile:
whitefield_image = np.asarray(wfile["data/data"])
whitefield_image = np.asarray(wfile[wf_dataset])
except Exception as error:
print(f"ERROR: Can't read whitefield from file {wf_data_file}. Skipping\n"
f"{error=}")