waveformtools.transforms

Methods to transform the waveform

Functions

CheckRegReq(data)

Check if a function requires regularization.

SHContract(modes[, info, ell_max])

Reconstruct a function on a grid given its SH modes.

SHDeRegularize(func, theta_grid, check_reg)

Return the original funtion given the regularized functions

SHExpand(func, info, method_info[, ...])

Expand a given function in spin weight 0 spherical harmonics upto an optimal \(\ell \leq \ell_{max}\).

SHExpandAuto(func, info, method_info[, ...])

Expand a given function in spin weight 0 spherical harmonics upto an optimal \(\ell \leq \ell_{max}\) that is automatically found.

SHExpandSimple(func, info, method_info[, ...])

Expand a given function in spin weight 0 spherical harmonics upto a user prescribed \(\ell_{max}\).

SHExpandSimpleSPack(func, info, method_info)

Expand a given function in spin weight 0 spherical harmonics upto a user prescribed \(\ell_{max}\).

SHRegularize(func, theta_grid, check_reg[, ...])

Regularize an SH expansion

Yslm(spin_weight, ell, emm, theta, phi)

Spin-weighted spherical harmonics fast evaluation.

Yslm_prec(spin_weight, ell, emm, theta, phi)

Spin-weighted spherical harmonics function with precise computations.

Yslm_prec_grid(spin_weight, ell, emm, ...[, ...])

Spin-weighted spherical harmonics function with precise computations on an angular grid.

Yslm_prec_sym(spin_weight, ell, emm)

Spin-weighted spherical harmonics precise, symbolic computation for deferred evaluations.

Yslm_vec(spin_weight, ell, emm, theta_grid, ...)

Spin-weighted spherical harmonics fast evaluations on numpy arrays for vectorized evaluations.

check_Yslm_args(spin_weight, ell, emm)

Check if the arguments to a Yslm functions makes sense

check_Yslm_theta(theta_grid[, threshold])

compute_fft(udata_x, delta_x)

Find the FFT of the samples in time-space, and return with the frequencies.

compute_ifft(utilde, delta_f)

Find the inverse FFT of the samples in frequency-space, and return with the time axis.

factorial(number)

rotate_polarizations(wf, alpha)

Rotate the polarizations of the time domain observer waveform by \(2lpha\)

set_fft_conven(utilde_orig)

Make a numppy fft consistent with the chosen conventions.

unset_fft_conven(utilde_conven)

Make an actual conventional fft consistent with numpy's conventions.

waveformtools.transforms.CheckRegReq(data)[source]

Check if a function requires regularization.

Parameters:
data1d array

A 1d array of the data to check.

Returns:
check_reglist

a list containg the list of boundary points where regularization may be required.

waveformtools.transforms.SHContract(modes, info=None, ell_max=None)[source]

Reconstruct a function on a grid given its SH modes.

Parameters:
modeslist

A list of modes, in the convention [[l, [m list]], ]

infosurfacegridinfo

An instance of the surfacegridinfo.

ell_maxint

The max l mode to include.

Returns
——-
recon_funcndarray

The reconstructed grid function.

waveformtools.transforms.SHDeRegularize(func, theta_grid, check_reg, order=1)[source]

Return the original funtion given the regularized functions

waveformtools.transforms.SHExpand(func, info, method_info, err_info=False, auto_ell_max=False, res_tol_percent=3, reg=False, reg_order=1)[source]

Expand a given function in spin weight 0 spherical harmonics upto an optimal \(\ell \leq \ell_{max}\).

Parameters:
funcndarray

The function to be expanded.

infoGrid

An instance of the Spherical grid class that stores the details of the structure of a grid on a topological sphere.

method_infoMethodInfo

An instance of the method info class that contains informations about the numerical methods to be used during the following operations.

err_infobool

Whether or not to compute and return the error measures related to the SH representation.

Returns:
modesdict

The modes as a dictionary whose keys are lm.

waveformtools.transforms.SHExpandAuto(func, info, method_info, err_info=False, res_tol_percent=3, reg=False, reg_order=1, check_reg=None)[source]

Expand a given function in spin weight 0 spherical harmonics upto an optimal \(\ell \leq \ell_{max}\) that is automatically found.

Additionally, if requested, this routine can:

  1. regularize a function and expand and return the modes of the regularized function and the associated regularization details.

  2. Compute diagnostic information in terms of residue per mode.

  3. The RMS deviation of the reconstructed expansion from the original function.

Parameters:
funcndarray

The function to be expanded.

infoGrid

An instance of the Spherical grid class that stores the details of the structure of a grid on a topological sphere.

method_infoMethodInfo

An instance of the method info class that contains informations about the numerical methods to be used during the following operations.

err_infobool

Whether or not to compute and return the error measures related to the SH representation.

check_reglist, optional

A list of two integers (0,1) that depicts whether or not to regularize the input function at the poles.

Returns
——-
modesdict

The modes as a dictionary whose keys are lm.

Notes

When regularization is requested,
  1. To compute the total RMS deviation, the orginal form is used.

  2. To compute the rms deviation per mode, regularized expression is used.

waveformtools.transforms.SHExpandSimple(func, info, method_info, err_info=False, reg=False, reg_order=1, check_reg=None)[source]

Expand a given function in spin weight 0 spherical harmonics upto a user prescribed \(\ell_{max}\).

Additionally, if requested, this routine can:

  1. regularize a function and expand and return the modes of the regularized function and the associated regularization details.

  2. Compute diagnostic information in terms of residue per mode.

  3. The RMS deviation of the reconstructed expansion from the original function.

Parameters:
funcndarray

The function to be expanded.

infoGrid

An instance of the Spherical grid class that stores the details of the structure of a grid on a topological sphere.

method_infoMethodInfo

An instance of the method info class that contains informations about the numerical methods to be used during the following operations.

err_infobool

Whether or not to compute and return the error measures related to the SH representation.

check_reglist, optional

A list of two integers (0,1) that depicts whether or not to regularize the input function at the poles.

Returns:
modesdict

The modes as a dictionary whose keys are lm.

Notes

When regularization is requested,
  1. To compute the total RMS deviation, the orginal form is used.

  2. To compute the rms deviation per mode, regularized expression is used.

waveformtools.transforms.SHExpandSimpleSPack(func, info, method_info, err_info=False, reg=False, reg_order=1, check_reg=None)[source]

Expand a given function in spin weight 0 spherical harmonics upto a user prescribed \(\ell_{max}\).

Additionally, if requested, this routine can:

  1. regularize a function and expand and return the modes of the regularized function and the associated regularization details.

  2. Compute diagnostic information in terms of residue per mode.

  3. The RMS deviation of the reconstructed expansion from the original function.

Parameters:
funcndarray

The function to be expanded.

infoGrid

An instance of the Spherical grid class that stores the details of the structure of a grid on a topological sphere.

method_infoMethodInfo

An instance of the method info class that contains informations about the numerical methods to be used during the following operations.

err_infobool

Whether or not to compute and return the error measures related to the SH representation.

check_reglist, optional

A list of two integers (0,1) that depicts whether or not to regularize the input function at the poles.

Returns:
modesdict

The modes as a dictionary whose keys are lm.

Notes

When regularization is requested,
  1. To compute the total RMS deviation, the orginal form is used.

  2. To compute the rms deviation per mode, regularized expression is used.

waveformtools.transforms.SHRegularize(func, theta_grid, check_reg, order=1)[source]

Regularize an SH expansion

waveformtools.transforms.Yslm(spin_weight, ell, emm, theta, phi)[source]

Spin-weighted spherical harmonics fast evaluation.

Parameters:
spin_weightint

The Spin weight of the harmonic.

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

thetafloat

The polar angle \(\theta\) in radians,

phifloat

The aximuthal angle :math:`phi’ in radians.

Returns:
Yslmfloat

The value of Yslm at :math:`theta, phi’.

waveformtools.transforms.Yslm_prec(spin_weight, ell, emm, theta, phi, prec=24)[source]

Spin-weighted spherical harmonics function with precise computations. Uses a symbolic method evaluated at the degree of precision requested by the user.

Parameters:
spin_weightint

The Spin weight of the harmonic

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

thetafloat

The polar angle \(\theta\) in radians,

phifloat

The aximuthal angle :math:`phi’ in radians.

presint, optional

The precision i.e. number of digits to compute upto. Default value is 16.

Returns:
Yslmfloat

The value of Yslm at :math:`theta, phi’.

waveformtools.transforms.Yslm_prec_grid(spin_weight, ell, emm, theta_grid, phi_grid, prec=24)[source]

Spin-weighted spherical harmonics function with precise computations on an angular grid. Uses a symbolic method evaluated at the degree of precision requested by the user.

Parameters:
spin_weightint

The Spin weight of the harmonic

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

theta_grid2darray

The polar angle \(\theta\) in radians,

phi_grid2darray

The aximuthal angle :math:`phi’ in radians.

presint, optional

The precision i.e. number of digits to compute upto. Default value is 16.

Returns:
Yslm_valsfloat

The value of Yslm at the grid :math:`theta, phi’.

waveformtools.transforms.Yslm_prec_sym(spin_weight, ell, emm)[source]

Spin-weighted spherical harmonics precise, symbolic computation for deferred evaluations. Is dependent on variables th: theta and ph:phi.

Parameters:
spin_weightint

The Spin weight of the harmonic

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

thetafloat

The polar angle \(\theta\) in radians,

phifloat

The aximuthal angle :math:`phi’ in radians.

presint, optional

The precision i.e. number of digits to compute upto. Default value is 16.

Returns:
Yslmsym

The value of Yslm at :math:`theta, phi’.

waveformtools.transforms.Yslm_vec(spin_weight, ell, emm, theta_grid, phi_grid)[source]

Spin-weighted spherical harmonics fast evaluations on numpy arrays for vectorized evaluations.

Parameters:
spin_weightint

The Spin weight of the harmonic

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

thetafloat

The polar angle \(\theta\) in radians,

phifloat

The aximuthal angle :math:`phi’ in radians.

Returns:
Yslmfloat

The value of Yslm at :math:`theta, phi’.

waveformtools.transforms.check_Yslm_args(spin_weight, ell, emm)[source]

Check if the arguments to a Yslm functions makes sense

Parameters:
spin_weightint

The Spin weight of the harmonic

ellint

The mode number :math:`ell’.

emmint

The azimuthal mode number :math:`m’.

waveformtools.transforms.check_Yslm_theta(theta_grid, threshold=1e-06)[source]
waveformtools.transforms.compute_fft(udata_x, delta_x)[source]

Find the FFT of the samples in time-space, and return with the frequencies.

Parameters:
udata_x1d array

The samples in time-space.

delta_xfloat

The stepping delta_x

Returns:
freqs1d array

The frequency axis, shifted approriately.

utilde1d array

The samples in frequency space, with conventions applied.

waveformtools.transforms.compute_ifft(utilde, delta_f)[source]

Find the inverse FFT of the samples in frequency-space, and return with the time axis.

Parameters:
utilde1d array

The samples in frequency-space.

delta_ffloat

The frequency stepping

Returns:
time_axis1d array

The time axis.

udata_time1d array

The samples in time domain.

waveformtools.transforms.factorial(number)[source]
waveformtools.transforms.rotate_polarizations(wf, alpha)[source]

Rotate the polarizations of the time domain observer waveform by \(2lpha\)

Parameters:
wf1d array

The complex observer waveform to rotate.

alphafloat

The coordinate angle to rotate the polarizations in radians. Note that the polarizarions would rotate by \(2 lpha\) on a cordinate rotation of \(lpha\).

Returns:
rot_wf1d array

The rotated waveform.

waveformtools.transforms.set_fft_conven(utilde_orig)[source]

Make a numppy fft consistent with the chosen conventions. This takes care of the zero mode factor and array position. Also, it shifts the negative frequencies using numpy’s fftshift.

Parameters:
utilde_orig1d array

The result of a numpy fft.

Returns:
utilde_conven1d array

The fft with set conventions.

waveformtools.transforms.unset_fft_conven(utilde_conven)[source]

Make an actual conventional fft consistent with numpy’s conventions. The inverse of set_conv.

Parameters:
utilde_conven1d array

The conventional fft data vector.

Returns:
utilde_np1darray

The fft data vector in numpy conventions.