cctbx / dxtbx

Diffraction Experiment Toolbox
BSD 3-Clause "New" or "Revised" License
2 stars 12 forks source link

Saturation / underload values for HDF5 / NeXus #103

Open graeme-winter opened 4 years ago

graeme-winter commented 4 years ago
                # Get the trusted range of pixel values
                underload = (
                    float(nx_detector.handle["underload_value"][()])
                    if "underload_value" in nx_detector.handle
                    else -400
                )
                overload = (
                    float(nx_detector.handle["saturation_value"][()])
                    if "saturation_value" in nx_detector.handle
                    else 90000
                )

seems arbitrary at best

if

Grey-Area work :( $ h5dump -d /entry/instrument/detector/saturation_value ../i03-0013_2_4_master.h5 
HDF5 "../i03-0013_2_4_master.h5" {
DATASET "/entry/instrument/detector/saturation_value" {
   DATATYPE  H5T_STD_I64LE
   DATASPACE  SCALAR
   DATA {
   (0): 65535
   }
}
}

is inconsistent with the actual data type; presumably the data type should win?

graeme-winter commented 4 years ago

I found the wrong references - for Eiger type data it defaults to

        # Get the trusted range of pixel values
            trusted_range = (-1, float(nx_detector["saturation_value"][()]))

or falls back to

            trusted_range = (-1, 99999999)

which makes more sense - assume code above applies to something else

phyy-nx commented 4 years ago

-400 to 90000 are the CSPAD trusted ranges in high gain mode. These defaults seem to have wandered in from the early CSPAD NeXus stuff Herbert and I were doing.

Regarding datatype, casting to float is reasonable to me since that's the interface on the detector/panel classes where the underload/overload values are headed.

On Fri, Oct 4, 2019 at 8:09 AM Graeme Winter notifications@github.com wrote:

I found the wrong references - for Eiger type data it defaults to

    # Get the trusted range of pixel values
        trusted_range = (-1, float(nx_detector["saturation_value"][()]))

or falls back to

        trusted_range = (-1, 99999999)

which makes more sense - assume code above applies to something else

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cctbx/dxtbx/issues/103?email_source=notifications&email_token=ADGY5SXM6YYIHIUHY6WFJALQM5MDRA5CNFSM4I5PDOZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAL6T6Q#issuecomment-538438138, or mute the thread https://github.com/notifications/unsubscribe-auth/ADGY5SVHFN3TJQNPDGWU23TQM5MDRANCNFSM4I5PDOZQ .

graeme-winter commented 4 years ago

OK, looking again at this - it seems underload_value is not commonly populated. We need to make sure that this is reported as 0 from Eiger data 🤔

dagewa commented 4 years ago

Do we need both trusted_range and underload_value?

graeme-winter commented 4 years ago

@dagewa underload_value comes from Eiger data set, goes to trusted_range