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

Merge branch 'feat/Extra_data_pnCCD' into 'master'

[pnCCD] [CORRECT][DARK] EXtra-data, processing using pasha, and parallel correction for different sequence files.

See merge request detectors/pycalibration!559
parents 2e05cca2 2b99c4d1
No related branches found
No related tags found
1 merge request!559[pnCCD] [CORRECT][DARK] EXtra-data and pasha
This diff is collapsed.
This diff is collapsed.
# Extracting slow data:
import os
import traceback
from typing import Tuple
import h5py
VALID_GAINS = {
"a" : 1.0,
"b" : 4.0,
"c" : 16.0,
"d" : 64.0,
"e" : 256.0,
"f" : 340.0,
"g" : 512.0
"a": 1.0,
"b": 4.0,
"c": 16.0,
"d": 64.0,
"e": 256.0,
"f": 340.0,
"g": 512.0
}
def extract_slow_data(karabo_id: str, karabo_da_control: str,
ctrl_fname: str, ctrl_path: str,
mdl_ctrl_path: str,
bias_voltage: float, gain: float,
fix_temperature_top :float,
fix_temperature_bot :float,
) -> Tuple[float, float, float, float]:
"""
Extract slow data from given control paths.
"""
try:
with h5py.File(ctrl_fname, "r") as f:
if bias_voltage == 0.:
bias_voltage = abs(f[os.path.join(mdl_ctrl_path,
"DAQ_MPOD/u0voltage/value")][0]) # noqa
if gain == 0.1:
gain = f[os.path.join(mdl_ctrl_path,
"DAQ_GAIN/pNCCDGain/value")][0]
if fix_temperature_top == 0.:
fix_temperature_top = f[os.path.join(ctrl_path,
"inputA/krdg/value")][0]
if fix_temperature_bot == 0.:
fix_temperature_bot = f[os.path.join(ctrl_path,
"inputB/krdg/value")][0]
except IOError:
print("Error during reading slow data,"
" please check the given h5 path for the control parameters")
traceback.print_exc(limit=1)
print("bias voltage control h5path:",
os.path.join(mdl_ctrl_path, "DAQ_MPOD/u0voltage/value"))
print("gain control h5path:",
os.path.join(mdl_ctrl_path, "DAQ_GAIN/pNCCDGain/value"))
print("fix_temperature_top control h5path:",
os.path.join(ctrl_path, "inputA/krdg/value"))
print("fix_temperature_bot control h5path:",
os.path.join(ctrl_path, "inputB/krdg/value"))
class PnccdCtrl():
def __init__(
self,
run_dc: "extra_data.DataCollection", # noqa
karabo_id: str
):
""" Extract control data from given control paths.
:param run_dc: run Extra-data data collection.
:param karabo_id: Detector identifier name.
"""
self.run_dc = run_dc
self.ctrl_src = f"{karabo_id}/CTRL/TCTRL"
self.mdl_src_temp = f"{karabo_id}/MDL/{{}}"
def get_bias_voltage(self):
return(
abs(self.run_dc.get_run_value(
self.mdl_src_temp.format("DAQ_MPOD"), "u0voltage.value")))
def get_gain(self):
return(
self.run_dc.get_run_value(
self.mdl_src_temp.format("DAQ_GAIN"), "pNCCDGain.value"))
def get_fix_temperature_top(self):
return self.run_dc.get_run_value(self.ctrl_src, "inputA.krdg.value")
return bias_voltage, gain, fix_temperature_top, fix_temperature_bot
def get_fix_temperature_bot(self):
return self.run_dc.get_run_value(self.ctrl_src, "inputB.krdg.value")
......@@ -120,8 +120,9 @@ notebooks = {
},
"CORRECT": {
"notebook": "notebooks/pnCCD/Correct_pnCCD_NBC.ipynb",
"concurrency": {"parameter": None,
"default concurrency": None,
"concurrency": {"parameter": "sequences",
"default concurrency": [-1],
"use function": "balance_sequences",
"cluster cores": 32},
},
},
......
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