Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • SCS/ToolBox
  • kluyvert/ToolBox
2 results
Show changes
Showing
with 2406 additions and 0 deletions
doc/metadata.png

136 KiB

sphinx
sphinx_rtd_theme
autoapi
sphinx-autoapi
nbsphinx
urllib3<2.0.0
#!/bin/bash
#SBATCH -N 1
#SBATCH --partition=exfel
#SBATCH --time=12:00:00
#SBATCH --mail-type=END,FAIL
#SBATCH --output=logs/%j-%x.out
while getopts ":p:d:r:k:m:x:b:" option
do
case $option in
p) PROPOSAL="$OPTARG";;
d) DARK="$OPTARG";;
r) RUN="$OPTARG";;
k) KERNEL="$OPTARG";;
m) MODULE_GROUP="$OPTARG";;
x) XAXIS="$OPTARG";;
b) BINWIDTH="$OPTARG";;
\?) echo "Unknown option"
exit 1;;
:) echo "Missing option for input flag"
exit 1;;
esac
done
# Load xfel environment
source /etc/profile.d/modules.sh
module load exfel exfel-python
echo processing run $RUN
PDIR=$(findxfel $PROPOSAL)
PPROPOSAL="p$(printf '%06d' $PROPOSAL)"
RDIR="$PDIR/usr/processed_runs/r$(printf '%04d' $RUN)"
mkdir $RDIR
NB='Dask DSSC module binning.ipynb'
# kernel list can be seen from 'jupyter kernelspec list'
if [ -z "${KERNEL}" ]; then
KERNEL="toolbox_$PPROPOSAL"
fi
python -c "import papermill as pm; pm.execute_notebook(\
'$NB', \
'$RDIR/output$MODULE_GROUP.ipynb', \
kernel_name='$KERNEL', \
parameters=dict(proposalNB=int('$PROPOSAL'), \
dark_runNB=int('$DARK'), \
runNB=int('$RUN'), \
module_group=int('$MODULE_GROUP'), \
path='$RDIR/', \
xaxis='$XAXIS', \
bin_width=float('$BINWIDTH')))"
#!/bin/bash
#SBATCH -N 1
#SBATCH --partition=allgpu
#SBATCH --constraint=V100
#SBATCH --time=2:00:00
#SBATCH --mail-type=END,FAIL
#SBATCH --output=logs/%j-%x.out
ROISTH='1'
SATLEVEL='500'
MODULE='15'
while getopts ":p:d:r:k:g:t:s:m:" option
do
case $option in
p) PROPOSAL="$OPTARG";;
d) DARK="$OPTARG";;
r) RUN="$OPTARG";;
k) KERNEL="$OPTARG";;
g) GAIN="$OPTARG";;
t) ROISTH="$OPTARG";;
s) SATLEVEL="$OPTARG";;
m) MODULE="$OPTARG";;
\?) echo "Unknown option"
exit 1;;
:) echo "Missing option for input flag"
exit 1;;
esac
done
# Load xfel environment
source /etc/profile.d/modules.sh
module load exfel exfel-python
echo processing run $RUN
PDIR=$(findxfel $PROPOSAL)
PPROPOSAL="p$(printf '%06d' $PROPOSAL)"
RDIR="$PDIR/usr/processed_runs/r$(printf '%04d' $RUN)"
mkdir $RDIR
NB='BOZ analysis part I.a Correction determination.ipynb'
# kernel list can be seen from 'jupyter kernelspec list'
if [ -z "${KERNEL}" ]; then
KERNEL="toolbox_$PPROPOSAL"
fi
python -c "import papermill as pm; pm.execute_notebook(\
'$NB', \
'$RDIR/output.ipynb', \
kernel_name='$KERNEL', \
parameters=dict(proposal=int('$PROPOSAL'), \
darkrun=int('$DARK'), \
run=int('$RUN'), \
module=int('$MODULE'), \
gain=float('$GAIN'), \
rois_th=float('$ROISTH'), \
sat_level=int('$SATLEVEL')))"
import os
import logging
import argparse
import numpy as np
import toolbox_scs as tb
import toolbox_scs.detectors as tbdet
logging.basicConfig(level=logging.INFO)
log_root = logging.getLogger(__name__)
# -----------------------------------------------------------------------------
# user input:
# -----------------------------------------------------------------------------
run_type = 'static, delay, .....'
description = 'useful description or comment .....'
#add xgm data to formatted file if save_xgm_binned was set to True
metadata = ['binner1', 'binner2', 'xgm_binned'] # ['binner1', 'binner2']
# -----------------------------------------------------------------------------
def formatting(run_number, run_folder):
log_root.debug("Collect, combine and format files in run folder")
run_formatted = tbdet.DSSCFormatter(run_folder)
run_formatted.combine_files()
run_formatted.add_dataArray(metadata)
attrs = {'run_type':run_type,
'description':description,
'run_number':run_number}
run_formatted.add_attributes(attrs)
run_formatted.save_formatted_data(f'{run_folder}run_{run_number}_formatted.h5')
log_root.debug("Formatting finished successfully.")
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--run-number', metavar='S',
action='store',
help='run number')
parser.add_argument('--run-folder', metavar='S',
action='store',
help='the run folder containing fractional data')
args = parser.parse_args()
formatting(str(args.run_number), str(args.run_folder))
#!/bin/bash
RUN_NR=${1}
RUN_DIR="../processed_runs/r_${RUN_NR}/"
if [ -d $RUN_DIR ]
then
echo creating formatted .h5 file for run $RUN_NR in $RUN_DIR
source /etc/profile.d/modules.sh
module load exfel exfel-python
python format_data.py --run-number $RUN_NR --run-folder $RUN_DIR
#chgrp -R 60002711-part $RUN_DIR
chmod -R 777 $RUN_DIR
else
echo run folder $RUN_DIR does not exist
echo please provide a valid run number
fi
import os
import logging
import argparse
import h5py
import numpy as np
import extra_data as ed
import toolbox_scs as tb
import toolbox_scs.detectors as tbdet
logging.basicConfig(level=logging.INFO)
log_root = logging.getLogger(__name__)
# -----------------------------------------------------------------------------
# user input: run-type specific
# -----------------------------------------------------------------------------
proposal_nb = 2599
output_filepath = "../processed_runs/"
# these get set by the shell script now! (e.g. "--runtype static")
# runtype = 'energyscan'
# runtype = 'energyscan_pumped'
# runtype = 'static'
# runtype = 'static_IR'
# runtype = 'delayscan'
# runtype = 'timescan'
# useful metadata to be added to h5 files
scriptname = os.path.basename(__file__)
save_xgm_binned = True
# optional prebinning methods for DSSC data
normevery = 2 # 2 if use intradark, 1 otherwise
xgm_mask = True # True: xgm_threshold will be used to drop corresponding DSSC frames accordingly to the xgm treshold
xgm_threshold = (1000, np.inf) # or you mean bad pulses here ?
filename_dark = None # 200
xgm_normalization = False
# -----------------------------------------------------------------------------
def process(run_nb, runtype, modules=[]):
run_description = f'{runtype}; script {scriptname}'
print(run_description)
mod_list = modules
if len(mod_list)==0:
mod_list = [i for i in range(16)]
path = f'{output_filepath}r_{run_nb}/'
log_root.info("create run objects")
run_info = tbdet.load_dssc_info(proposal_nb, run_nb)
fpt = run_info['frames_per_train']
n_trains = run_info['number_of_trains']
trainIds = run_info['trainIds']
# -------------------------------------------------------------------------
# user input: run specific
# -------------------------------------------------------------------------
run_obj = ed.open_run(proposal_nb, run_nb)
if runtype == 'static':
buckets_train = np.zeros(n_trains)
pulsepattern = ['image', 'intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
if runtype == 'energyscan':
buckets_train = tb.get_array(run_obj, 'nrj', 0.1).values
pulsepattern = ['image', 'intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
if runtype == 'static_IR':
buckets_train = np.zeros(n_trains)
pulsepattern = ['unpumped', 'unpumped_intradark', 'pumped', 'pumped_intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
if runtype == 'energyscan_pumped':
buckets_train = tb.get_array(run_obj, 'nrj', 0.1).values
pulsepattern = ['unpumped', 'unpumped_intradark', 'pumped', 'pumped_intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
if runtype == 'delayscan':
buckets_train = tb.get_array(run_obj, 'PP800_DelayLine', 0.03).values
pulsepattern = ['unpumped', 'unpumped_intradark', 'pumped', 'pumped_intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
if runtype == 'timescan': # 10s bins (tstamp is in ns)
bin_nsec = 10 * 1e9
tstamp = run_obj.get_array('SCS_RR_UTC/TSYS/TIMESERVER', 'id.timestamp')
buckets_train = (bin_nsec * np.round(tstamp / bin_nsec) - tstamp.min()) / 1e9
pulsepattern = ['unpumped', 'unpumped_intradark', 'pumped', 'pumped_intradark']
buckets_pulse = pulsepattern * (fpt // len(pulsepattern))
# -------------------------------------------------------------------------
# create binner
binner1 = tbdet.create_dssc_bins("trainId",trainIds,buckets_train)
binner2 = tbdet.create_dssc_bins("pulse",
np.linspace(0,fpt-1,fpt, dtype=int),
buckets_pulse)
binners = {'trainId': binner1, 'pulse': binner2}
bin_obj = tbdet.DSSCBinner(proposal_nb, run_nb,
binners=binners,
dssc_coords_stride=normevery)
if xgm_mask:
bin_obj.create_pulsemask('xgm', xgm_threshold)
dark=None
if filename_dark:
dark = tbdet.load_xarray(filename_dark)
dark = dark['data']
bin_params = {'modules':mod_list,
'chunksize':248,
'filepath':path,
'xgm_normalization':xgm_normalization,
'normevery':normevery,
'dark_image':dark}
log_root.info("start binning routine")
bin_obj.process_data(**bin_params)
log_root.info("Add additional data to module files")
if save_xgm_binned:
bin_obj.load_xgm()
xgm_binned = bin_obj.get_xgm_binned()
if not os.path.isdir(path):
os.mkdir(path)
for m in mod_list:
fname = f'run_{run_nb}_module{m}.h5'
if save_xgm_binned:
tbdet.save_xarray(
path+fname, xgm_binned, group='xgm_binned', mode='a')
tbdet.save_xarray(path+fname, binner1, group='binner1', mode='a')
tbdet.save_xarray(path+fname, binner2, group='binner2', mode='a')
metadata = {'run_number':run_nb,
'module':m,
'run_description':run_description}
tbdet.save_attributes_h5(path+fname, metadata)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--run-number', metavar='S',
action='store',
help='the run to be processed')
parser.add_argument('--module', metavar='S',
nargs='+', action='store',
help='modules to be processed')
parser.add_argument('--runtype', metavar='S',
nargs='+', action='store',
help=('type of run (static, static_IR, energyscan, energyscan_pumped)'
', delayscan', 'timescan)'))
args = parser.parse_args()
runtype = args.runtype[0]
if args.run_number:
if args.module is not None:
modules = []
if len(args.module) == 1:
args.module = args.module[0].split(" ")
modules = list(map(int, args.module))
process(str(args.run_number), runtype, modules)
else:
process(str(args.run_number), runtype)
#!/bin/bash
#SBATCH -N 1
#SBATCH --partition=upex
#SBATCH --time=00:30:00
#SBATCH --mail-type=END,FAIL
#SBATCH --output=../logs/%j-%x.out
RUN=$1
MODULES=$2
RUNTYPE=$3
source /etc/profile.d/modules.sh
module load exfel exfel-python
echo processing modules $MODULES of run $RUN
python process_data_201007_23h.py --run-number $RUN --module ${MODULES} --runtype $RUNTYPE
#!/bin/bash
RUN=$1
RUNTYPE=$2
if [ $RUN ] && [ $RUNTYPE ]
then
echo processing run $RUN
source /etc/profile.d/modules.sh
module load exfel exfel-python
sbatch ./start_job_single.sh $RUN '0 1 2 3' $RUNTYPE
sbatch ./start_job_single.sh $RUN '4 5 6 7' $RUNTYPE
sbatch ./start_job_single.sh $RUN '8 9 10 11' $RUNTYPE
sbatch ./start_job_single.sh $RUN '12 13 14 15' $RUNTYPE
else
echo please specify a run number and type
echo available runtypes:
echo energyscan, energyscan_pumped, static, static_IR, delayscan, timescan
fi
doc/sview.png

47.1 KiB

Finding time overlap by transient reflectivity
----------------------------------------------
Transient reflectivity of the optical laser measured on a large bandgap material pumped by the FEL is often used at SCS to find the time overlap between the two beams. The example notebook
* :doc:`Transient reflectivity measurement <Transient reflectivity measurement>`
shows how to analyze such data, including correcting the delay by the bunch arrival monitor (BAM).
%% Cell type:markdown id: tags:
This notebook shows an example of X-ray absorption spectroscopy (XAS) and X-ray magnetic circular dichroism (XMCD) experiment.
%% Cell type:markdown id: tags:
# Import toolbox_scs and subpackages
%% Cell type:code id: tags:
``` python
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
plt.rcParams['figure.constrained_layout.use'] = True
import toolbox_scs as tb
import toolbox_scs.detectors as tbdet
import toolbox_scs.routines as tbr
import extra_data as ed
import xarray as xr
import logging
logging.basicConfig(level=logging.INFO)
log_root = logging.getLogger(__name__)
```
%% Cell type:markdown id: tags:
# Load data, extract pulse-resolved signals from detectors
Here, we use the ToolBox mnemonics to get the arrays: MCP1apd is the pulse-resolved peak-integrated TIM data from MCP 1, SCS_SA3 is the XGM data for SASE 3 pulses in SCS hutch, nrj is the monochromator energy in eV and magnet is the current applied to the magnet in A.
The function get_all_detectors() takes care of aligning the pulse-resolved data (TIM and XGM) according to the sase 3 bunch pattern.
%% Cell type:code id: tags:
``` python
runNB = 491
proposalNB = 900094
mcp = 'MCP1apd'
fields = [mcp, 'SCS_SA3', 'nrj', 'magnet']
run, ds = tb.load(proposalNB, runNB, fields)
mcp = mcp.replace('apd', 'peaks')
ds
```
%% Cell type:markdown id: tags:
## Split positive and negative magnetic fields, calculate XAS and XMCD spectra
Here we first define the monochromator energy bins, and apply the xas() subroutine to subsets of the data. The subsets correspond to positive magnet current and negative magnet current. The xas() routine returns (among other quantities) the binned energy and the absorption, which are then plotted for both positive and negative magnet currents.
%% Cell type:code id: tags:
``` python
nrj_bins_edges = np.linspace(704, 712, 31)
pxas = tbr.xas(ds.where(ds['magnet'] > 2, drop=True), bins=nrj_bins_edges, plot=False, Itkey=mcp)
nxas = tbr.xas(ds.where(ds['magnet'] < -2, drop=True), bins=nrj_bins_edges, plot=False, Itkey=mcp)
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.plot(pxas['nrj'], pxas['muA'])
plt.plot(nxas['nrj'], nxas['muA'])
plt.ylabel('$\mu_A$')
plt.xlabel('Energy [eV]')
```
%% Cell type:markdown id: tags:
We now calculate the XMCD using the positive and negative data returned by xas() routine.
%% Cell type:code id: tags:
``` python
res = tbr.xasxmcd(pxas, nxas)
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.plot(res['nrj'], res['muXAS'])
plt.ylabel('$\mu_A$')
plt.xlabel('Energy [eV]')
plt.twinx()
plt.plot(res['nrj'], -res['muXMCD'], c='C1')
plt.ylabel('$\mu_{XMCD}$')
```
%% Cell type:markdown id: tags:
# Only 2000 first train
%% Cell type:code id: tags:
``` python
subds = ds.isel({'trainId':slice(1600)})
pxas2 = tbr.xas(subds.where(subds['magnet'] > 2, drop=True), bins=nrj_bins_edges, plot=False, Itkey=mcp)
nxas2 = tbr.xas(subds.where(subds['magnet'] < -2, drop=True), bins=nrj_bins_edges, plot=False, Itkey=mcp)
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.plot(subds['nrj'])
plt.ylabel('energy [eV]')
plt.xlabel('train number')
plt.twinx()
plt.plot(subds['magnet'], c='C1')
plt.ylabel('magnet current [A]')
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.errorbar(pxas['nrj'], pxas['muA'], pxas['sterrA'], label='pos all trains')
plt.errorbar(pxas2['nrj'], pxas2['muA'], pxas2['sterrA'], c='C0', ls='--', label='pos first 2000 trains')
plt.errorbar(nxas['nrj'], nxas['muA'], nxas['sterrA'], label='neg all trains')
plt.errorbar(nxas2['nrj'], nxas2['muA'], nxas['sterrA'], c='C1', ls='--', label='neg first 2000 trains')
plt.legend()
plt.ylabel('$\mu_A$')
plt.xlabel('Energy [eV]')
```
%% Cell type:code id: tags:
``` python
res2 = tbr.xasxmcd(pxas2, nxas2)
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.plot(res['nrj'], res['muXAS'])
plt.plot(res2['nrj'], res2['muXAS'], ls='--', c='C0')
plt.ylabel('$\mu_A$')
plt.xlabel('Energy [eV]')
plt.twinx()
plt.plot(res['nrj'], -res['muXMCD'], c='C1')
plt.plot(res2['nrj'], -res2['muXMCD'], ls='--', c='C1')
plt.ylabel('$\mu_{XMCD}$')
```
%% Cell type:markdown id: tags:
# Mono up or down
%% Cell type:code id: tags:
``` python
from scipy.signal import savgol_filter
dE = np.gradient(savgol_filter(ds['nrj'], 9, 1))
mono_turn = dE > 0
plt.figure()
plt.plot(1e3*dE)
plt.ylabel('Delta energy (meV)')
plt.twinx()
plt.plot(mono_turn, ls='', marker='.', c='C1')
plt.ylabel('mono going up')
plt.title(f'run {runNB} p{proposalNB}')
```
%% Cell type:code id: tags:
``` python
ds['mono_turn'] = xr.DataArray(np.gradient(savgol_filter(ds['nrj'], 9, 1))>0, dims=['trainId'])
```
%% Cell type:code id: tags:
``` python
ds
```
%% Cell type:code id: tags:
``` python
subds = ds#.isel({'trainId':slice(1600)})
Eshift = 0.05
shift_subds = subds
shift_subds['nrj'] = subds['nrj'] + Eshift
pxas3a = tbr.xas(shift_subds.where((subds['magnet'] > 2)*subds['mono_turn'], drop=True),
bins=nrj_bins_edges, plot=False, Itkey=mcp)
nxas3a = tbr.xas(shift_subds.where((subds['magnet'] < -2)*subds['mono_turn'], drop=True),
bins=nrj_bins_edges, plot=False, Itkey=mcp)
shift_subds['nrj'] = subds['nrj'] - Eshift
pxas3b = tbr.xas(shift_subds.where((subds['magnet'] > 2)*np.logical_not(subds['mono_turn']), drop=True),
bins=nrj_bins_edges, plot=False, Itkey=mcp)
nxas3b = tbr.xas(shift_subds.where((subds['magnet'] < -2)*np.logical_not(subds['mono_turn']), drop=True),
bins=nrj_bins_edges, plot=False, Itkey=mcp)
```
%% Cell type:code id: tags:
``` python
plt.figure()
#plt.errorbar(pxas['nrj'], pxas['muA'], pxas['sterrA'])
plt.errorbar(pxas3a['nrj'], pxas3a['muA'], pxas3a['sterrA'], c='C0', ls='-', label='+H, mono up')
plt.errorbar(pxas3b['nrj'], pxas3b['muA'], pxas3b['sterrA'], c='C0', ls='--',
label=f'+H, mono down, dE = {-1e3*Eshift} meV')
#plt.errorbar(nxas['nrj'], nxas['muA'], nxas['sterrA'])
plt.errorbar(nxas3a['nrj'], nxas3a['muA'], nxas3a['sterrA'], c='C1', ls='-', label='-H, mono up')
plt.errorbar(nxas3b['nrj'], nxas3b['muA'], nxas3b['sterrA'], c='C1', ls='--',
label=f'-H, mono down, dE = {-1e3*Eshift} meV')
plt.xlabel('Energy (eV)')
plt.ylabel('XAS (arb. units)')
plt.title(f'run {runNB} p{proposalNB}')
plt.xlim([707, 709])
plt.ylim([3, 4.5])
plt.legend()
```
%% Cell type:code id: tags:
``` python
plt.figure()
plt.title(f'run {runNB} p{proposalNB}')
plt.xlabel('Energy (eV)')
plt.ylabel('XAS (mono up) - XAS (mono down) (arb. units)')
plt.plot(pxas3a['nrj'], pxas3a['muA'] - pxas3b['muA'])
plt.plot(nxas3a['nrj'], nxas3a['muA'] - nxas3b['muA'])
plt.ylim([-0.1, 0.18])
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:markdown id: tags:
# How to
This notebook has been created for the latest commit on DevelopmentRG.
- git fetch origin
- git checkout DevelopmentRG
some methods changed, so the processing scripts have to be adapted correspondingly (if you want to use the tim for the processing in some way).
# changes since last version
selection from the changelog that is relevant for you (changes since 1.1.1-rc2)
* (DSSCBinner):
- constructor: kwargs 'tim_names' and 'dssc_coords_stride'
in constructor the latter described the relation between
xgm/tim pulses to the dssc frames. Can be an int or a list.
- load_xgm(), load_tim(): loading formatted xgm tim data
- create_pulsemask(), kwargs use_data='xgm'/'tim'. The
pulsemask is created from either the xgm or tim data.
- get_xgm_binned(), get_tim_binned(): returns the
binned xgm/tim data
# comments
The methods used in the code below use the automatic peak integration for the adcs. We have 4mcp's. 3 of them are downstream of the sample, one is in the FFT just under the sample and measures fluorecence from the sample. the automatic peak integratio has been set up for the 3 downstream mcps only. So this code here only works for these mcps. If you would like to use the 4th as well you have to look at the raw data (example at the end of the notebook) and do the peak integration by hand (older version of toolbox). The raw data is recorded all the time anyway. Mcp4 has been switched on after run 181.
%% Cell type:code id: tags:
``` python
import importlib
import logging
import numpy as np
import xarray as xr
import pandas as pd
import extra_data as ed
import matplotlib.pyplot as plt
import toolbox_scs as tb
import toolbox_scs.detectors as tbdet
import toolbox_scs.misc as tbm
import toolbox_scs.detectors.dssc_plot as dssc_plot
```
%% Cell type:code id: tags:
``` python
logging.basicConfig(level=logging.INFO)
log_root = logging.getLogger(__name__)
#%matplotlib inline
#xr.set_options(display_style='text')
```
%% Cell type:code id: tags:
``` python
proposal_nb = 2719
run_nb = 194
run_info = tbdet.load_dssc_info(proposal_nb, run_nb)
fpt = run_info['frames_per_train']
n_trains = run_info['number_of_trains']
trainIds = run_info['trainIds']
```
%% Output
INFO:extra_data.read_machinery:Found proposal dir '/gpfs/exfel/exp/SCS/202002/p002719' in 0.0048 s
%% Cell type:code id: tags:
``` python
n_trains
```
%% Output
9170
%% Cell type:code id: tags:
``` python
buckets_train = ['chunk1']*3000 + ['chunk2']*3000 + ['chunk3']*3170
buckets_pulse = np.linspace(0,fpt-1,fpt, dtype=int)
binner1 = tbdet.create_dssc_bins("trainId",trainIds,buckets_train)
binner2 = tbdet.create_dssc_bins("pulse",
np.linspace(0,fpt-1,fpt, dtype=int),
buckets_pulse)
binners = {'trainId': binner1, 'pulse': binner2}
```
%% Cell type:code id: tags:
``` python
bin_obj = tbdet.DSSCBinner(proposal_nb, run_nb,
binners=binners,
dssc_coords_stride=2)
```
%% Output
INFO:extra_data.read_machinery:Found proposal dir '/gpfs/exfel/exp/SCS/202002/p002719' in 0.0031 s
INFO:extra_data.read_machinery:Found proposal dir '/gpfs/exfel/exp/SCS/202002/p002719' in 0.0027 s
%% Cell type:code id: tags:
``` python
bin_obj.get_info()
```
%% Output
Frozen(SortedKeysDict({'trainId': 3, 'pulse': 52, 'x': 128, 'y': 512}))
%% Cell type:code id: tags:
``` python
bin_obj.load_tim()
tim_binned = bin_obj.get_tim_binned()
```
%% Output
INFO:toolbox_scs.detectors.digitizers:Extracting ADQ412 peaks from ['MCP2apd', 'MCP1apd', 'MCP3apd'].
INFO:toolbox_scs.detectors.dssc_misc:loaded formatted tim data.
INFO:toolbox_scs.detectors.dssc:binned tim data according to dssc binners.
%% Cell type:code id: tags:
``` python
bin_obj.load_xgm()
xgm_binned = bin_obj.get_xgm_binned()
```
%% Output
INFO:toolbox_scs.detectors.xgm:Extracting XGM data from ['SCS_SA3'].
INFO:toolbox_scs.detectors.dssc_misc:loaded formatted xgm data.
INFO:toolbox_scs.detectors.dssc:binned xgm data according to dssc binners.
%% Cell type:code id: tags:
``` python
plt.plot(xgm_binned['xgm'][0,:])
plt.plot(xgm_binned['xgm'][1,:])
plt.plot(xgm_binned['xgm'][2,:])
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba157986860>]
%% Cell type:code id: tags:
``` python
plt.plot(tim_binned['tim'][0,:])
plt.plot(tim_binned['tim'][1,:])
plt.plot(tim_binned['tim'][2,:])
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba1571a5e80>]
%% Cell type:code id: tags:
``` python
plt.plot(bin_obj.xgm.sel(pulse=20)[0:3000], 'o')
plt.plot(bin_obj.xgm.sel(pulse=0)[0:3000], 'o')
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba157b3f780>]
%% Cell type:code id: tags:
``` python
plt.plot(bin_obj.tim.sel(pulse=20)[0:3000], 'o')
plt.plot(bin_obj.tim.sel(pulse=0)[0:3000], 'o')
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba1571da9b0>]
%% Cell type:code id: tags:
``` python
plt.plot(bin_obj.xgm.sel(pulse=2)[0:3000], bin_obj.tim.sel(pulse=2)[0:3000], '.')
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba1579bee10>]
%% Cell type:code id: tags:
``` python
plt.plot(bin_obj.xgm.sel(pulse=2)[-3000::], bin_obj.tim.sel(pulse=2)[-3000::], '.')
```
%% Output
[<matplotlib.lines.Line2D at 0x2ba157513438>]
%% Cell type:code id: tags:
``` python
# this is how the correlation should look like ideally (run from last week)
```
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('VERSION') as f:
_version = f.read()
_version = _version.strip("\n")
basic_analysis_reqs = ['numpy', 'scipy',] # and is readily available in Karabo
advanced_analysis_reqs = [
'pandas', 'imageio', 'xarray>=0.13.0', 'psutil', 'h5py', 'h5netcdf',]
interactive_reqs = ['ipykernel', 'matplotlib', 'tqdm',]
maxwell_reqs = ['joblib', 'papermill', 'dask[diagnostics]',
'extra_data', 'extra_geom', 'euxfel_bunch_pattern>=0.6',
'pyFAI',]
docs_reqs = ['sphinx', 'nbsphinx', 'sphinx-autoap', 'pydata-sphinx-theme']
setup(name='toolbox_scs',
version=_version,
description="A collection of code for the SCS beamline",
long_description=readme,
author='SCS team',
author_email='scs@xfel.eu',
url="https://git.xfel.eu/gitlab/SCS/ToolBox.git",
keywords='XAS, xgm, DSSC, FCCD, PPL',
license="GPL",
package_dir={'': 'src'},
packages=find_packages('src'),
package_data={},
install_requires=basic_analysis_reqs,
extras_require={
'advanced': advanced_analysis_reqs,
'interactive': interactive_reqs,
'maxwell': advanced_analysis_reqs + interactive_reqs + maxwell_reqs,
'docs': docs_reqs,
'test': ['pytest']
}
)
from .constants import *
from .detectors import *
# Module name is the same as a child function, we use alias to avoid conflict
import toolbox_scs.load as load_module
from .load import *
from .misc import *
from .mnemonics_machinery import *
from .routines import *
__all__ = (
# top-level modules
constants.__all__
+ load_module.__all__
+ mnemonics_machinery.__all__
# submodules
+ detectors.__all__
+ misc.__all__
+ routines.__all__
)
from . import knife_edge as knife_edge_module
from .knife_edge import *
__all__ = knife_edge_module.__all__
import numpy as np
from scipy import special
from scipy.optimize import curve_fit
__all__ = ['knife_edge', 'knife_edge_base']
def knife_edge(positions, intensities, axisRange=None, p0=None):
"""
Calculates the beam radius at 1/e^2 from a knife-edge scan by
fitting with erfc function: f(a,b,u) = a*erfc(u) + b or
where u = sqrt(2)*(x-x0)/w0 with w0 the beam radius at 1/e^2
and x0 the beam center.
Parameters
----------
positions : np.ndarray
Motor position values, typically 1D
intensities : np.ndarray
Intensity values, could be either 1D or 2D, with the number or rows
equivalent with the position size
axisRange : sequence of two floats or None
Edges of the scanning axis between which to apply the fit.
p0 : list of floats, numpy 1D array
Initial parameters used for the fit: x0, w0, a, b. If None, a beam
radius of 100 um is assumed.
Returns
-------
width : float
The beam radius at 1/e^2
std : float
The standard deviation of the width
"""
popt, pcov = knife_edge_base(positions, intensities,
axisRange=axisRange, p0=p0)
width, std = 0, 0
if popt is not None and pcov is not None:
width, std = np.abs(popt[1]), pcov[1, 1]**0.5
return width, std
def knife_edge_base(positions, intensities, axisRange=None, p0=None):
"""
The base implementation of the knife-edge scan analysis.
Calculates the beam radius at 1/e^2 from a knife-edge scan by
fitting with erfc function: f(a,b,u) = a*erfc(u) + b or
where u = sqrt(2)*(x-x0)/w0 with w0 the beam radius at 1/e^2
and x0 the beam center.
Parameters
----------
positions : np.ndarray
Motor position values, typically 1D
intensities : np.ndarray
Intensity values, could be either 1D or 2D, with the number or rows
equivalent with the position size
axisRange : sequence of two floats or None
Edges of the scanning axis between which to apply the fit.
p0 : list of floats, numpy 1D array
Initial parameters used for the fit: x0, w0, a, b. If None, a beam
radius of 100 um is assumed.
Returns
-------
popt : sequence of floats or None
The parameters of the resulting fit.
pcov : sequence of floats
The covariance matrix of the resulting fit.
"""
# Prepare arrays
positions, intensities = prepare_arrays(positions, intensities,
xRange=axisRange)
# Estimate initial fitting params
if p0 is None:
p0 = [np.mean(positions), 0.1, np.max(intensities) / 2, 0]
# Fit
popt, pcov = function_fit(erfc, positions, intensities, p0=p0)
return popt, pcov
def function_fit(func, x, y, **kwargs):
"""A wrapper for scipy.optimize curve_fit()
"""
# Fit
try:
popt, pcov = curve_fit(func, x, y, **kwargs)
except (TypeError, RuntimeError) as err:
print("Fit did not converge:", err)
popt, pcov = (None, None)
return popt, pcov
def prepare_arrays(arrX: np.ndarray, arrY: np.ndarray,
xRange=None, yRange=None):
"""
Preprocessing of the input x and y arrays.
This involves the following steps.
1. Converting the arrays to 1D of the same size
2. Select the ranges from the input x- and y-ranges
3. Retrieve finite values.
"""
# Convert both arrays to 1D of the same size
arrX, arrY = arrays_to1d(arrX, arrY)
# Select ranges
if xRange is not None:
low, high = xRange
if low == high:
raise ValueError('The supplied xRange is not a valid range.')
mask_ = range_mask(arrX, low, high)
arrX = arrX[mask_]
arrY = arrY[mask_]
if yRange is not None:
low, high = yRange
if low == high:
raise ValueError('The supplied xRange is not a valid range.')
mask_ = range_mask(arrY, low, high)
arrX = arrX[mask_]
arrY = arrY[mask_]
# Clean both arrays by only getting finite values
finite_idx = np.isfinite(arrX) & np.isfinite(arrY)
arrX = arrX[finite_idx]
arrY = arrY[finite_idx]
return arrX, arrY
def arrays_to1d(arrX: np.ndarray, arrY: np.ndarray):
"""Flatten two arrays and matches their sizes
"""
assert arrX.shape[0] == arrY.shape[0]
arrX, arrY = arrX.flatten(), arrY.flatten()
if len(arrX) > len(arrY):
arrY = np.repeat(arrY, len(arrX) // len(arrY))
else:
arrX = np.repeat(arrX, len(arrY) // len(arrX))
return arrX, arrY
def range_mask(array, minimum=None, maximum=None):
"""Retrieve the resulting array from the given minimum and maximum
"""
default = np.ones(array.shape, dtype=bool)
min_slice, max_slice = default, default
if minimum is not None:
if minimum > np.nanmax(array):
raise ValueError('The range minimum is too large.')
min_slice = array >= minimum
if maximum is not None:
if maximum < np.nanmin(array):
raise ValueError('The range maximum is too small.')
max_slice = array <= maximum
return min_slice & max_slice
def erfc(x, x0, w0, a, b):
return a * special.erfc(np.sqrt(2) * (x - x0) / w0) + b
import numpy as np
import pytest
from ..knife_edge import erfc, knife_edge_base, prepare_arrays, range_mask
def test_range_mask():
arr = np.array([1, 2, 3, 4, 5])
# Exact
slice_ = range_mask(arr, minimum=2, maximum=4)
np.testing.assert_array_equal(slice_, [False, True, True, True, False])
# Range exceeds the closest values
slice_ = range_mask(arr, minimum=1.75, maximum=4.25)
np.testing.assert_array_equal(slice_, [False, True, True, True, False])
# Range misses the closest values
slice_ = range_mask(arr, minimum=2.25, maximum=3.75)
np.testing.assert_array_equal(slice_, [False, False, True, False, False])
# Equidistant
slice_ = range_mask(arr, minimum=2.5, maximum=4.5)
np.testing.assert_array_equal(slice_, [False, False, True, True, False])
# Out of bounds, valid minimum
slice_ = range_mask(arr, minimum=0)
np.testing.assert_array_equal(slice_, [True, True, True, True, True])
# Out of bounds, invalid minimum
with pytest.raises(ValueError):
range_mask(arr, minimum=6)
# Out of bounds, valid maximum
slice_ = range_mask(arr, maximum=6)
np.testing.assert_array_equal(slice_, [True, True, True, True, True])
# Out of bounds, invalid minimum
with pytest.raises(ValueError):
range_mask(arr, maximum=0)
# with NaNs
arr = np.array([1, np.nan, 3, np.nan, 5])
slice_ = range_mask(arr, minimum=3)
np.testing.assert_array_equal(slice_, [False, False, True, False, True])
def test_prepare_arrays_nans():
# Setup test values
trains, pulses = 5, 10
size = trains * pulses
motor = np.arange(trains)
signal = np.random.randint(100, size=(trains, pulses))
# Test finite motor and signal values
positions, intensities = prepare_arrays(motor, signal)
assert positions.shape == (size,)
assert intensities.shape == (size,)
# Test finite motors and signals with NaNs
signal_nan = _with_values(signal, value=np.nan, num=20)
positions, intensities = prepare_arrays(motor, signal_nan)
assert positions.shape == (size-20,)
assert np.isfinite(positions).all()
assert intensities.shape == (size-20,)
assert np.isfinite(intensities).all()
# Test finite signals and motors with NaNs
motor_nan = _with_values(motor, value=np.nan, num=3)
positions, intensities = prepare_arrays(motor_nan, signal)
assert positions.shape == ((trains-3) * pulses,)
assert np.isfinite(positions).all()
assert intensities.shape == ((trains-3) * pulses,)
assert np.isfinite(intensities).all()
def test_prepare_arrays_size():
trains, pulses = 5, 10
size = trains * pulses
motor = np.arange(trains)
signal = np.random.randint(100, size=(trains, pulses))
# Test finite motor and 2D signals
positions, intensities = prepare_arrays(motor, signal)
assert positions.shape == (size,)
assert intensities.shape == (size,)
# Test finite motor and 1D signals
positions, intensities = prepare_arrays(motor, signal[:, 0])
assert positions.shape == (trains,)
assert intensities.shape == (trains,)
def test_prepare_arrays_range():
trains, pulses = 5, 10
motor = np.arange(trains)
signal = np.random.randint(100, size=(trains, pulses))
# Test valid range, inside bounds
positions, intensities = prepare_arrays(motor, signal, xRange=[2, 4])
assert (positions.min(), positions.max()) == (2, 4)
unique = np.unique(positions)
np.testing.assert_array_equal(unique, [2, 3, 4])
assert intensities.shape == (unique.size * pulses,)
# Test invalid ranges
with pytest.raises(ValueError):
prepare_arrays(motor, signal, xRange=[5, 3])
with pytest.raises(ValueError):
prepare_arrays(motor, signal, xRange=[3, 3])
def test_knife_edge_base():
p0 = [0, -1.5, 1, 0]
x = np.linspace(-3, 3)
y = erfc(x, *p0)
noise = y * np.random.normal(0, .02, y.shape) # 2% error
eff_y = y + noise
# Test noisy data
popt, _ = knife_edge_base(x, eff_y)
np.testing.assert_allclose(p0, popt, atol=1e-1)
# Test flipped data
popt, _ = knife_edge_base(x, eff_y[::-1])
p0[1] = abs(p0[1]) # Absolute value when flipped
np.testing.assert_allclose(p0, popt, atol=1e-1)
def _with_values(array, value, num=5):
copy = array.astype(np.float)
copy.ravel()[np.random.choice(copy.size, num, replace=False)] = value
return copy
__all__ = [
'mnemonics'
]
mnemonics = {
# Machine
"sase3": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'sase3.pulseIds.value',
'dim': ['bunchId']},),
"sase2": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'sase2.pulseIds.value',
'dim': ['bunchId']},),
"sase1": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'sase1.pulseIds.value',
'dim': ['bunchId']},),
"laser": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'laser.pulseIds.value',
'dim': ['bunchId']},),
"maindump": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'maindump.pulseIds.value',
'dim': ['bunchId']},),
"bunchpattern": ({'source': 'SCS_RR_UTC/TSYS/TIMESERVER',
'key': 'readBunchPatternTable.value',
'dim': None},),
"bunchPatternTable": (
{'source': 'SCS_RR_UTC/TSYS/TIMESERVER:outputBunchPattern',
'key': 'data.bunchPatternTable',
'dim': ['pulse_slot']},
{'source': 'SCS_RR_UTC/TSYS/TIMESERVER',
'key': 'bunchPatternTable.value',
'dim': ['pulse_slot']}),
"npulses_sase3": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'sase3.nPulses.value',
'dim': None},),
"npulses_sase1": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'sase1.nPulses.value',
'dim': None},),
"npulses_laser": ({'source': 'SCS_RR_UTC/MDL/BUNCH_DECODER',
'key': 'laser.nPulses.value',
'dim': None},),
"bunchPatternTable_SA3": (
{'source': 'SA3_BR_UTC/TSYS/TIMESERVER:outputBunchPattern',
'key': 'data.bunchPatternTable',
'dim': ['pulse_slot']},),
# Bunch Arrival Monitors
"BAM414": ({'source': 'XFEL_SDIAG_BAM/DOOCS/414_B2:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_414_B2:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_414_B2:output',
'key': 'data.lowChargeArrivalTime',
'dim': ['BAMbunchId'],
'extract': 'BAM'},),
"BAM414_avg": ({'source': 'XFEL_SDIAG_BAM/DOOCS/414_B2',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_414_B2',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},),
"BAM1932M": ({'source': 'XFEL_SDIAG_BAM/DOOCS/1932M_TL:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932M_TL:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932M_TL:output',
'key': 'data.lowChargeArrivalTime',
'dim': ['BAMbunchId'],
'extract': 'BAM'},),
"BAM1932M_avg": ({'source': 'XFEL_SDIAG_BAM/DOOCS/1932M_TL',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932M_TL',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},),
"BAM1932S": ({'source': 'XFEL_SDIAG_BAM/DOOCS/1932S_TL:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932S_TL:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932S_TL:output',
'key': 'data.lowChargeArrivalTime',
'dim': ['BAMbunchId'],
'extract': 'BAM'},),
"BAM1932S_avg": ({'source': 'XFEL_SDIAG_BAM/DOOCS/1932S_TL',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},
{'source': 'SCS_ILH_LAS/DOOCS/BAM_1932S_TL',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},),
"BAM2955_S3": ({'source': 'XFEL_SDIAG_BAM/DOOCS/2955_S3:output',
'key': 'data.absoluteTD',
'dim': ['BAMbunchId'],
'extract': 'BAM'},),
"BAM2955_S3_avg": ({'source': 'XFEL_SDIAG_BAM/DOOCS/2955_S3',
'key': 'meanSA3.value',
'dim': None,
'extract': 'BAM'},),
"BAM_SLOW_FB": ({'source': 'SCS_BAM_FEEDBACK/MDL/CHECKER',
'key': 'sf_enabled.value',
'dim': None},),
"BAM_FAST_FB": ({'source': 'SCS_BAM_FEEDBACK/MDL/CHECKER',
'key': 'ff_enabled.value',
'dim': None},),
# SA3
"nrj": ({'source': 'SA3_XTD10_MONO/MDL/PHOTON_ENERGY',
'key': 'actualEnergy.value',
'dim': None},),
"nrj_target": ({'source': 'SA3_XTD10_MONO/MDL/PHOTON_ENERGY',
'key': 'targetEnergy.value',
'dim': None},),
"mono_order": ({'source': 'SA3_XTD10_MONO/MDL/PHOTON_ENERGY',
'key': 'M.value',
'dim': None},),
"M2BEND": ({'source': 'SA3_XTD10_MIRR-2/MOTOR/BENDER',
'key': 'actualPosition.value',
'dim': None},),
"tpi": ({'source': 'SCS_XTD10_TPI/DCTRL/SHUTTER',
'key': 'operationModePLC.value',
'dim': None},),
"TPI_STATE": ({'source': 'SCS_XTD10_TPI/DCTRL/SHUTTER',
'key': 'hardwareStatusBitField.value',
'dim': None},),
"VSLIT": ({'source': 'SA3_XTD10_VSLIT/MDL/BLADE',
'key': 'actualGap.value',
'dim': None},),
"ESLIT": ({'source': 'SCS_XTD10_ESLIT/MDL/MAIN',
'key': 'actualGap.value',
'dim': None},),
"HSLIT": ({'source': 'SCS_XTD10_HSLIT/MDL/BLADE',
'key': 'actualGap.value',
'dim': None},),
"H_BLADE_LEFT": ({'source': 'SCS_XTD10_HSLIT/MOTOR/BLADE_LEFT',
'key': 'actualPosition.value',
'dim': None},),
"H_BLADE_RIGHT": ({'source': 'SCS_XTD10_HSLIT/MOTOR/BLADE_RIGHT',
'key': 'actualPosition.value',
'dim': None},),
"transmission": ({'source': 'SA3_XTD10_VAC/MDL/GATT_TRANSMISSION_MONITOR',
'key': 'Estimated_Tr.value',
'dim': None},
{'source': 'SA3_XTD10_GATT/MDL/GATT_TRANSMISSION_MONITOR',
'key': 'Estimated_Tr.value',
'dim': None},),
"transmission_setpoint": ({'source': 'SA3_XTD10_VAC/MDL/GATT_PHYSICS_UNIT',
'key': 'TransmissionFactor.value',
'dim': None},),
"transmission_col2": (
{'source': 'SA3_XTD10_VAC/MDL/GATT_TRANSMISSION_MONITOR',
'key': 'second_color_Estimated_Tr.value',
'dim': None},),
"GATT_pressure": ({'source': 'SA3_XTD10_VAC/MDL/GATT_P_CELL',
'key': 'value.value',
'dim': None},
{'source': 'P_GATT',
'key': 'value.value',
'dim': None},),
"navitar": ({'source': 'SCS_XTD10_IMGES/CAM/BEAMVIEW_NAVITAR:daqOutput',
'key': 'data.image.pixels',
'dim': ['x', 'y']},),
"UND": ({'source': 'SA3_XTD10_UND/DOOCS/PHOTON_ENERGY',
'key': 'actualPosition.value',
'dim': None},),
"UND2": ({'source': 'SA3_XTD10_UND/DOOCS/PHOTON_ENERGY_COLOR2',
'key': 'actualPosition.value',
'dim': None},),
"UND3": ({'source': 'SA3_XTD10_UND/DOOCS/PHOTON_ENERGY_COLOR3',
'key': 'actualPosition.value',
'dim': None},),
"MAG_CHICANE_DELAY": ({'source': 'SA3_XTD4_CHICANE/DOOCS/SXR2CPP',
'key': 'XFEL_MAGNETS_CHICANE_SXR2CPP.dtFs.value',
'dim': None},),
"AppleX": ({'source': 'SA3_XTD10_UND/DOOCS/PHOTON_ENERGY',
'key': 'actualPolarization.value',
'dim': None},),
# PES
"PES_1Araw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_1_A.raw.samples',
'dim': ['PESsampleId']},),
"PES_1Braw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_1_B.raw.samples',
'dim': ['PESsampleId']},),
"PES_1Craw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_1_C.raw.samples',
'dim': ['PESsampleId']},),
"PES_1Draw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_1_D.raw.samples',
'dim': ['PESsampleId']},),
"PES_2Araw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_2_A.raw.samples',
'dim': ['PESsampleId']},),
"PES_2Braw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_2_B.raw.samples',
'dim': ['PESsampleId']},),
"PES_2Craw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_2_C.raw.samples',
'dim': ['PESsampleId']},),
"PES_2Draw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_2_D.raw.samples',
'dim': ['PESsampleId']},),
"PES_4Araw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_4_A.raw.samples',
'dim': ['PESsampleId']},),
"PES_4Braw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_4_B.raw.samples',
'dim': ['PESsampleId']},),
"PES_4Craw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_4_C.raw.samples',
'dim': ['PESsampleId']},),
"PES_4Draw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_4_D.raw.samples',
'dim': ['PESsampleId']},),
"PES_3Aaw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_3_A.raw.samples',
'dim': ['PESsampleId']},),
"PES_3Braw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_3_B.raw.samples',
'dim': ['PESsampleId']},),
"PES_3Craw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_3_C.raw.samples',
'dim': ['PESsampleId']},),
"PES_3Draw": ({'source': 'SA3_XTD10_PES/ADC/1:network',
'key': 'digitizers.channel_3_D.raw.samples',
'dim': ['PESsampleId']},),
"PES_pressure": ({'source': 'SA3_XTD10_PES/GAUGE/G30310F',
'key': 'value.value',
'dim': None},),
"PES_RV": ({'source': 'SA3_XTD10_PES/MDL/DAQ_MPOD',
'key': 'u213.value',
'dim': None},),
"PES_N2": ({'source': 'SA3_XTD10_PES/DCTRL/V30300S_NITROGEN',
'key': 'hardwareState.value',
'dim': None},),
"PES_Ne": ({'source': 'SA3_XTD10_PES/DCTRL/V30310S_NEON',
'key': 'hardwareState.value',
'dim': None},),
"PES_Kr": ({'source': 'SA3_XTD10_PES/DCTRL/V30320S_KRYPTON',
'key': 'hardwareState.value',
'dim': None},),
"PES_Xe": ({'source': 'SA3_XTD10_PES/DCTRL/V30330S_XENON',
'key': 'hardwareState.value',
'dim': None},),
# XTD10 MCP (after GATT)
'XTD10_MCP3raw': ({'source': 'SA3_XTD10_MCP/ADC/1:channel_3.output',
'key': 'data.rawData',
'dim': ['XTD10_MCPsampleId']},),
'XTD10_MCP5raw': ({'source': 'SA3_XTD10_MCP/ADC/1:channel_5.output',
'key': 'data.rawData',
'dim': ['XTD10_MCPsampleId']},),
'XTD10_MCP9raw': ({'source': 'SA3_XTD10_MCP/ADC/1:channel_9.output',
'key': 'data.rawData',
'dim': ['XTD10_MCPsampleId']},),
# DPS imagers
"DPS1CAM2": ({'source': 'SCS_BLU_DPS-1/CAM/IMAGER2CAMERA:daqOutput',
'key': 'data.image.pixels',
'dim': ['dps1cam2_y', 'dps1cam2_x']},),
"DPS2CAM2": ({'source': 'SCS_BLU_DPS-2/CAM/IMAGER2CAMERA:daqOutput',
'key': 'data.image.pixels',
'dim': ['dps2cam2_y', 'dps2cam2_x']},),
# XOX
"XOX_ANALYZER": ({'source': 'SCS_BLU_DPS-2/MOTOR/X2',
'key': 'actualPosition.value',
'dim': None},),
"XOX_HWP": ({'source': 'SCS_ILH_LAS/MOTOR/LT_SPARE1',
'key': 'actualPosition.value',
'dim': None},),
# XTD10 XGM
# keithley
"XTD10_photonFlux": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS',
'key': 'pulseEnergy.photonFlux.value',
'dim': None},),
"XTD10_photonFlux_sigma": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS',
'key': 'pulseEnergy.photonFluxSigma.value',
'dim': None},),
# ADC
"XTD10_XGM": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensityTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"XTD10_XGM_sigma": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensitySigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"XTD10_SA3": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa3TD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"XTD10_SA3_sigma": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa3SigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"XTD10_SA1": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa1TD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"XTD10_SA1_sigma": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa1SigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
# low pass averaged ADC
"XTD10_slowTrain": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS',
'key': 'controlData.slowTrain.value',
'dim': None},),
"XTD10_slowTrain_SA1": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS',
'key': 'controlData.slowTrainSa1.value',
'dim': None},),
"XTD10_slowTrain_SA3": ({'source': 'SA3_XTD10_XGM/XGM/DOOCS',
'key': 'controlData.slowTrainSa3.value',
'dim': None},),
# SCS XGM
# keithley
"SCS_photonFlux": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'pulseEnergy.photonFlux.value',
'dim': None},),
"SCS_photonFlux_sigma": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'pulseEnergy.photonFluxSigma.value',
'dim': None},),
"SCS_HAMP_HV": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'hv.hamph.value',
'dim': None},),
# ADC
"SCS_XGM": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensityTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"SCS_XGM_sigma": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensitySigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"SCS_SA1": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa1TD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"SCS_SA1_sigma": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa1SigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"SCS_SA3": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa3TD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
"SCS_SA3_sigma": ({'source': 'SCS_BLU_XGM/XGM/DOOCS:output',
'key': 'data.intensitySa3SigmaTD',
'dim': ['XGMbunchId'],
'extract': 'XGM'},),
# low pass averaged ADC
"SCS_slowTrain": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'controlData.slowTrain.value',
'dim': None},),
"SCS_slowTrain_SA1": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'controlData.slowTrainSa1.value',
'dim': None},),
"SCS_slowTrain_SA3": ({'source': 'SCS_BLU_XGM/XGM/DOOCS',
'key': 'controlData.slowTrainSa3.value',
'dim': None},),
# KBS
"HFM_CAPB": ({'source': 'SCS_KBS_HFM/ASENS/CAPB',
'key': 'value.value',
'dim': None},),
"HFM_CAPF": ({'source': 'SCS_KBS_HFM/ASENS/CAPF',
'key': 'value.value',
'dim': None},),
"HFM_CAPM": ({'source': 'SCS_KBS_HFM/ASENS/CAPM',
'key': 'value.value',
'dim': None},),
"HFM_BENDERB": ({'source': 'SCS_KBS_HFM/MOTOR/BENDERB',
'key': 'encoderPosition.value',
'dim': None},),
"HFM_BENDERF": ({'source': 'SCS_KBS_HFM/MOTOR/BENDERF',
'key': 'encoderPosition.value',
'dim': None},),
"VFM_CAPB": ({'source': 'SCS_KBS_VFM/ASENS/CAPB',
'key': 'value.value',
'dim': None},),
"VFM_CAPF": ({'source': 'SCS_KBS_VFM/ASENS/CAPF',
'key': 'value.value',
'dim': None},),
"VFM_CAPM": ({'source': 'SCS_KBS_VFM/ASENS/CAPM',
'key': 'value.value',
'dim': None},),
"VFM_BENDERB": ({'source': 'SCS_KBS_VFM/MOTOR/BENDERB',
'key': 'encoderPosition.value',
'dim': None},),
"VFM_BENDERF": ({'source': 'SCS_KBS_VFM/MOTOR/BENDERF',
'key': 'encoderPosition.value',
'dim': None},),
"HFM_BENDING": ({'source': 'SCS_KBS_HFM/MDL/AVERAGER',
'key': 'result.value',
'dim': None},),
"VFM_BENDING": ({'source': 'SCS_KBS_VFM/MDL/AVERAGER',
'key': 'result.value',
'dim': None},),
# AFS LASER
"AFS_PhaseShifter": ({'source': 'SCS_ILH_LAS/PHASESHIFTER/DOOCS',
'key': 'actualPosition.value',
'dim': None},),
"AFS_DelayLine": ({'source': 'SCS_ILH_LAS/MOTOR/LT3',
'key': 'actualPosition.value',
'dim': None},
{'source': 'SCS_ILH_LAS/MOTOR/LT3',
'key': 'AActualPosition.value',
'dim': None},),
"AFS_HalfWP": ({'source': 'SCS_ILH_LAS/MOTOR/ROT_OPA_BWP1',
'key': 'actualPosition.value',
'dim': None},),
"AFS_FocusLens": ({'source': 'SCS_ILH_LAS/MOTOR/LT_SPARE1',
'key': 'actualPosition.value',
'dim': None},),
# 2nd lens of telescope
"AFS_TeleLens": ({'source': 'SCS_ILH_LAS/MOTOR/LT2',
'key': 'actualPosition.value',
'dim': None},),
# PP LASER 800 nm path
"PP800_PhaseShifter": ({'source': 'SCS_ILH_LAS/DOOCS/PP800_PHASESHIFTER',
'key': 'actualPosition.value',
'dim': None},),
"PP800_SynchDelayLine": ({'source': 'SCS_ILH_LAS/DOOCS/PPL_OPT_DELAY',
'key': 'actualPosition.value',
'dim': None},),
"PP800_DelayLine": ({'source': 'SCS_ILH_LAS/MOTOR/LT3',
'key': 'actualPosition.value',
'dim': None},
{'source': 'SCS_ILH_LAS/MOTOR/LT3',
'key': 'AActualPosition.value',
'dim': None},),
"PP800_T0_mm": ({'source': 'SCS_ILH_LAS/MDL/OPTICALDELAY_PP800',
'key': 'motorOffset.value',
'dim': None},),
"PP800_HalfWP": ({'source': 'SCS_ILH_LAS/MOTOR/ROT8WP1',
'key': 'actualPosition.value',
'dim': None},),
"PP800_HWP_POWER": ({'source': 'SCS_ILH_LAS/MDL/WAVEPLATE_PP800',
'key': 'actualPosition.value',
'dim': None},),
"PP800_FocusLens": ({'source': 'SCS_ILH_LAS/MOTOR/LT_SPARE1',
'key': 'actualPosition.value',
'dim': None},),
"PP800_HWP_POLARIZATION": ({'source': 'SCS_CDIFFT_FDM/MOTOR/FOCUS_1',
'key': 'actualPosition.value',
'dim': None},),
"LIN_FocusLens": ({'source': 'SCS_CDIFFT_FDM/MOTOR/FOCUS_2',
'key': 'actualPosition.value',
'dim': None},),
"FFT_FocusLens": ({'source': 'SCS_CDIFFT_FDM/MOTOR/BARLOW_1',
'key': 'actualPosition.value',
'dim': None},),
# 1st lens of telescope (setup of August 2019)
"PP800_TeleLens": ({'source': 'SCS_ILH_LAS/MOTOR/LT7',
'key': 'actualPosition.value',
'dim': None},),
"ILH_8CAM1": ({'source': 'SCS_ILH_LAS/CAM/8CAM1:daqOutput',
'key': 'data.image.pixels',
'dim': ['8cam1_y', '8cam1_x']},),
"ILH_8CAM5": ({'source': 'SCS_ILH_LAS/CAM/8CAM5:daqOutput',
'key': 'data.image.pixels',
'dim': ['8cam5_y', '8cam5_x']},),
"ILH_10CAM1": ({'source': 'SCS_ILH_LAS/CAM/10CAM1:daqOutput',
'key': 'data.image.pixels',
'dim': ['10cam1_y', '10cam1_x']},),
"ILH_CAM_SPARE3": ({'source': 'SCS_ILH_LAS/CAM/CAM_SPARE3:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam_spare3_y', 'cam_spare3_x']},),
"ILH_CAM_SPARE4": ({'source': 'SCS_ILH_LAS/CAM/CAM_SPARE4:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam_spare4_y', 'cam_spare4_x']},),
"ILH_CAM_SPARE5": ({'source': 'SCS_ILH_LAS/CAM/CAM_SPARE5:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam_spare5_y', 'cam_spare5_x']},),
"ILH_PIDelay": ({'source': 'SCS_ILH_LAS/MOTOR/PIDELAY',
'key': 'actualPosition.value',
'dim': None},),
"ZABER210_ODL": ({'source': 'SCS_ILH_LAS/MOTOR/ZABER210_ODL',
'key': 'actualPosition.value',
'dim': None},
{'source': 'SCS_ILH_LAS/MOTOR/EOS_DELAY',
'key': 'actualPosition.value',
'dim': None},),
"ZABER110_ODL": ({'source': 'SCS_ILH_LAS/MOTOR/ZABER110_ODL',
'key': 'actualPosition.value',
'dim': None},),
"virtual_sample": ({'source': 'SCS_LIN_SCR/CAM/VIRTUAL_SAMPLE:daqOutput',
'key': 'data.image.pixels',
'dim': ['vs_y', 'vs_x']},),
# SHG SETUP in ILH
## 800 nm delay line
"SHG_DELAY_800": ({'source': 'SCS_GPC_LAS/MOTOR/DELAY',
'key': 'actualPosition.value',
'dim': None},),
## 266 nm attenuator
"SHG_ATT_266": ({'source': 'SCS_GPC_MOV/MOTOR/THETA',
'key': 'actualPosition.value',
'dim': None},),
## finesse delay stage to find temporal overlap between 800 nm and 400 nm beams
"SHG_THG_DELAY": ({'source': 'SCS_LASLAB_LASER/MOTOR/STAGE-4',
'key': 'actualPosition.value',
'dim': None},),
## 266 nm half wave plate otation stage
"SHG_HWP_266": ({'source': 'SCS_LASLAB_LASER/MOTOR/STAGE-2',
'key': 'actualPosition.value',
'dim': None},),
## 266 nm lens
"SHG_LENS_266": ({'source': 'SCS_GPC_LAS/PMOTOR/PARABOLA_RY',
'key': 'actualPosition.value',
'dim': None},),
## 800 nm attenuator
"SHG_ATT_800": ({'source': 'SCS_GPC_MOV/MOTOR/THETAMAG',
'key': 'actualPosition.value',
'dim': None},),
## 800 nm HWM
"SHG_HWP_800": ({'source': 'SCS_LASLAB_LASER/MOTOR/STAGE-1',
'key': 'actualPosition.value',
'dim': None},),
## 400 nm Glan polarizer
"SHG_GLAN_POL": ({'source': 'SCS_LASLAB_LASER/MOTOR/STAGE-3',
'key': 'actualPosition.value',
'dim': None},),
## 800 nm lens
"SHG_LENS_800": ({'source': 'SCS_GPC_LAS/PMOTOR/PARABOLA_RZ',
'key': 'actualPosition.value',
'dim': None},),
## sample TX
"SHG_SAM_TX": ({'source': 'SCS_GPC_LAS/PMOTOR/STAGE_X',
'key': 'actualPosition.value',
'dim': None},),
## sample TY
"SHG_SAM_TY": ({'source': 'SCS_GPC_LAS/PMOTOR/STAGE_Z',
'key': 'actualPosition.value',
'dim': None},),
## sample RY
"SHG_SAM_RY": ({'source': 'SCS_GPC_MOV/MOTOR/X',
'key': 'actualPosition.value',
'dim': None},),
## cameras
"SHG_CAM1": ({'source': 'SCS_GPC_SHG/CAM/CAMERA1:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam1_y', 'cam1_x']},),
"SHG_CAM2": ({'source': 'SCS_GPC_SHG/CAM/CAMERA2:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam2_y', 'cam2_x']},),
"SHG_CAM3": ({'source': 'SCS_GPC_SHG/CAM/CAMERA3:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam3_y', 'cam3_x']},),
"SHG_CAM4": ({'source': 'SCS_GPC_SHG/CAM/CAMERA4:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam4_y', 'cam4_x']},),
"SHG_CAM5": ({'source': 'SCS_GPC_SHG/CAM/CAMERA5:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam5_y', 'cam5_x']},),
"SHG_CAM6": ({'source': 'SCS_GPC_SHG/CAM/CAMERA6:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam6_y', 'cam6_x']},),
"SHG_CAM7": ({'source': 'SCS_GPC_SHG/CAM/CAMERA7:daqOutput',
'key': 'data.image.pixels',
'dim': ['cam7_y', 'cam7_x']},),
# GPC
"GPC_EOS_DelayLine": ({'source': 'SCS_CDIDET_GRD/MOTOR/IMAGER',
'key': 'actualPosition.value',
'dim': None},),
"GPC_X": ({'source': 'SCS_GPC_MOV/MOTOR/X',
'key': 'actualPosition.value',
'dim': None},),
"GPC_Y": ({'source': 'SCS_GPC_MOV/MOTOR/Y',
'key': 'actualPosition.value',
'dim': None},),
"GPC_THETA": ({'source': 'SCS_GPC_MOV/MOTOR/THETA',
'key': 'actualPosition.value',
'dim': None},),
"GPC_THETAMAG": ({'source': 'SCS_GPC_MOV/MOTOR/THETAMAG',
'key': 'actualPosition.value',
'dim': None},),
# FFT
"scannerX": ({'source': 'SCS_CDIFFT_SAM/LMOTOR/SCANNERX',
'key': 'actualPosition.value',
'dim': None},),
"scannerY": ({'source': 'SCS_CDIFFT_SAM/MOTOR/SCANNERY2',
'key': 'actualPosition.value',
'dim': None},
{'source': 'SCS_CDIFFT_SAM/MOTOR/SCANNERY',
'key': 'actualPosition.value',
'dim': None},),
"scannerY_enc": ({'source': 'SCS_CDIFFT_SAM/ENC/SCANNERY',
'key': 'value.value',
'dim': None},),
"sampleH": ({'source': 'SCS_CDIFFT_SAM/MDL/GRIDSAMPLE',
'key': 'actualH.value',
'dim': None},),
"sampleK": ({'source': 'SCS_CDIFFT_SAM/MDL/GRIDSAMPLE',
'key': 'actualK.value',
'dim': None},),
"FFT_SAM_Z": ({'source': 'SCS_CDIFFT_MOV/MOTOR/SAM_Z',
'key': 'actualPosition.value',
'dim': None},),
"FFT_SAM_Z_ENC": ({'source': 'SCS_CDIFFT_MOV/ENC/SAM_Z',
'key': 'value.value',
'dim': None},),
"magnet": ({'source': 'SCS_CDIFFT_MAG/MDL/FIELD',
'key': 'actualPosition.value',
'dim': None},),
"magnet_current": ({'source': 'SCS_CDIFFT_MAG/ASENS/PSU_CMON',
'key': 'value.value',
'dim': None},
{'source': 'SCS_CDIFFT_MAG/ASENS/CURRENT',
'key': 'value.value',
'dim': None},
{'source': 'SCS_CDIFFT_MAG/SUPPLY/CURRENT',
'key': 'actualCurrent.value',
'dim': None}),
"Vertical_FDM": ({'source': 'SCS_CDIFFT_LDM/CAM/CAMERA1A:daqOutput',
'key': 'data.image.pixels',
'dim': ['vfdm_y', 'vfdm_x']},),
"Horizontal_FDM": ({'source': 'SCS_CDIFFT_LDM/CAM/CAMERA2A:daqOutput',
'key': 'data.image.pixels',
'dim': ['hfdm_y', 'hfdm_x']},),
"LLC_webcam1": ({'source': 'SCS_CDILLC_VAC/CAM/WEBCAMERA1:daqOutput',
'key': 'data.image.pixels',
'dim': ['llc1_y', 'llc1_x']},),
"LLC_webcam2": ({'source': 'SCS_CDILLC_VAC/CAM/WEBCAMERA2:daqOutput',
'key': 'data.image.pixels',
'dim': ['llc2_y', 'llc2_x']},),
"LLC_webcam3": ({'source': 'SCS_CDILLC_VAC/CAM/WEBCAMERA3:daqOutput',
'key': 'data.image.pixels',
'dim': ['llc3_y', 'llc3_x']},),
# DSSC
"DSSC_delay": ({'source': 'SCS_RR_SYS/TSYS/UTC-1-S2',
'key': 'backTrg3.delay.value',
'dim': None},),
# CHEM
"chem_X": ({'source': 'SCS_CHEM_JET/MOTOR/MANA_X',
'key': 'actualPosition.value',
'dim': None},),
"chem_Y": ({'source': 'SCS_CHEM_JET/MOTOR/MANA_Y',
'key': 'actualPosition.value',
'dim': None},),
"chem_Z": ({'source': 'SCS_CHEM_JET/MOTOR/MANA_Z',
'key': 'actualPosition.value',
'dim': None},),
"chem_ppl_x": ({'source': 'SCS_CHEM_LIN/PMOTOR/X',
'key': 'actualPosition.value',
'dim': None},),
"chem_ppl_y": ({'source': 'SCS_CHEM_LIN/PMOTOR/Y',
'key': 'actualPosition.value',
'dim': None},),
"chem_ppl_pol": ({'source': 'SCS_CDIFFT_FDM/MOTOR/FOCUS_1',
'key': 'actualPosition.value',
'dim': None},),
# hRIXS
"hRIXS_det": ({'source': 'SCS_HRIXS_DET/CAM/CAMERA:daqOutput',
'key': 'data.image.pixels',
'dim': ['x', 'y']},),
"hRIXS_exposure": ({'source': 'SCS_HRIXS_DET/CAM/CAMERA',
'key': 'ShutterTiming.exposureTime.value',
'dim': None},),
"hRIXS_delay": ({'source': 'SCS_HRIXS_DET/MDL/CAMERA_SHUTTER',
'key': 'delay.value',
'dim': None},),
"hRIXS_index": ({'source': 'SCS_HRIXS_DET/MDL/CAMERA_SHUTTER',
'key': 'currentIndex.value',
'dim': None},),
"hRIXS_norm": ({'source': 'SCS_HRIXS_DET/MDL/CAMERA_SHUTTER',
'key': 'xgmSum.value',
'dim': None},),
"hRIXS_ABB": ({'source': 'SCS_HRIXS_MOV/MOTOR/ABB',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_ABL": ({'source': 'SCS_HRIXS_MOV/MOTOR/ABL',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_ABR": ({'source': 'SCS_HRIXS_MOV/MOTOR/ABR',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_ABT": ({'source': 'SCS_HRIXS_MOV/MOTOR/ABT',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_DRX": ({'source': 'SCS_HRIXS_MOV/MOTOR/DRX',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_DTY1":({'source': 'SCS_HRIXS_MOV/MOTOR/DTY1',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_DTZ": ({'source': 'SCS_HRIXS_MOV/MOTOR/DTZ',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GMX": ({'source': 'SCS_HRIXS_MOV/MOTOR/GMX',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GRX": ({'source': 'SCS_HRIXS_MOV/MOTOR/GRX',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GTLY": ({'source': 'SCS_HRIXS_MOV/MOTOR/GTLY',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GTRY": ({'source': 'SCS_HRIXS_MOV/MOTOR/GTRY',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GTX": ({'source': 'SCS_HRIXS_MOV/MOTOR/GTX',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_GTZ": ({'source': 'SCS_HRIXS_MOV/MOTOR/GTZ',
'key': 'actualPosition.value',
'dim': None},),
"hRIXS_RRY": ({'source': 'SCS_HRIXS_MOV/MOTOR/RRY',
'key': 'actualPosition.value',
'dim': None},),
# XRD
"XRD_DRY": ({'source': 'SCS_XRD_MOV/MOTOR/DRY',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SRX": ({'source': 'SCS_XRD_MOV/MOTOR/SRX',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SRY": ({'source': 'SCS_XRD_MOV/MOTOR/SRY',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SRZ": ({'source': 'SCS_XRD_MOV/MOTOR/SRZ',
'key': 'actualPosition.value',
'dim': None},),
"XRD_STX": ({'source': 'SCS_XRD_MOV/MOTOR/STX',
'key': 'actualPosition.value',
'dim': None},),
"XRD_STY": ({'source': 'SCS_XRD_MOV/MOTOR/STY',
'key': 'actualPosition.value',
'dim': None},),
"XRD_STZ": ({'source': 'SCS_XRD_MOV/MOTOR/STZ',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SXT1Y": ({'source': 'SCS_XRD_MOV/MOTOR/SXT1Y',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SXT2Y": ({'source': 'SCS_XRD_MOV/MOTOR/SXT2Y',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SXTX": ({'source': 'SCS_XRD_MOV/MOTOR/SXTX',
'key': 'actualPosition.value',
'dim': None},),
"XRD_SXTZ": ({'source': 'SCS_XRD_MOV/MOTOR/SXTZ',
'key': 'actualPosition.value',
'dim': None},),
"XRD_CRY": ({'source': 'SCS_XRD_MOV/MOTOR/CRY',
'key': 'actualPosition.value',
'dim': None},),
"XRD_CTX": ({'source': 'SCS_XRD_MOV/MOTOR/CTX',
'key': 'actualPosition.value',
'dim': None},),
"XRD_CTY": ({'source': 'SCS_XRD_MOV/MOTOR/CTY',
'key': 'actualPosition.value',
'dim': None},),
"XRD_CTZ": ({'source': 'SCS_XRD_MOV/MOTOR/CTZ',
'key': 'actualPosition.value',
'dim': None},),
# Viking
"VIKING_FILTER": ({'source': 'SCS_EXP_VIKING/MDL/FILTER_SELECT',
'key': 'actualIncrement.value',
'dim': None},),
"VIKING_AX": ({'source': 'SCS_EXP_VIKING/MOTOR/AX',
'key': 'actualPosition.value',
'dim': None},),
"VIKING_Y": ({'source': 'SCS_EXP_VIKING/MOTOR/Y',
'key': 'actualPosition.value',
'dim': None},),
"VIKING_Z": ({'source': 'SCS_EXP_VIKING/MOTOR/Z',
'key': 'actualPosition.value',
'dim': None},),
# PI-MTE3 CCD camera
"MTE3": ({'source': 'SCS_CDIDET_MTE3/CAM/CAMERA:daqOutput',
'key': 'data.image.pixels',
'dim': ['x', 'y']},),
"GRID_H": ({'source': 'SCS_CDIFFT_SAM/MDL/GRIDSAMPLE',
'key': 'actualH.value',
'dim': None},),
"GRID_K": ({'source': 'SCS_CDIFFT_SAM/MDL/GRIDSAMPLE',
'key': 'actualK.value',
'dim': None},),
# Andor Newton CCD camera
"newton": ({'source': 'SCS_EXP_NEWTON/CAM/CAMERA:daqOutput',
'key': 'data.image.pixels',
'dim': ['newt_y', 'newt_x']},),
# Andor Newton CCD camera
"MaranaX": ({'source': 'SCS_HRIXS_DET/CAM/MARANAX:daqOutput',
'key': 'data.image.pixels',
'dim': ['mara_y', 'mara_x']},),
# FastCCD, if in raw folder, raw images
# if in proc folder, dark substracted and relative gain corrected
"fastccd": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.pixels',
'dim': ['x', 'y']},),
# FastCCD with common mode correction
"fastccd_cm": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.pixels_cm',
'dim': ['x', 'y']},),
# FastCCD charge split correction in very low photon count regime
"fastccd_classified": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.pixels_classified',
'dim': ['x', 'y']},),
# FastCCD event multiplicity from the charge split correction:
# 0: no events
# 100, 101: single events
# 200-203: charge split into two pixels in four different orientations
# 300-303: charge split into three pixels in four different orientations
# 400-403: charge split into four pixels in four different orientations
# 1000: charge in more than four neighboring pixels. Cannot be produced
# by a single photon alone.
"fastccd_patterns": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.patterns',
'dim': ['x', 'y']},),
# FastCCD gain map, 0 high gain, 1 medium gain, 2 low gain
"fastccd_gain": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.gain',
'dim': ['x', 'y']},),
# FastCCD mask, bad pixel map to be ignored if > 0
"fastccd_mask": ({'source': 'SCS_CDIDET_FCCD2M/DAQ/FCCD:daqOutput',
'key': 'data.image.mask',
'dim': ['x', 'y']},),
# TIM
"MCP1apd": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_D.apd.pulseIntegral',
'dim': ['apdId'],
'extract': 'peaks'},),
"MCP1raw": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_D.raw.samples',
'dim': ['samplesId'],
'extract': 'peaks'},),
"MCP2apd": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_C.apd.pulseIntegral',
'dim': ['apdId'],
'extract': 'peaks'},),
"MCP2raw": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_C.raw.samples',
'dim': ['samplesId'],
'extract': 'peaks'},),
"MCP3apd": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_B.apd.pulseIntegral',
'dim': ['apdId'],
'extract': 'peaks'},),
"MCP3raw": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_B.raw.samples',
'dim': ['samplesId'],
'extract': 'peaks'},),
"MCP4apd": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_A.apd.pulseIntegral',
'dim': ['apdId'],
'extract': 'peaks'},),
"MCP4raw": ({'source': 'SCS_UTC1_ADQ/ADC/1:network',
'key': 'digitizers.channel_1_A.raw.samples',
'dim': ['samplesId'],
'extract': 'peaks'},),
# FastADC
"FastADC0peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_0.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC0raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_0.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC1peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_1.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC1raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_1.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC2peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_2.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_2.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC3peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_3.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC3raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_3.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC4peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_4.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC4raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_4.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC5peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_5.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC5raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_5.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC6peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_6.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC6raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_6.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC7peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_7.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC7raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_7.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC8peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_8.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC8raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_8.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
"FastADC9peaks": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_9.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC9raw": ({'source': 'SCS_UTC1_MCP/ADC/1:channel_9.output',
'key': 'data.rawData',
'dim': ['fadc_samplesId'],
'extract': 'peaks'},),
# FastADC 2
"FastADC2_0peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_0.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_0raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_0.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_1peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_1.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_1raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_1.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_2peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_2.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_2raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_2.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_3peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_3.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_3raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_3.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_4peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_4.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_4raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_4.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_5peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_5.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_5raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_5.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_6peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_6.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_6raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_6.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_7peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_7.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_7raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_7.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_8peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_8.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_8raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_8.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FastADC2_9peaks": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_9.output',
'key': 'data.peaks',
'dim': ['peakId'],
'extract': 'peaks'},),
"FastADC2_9raw": ({'source': 'SCS_UTC2_FADC/ADC/1:channel_9.output',
'key': 'data.rawData',
'dim': ['fadc2_samplesId'],
'extract': 'peaks'},),
"FFT_PD2raw": ({'source': 'SCS_FFT_DIAG/ADC/PD2:output',
'key': 'data.rawData',
'dim': ['fftpd2_samplesId'],
'extract': 'peaks'},),
"FFT_MCPraw": ({'source': 'SCS_FFT_MCP/ADC/MCP:output',
'key': 'data.rawData',
'dim': ['fftmcp_samplesId'],
'extract': 'peaks'},),
"FFT_REFLraw": ({'source': 'SCS_FFT_REFL/ADC/DIODE_UP:output',
'key': 'data.rawData',
'dim': ['fftrefl_samplesId'],
'extract': 'peaks'},),
"I0_ILHraw": ({'source': 'SCS_ILH_LAS/ADC/I0_ILH:output',
'key': 'data.rawData',
'dim': ['i0ilh_samplesId'],
'extract': 'peaks'},),
"I0_LINraw": ({'source': 'SCS_LIN_LAS/ADC/I0:output',
'key': 'data.rawData',
'dim': ['i0lin_samplesId'],
'extract': 'peaks'},),
"REFLECTOMETERraw": ({'source': 'SCS_LIN_LAS/ADC/REFLECTOMETER:output',
'key': 'data.rawData',
'dim': ['linrefl_samplesId'],
'extract': 'peaks'},),
"CHEM_PDFILTERraw": ({'source': 'SCS_CHEM_DIAG/ADC/DIODE_FILTER:output',
'key': 'data.rawData',
'dim': ['chempdfilt_samplesId'],
'extract': 'peaks'},),
"CHEM_PDNOFILTERraw": ({'source': 'SCS_CHEM_DIAG/ADC/DIODE_NOFILTER:output',
'key': 'data.rawData',
'dim': ['chempdnofilt_samplesId'],
'extract': 'peaks'},),
"CHEM_APDraw": ({'source': 'SCS_CHEM_DET/ADC/APD:output',
'key': 'data.rawData',
'dim': ['chemapd_samplesId'],
'extract': 'peaks'},),
"XOX_EOSPDraw": ({'source': 'SCS_PAM_XOX/ADC/EOS_PD:output',
'key': 'data.rawData',
'dim': ['xoxeos_samplesId'],
'extract': 'peaks'},),
"XRD_MCP_SMALLraw": ({'source': 'SCS_XRD_DET/ADC/MCP_SMALL:output',
'key': 'data.rawData',
'dim': ['mcpsmall_samplesId'],
'extract': 'peaks'},),
"XRD_MCP_BIGraw": ({'source': 'SCS_XRD_DET/ADC/MCP_BIG:output',
'key': 'data.rawData',
'dim': ['mcpbig_samplesId'],
'extract': 'peaks'},),
"XRD_PD2raw": ({'source': 'SCS_XRD_DET/ADC/DIODE2:output',
'key': 'data.rawData',
'dim': ['pd2_samplesId'],
'extract': 'peaks'},),
"XRD_PD6raw": ({'source': 'SCS_XRD_DET/ADC/DIODE6:output',
'key': 'data.rawData',
'dim': ['pd6_samplesId'],
'extract': 'peaks'},),
# KARABACON
"KARABACON": ({'source': 'SCS_DAQ_SCAN/MDL/KARABACON',
'key': 'actualStep.value',
'dim': None},),
# GOTTHARD
"Gotthard1": ({'source': 'SCS_PAM_XOX/DET/GOTTHARD_RECEIVER1:daqOutput',
'key': 'data.adc',
'dim': ['gott_pId', 'pixelId']},),
"Gotthard2": ({'source': 'SCS_PAM_XOX/DET/GOTTHARD_RECEIVER2:daqOutput',
'key': 'data.adc',
'dim': ['gott_pId', 'pixelId']},),
"GH21": ({'source': 'SCS_XOX_GH21/CORR/RECEIVER:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},
{'source': 'SCS_XOX_GH21/CORR/GOTTHARD2_RECEIVER1:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},),
"GH22": ({'source': 'SCS_XOX_GH22/CORR/RECEIVER:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},
{'source': 'SCS_XOX_GH22/CORR/GOTTHARD2_RECEIVER2:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},),
"GH21_raw": ({'source': 'SCS_XOX_GH21/DET/GOTTHARD2_RECEIVER1:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},),
"GH22_raw": ({'source': 'SCS_XOX_GH22/DET/GOTTHARD2_RECEIVER2:daqOutput',
'key': 'data.adc',
'dim': ['gh2_pId', 'pixelId']},),
# BASLER RACER
"Racer1": ({'source': 'SCS_PAM_XOX/CAM/RACER1:daqOutput',
'key': 'data.image.pixels',
'dim': ['racer1_pId', 'racer1_x']},),
# BBO2 RY (interferometric timing tool, Nov 2020, p2711)
"BBO_RY": ({'source': 'SCS_CDIDET_GRD/MOTOR/IMAGER',
'key': 'actualPosition.value',
'dim': None},)
}