pulsarbat.DualPolarizationSignal#

class pulsarbat.DualPolarizationSignal(z, /, *, sample_rate, start_time=None, center_freq, freq_align='center', pol_type, meta=None)[source]#

Class for dual-polarization complex baseband signals.

See the documentation for RadioSignal and BasebandSignal for more details.

Parameters:
zarray-like

The signal data. Must be at least 3-dimensional with shape (nsample, nchan, npol, ...) where npol = 2.

sample_rateQuantity

The number of samples per second. Must be in units of frequency.

start_timeTime, optional

The start time of the signal (that is, the time at the first sample of the signal). Default is None.

center_freqQuantity

The frequency at the center of the signal’s band. Must be in units of frequency.

freq_align{‘bottom’, ‘center’, ‘top’}, default: ‘center’

The alignment of channels relative to the center_freq. Default is ‘center’ (as with odd-length complex DFTs). ‘bottom’ and ‘top’ only have an effect when nchan is even.

pol_type{‘linear’, ‘circular’}

The polarization type of the signal. ‘linear’ for linearly polarized signals (with basis [X, Y]) or ‘circular’ for circularly polarized signals (with basis [L, R]).

metadict, optional

Any metadata that the user might want to attach to the signal.

Notes

Linear polarization is assumed to have basis [X, Y] and circular polarization is assumed to have basis [L, R]. For example, with pol_type='circular', z[:, :, 0] refers to the right-handed circular polarization component.

We use the PSR/IEEE convention. The circular and linear bases are related by:

L = X - i Y
R = X + i Y

The linear basis is converted to Stokes representation by:

I = X X* + Y Y*
Q = X X* - Y Y*
U = 2 Re(X* Y)
V = 2 Im(X* Y)

where * denotes a complex conjugate.

Attributes

axes_labels

Dictionary of axes labels.

bandwidth

Total bandwidth.

center_freq

Center frequency.

chan_bw

Channel bandwidth.

channel_freqs

Center frequencies of all channels.

data

The signal data.

dt

Sample spacing of the signal (1 / sample_rate).

dtype

Data type of the signal.

freq_align

Alignment of channel frequencies.

max_freq

Frequency at top of the band.

meta

Signal metadata.

min_freq

Frequency at bottom of the band.

nchan

Number of frequency channels.

ndim

Number of dimensions in data.

pol_type

Polarization type (linear or circular).

sample_rate

Sample rate of the signal.

sample_shape

Shape of a sample.

shape

Shape of the signal.

start_time

Start time of the signal (Time at first sample).

stop_time

Stop time of the signal (Time at sample after the last sample).

time_length

Length of signal in time units.

Methods

compute(**kwargs)

Returns signal with computed data.

contains(t, /)

Whether time(s) are within the bounds of the signal.

get_axis(axis)

Axis number from an integer or axis label.

like(obj[, z])

Returns a signal object "like" given signal object.

persist(**kwargs)

Returns signal with data persisted in memory.

rechunk([chunks])

Rechunks signal data if stored as a Dask array.

to_circular()

Converts the dual-polarization signal to circular basis.

to_dask_array()

Returns signal with data as a Dask array.

to_intensity()

Absolute square of signal.

to_linear()

Converts the dual-polarization signal to linear basis.

to_stokes()

Converts signal to IQUV Stokes representation.

compute(**kwargs)#

Returns signal with computed data.

Has no effect unless data is stored as a Dask Array. kwargs are passed on to the dask.compute() function.

contains(t, /)#

Whether time(s) are within the bounds of the signal.

get_axis(axis)#

Axis number from an integer or axis label.

classmethod like(obj, z=None, /, **kwargs)#

Returns a signal object “like” given signal object.

This classmethod inspects the class signature and creates a signal object like the given reference object. The signal data (as an array) must always be provided as well as any other arguments that are intended to be different than the reference object. All arguments required by the class signature that are not provided are acquired from attributes of the same name in the reference object.

Parameters:
objSignal

The reference signal object.

zarray-like

The signal data.

**kwargs

Additional keyword arguments to pass on to the target class.

persist(**kwargs)#

Returns signal with data persisted in memory.

Has no effect unless data is stored as a Dask Array. kwargs are passed on to the dask.persist() function.

rechunk(chunks=None, **kwargs)#

Rechunks signal data if stored as a Dask array.

If the underlying data is not a Dask array, it is converted to one first. By default, there is no chunking along the first dimension and other dimensions are automatically chunked based on the default chunk size set in Dask’s configuration. kwargs are passed along to dask.array.rechunk().

to_circular()[source]#

Converts the dual-polarization signal to circular basis.

If polarization basis is already circular, simply returns a copy of the signal object.

Returns:
DualPolarizationSignal
to_dask_array()#

Returns signal with data as a Dask array.

Uses dask.array.asanyarray() to convert signal data to a Dask array.

to_intensity()#

Absolute square of signal.

Returns:
IntensitySignal
to_linear()[source]#

Converts the dual-polarization signal to linear basis.

If polarization basis is already linear, simply returns a copy of the signal object.

Returns:
DualPolarizationSignal
to_stokes()[source]#

Converts signal to IQUV Stokes representation.

Returns:
FullStokesSignal