ess.reduce.nexus.merge#
Merge the NeXus files of consecutive runs into a file that looks like one run.
A dataset whose first dimension is unlimited holds data streamed during the run, such as the fields of NXlog and NXevent_data groups, and of the NXdata groups of monitors in histogram mode, with a histogram per row. The merge concatenates it along that dimension, in the order of the runs’ start times. Every other dataset and attribute must be identical in all runs, except
the per-run fields of NXentry (
start_time,end_time, …), whose values for each run are kept in<entry>/merged_runs;minimum_value,maximum_value, andaverage_valueof an NXlog, which are recomputed from the merged values;the paths that
MergeRules.ignorematches.
The file writer starts each series of an NXlog with the values from shortly before the run. Those rows repeat the last rows of the previous run if it ended shortly before. The merge drops them, so a log of a device that did not move keeps a single value, as in a single run.
MergeRules also says how much the values of an NXlog may vary over all
runs: the merge is meant for runs whose device settings are the same.
Make a plan, look at its issues, then write the merged file:
plan = plan_merge(files, MergeRules.from_toml(rules_file))
for issue in plan.issues:
print(issue)
plan.write(output)
The merged file is the first file with the data of the other runs appended, so it keeps the attributes, links, chunking, and compression of the first file.
Functions
|
Check whether the runs in |
Classes
|
A finding about the runs to merge. |
|
Runs to merge, and what the checks found. |
|
Which differences between runs prevent merging them. |
|
Tolerances on the spread (maximum minus minimum) of the values of NXlogs. |