Skip to content
Snippets Groups Projects

empty relgain and random db port

Merged Karim Ahmed requested to merge fix/multiple_db_ports_and_no_relgain into master
All threads resolved!
1 file
+ 26
20
Compare changes
  • Side-by-side
  • Inline
metadata = ConstantMetaData()
metadata = ConstantMetaData()
relgain = Constants.CCD(DetectorTypes.pnCCD).RelativeGain()
relgain = Constants.CCD(DetectorTypes.pnCCD).RelativeGain()
metadata.calibration_constant = relgain
metadata.calibration_constant = relgain
try:
# set the operating condition
# set the operating condition
condition = Conditions.Illuminated.CCD(bias_voltage=bias_voltage,
condition = Conditions.Illuminated.CCD(bias_voltage=bias_voltage,
integration_time=integration_time,
integration_time=integration_time,
gain_setting=gain,
gain_setting=gain,
temperature=fix_temperature,
temperature=fix_temperature,
pixels_x=pixels_x,
pixels_x=pixels_x,
pixels_y=pixels_y,
pixels_y=pixels_y,
photon_energy=photon_energy)
photon_energy=photon_energy)
device = Detectors.PnCCD1
device = Detectors.PnCCD1
metadata.detector_condition = condition
metadata.detector_condition = condition
# specify the a version for this constant
# specify the a version for this constant
metadata.calibration_constant_version = Versions.Now(device=device)
metadata.calibration_constant_version = Versions.Now(device=device)
metadata.retrieve(cal_db_interface, timeout=cal_db_timeout)
cal_db_interface = get_random_db_interface(cal_db_interface)
constants["RelativeGain"] = relgain.data
metadata.retrieve(cal_db_interface, timeout=cal_db_timeout)
print("Retrieved RelativeGain constant with creation time:"
constants["RelativeGain"] = relgain.data
f"{metadata.calibration_constant_version.begin_at}")
print("Retrieved RelativeGain constant with creation time:"
 
f"{metadata.calibration_constant_version.begin_at}")
 
except Exception as e:
 
print(f"Error: {e}.\n")
 
if relgain.data is None:
 
constants["RelativeGain"] = np.ones((pixels_x, pixels_y))
 
print("Relative was not retrieved and an empty constant of ones will be used.")
display(Markdown('### Relative Gain Map Retrieval'))
display(Markdown('### Relative Gain Map Retrieval'))
fig = xana.heatmapPlot(constants["RelativeGain"], figsize=(8, 8), x_label='Columns', y_label='Rows', lut_label='Relative Gain',
fig = xana.heatmapPlot(constants["RelativeGain"], figsize=(8, 8), x_label='Columns', y_label='Rows', lut_label='Relative Gain',
aspect=1, x_range=(0, pixels_y), y_range=(0, pixels_x), vmin=0.8, vmax=1.2,
aspect=1, x_range=(0, pixels_y), y_range=(0, pixels_x), vmin=0.8, vmax=1.2,
Loading