LAL  7.5.0.1-08ee4f4
lal.utils.series Namespace Reference

Functions

def func_factory (operation, dtype)
 Returns the LAL function to perform the given operation for the relevant data type. More...
 
def get_struct_name (series)
 Format a structure name into the understood type for LAL. More...
 
def get_series_type (series)
 Find the LAL type enum for this series. More...
 
def get_lal_type_str (datatype)
 Return the LAL type str for the given datatype More...
 
def get_lal_type (datatype)
 Return the LAL type enum for the given datatype More...
 
def get_numpy_type (datatype)
 Return the numpy type for the given datatype More...
 
def duplicate (series)
 Duplicate a TimeSeries or FrequencySeries. More...
 

Variables

dictionary LAL_TYPE_STR
 
 LAL_TYPE_FROM_STR = dict((v, k) for k, v in LAL_TYPE_STR.items())
 
 LAL_TYPE_STR_REGEX
 
dictionary LAL_TYPE_FROM_NUMPY
 
 NUMPY_TYPE_FROM_LAL = dict((v, k) for k, v in LAL_TYPE_FROM_NUMPY.items())
 
list SERIES_OPERATIONS = ['create', 'destroy', 'cut', 'resize', 'shrink', 'add']
 
list SERIES_TYPES = ['Time', 'Frequency']
 
list STRUCT_TYPES = ['Sequence', 'Vector']
 
 SERIES_REGEX
 
 ARRAY_REGEX
 
 STRUCT_REGEX
 

Function Documentation

◆ func_factory()

def lal.utils.series.func_factory (   operation,
  dtype 
)

Returns the LAL function to perform the given operation for the relevant data type.

Example::

>>> create = func_factory('create', 'real8timeseries')
>>> create
lal.CreateREAL8TimeSeries
>>> ts = create(name, epoch, f0, deltaT, sampleUnits, length)
>>> func_factory('resize', ts)
lal.ResizeREAL8TimeSeries

Definition at line 93 of file utils/series.py.

◆ get_struct_name()

def lal.utils.series.get_struct_name (   series)

Format a structure name into the understood type for LAL.

Example::

>>> get_struct_name('real8timeseries')
'REAL8TimeSeries'

Definition at line 114 of file utils/series.py.

◆ get_series_type()

def lal.utils.series.get_series_type (   series)

Find the LAL type enum for this series.

Parameters
seriesa LAL series object (e.g. REAL8TimeSeries)
Returns
the LAL type enum (integer) for the series

Definition at line 155 of file utils/series.py.

◆ get_lal_type_str()

def lal.utils.series.get_lal_type_str (   datatype)

Return the LAL type str for the given datatype

Parameters
datatypea dtype representation, normally a string, or a python/numpy type object
Returns
the LAL type str for the given datatype

Example::

>>> get_lal_type_str('uint32')
'UINT4'
>>> get_lal_type_str(float)
'REAL8'

Definition at line 180 of file utils/series.py.

◆ get_lal_type()

def lal.utils.series.get_lal_type (   datatype)

Return the LAL type enum for the given datatype

Parameters
datatypea dtype representation, normally a string, or a python/numpy type object
Returns
the LAL type enum (integer) for the given datatype

Example::

>>> get_lal_type('uint32')
34
>>> get_lal_type(float)
11

Definition at line 199 of file utils/series.py.

◆ get_numpy_type()

def lal.utils.series.get_numpy_type (   datatype)

Return the numpy type for the given datatype

Parameters
datatypea dtype representation, normally a LAL type enum (int), a LAL type string, or a python/numpy type object
Returns
the numpy type corresponding to the given datatype

Example::

>>> get_numpy_type(float)
numpy.float64
>>> get_numpy_type('REAL8')
numpy.float64
>>> get_numpy_type(11)
numpy.float64

Definition at line 247 of file utils/series.py.

◆ duplicate()

def lal.utils.series.duplicate (   series)

Duplicate a TimeSeries or FrequencySeries.

Arguments:

series : [ TimeSeries | FrequencySeries ]
    input series to duplicate

Definition at line 264 of file utils/series.py.

Variable Documentation

◆ LAL_TYPE_STR

dictionary lal.utils.series.LAL_TYPE_STR
Initial value:
1 = {
2  lal.I2_TYPE_CODE: 'INT2',
3  lal.I4_TYPE_CODE: 'INT4',
4  lal.I8_TYPE_CODE: 'INT8',
5  lal.U2_TYPE_CODE: 'UINT2',
6  lal.U4_TYPE_CODE: 'UINT4',
7  lal.U8_TYPE_CODE: 'UINT8',
8  lal.S_TYPE_CODE: 'REAL4',
9  lal.D_TYPE_CODE: 'REAL8',
10  lal.C_TYPE_CODE: 'COMPLEX8',
11  lal.Z_TYPE_CODE: 'COMPLEX16',
12 }

Definition at line 31 of file utils/series.py.

◆ LAL_TYPE_FROM_STR

lal.utils.series.LAL_TYPE_FROM_STR = dict((v, k) for k, v in LAL_TYPE_STR.items())

Definition at line 43 of file utils/series.py.

◆ LAL_TYPE_STR_REGEX

lal.utils.series.LAL_TYPE_STR_REGEX
Initial value:
1 = re.compile(
2  '(?P<dtype>(%s))' % ('|'.join(LAL_TYPE_FROM_STR.keys())), re.I)

Definition at line 44 of file utils/series.py.

◆ LAL_TYPE_FROM_NUMPY

dictionary lal.utils.series.LAL_TYPE_FROM_NUMPY
Initial value:
1 = {
2  numpy.int16: lal.I2_TYPE_CODE,
3  numpy.int32: lal.I4_TYPE_CODE,
4  numpy.int64: lal.I8_TYPE_CODE,
5  numpy.uint16: lal.U2_TYPE_CODE,
6  numpy.uint32: lal.U4_TYPE_CODE,
7  numpy.uint64: lal.U8_TYPE_CODE,
8  numpy.float32: lal.S_TYPE_CODE,
9  numpy.float64: lal.D_TYPE_CODE,
10  numpy.complex64: lal.C_TYPE_CODE,
11  numpy.complex128: lal.Z_TYPE_CODE,
12 }

Definition at line 48 of file utils/series.py.

◆ NUMPY_TYPE_FROM_LAL

lal.utils.series.NUMPY_TYPE_FROM_LAL = dict((v, k) for k, v in LAL_TYPE_FROM_NUMPY.items())

Definition at line 60 of file utils/series.py.

◆ SERIES_OPERATIONS

list lal.utils.series.SERIES_OPERATIONS = ['create', 'destroy', 'cut', 'resize', 'shrink', 'add']

Definition at line 64 of file utils/series.py.

◆ SERIES_TYPES

list lal.utils.series.SERIES_TYPES = ['Time', 'Frequency']

Definition at line 65 of file utils/series.py.

◆ STRUCT_TYPES

list lal.utils.series.STRUCT_TYPES = ['Sequence', 'Vector']

Definition at line 66 of file utils/series.py.

◆ SERIES_REGEX

lal.utils.series.SERIES_REGEX
Initial value:
1 = re.compile(
2  r'%s(?P<stype>(%s))Series\Z'
3  % (LAL_TYPE_STR_REGEX.pattern, '|'.join(SERIES_TYPES)), re.I)

Definition at line 68 of file utils/series.py.

◆ ARRAY_REGEX

lal.utils.series.ARRAY_REGEX
Initial value:
1 = re.compile(
2  r'%sArray(?:(?P<dir>(L|V))?)' % LAL_TYPE_STR_REGEX.pattern, re.I)

Definition at line 71 of file utils/series.py.

◆ STRUCT_REGEX

lal.utils.series.STRUCT_REGEX
Initial value:
1 = re.compile(
2  r'%s(?P<struct>(%s))\Z'
3  % (LAL_TYPE_STR_REGEX.pattern, '|'.join(STRUCT_TYPES)), re.I)

Definition at line 73 of file utils/series.py.