Skip to content
Snippets Groups Projects
Commit bdee6c3f authored by Karim Ahmed's avatar Karim Ahmed
Browse files

add operation mode and single photon

parent 4ca823df
No related branches found
No related tags found
1 merge request!658[Gotthard-II] Correction
......@@ -26,10 +26,17 @@
"sequences_per_node = 1 # number of sequence files per node if notebook executed through xfel-calibrate, set to 0 to not run SLURM parallel\n",
"\n",
"# Parameters used to access raw data.\n",
<<<<<<< HEAD
"karabo_id = \"DET_LAB_G2\" # karabo prefix of Jungfrau devices\n",
"karabo_da = [\"DA01\"] # data aggregators\n",
"receiver_template = \"GOT{}\" # receiver template used to read INSTRUMENT keys.\n",
"control_template = \"CTRL{}\" # control template used to read CONTROL keys.\n",
=======
"karabo_id = \"FXE_XAD_G2XES\" # karabo prefix of Gotthard-II devices\n",
"karabo_da = [\"GH201\"] # data aggregators\n",
"receiver_template = \"RECEIVER\" # receiver template used to read INSTRUMENT keys.\n",
"control_template = \"CONTROL\" # control template used to read CONTROL keys.\n",
>>>>>>> add operation mode and single photon
"instrument_source_template = \"{}/DET/{}:daqOutput\" # template for source name (filled with karabo_id & receiver_id). e.g. 'SPB_IRDA_JF4M/DET/JNGFR01:daqOutput'\n",
"ctrl_source_template = \"{}/DET/{}\" # template for control source name (filled with karabo_id_control)\n",
"karabo_id_control = \"\" # Control karabo ID. Set to empty string to use the karabo-id\n",
......@@ -44,11 +51,11 @@
"constants_file = \"/gpfs/exfel/data/scratch/ahmedk/dont_remove/gotthard2/constants/calibration_constants_GH2.h5\"\n",
"\n",
"# Parameter conditions.\n",
"pulses = -1 # Number of detector pulses, -1 to use value in raw file.\n",
"bias_voltage = -1 # Detector bias voltage, -1 to use value in raw file.\n",
"integration_time = -1 # Detector integration time, -1 to use value in raw file.\n",
"acquisition_rate = -1 # Detector acquisition rate, -1 to use value in raw file.\n",
"gain_setting = -1 # Detector gain setting (High and Low CDS), -1 to use value in raw file.\n",
"bias_voltage = -1 # Detector bias voltage, set to -1 to use value in raw file.\n",
"exposure_time = -1 # Detector exposure time, set to -1 to use value in raw file.\n",
"exposure_period = -1 # Detector exposure period, set to -1 to use value in raw file.\n",
"operation_mode = -1 # Detector operation mode (1.1/4.5), set to -1 to use value in raw file.\n",
"single_photon = -1 # Detector single photon mode (High/Low CDS), set to -1 to use value in raw file.\n",
"\n",
"# Parameters for plotting\n",
"skip_plots = False # exit after writing corrected files\n",
......@@ -175,60 +182,60 @@
{
"cell_type": "code",
"execution_count": null,
"id": "764f1295",
"id": "4a8c1b95",
"metadata": {},
"outputs": [],
"source": [
"# condition = Conditions.Dark.jungfrau(\n",
"# pulses=pulses,\n",
"# condition = Conditions.Dark.gotthard2(\n",
"# bias_voltage=bias_voltage,\n",
"# integration_time=exposure_time,\n",
"# acquisition_time=acquisition_time,\n",
"# #gain_setting=gain_setting,\n",
"# exposure_time=exposure_time,\n",
"# exposure_period=exposure_period,\n",
"# single_photon=single_photon,\n",
"# operation_mode=operation_mode,\n",
"# )\n",
"\n",
"# def get_constants_for_module(karabo_da: str):\n",
"# \"\"\" Get calibration constants for given module for Gotthard2\"\"\"\n",
"# stripes = 1280\n",
"\n",
"\n",
"# def get_constants_for_module(mod: str):\n",
"# \"\"\"Get calibration constants for given module for Gotthard-II.\"\"\"\n",
"# when = {}\n",
"# retrieval_function = partial(get_constant_from_db_and_time(\n",
"# karabo_id=karabo_id,\n",
"# karabo_da=karabo_da,\n",
"# karabo_da=mod,\n",
"# cal_db_interface=cal_db_interface,\n",
"# creation_time=creation_time,\n",
"# timeout=cal_db_timeout,\n",
"# print_once=False,\n",
"# ))\n",
"# lut, when[\"Offset\"] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.jungfrau.LUT(),\n",
"# empty_constant=np.zeros((stripes, 2, 3))\n",
"# )\n",
"# offset_map, when[\"Offset\"] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.jungfrau.Offset(),\n",
"# empty_constant=np.zeros((stripes, 2, 3))\n",
"# )\n",
"# bpix_map, when[\"BadPixelsDark\"] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.jungfrau.BadPixelsDark(),\n",
"# empty_constant=np.zeros((stripes, 2, 3), dtype=np.uint32),\n",
"# )\n",
"# if gain_correction:\n",
"# mask_ff, when[\"BadPixelsFF\"] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.jungfrau.BadPixelsFF(),\n",
"# empty_constant=None\n",
"# )\n",
"# gain_map, when[\"Gain\"] = retrieval_function(\n",
"\n",
"# constants = {\n",
"# \"LUT\":np.uint32,\n",
"# \"Offset\":np.float32,\n",
"# \"Noise\":np.float32,\n",
"# \"BadPixelsDark\":np.float32\n",
"# }\n",
"# cons_data[mod] = {}\n",
"# for cname, ctype in constants.items():\n",
"# cons_data[mod][cname], when[cname] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.jungfrau.RelativeGain(),\n",
"# empty_constant=None\n",
"# constant=getattr(Constants.gotthard2, cname)(),\n",
"# empty_constant=np.zeros((stripes, 2, 3), dtype=ctype)\n",
"# )\n",
"# if gain_correction:\n",
"# for cname in [\"BadPixelsFF\", \"RelativeGain\"]:\n",
"# cons_data[mod][cname], when[cname] = retrieval_function(\n",
"# condition=condition,\n",
"# constant=Constants.gotthard2.BadPixelsFF(),\n",
"# empty_constant=None\n",
"# )\n",
"\n",
"# # combine masks\n",
"# if mask_ff is not None:\n",
"# mask |= np.moveaxis(mask_ff, 0, 1)\n",
"# if cons_data[mod].get(\"BadPixelsFF\", None) is not None:\n",
"# mask |= np.moveaxis(cons_data[mod][\"BadPixelsFF\"], 0, 1)\n",
"\n",
"\n",
"# cons_data = {}\n",
"# with multiprocessing.Pool() as pool:\n",
"# r = pool.map(get_constants_for_module, karabo_da)"
]
......
......@@ -24,10 +24,13 @@ ext_modules = [
extra_compile_args=['-O3', '-fopenmp', '-march=native',
'-ftree-vectorize', '-frename-registers'],
extra_link_args=['-fopenmp'],
)
),
Extension(
"cal_tools.gotthard2.gotthard2algs",
["src/cal_tools/gotthard2/gotthard2algs.pyx"],
include_dirs=[numpy.get_include()],
extra_compile_args=["-fopenmp", "-march=native"],
extra_link_args=["-fopenmp"],
),
]
......
......@@ -14,19 +14,19 @@ class Gotthard2Ctrl():
self.run_dc = run_dc
self.ctrl_src = ctrl_src
def get_pulses(self):
return(self.run_dc[self.ctrl_src, "numberOfFrames"].as_single_value())
def get_bias_voltage(self):
return(self.run_dc[self.ctrl_src, "highVoltageMax"].as_single_value())
def get_acquisition_time(self):
return(
float(self.run_dc.get_run_value(self.ctrl_src, "operationMode")))
def get_exposure_time(self):
return(self.run_dc[self.ctrl_src, "exposureTime"].as_single_value())
def get_gain_setting(self):
def get_exposure_period(self):
return(self.run_dc[self.ctrl_src, "exposurePeriod"].as_single_value())
def get_operation_mode(self):
return(
float(self.run_dc.get_run_value(self.ctrl_src, "operationMode")))
def get_single_photon(self):
return(
bool(self.run_dc[self.ctrl_src, "singlePhoton"].as_single_value()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment