diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index 98862ca54..d672d9a80 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -2191,19 +2191,19 @@ static int RunRugnux(int argc, char **argv) { const std::string poni_path = output_prefix + ".poni"; const std::string json_path = output_prefix + ".json"; try { - // A .poni file states where the detector is and nothing else. It has no field for doubt, so - // there is no honest way to write a geometry that is not a measurement into one - every - // program that reads it downstream would read it as if it were. Withholding it is the only - // thing the format allows. The JSON is written either way and carries the verdict, because - // it is where the evidence lives and it is wanted most exactly when the fit failed. - if (cal.converged) - WritePoniFile(poni_path, experiment, g); - // The same answer for whatever reads it next. A PONI file is what pyFAI and its neighbours - // take, but nothing in this system does, and it says nothing about how well the geometry is - // known - so write the JSON alongside it, with the geometry under dataset_settings' own - // property names and the quality beside it. + // The JSON FIRST, and ahead of anything the poni can refuse. It is the file that can state everything - + // the verdict, the uncertainty, and a geometry a PONI has no fields for - so it must exist + // even where the poni cannot be written, and it is wanted most exactly when the fit failed. + // WritePoniFile refuses a detector whose image orientation a PONI cannot express; refusing + // by throwing would otherwise take the JSON with it and leave a run whose own error text + // says "the .json beside it carries the full geometry" beside no .json at all. WriteCalibrationJson(json_path, experiment, cal, calibrant_label, calibration_method == CalibrationMethod::Rings ? "rings" : "spots"); + // A .poni file states where the detector is and nothing else. It has no field for doubt, so + // there is no honest way to write a geometry that is not a measurement into one - every + // program that reads it downstream would read it as if it were. + if (cal.converged) + WritePoniFile(poni_path, experiment, g); } catch (const std::exception &e) { logger.Error("{}", e.what()); return 1;