reader: treat negative total_flux as unknown/absent
Serial-stills master files can store /entry/instrument/beam/total_flux as a -1.0 "unknown flux" sentinel (seen in the OCP dark dataset). DatasetSettings rejects values below 0, so opening such a file hard-failed with "Input parameter below min (Total flux)". Reset a negative flux to nullopt so it is treated as absent instead of aborting the read. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -611,7 +611,10 @@ HDF5MetadataSource::OpenResult HDF5MetadataSource::Open(const std::string &filen
|
||||
if (master_file->Exists("/entry/instrument/attenuator"))
|
||||
dataset->experiment.AttenuatorTransmission(
|
||||
master_file->GetOptFloat("/entry/instrument/attenuator/attenuator_transmission"));
|
||||
dataset->experiment.TotalFlux(master_file->GetOptFloat("/entry/instrument/beam/total_flux"));
|
||||
auto total_flux = master_file->GetOptFloat("/entry/instrument/beam/total_flux");
|
||||
if (total_flux.has_value() && total_flux.value() < 0)
|
||||
total_flux.reset(); // negative value is an "unknown flux" sentinel; treat as absent
|
||||
dataset->experiment.TotalFlux(total_flux);
|
||||
|
||||
if (master_file->Exists("/entry/azint") && master_file->Exists("/entry/azint/bin_to_q")) {
|
||||
HDF5DataSet bin_to_q_dataset(*master_file, "/entry/azint/bin_to_q");
|
||||
|
||||
Reference in New Issue
Block a user