Skip to content
Snippets Groups Projects
Commit cc3d0a3b authored by Kiana Setoodehnia's avatar Kiana Setoodehnia Committed by Karim Ahmed
Browse files

Corrected pnCCD Main notebooks for path to slow data, etc.

parent 1231c225
No related branches found
No related tags found
No related merge requests found
# Extracting slow data:
import os
import traceback
from typing import Tuple
import h5py
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 KeyError:
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"))
return bias_voltage, gain, fix_temperature_top, fix_temperature_bot
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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