from_lal_type#

gwpy.utils.lal.from_lal_type(laltype: type) type[source]#

Convert the data type of a LAL instance or type into a numpy data type.

Parameters:
laltypeSwigPyObject or type

The input LAL instance or type.

Returns:
npytypetype

The numpy data type, such as numpy.uint32, numpy.float64, etc.

Raises:
ValueError

If the numpy data type cannot be inferred from the LAL object.

Examples

>>> from_lal_type(lal.REAL8TimeSeries)
numpy.float64

This also works with instances of LAL series types:

>>> series = lal.CreateINT4TimeSeries("test", 0, 0, 1, "m", 10)
>>> from_lal_type(series)
numpy.int32