waveformtools.single_mode

Classes

SingleMode([modes_data, zero_modes, ...])

Storage and handling of a single mode

class waveformtools.single_mode.SingleMode(modes_data=None, zero_modes=None, non_zero_modes=None, spin_weight=0, ell_max=8, modes_list=None, modes_dict=None, tol=1e-08, extra_mode_axes_shape=None, Grid=None, vec_modes=None, func=None, label=None, sine_power=0)[source]

Storage and handling of a single mode

Attributes:
Grid
ell_max
extra_mode_axes_shape
func
label
modes_data
modes_list
modes_spherepack

Get the modes in spherepack convention.

n_modes
sine_power

This is just kept for bookkeeping purposes.

spin_weight

The spin weight of the modes

tol
vec_modes

Methods

calculate_power_monitor_ell([ell_max])

Get the power in each ell mode

compare_modes_dict(other_modes_dict[, prec])

Compare the Single modes object against a given modes dictionary

compute_spatial_detivatives()

Given the modes, compute its spatial derivatives

compute_zero_modes([tol])

Get the details of the zero modes in the data below a given tolerance

construct_from_vec_modes(vec_modes)

Load the single modes object using the modes vector

contract([ell_max, all_available_modes, ...])

Contract the modes to get co-ordinate space representation of the function.

create_modes_array()

Create a modes array and initialize it with zeros.

evaluate_angular([theta, phi, ell_max])

Evaluate the expansion at requested angular coordinates by generating SWSHs in parallel and vectorizing the summation

evaluate_old(theta, phi[, ell_max])

Evaluate the expansion at requested angular coordinates

evaluate_old_1(theta, phi[, ell_max])

Evaluate the expansion at requested angular coordinates by generating SWSHs in serial and vectorizing the summation

evaluate_sp(theta, phi[, ell_max])

Evaluate the expansion at requested angular coordinates by computing SWSHs using the spherical package

get_expansion_residues([func])

Get the expansion residues

get_in_spherepack_convention()

Convert the modes into spherepack convention. This returns a set of complex modes but only the real part is to be used. The imaginary part may be useful for error checking and should be small.

get_modes_dict([modes_list])

Get a dictionary representation of the modes requested

mode(ell, emm)

Return a particular mode

plot_residues([orig_func])

Plot the residues of this expanion

set_mode_data(data[, ell, emm])

Set the mode array data for the respective \((\ell, m)\) mode.

truncate_modes(ell_max_choice)

Returns a new SingleModes object containing only modes upto the given ell_max_choice

vector()

return the vector of modes in ell - emm format (opposite to spherepack's emm - ell format

compare_modes

non_zero_modes

zero_modes

property Grid
calculate_power_monitor_ell(ell_max=None)[source]

Get the power in each ell mode

Parameters:
single_modemodes dict / single_mode

A dictionary of modes or an instance of the single mode class, that contains the modes of an SH expansion.

Returns:
powerlist

A list containing the power in each \(\ell\) mode of the system.

cumulative_power
cumulative_even_power
cumulative_even_power_axis
cumulative_power_axis
power_ell
compare_modes(other_modes, prec=18)[source]
compare_modes_dict(other_modes_dict, prec=18)[source]

Compare the Single modes object against a given modes dictionary

compute_spatial_detivatives()[source]

Given the modes, compute its spatial derivatives

compute_zero_modes(tol=1e-08)[source]

Get the details of the zero modes in the data below a given tolerance

construct_from_vec_modes(vec_modes)[source]

Load the single modes object using the modes vector

contract(ell_max=None, all_available_modes=True, only_modes_above_tol=False, tol=None)[source]

Contract the modes to get co-ordinate space representation of the function.

Parameters:
ell_max: int, optional

The max \(\ell\) upto which to contract the modes to. If None, then the available ell_max will be chosen.

all_available_modes: bool,optional

Wheter or not to use all available modes.

Returns:
func: 2darray

The function on the sphere in coordinate space representation.

create_modes_array()[source]

Create a modes array and initialize it with zeros.

Parameters:
ell_maxint

The maximum \(\ell\) value of the modes.

Returns:
self.modes_arraymodes_array

sets the self.modes_array attribute.

Notes

The ordering of axis is (ell, emm, extra axis)

property ell_max
evaluate_angular(theta=None, phi=None, ell_max=None)[source]

Evaluate the expansion at requested angular coordinates by generating SWSHs in parallel and vectorizing the summation

evaluate_old(theta, phi, ell_max=None)[source]
Evaluate the expansion at requested angular coordinates

by looping over SWSH and summing. SWSHs are generated using

Yslm_vec

evaluate_old_1(theta, phi, ell_max=None)[source]

Evaluate the expansion at requested angular coordinates by generating SWSHs in serial and vectorizing the summation

evaluate_sp(theta, phi, ell_max=None)[source]

Evaluate the expansion at requested angular coordinates by computing SWSHs using the spherical package

property extra_mode_axes_shape
property func
get_expansion_residues(func=None)[source]

Get the expansion residues

get_in_spherepack_convention()[source]

Convert the modes into spherepack convention. This returns a set of complex modes but only the real part

is to be used. The imaginary part may be useful for error checking and should be small

get_modes_dict(modes_list=None)[source]

Get a dictionary representation of the modes requested

property label
mode(ell, emm)[source]

Return a particular mode

Parameters:
ellint

The \(\ell\) index of the mode.

emmint

The \(m\) index of the mode.

Returns:
mode_datafloat

The value of the requested mode.

property modes_data
property modes_list
property modes_spherepack

Get the modes in spherepack convention. Note that this assumes expansion of a real function in real spherical harmonics

property n_modes
non_zero_modes(tol=None)[source]
plot_residues(orig_func=None, *args, **kwargs)[source]

Plot the residues of this expanion

set_mode_data(data, ell=None, emm=None)[source]

Set the mode array data for the respective \((\ell, m)\) mode.

Parameters:
ellint

The \(\ell\) polar mode number.

emm_valueint

The \(m\) azimuthal mode number.

datafloat

The value of the mode data of the corresponding mode.

property sine_power

This is just kept for bookkeeping purposes.

property spin_weight

The spin weight of the modes

property tol
truncate_modes(ell_max_choice)[source]

Returns a new SingleModes object containing only modes upto the given ell_max_choice

property vec_modes
vector()[source]

return the vector of modes in ell - emm format (opposite to spherepack’s emm - ell format

zero_modes(tol=1e-08)[source]