5from contextlib
import contextmanager
13 lal.swig_redirect_standard_output_error(
True)
16 state = lal.swig_redirect_standard_output_error(
False)
18 lal.swig_redirect_standard_output_error(state)
20 warnings.warn(
"""Wswiglal-redir-stdio:
22SWIGLAL standard output/error redirection is enabled in IPython.
23This may lead to performance penalties. To disable locally, use:
25with lal.no_swig_redirect_standard_output_error():
28To disable globally, use:
30lal.swig_redirect_standard_output_error(False)
32Note however that this will likely lead to error messages
from
33LAL functions being either misdirected
or lost when called
from
36To suppress this warning, use:
39warnings.filterwarnings(
"ignore",
"Wswiglal-redir-stdio")
43__version__ = "7.7.0.1"
45## \addtogroup lal_python
46"""This package provides Python wrappings
and extensions to LAL
"""
49# =============================================================================
51# CachedDetectors Look-up Tables
57cached_detector_by_prefix = dict((cd.frDetector.prefix, cd)
for cd
in CachedDetectors)
59assert len(cached_detector_by_prefix) == len(CachedDetectors)
62cached_detector_by_name = dict((cd.frDetector.name, cd)
for cd
in CachedDetectors)
64assert len(cached_detector_by_name) == len(CachedDetectors)
67name_to_prefix = dict((name, detector.frDetector.prefix)
for name, detector
in cached_detector_by_name.items())
68prefix_to_name = dict((prefix, name)
for name, prefix
in name_to_prefix.items())
81numpy_to_lal_types = {
'char':
'CHAR',
90 'complex64':
'COMPLEX8',
91 'complex128':
'COMPLEX16'}
95 return LIGOTimeGPS, (obj.gpsSeconds, obj.gpsNanoSeconds)
99 return Unit, (str(obj),)
103 lal_type = numpy_to_lal_types[data.dtype.name]
104 creator = globals()[
'Create{}Vector'.format(lal_type)]
105 result = creator(len(data))
111 return unpickle_vector, (obj.data,)
115 lal_type = numpy_to_lal_types[attrs[
'data'].data.dtype.name]
116 kind =
'Frequency' if 'deltaF' in attrs
else 'Time'
117 creator = globals()[
'{}{}Series'.format(lal_type, kind)]
119 for key, value
in attrs.items():
120 setattr(result, key, value)
125 attrs = {
'name': obj.name,
'epoch': obj.epoch,
'f0': obj.f0,
126 'sampleUnits': obj.sampleUnits,
'data': obj.data}
127 if hasattr(obj,
'deltaF'):
128 attrs[
'deltaF'] = obj.deltaF
130 attrs[
'deltaT'] = obj.deltaT
131 return unpickle_series, (attrs,)
134copyreg.pickle(LIGOTimeGPS, pickle_gps)
135copyreg.pickle(Unit, pickle_unit)
136for datatype
in numpy_to_lal_types.values():
137 clazz = globals().get(
'{}Vector'.format(datatype))
139 copyreg.pickle(clazz, pickle_vector)
140 clazz = globals().get(
'{}FrequencySeries'.format(datatype))
142 copyreg.pickle(clazz, pickle_series)
143 clazz = globals().get(
'{}TimeSeries'.format(datatype))
145 copyreg.pickle(clazz, pickle_series)
def no_swig_redirect_standard_output_error()
def unpickle_vector(data)
def unpickle_series(attrs)