toolbox_scs.detectors.dssc_misc

DSSC-related sub-routines.

comment: contributions should comply with pep8 code structure guidelines.

Module Contents

Functions

load_dssc_info(proposal, run_nr)

Loads the first data file for DSSC module 0 (this is hardcoded)

create_dssc_bins(name, coordinates, bins)

Creates a single entry for the dssc binner dictionary. The produced xarray

get_xgm_formatted(run_obj, xgm_name, dssc_frame_coords)

Load the xgm data and define coordinates along the pulse dimension.

quickmask_DSSC_ASIC(poslist)

Returns a mask for the given DSSC geometry with ASICs given in poslist

load_mask(fname, dssc_mask)

Load a DSSC mask file.

toolbox_scs.detectors.dssc_misc.load_dssc_info(proposal, run_nr)[source]

Loads the first data file for DSSC module 0 (this is hardcoded) and returns the detector_info dictionary

Parameters
  • proposal (str, int) – number of proposal

  • run_nr (str, int) – number of run

Returns

info – {‘dims’: tuple, ‘frames_per_train’: int, ‘total_frames’: int}

Return type

dictionary

toolbox_scs.detectors.dssc_misc.create_dssc_bins(name, coordinates, bins)[source]

Creates a single entry for the dssc binner dictionary. The produced xarray data-array will later be used to perform grouping operations according to the given bins.

Parameters
  • name (str) – name of the coordinate to be binned.

  • coordinates (numpy.ndarray) – the original coordinate values (1D)

  • bins (numpy.ndarray) – the bins according to which the corresponding dimension should be grouped.

Returns

da – A pre-formatted xarray.DataArray relating the specified dimension with its bins.

Return type

xarray.DataArray

Examples

>>> import toolbox_scs as tb
>>> run = tb.open_run(2212, 235, include='*DA*')

1.) binner along ‘pulse’ dimension. Group data into two bins. >>> bins_pulse = [‘pumped’, ‘unpumped’] * 10 >>> binner_pulse = tb.create_dssc_bins(“pulse”,

np.linspace(0,19,20, dtype=int), bins_pulse)

2.) binner along ‘train’ dimension. Group data into bins corresponding

to the positions of a delay stage for instance.

>>> bins_trainId = tb.get_array(run, 'PP800_PhaseShifter', 0.04)
>>> binner_train = tb.create_dssc_bins("trainId",
                            run.trainIds,
                            bins_trainId.values)
toolbox_scs.detectors.dssc_misc.get_xgm_formatted(run_obj, xgm_name, dssc_frame_coords)[source]

Load the xgm data and define coordinates along the pulse dimension.

Parameters
  • run_obj (extra_data.DataCollection) – DataCollection object providing access to the xgm data to be loaded

  • xgm_name (str) – valid mnemonic of a xgm source

  • dssc_frame_coords (int, list) – defines which dssc frames should be normalized using data from the xgm.

Returns

xgm – xgm data with coordinate ‘pulse’.

Return type

xarray.DataArray

toolbox_scs.detectors.dssc_misc.quickmask_DSSC_ASIC(poslist)[source]

Returns a mask for the given DSSC geometry with ASICs given in poslist blanked. poslist is a list of (module, row, column) tuples. Each module consists of 2 rows and 8 columns of individual ASICS.

Copyright (c) 2019, Michael Schneider Copyright (c) 2020, SCS-team license: BSD 3-Clause License (see LICENSE_BSD for more info)

toolbox_scs.detectors.dssc_misc.load_mask(fname, dssc_mask)[source]

Load a DSSC mask file.

Copyright (c) 2019, Michael Schneider Copyright (c) 2020, SCS-team license: BSD 3-Clause License (see LICENSE_BSD for more info)

Parameters

fname (str) – string of the filename of the mask file

Return type

dssc_mask