Skip to content
Snippets Groups Projects
Commit 44491d94 authored by Rafael Gort's avatar Rafael Gort
Browse files

Merge branch 'bunch_pattern' into 'master'

Added wrappers for external bunch pattern decoding

See merge request !83
parents 62e98945 c386fc88
No related branches found
No related tags found
1 merge request!83Added wrappers for external bunch pattern decoding
"""
A collection of wrappers around the the euxfel_bunch_pattern pkg
----------------------------------------------------------------
The euxfel_bunch_pattern package provides generic methods to extract
information from the bunch pattern tables. To ease its use from within
the toolbox some of its methods are wrapped. Like this they show up in
the users namespace in a self-explanatory way.
"""
import euxfel_bunch_pattern as ebp
PPL_SCS = ebp.LASER_SEED6
def is_sase_3(data):
"""
Check for prescence of a SASE3 pulse.
Parameters
----------
data : numpy array, xarray DataArray
The bunch pattern data.
Returns
-------
boolean : numpy array, xarray DataArray
true if SASE3 pulse is present.
"""
return ebp.is_sase(data, 3)
def is_sase_1(data):
"""
Check for prescence of a SASE1 pulse.
Parameters
----------
data : numpy array, xarray DataArray
The bunch pattern data.
Returns
-------
boolean : numpy array, xarray DataArray
true if SASE1 pulse is present.
"""
return ebp.is_sase(data, 1)
def is_ppl(data):
"""
Check for prescence of pp-laser pulse.
Parameters
----------
data : numpy array, xarray DataArray
The bunch pattern data.
Returns
-------
boolean : numpy array, xarray DataArray
true if pp-laser pulse is present.
"""
return ebp.is_laser(data, laser=PPL_SCS)
def get_index_ppl(data):
"""
Check array index where pp-laser pulse is present.
Parameters
----------
data : numpy array
The bunch pattern data.
Returns
-------
boolean : numpy array
The indices of the pp-laser pulses in the given array.
"""
return ebp.indices_at_laser(data, laser=PPL_SCS)
def get_index_sase1(data):
"""
Search for array index where SASE1 pulse is present.
Parameters
----------
data : numpy array
The bunch pattern data.
Returns
-------
boolean : numpy array
The indices of the SASE1 pulses in the given array.
"""
return ebp.indices_at_sase(data, 1)
def get_index_sase3(data):
"""
Search for array index where SASE3 pulse is present.
Parameters
----------
data : numpy array
The bunch pattern data.
Returns
-------
boolean : numpy array
The indices of the SASE3 pulses in the given array.
"""
return ebp.indices_at_sase(data, 3)
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