diff --git a/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb index 031dbce99f766e589710e9deb077c0c877cda2e0..7a26a81975b9b70d3c9c14a747912b07cd63f4b3 100644 --- a/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb +++ b/notebooks/Gotthard2/Characterize_Darks_Gotthard2_NBC.ipynb @@ -22,34 +22,33 @@ "run_high = 50 # run number for G0 dark run, required\n", "run_med = 51 # run number for G1 dark run, required\n", "run_low = 52 # run number for G2 dark run, required\n", - "sequences = [-1] # sequences to correct, set to [-1] for all, range allowed\n", - "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", "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", - "instrument_source_template = '{}/DET/{}:daqOutput' # template for source name (filled with karabo_id & receiver_id). e.g. 'SPB_IRDA_JF4M/DET/JNGFR01:daqOutput'\n", + "instrument_source_template = '{}/DET/{}:daqOutput' # template for source name (filled with karabo_id & receiver_id). e.g. 'SPB_IRDA_JF4M/DET/JNGFR01:daqOutput' # noqa\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", "\n", "# Parameters for the calibration database.\n", "use_dir_creation_date = True\n", - "cal_db_interface = \"tcp://max-exfl017:8020\" # calibration DB interface to use\n", - "cal_db_timeout = 300000 # timeout on caldb requests\n", - "db_output = False # Output constants to the calibration database\n", - "local_output = True # Output constants locally\n", + "cal_db_interface = \"tcp://max-exfl017:8020\" # calibration DB interface to use\n", + "cal_db_timeout = 300000 # timeout on caldb requests\n", + "overwrite_creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC.00 e.g. \"2022-06-28 13:00:00.00\"\n", + "db_output = False # Output constants to the calibration database\n", + "local_output = True # Output constants locally\n", "\n", "# Conditions used for injected calibration constants.\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", + "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", + "acquisition_rate = -1. # Detector acquisition rate (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 used during selecting raw data trains.\n", - "min_trains = 1 # Minimum number of trains that should be available to process dark constants. Default 1.\n", + "min_trains = 1 # Minimum number of trains that should be available to process dark constants. Default 1.\n", "max_trains = 1000 # Maximum number of trains to use for processing dark constants. Set to 0 to use all available trains.\n", "badpixel_threshold_sigma = 5. # bad pixels defined by values outside n times this std from median\n", "\n", @@ -64,9 +63,9 @@ "metadata": {}, "outputs": [], "source": [ + "import datetime\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", - "import multiprocessing\n", "import pasha as psh\n", "from IPython.display import Markdown, display\n", "from extra_data import RunDirectory\n", @@ -77,7 +76,6 @@ "from cal_tools.step_timing import StepTimer\n", "from cal_tools.tools import (\n", " get_dir_creation_date,\n", - " get_from_db,\n", " get_constant_from_db_and_time,\n", " get_pdu_from_db,\n", " get_report,\n", @@ -85,7 +83,8 @@ " send_to_db,\n", ")\n", "from iCalibrationDB import Conditions, Constants\n", - "from XFELDetAna.plotting.heatmap import heatmapPlot" + "\n", + "%matplotlib inline" ] }, { @@ -105,22 +104,22 @@ "run_dc = RunDirectory(in_folder / f\"r{run_high:04d}\")\n", "file_loc = f\"proposal:{run_dc.run_metadata()['proposalNumber']} runs:{run_high} {run_med} {run_low}\" # noqa\n", "\n", - "instrument_src = instrument_source_template.format(\n", - " karabo_id, receiver_template)\n", - "ctrl_src = ctrl_source_template.format(\n", - " karabo_id_control, control_template)\n", + "instrument_src = instrument_source_template.format(karabo_id, receiver_template)\n", + "ctrl_src = ctrl_source_template.format(karabo_id_control, control_template)\n", "\n", "# Read report path to associate it later with injected constants.\n", "report = get_report(out_folder)\n", "\n", - "if use_dir_creation_date:\n", + "\n", + "if overwrite_creation_time:\n", + " creation_time = datetime.datetime.strptime(\n", + " overwrite_creation_time, \"%Y-%m-%d %H:%M:%S.%f\"\n", + " )\n", + "elif use_dir_creation_date:\n", " creation_time = get_dir_creation_date(in_folder, run_high)\n", " print(f\"Using {creation_time.isoformat()} as creation time\")\n", - "# TODO: Remove later\n", - "import datetime\n", - "creation_time=datetime.datetime.strptime(\n", - " \"2022-06-28 13:00:00.00\",\n", - " \"%Y-%m-%d %H:%M:%S.%f\")\n", + "\n", + "\n", "if not karabo_id_control:\n", " karabo_id_control = karabo_id" ] @@ -152,21 +151,30 @@ " \"bias_voltage\": set(),\n", " \"exposure_time\": set(),\n", " \"exposure_period\": set(),\n", - " #\"operation_mode\": set(),\n", - " #\"single_photon\": set(),\n", + " \"acquisition_rate\": set(),\n", + " \"single_photon\": set(),\n", "}\n", "for gain, run in enumerate(run_nums):\n", " run_dc = RunDirectory(in_folder / f\"r{run:04d}/\")\n", " run_dcs_dict[run] = [gain, run_dc]\n", "\n", " # Read slow data.\n", - " g2ctrl = gotthard2lib.Gotthard2Ctrl(\n", - " run_dc=run_dc, ctrl_src=ctrl_src)\n", - " conditions[\"bias_voltage\"].add(g2ctrl.get_bias_voltage() if bias_voltage == -1 else bias_voltage) # noqa\n", - " conditions[\"exposure_time\"].add(g2ctrl.get_exposure_time() if exposure_time == -1 else exposure_time) # noqa\n", - " conditions[\"exposure_period\"].add(g2ctrl.get_exposure_period() if exposure_period == -1 else exposure_period) # noqa\n", - "# conditions[\"single_photon\"].add(g2ctrl.get_single_photon() if single_photon == -1 else single_photon) # noqa\n", - "# conditions[\"operation_mode\"].add(g2ctrl.get_operation_mode() if operation_mode == -1 else operation_mode) # noqa\n", + " g2ctrl = gotthard2lib.Gotthard2Ctrl(run_dc=run_dc, ctrl_src=ctrl_src)\n", + " conditions[\"bias_voltage\"].add(\n", + " g2ctrl.get_bias_voltage() if bias_voltage == -1 else bias_voltage\n", + " )\n", + " conditions[\"exposure_time\"].add(\n", + " g2ctrl.get_exposure_time() if exposure_time == -1 else exposure_time\n", + " )\n", + " conditions[\"exposure_period\"].add(\n", + " g2ctrl.get_exposure_period() if exposure_period == -1 else exposure_period\n", + " )\n", + " conditions[\"single_photon\"].add(\n", + " g2ctrl.get_single_photon() if single_photon == -1 else single_photon\n", + " )\n", + " conditions[\"acquisition_rate\"].add(\n", + " g2ctrl.get_acquisition_rate() if acquisition_rate == -1 else acquisition_rate\n", + " )\n", "\n", "for c, v in conditions.items():\n", " assert len(v) == 1, f\"{c} value is not the same for the three runs.\"\n", @@ -177,8 +185,10 @@ "print(\"Exposure time: \", exposure_time)\n", "exposure_period = conditions[\"exposure_period\"].pop()\n", "print(\"Exposure period: \", exposure_period)\n", - "# single_photon = conditions[\"single_photon\"].pop()\n", - "# operation_mode = conditions[\"operation_mode\"].pop()" + "single_photon = conditions[\"single_photon\"].pop()\n", + "print(\"Single photon: \", single_photon)\n", + "acquisition_rate = conditions[\"acquisition_rate\"].pop()\n", + "print(\"Acquisition rate: \", acquisition_rate)" ] }, { @@ -202,13 +212,16 @@ " # Specifies total number of trains to proccess.\n", " n_trains = img_key_data.shape[0]\n", " all_trains = len(img_key_data.train_ids)\n", - " print(f\"{mod} has {all_trains - n_trains} \"\n", - " f\"trains with empty frames out of {all_trains} trains\")\n", + " print(\n", + " f\"{mod} has {all_trains - n_trains} \"\n", + " f\"trains with empty frames out of {all_trains} trains\"\n", + " )\n", "\n", " if n_trains < min_trains:\n", " raise ValueError(\n", " f\"Less than {min_trains} trains are available in RAW data.\"\n", - " \" Not enough data to process darks.\")\n", + " \" Not enough data to process darks.\"\n", + " )\n", "\n", " if max_trains > 0:\n", " n_trains = min(n_trains, max_trains)\n", @@ -231,8 +244,8 @@ " bias_voltage=bias_voltage,\n", " exposure_time=exposure_time,\n", " exposure_period=exposure_period,\n", - " #operation_mode=operation_mode,\n", - " #single_photon=single_photon,\n", + " acquisition_rate=acquisition_rate,\n", + " single_photon=single_photon,\n", ")\n", "\n", "db_modules = get_pdu_from_db(\n", @@ -241,7 +254,8 @@ " constant=Constants.Gotthard2.LUT(),\n", " condition=condition,\n", " cal_db_interface=cal_db_interface,\n", - " snapshot_at=creation_time)\n" + " snapshot_at=creation_time,\n", + ")" ] }, { @@ -253,7 +267,9 @@ "source": [ "def convert_train(wid, index, tid, d):\n", " \"\"\"Convert a Gotthard2 train from 12bit to 10bit.\"\"\"\n", - " gotthard2algs.convert_to_10bit(d[instr_mod_src][\"data.adc\"], lut, data_10bit[index, ...])\n" + " gotthard2algs.convert_to_10bit(\n", + " d[instr_mod_src][\"data.adc\"], lut, data_10bit[index, ...]\n", + " )" ] }, { @@ -268,15 +284,19 @@ "offset_map = dict()\n", "badpixels_map = dict()\n", "\n", - "context = psh.context.ProcessContext(num_workers=multiprocessing.cpu_count())\n", + "context = psh.context.ProcessContext(num_workers=2)\n", "\n", + "empty_lut = (np.arange(2 ** 12).astype(np.float64) * 2 ** 10 / 2 ** 12).astype(\n", + " np.uint16\n", + ")\n", + "empty_lut = np.stack(1280 * [np.stack([empty_lut] * 2)], axis=0)\n", "for mod in karabo_da:\n", "\n", " # Retrieve LUT constant\n", " lut, time = get_constant_from_db_and_time(\n", " constant=Constants.Gotthard2.LUT(),\n", " condition=condition,\n", - " empty_constant=None,\n", + " empty_constant=empty_lut,\n", " karabo_id=karabo_id,\n", " karabo_da=mod,\n", " cal_db_interface=cal_db_interface,\n", @@ -300,16 +320,16 @@ " n_trains = specify_trains_to_process(run_dc[instr_mod_src, \"data.adc\"])\n", "\n", " # Select requested number of trains to process.\n", - " dc = run_dc.select(\n", - " instr_mod_src, require_all=True).select_trains(np.s_[:n_trains]) # noqa\n", + " dc = run_dc.select(instr_mod_src, require_all=True).select_trains(\n", + " np.s_[:n_trains]\n", + " ) # noqa\n", "\n", " step_timer.done_step(\"preparing raw data\")\n", "\n", " step_timer.start()\n", " # Convert 12bit data to 10bit\n", " data_10bit = context.alloc(\n", - " shape=dc[instr_mod_src, \"data.adc\"].shape,\n", - " dtype=np.float32\n", + " shape=dc[instr_mod_src, \"data.adc\"].shape, dtype=np.float32\n", " )\n", " context.map(convert_train, dc)\n", " step_timer.done_step(\"convert to 10bit\")\n", @@ -320,26 +340,43 @@ " # Detector always operates in burst mode.\n", " even_data = data_10bit[:, ::2, :]\n", " odd_data = data_10bit[:, 1::2, :]\n", - " data_gain = dc[instr_mod_src, \"data.gain\"].ndarray()\n", - " even_gain = data_gain[:, ::2, :]\n", - " odd_gain = data_gain[:, 1::2, :]\n", + "\n", " def offset_noise_cell(wid, index, d):\n", " offset_map[mod][:, index, gain] = np.mean(d, axis=(0, 1))\n", " noise_map[mod][:, index, gain] = np.std(d, axis=(0, 1))\n", "\n", + " # Calculate Offset and Noise Maps.\n", " context.map(offset_noise_cell, (even_data, odd_data))\n", "\n", + " # Split even and odd gain data.\n", + " data_gain = dc[instr_mod_src, \"data.gain\"].ndarray()\n", + " even_gain = data_gain[:, ::2, :]\n", + " odd_gain = data_gain[:, 1::2, :]\n", " raw_g = 3 if gain == 2 else gain\n", + "\n", " def badpixels_cell(wid, index, g):\n", " \"\"\"Check if there are wrong bad gain values.\n", " Indicate pixels with wrong gain value across all trains for each cell.\"\"\"\n", - " badpixels_map[mod][np.mean(g, axis=(0, 1)) != raw_g, index,\n", - " gain] |= BadPixels.WRONG_GAIN_VALUE.value\n", + " badpixels_map[mod][\n", + " np.mean(g, axis=(0, 1)) != raw_g, index, gain\n", + " ] |= BadPixels.WRONG_GAIN_VALUE.value\n", + "\n", " context.map(badpixels_cell, (even_gain, odd_gain))\n", "\n", " step_timer.done_step(\"Processing darks\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "8e410ca2", + "metadata": {}, + "outputs": [], + "source": [ + "print(f\"Total processing time {step_timer.timespan():.01f} s\")\n", + "step_timer.print_summary()" + ] + }, { "cell_type": "code", "execution_count": null, @@ -350,31 +387,21 @@ "def print_bp_entry(bp):\n", " print(f\"{bp.name:<30s} {bp.value:032b} -> {int(bp.value)}\")\n", "\n", + "\n", "print_bp_entry(BadPixels.NOISE_OUT_OF_THRESHOLD)\n", "print_bp_entry(BadPixels.OFFSET_NOISE_EVAL_ERROR)\n", "print_bp_entry(BadPixels.WRONG_GAIN_VALUE)\n", "\n", + "\n", "def eval_bpidx(d):\n", " mdn = np.nanmedian(d, axis=(0))[None, :, :]\n", - " std = np.nanstd(d, axis=(0))[None, :, :] \n", - " idx = (\n", - " d > badpixel_threshold_sigma * std + mdn\n", - " ) | (\n", + " std = np.nanstd(d, axis=(0))[None, :, :]\n", + " idx = (d > badpixel_threshold_sigma * std + mdn) | (\n", " d < (-badpixel_threshold_sigma) * std + mdn\n", " )\n", " return idx" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "9409d10f", - "metadata": {}, - "outputs": [], - "source": [ - "badpixels_map[mod][~np.isfinite(noise_map[mod])]" - ] - }, { "cell_type": "code", "execution_count": null, @@ -383,94 +410,34 @@ "outputs": [], "source": [ "step_timer.start()\n", - "g_name = ['G0', 'G1', 'G2']\n", + "g_name = [\"G0\", \"G1\", \"G2\"]\n", "\n", "for mod, pdu in zip(karabo_da, db_modules):\n", " display(Markdown(f\"### Badpixels for module {mod}:\"))\n", "\n", - " badpixels_map[mod][~np.isfinite(offset_map[mod])] |= BadPixels.OFFSET_NOISE_EVAL_ERROR.value # npqa\n", - " badpixels_map[mod][eval_bpidx(noise_map[mod])] |= BadPixels.NOISE_OUT_OF_THRESHOLD.value\n", - "\n", - " badpixels_map[mod][~np.isfinite(noise_map[mod])] |= BadPixels.OFFSET_NOISE_EVAL_ERROR.value # noqa\n", + " badpixels_map[mod][\n", + " ~np.isfinite(offset_map[mod])\n", + " ] |= BadPixels.OFFSET_NOISE_EVAL_ERROR.value\n", + " badpixels_map[mod][\n", + " eval_bpidx(noise_map[mod])\n", + " ] |= BadPixels.NOISE_OUT_OF_THRESHOLD.value\n", "\n", + " badpixels_map[mod][\n", + " ~np.isfinite(noise_map[mod])\n", + " ] |= BadPixels.OFFSET_NOISE_EVAL_ERROR.value\n", "\n", " for cell in [0, 1]:\n", " fig, ax = plt.subplots(figsize=(10, 5))\n", - " for g_idx in [0, 1, 2]: \n", + " for g_idx in [0, 1, 2]:\n", " ax.plot(badpixels_map[mod][:, cell, g_idx], label=f\"G{g_idx} Bad pixel map\")\n", " ax.set_xticks(np.arange(0, 1281, 80))\n", " ax.set_xlabel(\"Stripes #\")\n", " ax.set_xlabel(\"BadPixels\")\n", - " ax.set_title(f'Cell {cell} - Module {mod} ({pdu})')\n", - " ax.set_ylim([0, BadPixels.WRONG_GAIN_VALUE.value])\n", - " ax.set_yticks([0,\n", - " BadPixels.NOISE_OUT_OF_THRESHOLD.value,\n", - " BadPixels.OFFSET_NOISE_EVAL_ERROR.value,\n", - " BadPixels.WRONG_GAIN_VALUE.value])\n", + " ax.set_title(f\"Cell {cell} - Module {mod} ({pdu})\")\n", + " ax.set_ylim([0, 5])\n", " ax.legend()\n", " pass\n", - "step_timer.done_step(f'Creating bad pixels constant and plotting it.')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e5131112", - "metadata": {}, - "outputs": [], - "source": [ - "step_timer.start()\n", - "g_name = ['G0', 'G1', 'G2']\n", - "\n", - "for mod, pdu in zip(karabo_da, db_modules):\n", - " display(Markdown(f\"### Badpixels for module {mod}:\"))\n", - "\n", - " for g_idx in [0, 1, 2]:\n", - " # for cell in [0, 1]:\n", - " heatmapPlot(\n", - " badpixels_map[mod][:, :, g_idx],\n", - " y_label=\"Stripes\",\n", - " x_label=\"Cells\",\n", - "# lut_label=unit,\n", - " vmin=0, vmax=5,\n", - " title=f\"Even / Odd Offset map G{g_idx} - Module {mod} ({pdu})\",\n", - " )\n", - " pass\n", - "step_timer.done_step(f'Creating bad pixels constant and plotting it.')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fde8e1cf-bc74-462f-b6e5-cfee8279090d", - "metadata": {}, - "outputs": [], - "source": [ - "unit = '[ADCu]'\n", - "\n", - "for mod, pdu in zip(karabo_da, db_modules):\n", - " for _, [gain, _] in run_dcs_dict.items():\n", - " heatmapPlot(\n", - " offset_map[mod][:, :, gain],\n", - " y_label=\"Stripes\",\n", - " x_label=\"Cells\",\n", - " lut_label=unit,\n", - " x_ticks=[0.5, 1.5],\n", - " x_ticklabels=[\"EVEN\", \"ODD\"],\n", - " x_tick_rotation=0,\n", - " title=f\"Even / Odd Offset map G{gain} - Module {mod} ({pdu})\",\n", - " )\n", - " heatmapPlot(\n", - " noise_map[mod][:, :, gain],\n", - " y_label=\"Stripes\",\n", - " x_label=\"Cells\",\n", - " lut_label=unit,\n", - " x_ticks=[0.5, 1.5],\n", - " x_ticklabels=[\"EVEN\", \"ODD\"],\n", - " x_tick_rotation=0,\n", - " title=f\"Even / Odd noise map G{gain} - Module {mod} ({pdu})\",\n", - " )\n", - " pass" + "step_timer.done_step(f\"Creating bad pixels constant and plotting it.\")" ] }, { @@ -489,7 +456,7 @@ "\n", " ax.set_xlabel(\"Stripes #\")\n", " ax.set_xlabel(cname)\n", - " ax.set_title(f\"{cname} map - Cell {cell} - Module {mod} ({pdu})\"),\n", + " ax.set_title(f\"{cname} map - Cell {cell} - Module {mod} ({pdu})\")\n", " ax.legend()\n", " pass" ] @@ -506,7 +473,7 @@ " constants = {\n", " \"Offset\": offset_map[mod],\n", " \"Noise\": noise_map[mod],\n", - " \"BadPixelsDark\": badpixels_map[mod]\n", + " \"BadPixelsDark\": badpixels_map[mod],\n", " }\n", "\n", " md = None\n", @@ -543,14 +510,14 @@ " print(f\"Calibration constant {key} is stored locally at {out_folder}.\\n\")\n", "\n", "print(\"Constants parameter conditions are:\\n\")\n", - "# TODO: add the final conditions for constants.\n", "print(\n", " f\"• Bias voltage: {bias_voltage}\\n\"\n", " f\"• Exposure time: {exposure_time}\\n\"\n", " f\"• Exposure period: {exposure_period}\\n\"\n", - " f\"• Operation mode: {operation_mode}\\n\"\n", + " f\"• Acquisition rate: {acquisition_rate}\\n\"\n", " f\"• Single photon: {single_photon}\\n\"\n", - " f\"• Creation time: {md.calibration_constant_version.begin_at if md is not None else creation_time}\\n\") # noqa\n", + " f\"• Creation time: {md.calibration_constant_version.begin_at if md is not None else creation_time}\\n\"\n", + ")\n", "step_timer.done_step(\"Injecting constants.\")" ] } diff --git a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb index b9d190420845cbfb23de70faa88e4ef59557e1b9..8368dcb9756d7b619c2187642ed024788dcaa54f 100644 --- a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb +++ b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb @@ -58,7 +58,6 @@ "pulse_idx_preview = 3 # pulse index to preview. The following even/odd pulse index is used for preview. # TODO: update to pulseId preview.\n", "\n", "\n", - "\n", "def balance_sequences(in_folder, run, sequences, sequences_per_node, karabo_da):\n", " from xfel_calibrate.calibrate import balance_sequences as bs\n", " return bs(in_folder, run, sequences, sequences_per_node, karabo_da)" diff --git a/src/cal_tools/gotthard2/gotthard2lib.py b/src/cal_tools/gotthard2/gotthard2lib.py index f5c431cb018a85c71bbb5c25d21fca0753010ddd..8a0a32b5d974f11c510abf5165440eb89333faed 100644 --- a/src/cal_tools/gotthard2/gotthard2lib.py +++ b/src/cal_tools/gotthard2/gotthard2lib.py @@ -17,16 +17,6 @@ class Gotthard2Ctrl(): def get_bias_voltage(self): return(self.run_dc[self.ctrl_src, "highVoltageMax"].as_single_value()) -<<<<<<< HEAD -<<<<<<< HEAD -======= - def get_acquisition_time(self): - return( - float(self.run_dc.get_run_value(self.ctrl_src, "operationMode"))) - ->>>>>>> introduce SinglePhoton and OperationMode -======= ->>>>>>> add operation mode and single photon def get_exposure_time(self): return(round( self.run_dc[self.ctrl_src, "exposureTime"].as_single_value(), 4)) @@ -34,7 +24,6 @@ class Gotthard2Ctrl(): def get_exposure_period(self): return(round( self.run_dc[self.ctrl_src, "exposurePeriod"].as_single_value(), 4)) # noqa -<<<<<<< HEAD def get_acquisition_rate(self): if "acquisitionRate.value" in self.run_dc.keys_for_source(self.ctrl_src): # noqa @@ -42,36 +31,7 @@ class Gotthard2Ctrl(): float(self.run_dc.get_run_value( self.ctrl_src, "acquisitionRate"))) -<<<<<<< HEAD -<<<<<<< HEAD def get_single_photon(self): if "singlePhoton.value" in self.run_dc.keys_for_source(self.ctrl_src): # noqa return( bool(self.run_dc[self.ctrl_src, "singlePhoton"].as_single_value())) # noqa -======= - def get_gain_setting(self): -======= - def get_exposure_period(self): - return(self.run_dc[self.ctrl_src, "exposurePeriod"].as_single_value()) -======= ->>>>>>> retrieve constants from calcat - - def get_operation_mode(self): - if "operationMode.value" in self.run_dc.keys_for_source( - self.ctrl_src): - return( - float(self.run_dc.get_run_value( - self.ctrl_src, "operationMode"))) - - def get_single_photon(self): -<<<<<<< HEAD ->>>>>>> add operation mode and single photon - return( - bool(self.run_dc[self.ctrl_src, "singlePhoton"].as_single_value())) ->>>>>>> introduce SinglePhoton and OperationMode -======= - if "singlePhoton.value" in self.run_dc.keys_for_source( - self.ctrl_src): - return( - bool(self.run_dc[self.ctrl_src, "singlePhoton"].as_single_value())) # noqa ->>>>>>> retrieve constants from calcat