Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org starting 2 March 2020 at approximately 8am MST. It is expected to take around 10 minutes and will include a short period of downtime towards the end of the maintenance window. Please direct any comments, concerns, or questions to computing-help@igwn.org.

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: ...@@ -398,7 +398,7 @@ class PowerSpectralDensity:
def __init__(self, asd_file=None, psd_file='aLIGO_ZERO_DET_high_P_psd.txt'): 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. Only one of the asd_file or psd_file needs to be specified.
If multiple are given, the first will be used. If multiple are given, the first will be used.
...@@ -498,15 +498,16 @@ def get_empty_interferometer(name): ...@@ -498,15 +498,16 @@ def get_empty_interferometer(name):
The available instruments are: The available instruments are:
H1, L1, V1, GEO600 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 Parameters
---------- ----------
name: str name: str
Interferometer identifier. Interferometer identifier.
Return Returns
------ -------
interferometer: Interferometer interferometer: Interferometer
Interferometer instance Interferometer instance
""" """
...@@ -546,7 +547,7 @@ def get_interferometer_with_open_data( ...@@ -546,7 +547,7 @@ def get_interferometer_with_open_data(
raw_data_file=None, **kwargs): raw_data_file=None, **kwargs):
""" """
Helper function to obtain an Interferometer instance with appropriate Helper function to obtain an Interferometer instance with appropriate
PSD and data, given an center_time PSD and data, given an center_time.
Parameters Parameters
---------- ----------
...@@ -576,6 +577,7 @@ def get_interferometer_with_open_data( ...@@ -576,6 +577,7 @@ def get_interferometer_with_open_data(
------- -------
interferometer: `tupak.detector.Interferometer` interferometer: `tupak.detector.Interferometer`
An Interferometer instance with a PSD and frequency-domain strain data. An Interferometer instance with a PSD and frequency-domain strain data.
""" """
utils.check_directory_exists_and_if_not_mkdir(outdir) utils.check_directory_exists_and_if_not_mkdir(outdir)
...@@ -647,14 +649,15 @@ def get_interferometer_with_fake_noise_and_injection( ...@@ -647,14 +649,15 @@ def get_interferometer_with_fake_noise_and_injection(
save=True): save=True):
""" """
Helper function to obtain an Interferometer instance with appropriate 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 Parameters
---------- ----------
name: str name: str
Detector name, e.g., 'H1'. Detector name, e.g., 'H1'.
injection_polarizations: dict 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: dict
injection parameters, needed for sky position and timing injection parameters, needed for sky position and timing
sampling_frequency: float sampling_frequency: float
...@@ -672,6 +675,7 @@ def get_interferometer_with_fake_noise_and_injection( ...@@ -672,6 +675,7 @@ def get_interferometer_with_fake_noise_and_injection(
------- -------
interferometer: `tupak.detector.Interferometer` interferometer: `tupak.detector.Interferometer`
An Interferometer instance with a PSD and frequency-domain strain data. An Interferometer instance with a PSD and frequency-domain strain data.
""" """
utils.check_directory_exists_and_if_not_mkdir(outdir) utils.check_directory_exists_and_if_not_mkdir(outdir)
...@@ -716,9 +720,6 @@ def get_event_data( ...@@ -716,9 +720,6 @@ def get_event_data(
""" """
Get open data for a specified event. Get open data for a specified event.
We currently know about:
GW150914
Parameters Parameters
---------- ----------
event: str event: str
......
...@@ -12,6 +12,36 @@ import logging ...@@ -12,6 +12,36 @@ import logging
class GravitationalWaveTransient(object): 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, def __init__(self, interferometers, waveform_generator, distance_marginalization=False, phase_marginalization=False,
prior=None): prior=None):
# GravitationalWaveTransient.__init__(self, interferometers, waveform_generator) # GravitationalWaveTransient.__init__(self, interferometers, waveform_generator)
...@@ -148,7 +178,9 @@ def get_binary_black_hole_likelihood(interferometers): ...@@ -148,7 +178,9 @@ def get_binary_black_hole_likelihood(interferometers):
A list of `tupak.detector.Interferometer` instances, typically the A list of `tupak.detector.Interferometer` instances, typically the
output of either `tupak.detector.get_interferometer_with_open_data` output of either `tupak.detector.get_interferometer_with_open_data`
or `tupak.detector.get_interferometer_with_fake_noise_and_injection` or `tupak.detector.get_interferometer_with_fake_noise_and_injection`
Returns Returns
-------
likelihood: tupak.likelihood.GravitationalWaveTransient likelihood: tupak.likelihood.GravitationalWaveTransient
The likelihood to pass to `run_sampler` The likelihood to pass to `run_sampler`
""" """
......
import inspect import inspect
import tupak
from . import utils from . import utils
import numpy as np import numpy as np
class WaveformGenerator(object): class WaveformGenerator(object):
""" A waveform generator """ A waveform generator
...@@ -24,13 +24,15 @@ class WaveformGenerator(object): ...@@ -24,13 +24,15 @@ class WaveformGenerator(object):
parameters: dict parameters: dict
Initial values for the parameters Initial values for the parameters
parameter_conversion: func 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 non_standard_sampling_parameter_keys: list
List of parameter name for *non-standard* sampling parameters. List of parameter name for *non-standard* sampling parameters.
Note: the arguments of frequency_domain_source_model (except the first, which is the Note: the arguments of frequency_domain_source_model (except the first,
frequencies at which to compute the strain) will be added to the which is the frequencies at which to compute the strain) will be added to
WaveformGenerator object and initialised to `None`. the WaveformGenerator object and initialised to `None`.
""" """
def __init__(self, time_duration, sampling_frequency, frequency_domain_source_model=None, def __init__(self, time_duration, sampling_frequency, frequency_domain_source_model=None,
...@@ -52,7 +54,7 @@ class WaveformGenerator(object): ...@@ -52,7 +54,7 @@ class WaveformGenerator(object):
""" Wrapper to source_model """ """ Wrapper to source_model """
if self.parameter_conversion is not None: if self.parameter_conversion is not None:
added_keys = self.parameter_conversion(self.parameters, self.non_standard_sampling_parameter_keys) added_keys = self.parameter_conversion(self.parameters, self.non_standard_sampling_parameter_keys)
if self.frequency_domain_source_model is not None: if self.frequency_domain_source_model is not None:
model_frequency_strain = self.frequency_domain_source_model(self.frequency_array, **self.parameters) model_frequency_strain = self.frequency_domain_source_model(self.frequency_array, **self.parameters)
elif self.time_domain_source_model is not None: 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