API reference

Auto-generated from the in-code docstrings.

Top-level names

These are re-exported from pystoch for convenience and can be imported directly, e.g. from pystoch import PystochParam, calculate_maps, gwdetectors:

PystochParam, FramesetParam, FramesetIntermediates, PystochResults, calculate_maps, calculate_maps_wrapper, calculate_fisher_diag, load_frame_data, seed_matrices, make_notch_array, spectral_index, complex_getlm, complex_map2alm, part_alm, fisher_zeros, gwdetectors, gmst_calculate, combined_antenna_response_t_delay, arrival_time, ehat, display_time.

They are documented in full under their defining modules below.

Detectors and antenna response

pystoch.detectors.arrival_time(detNAME, gpsTIME, phi, theta)[source]

Arrival time of Gravitational Wave at the detector with respect to a given GPS time, right ascension, and declination.

The velocity of light in vacuum C_SI = 299792458e0 m s^-1

Parameters:
  • detNAME (string) –

    Gravitational Wave detector name

    Valid detector name string

    [“GEO”, “G1”, “G”, “LHO”, “H1”, “H2”, “H”, “LLO”, “L1”, “L”, “VIRGO”, “V1”, “V”, “KAGRA”, “K1”, “LIGO-INDIA”, “LIO”, “I1”]

  • gpsTIME (float or int) – Global Positioning System Time.

  • phi (float) – Range = [0, 2 pi) The right ascension angle (in rad) of the signal.

  • theta (float) – Range = [0, pi] The declination angle (in rad) of the signal

Returns:

tarrival – Time of arrival at the detector

Return type:

float

pystoch.detectors.combined_antenna_response_t_delay(*args, GW_polarization='T')[source]

Combined antenna response and the time delay between two Gravitational wave detectors in the given GPS time

Parameters:

*args (Variable length argument list.) –

ifo1: string

The First interferometer name.

ifo2: string

The Second interferometer name.

gpstARRAY: array-like

Global Positioning System Time.

phi: list or array-like

Range = [0, 2 pi) The right ascension angle (in rad) of the signal.

theta: list or array-like

Range = [0, pi] The declination angle (in rad) of the signal

psi: list or array-like

Range = [0, pi) The polarization angle (in rad) of the source.

GW_polarization: string

Gravitational Wave Polarization Default value: T for Tensor. values: T for Tensor, S for Scalar, and V for Vector

Returns:

  • combined_response (array-like) – Combined Antenna Response FPlus and FCross (for Tensor), Fb and Fl (for Scalar), and Fx and Fy (for Vector) from the two Gravitational wave detectors

  • time_delay (array-like) – The time delay between two Gravitational wave detectors.

pystoch.detectors.display_time(seconds, granularity=2)[source]

FIXME: Function used to display the time

pystoch.detectors.ehat(phi, theta)[source]

Cartesian source direction

Parameters:
  • phi (float) – Range = [0, 2 pi)

  • theta (float) – Range = [0, pi]

Returns:

ehat_src – Source direction

Return type:

numpy array

pystoch.detectors.gmst_calculate(gps_time)[source]

Convert Global Positioning System Time (GPST) to Greenwich Median Sidereal Time (GMST)

GMST is calculated from astropy modules. Default GMST model is the latest IAU GMST precision model (IAU2006). Default conversion scale from GPST is UT1.

Parameters:

gpsTime (float) – Global Positioning System Time

Returns:

gmstw – Greenwich Median Sidereal Time in radian

Return type:

float

pystoch.detectors.gwdetectors(detector)[source]

Location and response matrix data for the specified gravitational wave detectors

References

https://dcc.ligo.org/public/0072/P000006/000/P000006-D.pdf

https://journals.aps.org/prd/pdf/10.1103/PhysRevD.63.042003

Parameters:

detector (string) – Gravitational wave detector name Valid detector name string [“GEO”, “G1”, “G”, “LHO”, “H1”, “H2”, “H”, “LLO”, “L1”, “L”, “VIRGO”, “V1”, “V”, “KAGRA”, “K1”, “LIGO-INDIA”, “LIO”, “I1”]

Returns:

  • detector_location (numpy array) – Detector location data corresponding to the speed of light travel time from the center of the Earth.

  • detector_response (numpy array) – Detector response matrices are dimensionless.

Map-making functions

pystoch.pystoch_functions.ascii_art()[source]
pystoch.pystoch_functions.calculate_t_delay_antenna_response_maps(frame_param, parameters, tt)[source]

Calculates the seed matrices for Overlap Reduction Function

pystoch.pystoch_functions.complex_getlm(l_max)[source]

Creates a list of l and m in the order they appear in a a_lm array. Replacement for hp.Alm.getlm. Now we are including -m contribution

pystoch.pystoch_functions.complex_map2alm(m, lmax)[source]

Converts a HealPix pixel map to Spherical harmonic a_lm. Replacement for hp.map2alm. Now we do not ignore complex input. The output contains -m contributions

pystoch.pystoch_functions.fisher_zeros(fisher)[source]

If l+l’ is odd, make the Fisher matrix elements to be zero

pystoch.pystoch_functions.load_frame_data(parameters, frame_param, dataset)[source]

Function to load CSD and PSD (inv sigma2) and frequency and time Information.

pystoch.pystoch_functions.make_notch_array(frequency_array, notching, notch_list)[source]

Returns an array having the same size as the frequency list. The elements corresponding to a notched frequency are False, rest are True. This version of the code support the pygwb options

pystoch.pystoch_functions.part_alm(alm)[source]

Parts/separates a given set of a_lm into the sum of two a_lm s which corresponds to a purely real and purely imaginary map.

pystoch.pystoch_functions.seed_matrices(GPSmid, parameters, frame_param, dataset)[source]

Function to calculate the seed seed_matrices time series for which ORF seeds are to be calculated.

pystoch.pystoch_functions.spectral_index(freq, Hf_data)[source]

Linear interpolation

Parameter classes and mapping

class pystoch.pystoch_class_and_mapping.FramesetIntermediates(frame_param, pystoch_param)[source]

Bases: object

Class to pack all relevant data required for map calculation for a frameset.

class pystoch.pystoch_class_and_mapping.FramesetParam(framesets_file, set_name)[source]

Bases: object

‘Class to pack all relevant parameters for a set of framesets. Initialized by location of framesets file and name of frameset folder.

class pystoch.pystoch_class_and_mapping.PystochParam(param_file, override_params=None, info_logger=None)[source]

Bases: object

Class to pack all the PyStoch parameters. Initialized by location of the parameter file.

class pystoch.pystoch_class_and_mapping.PystochResults(pystoch_param)[source]

Bases: object

Class to pack all the results.

pystoch.pystoch_class_and_mapping.calculate_fisher_diag(frameset, frame_param)[source]

Calculating the fisher diagonal matrix.

pystoch.pystoch_class_and_mapping.calculate_maps(ll, f, frameset, frame_param, pystoch_param)[source]

Computing all the maps (in both pixel and sph) along with the beam function.

pystoch.pystoch_class_and_mapping.calculate_maps_wrapper(frameset, frame_param, pystoch_param, f_chunk)[source]

A wrapper for all the map computations.

Command-line entry points

pystoch.cli.read_frames.main() None[source]
pystoch.cli.read_frames.parse_arguments() Namespace[source]
pystoch.cli.read_frames.process_directory(root: str, name: str, parameter_file) None[source]
pystoch.cli.read_frames.read_channels(frame: str, chnl_list: List[str]) List[float][source]

A wrapper function that uses gwpy to get data from frames.

pystoch.cli.read_frames.write_frame_parameters(name: str, dir_full: str, nn: int, ifo1_name: str, ifo2_name: str, deltaF: float, fhigh: float, flow: float, winFactor: float, w1w2bar: float, bias: float, segDuration: int, GPSStart: int, parameter_file) None[source]
pystoch.cli.convert_frames.main()[source]
pystoch.cli.convert_frames.process_frameset(frameset: SectionProxy, parameters: ConfigParser)[source]
pystoch.cli.convert_frames.read_ini_file(file_path: str) ConfigParser[source]
pystoch.cli.make_maps.build_overrides(args)[source]

Collect the –param_<name> overrides that were actually provided.

pystoch.cli.make_maps.build_parser(param_default)[source]

Build the command-line argument parser.

pystoch.cli.make_maps.keyboard_interrupt_handler(signal, frame)[source]
pystoch.cli.make_maps.main()[source]
pystoch.cli.make_maps.process_dataset(dataset, framesets_file, parameters, args)[source]

Compute and write the maps for a single frameset.

pystoch.cli.make_maps.select_datasets(args, framesets, datasets_full, param_file)[source]

Pick which framesets to process; a passed .ini overrides param_file.

pystoch.cli.make_maps.str2bool(v)[source]

Convert string to boolean

pystoch.cli.make_maps.write_final_parameters(parameters, framesets, datasets, output_dir)[source]
pystoch.cli.make_maps.write_pickle(file_name, data)[source]
pystoch.cli.make_maps.write_pixel_output(dataset, args, parameters, frame_param, frameset, dict_output, map_dirty_mat_pix, map_inj_mat_pix, fisher_pix)[source]

Build and write the pixel-basis (and NBR, if enabled) output pickle(s).

pystoch.cli.make_maps.write_sph_output(dataset, args, parameters, frameset, dict_output, map_dirty_mat_sph, map_inj_mat_sph, fisher_sph)[source]

Build and write the spherical-harmonic output pickle.