Commit 91dec665 authored by Gregory Ashton's avatar Gregory Ashton

Update of various docstrings

parent 3d31a6e6
Pipeline #19570 passed with stages
in 5 minutes and 51 seconds
......@@ -398,7 +398,7 @@ class PowerSpectralDensity:
def __init__(self, asd_file=None, psd_file='aLIGO_ZERO_DET_high_P_psd.txt'):
"""
Instantiate a new PSD object.
Instantiate a new PowerSpectralDensity object.
Only one of the asd_file or psd_file needs to be specified.
If multiple are given, the first will be used.
......@@ -498,15 +498,16 @@ def get_empty_interferometer(name):
The available instruments are:
H1, L1, V1, GEO600
Detector positions taken from LIGO-T980044-10 for L1/H1 and from arXiv:gr-qc/0008066 [45] for V1/GEO600
Detector positions taken from LIGO-T980044-10 for L1/H1 and from
arXiv:gr-qc/0008066 [45] for V1/GEO600
Parameters
----------
name: str
Interferometer identifier.
Return
------
Returns
-------
interferometer: Interferometer
Interferometer instance
"""
......@@ -546,7 +547,7 @@ def get_interferometer_with_open_data(
raw_data_file=None, **kwargs):
"""
Helper function to obtain an Interferometer instance with appropriate
PSD and data, given an center_time
PSD and data, given an center_time.
Parameters
----------
......@@ -576,6 +577,7 @@ def get_interferometer_with_open_data(
-------
interferometer: `tupak.detector.Interferometer`
An Interferometer instance with a PSD and frequency-domain strain data.
"""
utils.check_directory_exists_and_if_not_mkdir(outdir)
......@@ -647,14 +649,15 @@ def get_interferometer_with_fake_noise_and_injection(
save=True):
"""
Helper function to obtain an Interferometer instance with appropriate
PSD and data, given an center_time
power spectral density and data, given an center_time.
Parameters
----------
name: str
Detector name, e.g., 'H1'.
injection_polarizations: dict
polarizations of waveform to inject, output of waveform_generator.get_frequency_domain_signal
polarizations of waveform to inject, output of
`waveform_generator.get_frequency_domain_signal`
injection_parameters: dict
injection parameters, needed for sky position and timing
sampling_frequency: float
......@@ -672,6 +675,7 @@ def get_interferometer_with_fake_noise_and_injection(
-------
interferometer: `tupak.detector.Interferometer`
An Interferometer instance with a PSD and frequency-domain strain data.
"""
utils.check_directory_exists_and_if_not_mkdir(outdir)
......@@ -716,9 +720,6 @@ def get_event_data(
"""
Get open data for a specified event.
We currently know about:
GW150914
Parameters
----------
event: str
......
......@@ -12,6 +12,36 @@ import logging
class GravitationalWaveTransient(object):
""" A gravitational-wave transient likelihood object
This is the usual likelihood object to use for transient gravitational
wave parameter estimation. It computes the log-likelihood in the frequency
domain assuming a colored Gaussian noise model described by a power
spectral density
Parameters
----------
interferometers: list
A list of `tupak.detector.Interferometer` instances - contains the
detector data and power spectral densities
waveform_generator: `tupak.waveform_generator.WaveformGenerator`
An object which computes the frequency-domain strain of the signal,
given some set of parameters
distance_marginalization: bool
If true, analytic distance marginalization
phase_marginalization: bool
If true, analytic phase marginalization
prior: dict
If given, used in the distance and phase marginalization.
Returns
-------
Likelihood: `tupak.likelihood.Likelihood`
A likehood object, able to compute the likelihood of the data given
some model parameters
"""
def __init__(self, interferometers, waveform_generator, distance_marginalization=False, phase_marginalization=False,
prior=None):
# GravitationalWaveTransient.__init__(self, interferometers, waveform_generator)
......@@ -148,7 +178,9 @@ def get_binary_black_hole_likelihood(interferometers):
A list of `tupak.detector.Interferometer` instances, typically the
output of either `tupak.detector.get_interferometer_with_open_data`
or `tupak.detector.get_interferometer_with_fake_noise_and_injection`
Returns
-------
likelihood: tupak.likelihood.GravitationalWaveTransient
The likelihood to pass to `run_sampler`
"""
......
import inspect
import tupak
from . import utils
import numpy as np
class WaveformGenerator(object):
""" A waveform generator
......@@ -24,13 +24,15 @@ class WaveformGenerator(object):
parameters: dict
Initial values for the parameters
parameter_conversion: func
Function to convert from sampled parameters to parameters of the waveform generator
Function to convert from sampled parameters to parameters of the
waveform generator
non_standard_sampling_parameter_keys: list
List of parameter name for *non-standard* sampling parameters.
Note: the arguments of frequency_domain_source_model (except the first, which is the
frequencies at which to compute the strain) will be added to the
WaveformGenerator object and initialised to `None`.
Note: the arguments of frequency_domain_source_model (except the first,
which is the frequencies at which to compute the strain) will be added to
the WaveformGenerator object and initialised to `None`.
"""
def __init__(self, time_duration, sampling_frequency, frequency_domain_source_model=None,
......@@ -52,7 +54,7 @@ class WaveformGenerator(object):
""" Wrapper to source_model """
if self.parameter_conversion is not None:
added_keys = self.parameter_conversion(self.parameters, self.non_standard_sampling_parameter_keys)
if self.frequency_domain_source_model is not None:
model_frequency_strain = self.frequency_domain_source_model(self.frequency_array, **self.parameters)
elif self.time_domain_source_model is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment