[LPD][Correct] Fix/constant dtype conversion
Description
Before !867 (merged) and !779 (merged), constant arrays were loaded in the notebook and were initialized in the correct type for bad pixels.
After using CalibrationData API, https://git.xfel.eu/calibration/pycalibration/-/blob/master/src/cal_tools/calcat_interface.py#L626-638. Masks were stored in the wrong expected values for the corrected data.
with h5py.File(self.caldb_root / mdata["path"], "r") as cf:
shape = cf[f"{dataset}/data"].shape
dtype = cf[f"{dataset}/data"].dtype
As there are some old BadPixels constants that are stored as <f8
with NANs. When converting these nans to uint32, instead of being converted to 0
uint32 it gets converted to 2147483648
For the BadPixels, I convert NANs to zeros first. This bug was caught using the automated tests and the masks were the only non-validated data.
How Has This Been Tested?
Relevant Documents (optional)
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
Reviewers
Merge request reports
Activity
added Waiting for review label
assigned to @ahmedk
- Resolved by Karim Ahmed
Thanks, that LGTM. I wondered about doing this only if it's a float dtype, but it's probably not worth the extra code.
added 6 commits
-
170e231d...9dafd4fa - 4 commits from branch
master
- 86fa6eb5 - convert f8 nan before converting to uint32
- 224f8ec9 - Avoid converting nans for uint32 badpixels
-
170e231d...9dafd4fa - 4 commits from branch
enabled an automatic merge when the pipeline for 224f8ec9 succeeds
mentioned in commit f3027732
changed milestone to %3.11.0