_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31500 | Detector.time_delay_from_detector | train | def time_delay_from_detector(self, other_detector, right_ascension,
declination, t_gps):
"""Return the time delay from the given to detector for a signal with
the given sky location; i.e. return `t1 - t2` where `t1` is the
arrival time in this detector and `t2` i... | python | {
"resource": ""
} |
q31501 | Detector.project_wave | train | def project_wave(self, hp, hc, longitude, latitude, polarization):
"""Return the strain of a waveform as measured by the detector.
Apply the time shift for the given detector relative to the assumed
geocentric frame and apply the antenna patterns to the plus and cross
polarizations.
... | python | {
"resource": ""
} |
q31502 | Detector.optimal_orientation | train | def optimal_orientation(self, t_gps):
"""Return the optimal orientation in right ascension and declination
for a given GPS time.
Parameters
----------
t_gps: float
Time in gps seconds
Returns
-------
ra: float
Right ascension t... | python | {
"resource": ""
} |
q31503 | _read_channel | train | def _read_channel(channel, stream, start, duration):
""" Get channel using lalframe """
channel_type = lalframe.FrStreamGetTimeSeriesType(channel, stream)
read_func = _fr_type_map[channel_type][0]
d_type = _fr_type_map[channel_type][1]
data = read_func(stream, channel, | python | {
"resource": ""
} |
q31504 | _is_gwf | train | def _is_gwf(file_path):
"""Test if a file is a frame file by checking if its contents begins with
the magic string 'IGWD'."""
| python | {
"resource": ""
} |
q31505 | locations_to_cache | train | def locations_to_cache(locations, latest=False):
""" Return a cumulative cache file build from the list of locations
Parameters
----------
locations : list
A list of strings containing files, globs, or cache files used to build
a combined lal cache file object.
latest : Optional, {False... | python | {
"resource": ""
} |
q31506 | datafind_connection | train | def datafind_connection(server=None):
""" Return a connection to the datafind server
Parameters
-----------
server : {SERVER:PORT, string}, optional
A string representation of the server and port.
The port may be ommitted.
Returns
--------
connection
The open connecti... | python | {
"resource": ""
} |
q31507 | frame_paths | train | def frame_paths(frame_type, start_time, end_time, server=None, url_type='file'):
"""Return the paths to a span of frame files
Parameters
----------
frame_type : string
The string representation of the frame type (ex. 'H1_ER_C00_L1')
start_time : int
The start time that we need the f... | python | {
"resource": ""
} |
q31508 | write_frame | train | def write_frame(location, channels, timeseries):
"""Write a list of time series to a single frame file.
Parameters
----------
location : string
A frame filename.
channels : string or list of strings
Either a string that contains the channel name or a list of channel
name str... | python | {
"resource": ""
} |
q31509 | DataBuffer.update_cache | train | def update_cache(self):
"""Reset the lal cache. This can be used to update the cache if the
result may change due to more files being added | python | {
"resource": ""
} |
q31510 | DataBuffer._retrieve_metadata | train | def _retrieve_metadata(stream, channel_name):
"""Retrieve basic metadata by reading the first file in the cache
Parameters
----------
stream: lal stream object
Stream containing a channel we want to learn about
channel_name: str
The name of the channel we... | python | {
"resource": ""
} |
q31511 | DataBuffer._read_frame | train | def _read_frame(self, blocksize):
"""Try to read the block of data blocksize seconds long
Parameters
----------
blocksize: int
The number of seconds to attempt to read from the channel
Returns
-------
data: TimeSeries
TimeSeries containg ... | python | {
"resource": ""
} |
q31512 | DataBuffer.update_cache_by_increment | train | def update_cache_by_increment(self, blocksize):
"""Update the internal cache by starting from the first frame
and incrementing.
Guess the next frame file name by incrementing from the first found
one. This allows a pattern to be used for the GPS folder of the file,
which is indi... | python | {
"resource": ""
} |
q31513 | DataBuffer.attempt_advance | train | def attempt_advance(self, blocksize, timeout=10):
""" Attempt to advance the frame buffer. Retry upon failure, except
if the frame file is beyond the timeout limit.
Parameters
----------
blocksize: int
The number of seconds to attempt to read from the channel
... | python | {
"resource": ""
} |
q31514 | StatusBuffer.check_valid | train | def check_valid(self, values, flag=None):
"""Check if the data contains any non-valid status information
Parameters
----------
values: pycbc.types.Array
Array of status information
flag: str, optional
Override the default valid mask with a user defined ma... | python | {
"resource": ""
} |
q31515 | StatusBuffer.is_extent_valid | train | def is_extent_valid(self, start_time, duration, flag=None):
"""Check if the duration contains any non-valid frames
Parameters
----------
start_time: int
Beginning of the duration to check in gps seconds
duration: int
Number of seconds after the start_time... | python | {
"resource": ""
} |
q31516 | StatusBuffer.indices_of_flag | train | def indices_of_flag(self, start_time, duration, times, padding=0):
""" Return the indices of the times lying in the flagged region
Parameters
----------
start_time: int
Beginning time to request for
duration: int
Number of seconds to check.
paddin... | python | {
"resource": ""
} |
q31517 | snr_series_to_xml | train | def snr_series_to_xml(snr_series, document, sngl_inspiral_id):
"""Save an SNR time series into an XML document, in a format compatible
with BAYESTAR.
"""
snr_lal = snr_series.lal()
snr_lal.name = 'snr'
snr_lal.sampleUnits = ''
snr_xml = _build_series(snr_lal, (u'Time', u'Time,Real,Imaginary'... | python | {
"resource": ""
} |
q31518 | make_psd_xmldoc | train | def make_psd_xmldoc(psddict, xmldoc=None):
"""Add a set of PSDs to a LIGOLW XML document. If the document is not
given, a new one is created first.
"""
xmldoc = ligolw.Document() if xmldoc is None else xmldoc.childNodes[0]
# the PSDs must be children of a LIGO_LW with name "psd"
root_name = u"p... | python | {
"resource": ""
} |
q31519 | SingleCoincForGraceDB.save | train | def save(self, filename):
"""Write this trigger to gracedb compatible xml format
Parameters
----------
filename: str
Name of file to write to disk.
| python | {
"resource": ""
} |
q31520 | get_cosmology | train | def get_cosmology(cosmology=None, **kwargs):
r"""Gets an astropy cosmology class.
Parameters
----------
cosmology : str or astropy.cosmology.FlatLambdaCDM, optional
The name of the cosmology to use. For the list of options, see
:py:attr:`astropy.cosmology.parameters.available`. If None,... | python | {
"resource": ""
} |
q31521 | z_at_value | train | def z_at_value(func, fval, unit, zmax=1000., **kwargs):
r"""Wrapper around astropy.cosmology.z_at_value to handle numpy arrays.
Getting a z for a cosmological quantity involves numerically inverting
``func``. The ``zmax`` argument sets how large of a z to guess (see
:py:func:`astropy.cosmology.z_at_val... | python | {
"resource": ""
} |
q31522 | _redshift | train | def _redshift(distance, **kwargs):
r"""Uses astropy to get redshift from the given luminosity distance.
Parameters
----------
distance : float
The luminosity distance, in Mpc.
\**kwargs :
All other keyword args are passed to :py:func:`get_cosmology` to
select a cosmology. If... | python | {
"resource": ""
} |
q31523 | redshift | train | def redshift(distance, **kwargs):
r"""Returns the redshift associated with the given luminosity distance.
If the requested cosmology is one of the pre-defined ones in
:py:attr:`astropy.cosmology.parameters.available`, :py:class:`DistToZ` is
used to provide a fast interpolation. This takes a few seconds... | python | {
"resource": ""
} |
q31524 | redshift_from_comoving_volume | train | def redshift_from_comoving_volume(vc, **kwargs):
r"""Returns the redshift from the given comoving volume.
Parameters
----------
vc : float
The comoving volume, in units of cubed Mpc.
\**kwargs :
All other keyword args are passed to :py:func:`get_cosmology` to
select a cosmol... | python | {
"resource": ""
} |
q31525 | distance_from_comoving_volume | train | def distance_from_comoving_volume(vc, **kwargs):
r"""Returns the luminosity distance from the given comoving volume.
Parameters
----------
vc : float
The comoving volume, in units of cubed Mpc.
\**kwargs :
All other keyword args are passed to :py:func:`get_cosmology` to
sele... | python | {
"resource": ""
} |
q31526 | DistToZ.get_redshift | train | def get_redshift(self, dist):
"""Returns the redshift for the given distance.
"""
dist, input_is_array = ensurearray(dist)
try:
zs = self.nearby_d2z(dist)
except TypeError:
# interpolant hasn't been setup yet
self.setup_interpolant()
... | python | {
"resource": ""
} |
q31527 | EmceeFile.write_posterior | train | def write_posterior(self, filename, **kwargs):
"""Write posterior only file
Parameters
----------
filename : str
Name of output file to store posterior
"""
f = h5py.File(filename, 'w')
# Preserve top-level metadata
for key in self.attrs:
| python | {
"resource": ""
} |
q31528 | geweke | train | def geweke(x, seg_length, seg_stride, end_idx, ref_start,
ref_end=None, seg_start=0):
""" Calculates Geweke conervergence statistic for a chain of data.
This function will advance along the chain and calculate the
statistic for each step.
Parameters
----------
x : numpy.array
... | python | {
"resource": ""
} |
q31529 | insert_fft_option_group | train | def insert_fft_option_group(parser):
"""
Adds the options used to choose an FFT backend. This should be used
if your program supports the ability to select the FFT backend; otherwise
you may simply call the fft and ifft functions and rely on default
choices. This function will also attempt to add a... | python | {
"resource": ""
} |
q31530 | set_grb_start_end | train | def set_grb_start_end(cp, start, end):
"""
Function to update analysis boundaries as workflow is generated
Parameters
----------
cp : pycbc.workflow.configuration.WorkflowConfigParser object
The parsed configuration options of a pycbc.workflow.core.Workflow.
start : int
The start of th... | python | {
"resource": ""
} |
q31531 | get_coh_PTF_files | train | def get_coh_PTF_files(cp, ifos, run_dir, bank_veto=False, summary_files=False):
"""
Retrieve files needed to run coh_PTF jobs within a PyGRB workflow
Parameters
----------
cp : pycbc.workflow.configuration.WorkflowConfigParser object
The parsed configuration options of a pycbc.workflow.core.Wor... | python | {
"resource": ""
} |
q31532 | make_exttrig_file | train | def make_exttrig_file(cp, ifos, sci_seg, out_dir):
'''
Make an ExtTrig xml file containing information on the external trigger
Parameters
----------
cp : pycbc.workflow.configuration.WorkflowConfigParser object
The parsed configuration options of a pycbc.workflow.core.Workflow.
ifos : str
... | python | {
"resource": ""
} |
q31533 | get_ipn_sky_files | train | def get_ipn_sky_files(workflow, file_url, tags=None):
'''
Retreive the sky point files for searching over the IPN error box and
populating it with injections.
Parameters
----------
workflow: pycbc.workflow.core.Workflow
An instanced class that manages the constructed workflow.
file_... | python | {
"resource": ""
} |
q31534 | make_gating_node | train | def make_gating_node(workflow, datafind_files, outdir=None, tags=None):
'''
Generate jobs for autogating the data for PyGRB runs.
Parameters
----------
workflow: pycbc.workflow.core.Workflow
An instanced class that manages the constructed workflow.
datafind_files : pycbc.workflow.core.F... | python | {
"resource": ""
} |
q31535 | create_waveform_generator | train | def create_waveform_generator(variable_params, data,
recalibration=None, gates=None,
**static_params):
"""Creates a waveform generator for use with a model.
Parameters
----------
variable_params : list of str
The names of the parameter... | python | {
"resource": ""
} |
q31536 | low_frequency_cutoff_from_config | train | def low_frequency_cutoff_from_config(cp):
"""Gets the low frequency cutoff from the given config file.
This looks for ``low-frequency-cutoff`` in the ``[model]`` section and
casts it to float. If none is found, or the casting to float fails, an
error is raised.
Parameters
----------
cp : W... | python | {
"resource": ""
} |
q31537 | high_frequency_cutoff_from_config | train | def high_frequency_cutoff_from_config(cp):
"""Gets the high frequency cutoff from the given config file.
This looks for ``high-frequency-cutoff`` in the ``[model]`` section and
casts it to float. If none is found, will just return ``None``.
Parameters
| python | {
"resource": ""
} |
q31538 | GaussianNoise._lognl | train | def _lognl(self):
"""Computes the log likelihood assuming the data is noise.
Since this is a constant for Gaussian noise, this is only computed once
then stored.
"""
try:
return self.__lognl
except AttributeError:
det_lognls = {}
for (... | python | {
"resource": ""
} |
q31539 | GaussianNoise._nowaveform_loglr | train | def _nowaveform_loglr(self):
"""Convenience function to set loglr values if no waveform generated.
"""
for det in self._data:
setattr(self._current_stats, 'loglikelihood', -numpy.inf)
setattr(self._current_stats, '{}_cplx_loglr'.format(det),
-numpy.inf... | python | {
"resource": ""
} |
q31540 | GaussianNoise.det_lognl | train | def det_lognl(self, det):
"""Returns the log likelihood of the noise in the given detector.
Parameters
----------
det : str
The name of the detector.
Returns
-------
float :
| python | {
"resource": ""
} |
q31541 | GaussianNoise.det_cplx_loglr | train | def det_cplx_loglr(self, det):
"""Returns the complex log likelihood ratio in the given detector.
Parameters
----------
det : str
The name of the detector.
Returns
-------
complex float :
The complex log likelihood ratio.
"""
... | python | {
"resource": ""
} |
q31542 | GaussianNoise.det_optimal_snrsq | train | def det_optimal_snrsq(self, det):
"""Returns the opitmal SNR squared in the given detector.
Parameters
----------
det : str
The name of the detector.
Returns
-------
float :
The opimtal SNR squared.
| python | {
"resource": ""
} |
q31543 | GaussianNoise.write_metadata | train | def write_metadata(self, fp):
"""Adds writing the psds and lognl, since it's a constant.
The lognl is written to the sample group's ``attrs``.
Parameters
----------
fp : pycbc.inference.io.BaseInferenceFile instance
The inference file to write to.
"""
... | python | {
"resource": ""
} |
q31544 | GaussianNoise.from_config | train | def from_config(cls, cp, **kwargs):
r"""Initializes an instance of this class from the given config file.
Parameters
----------
cp : WorkflowConfigParser
Config file parser to read.
\**kwargs :
All additional keyword arguments are passed to the class. Any... | python | {
"resource": ""
} |
q31545 | loadfile | train | def loadfile(path, mode=None, filetype=None, **kwargs):
"""Loads the given file using the appropriate InferenceFile class.
If ``filetype`` is not provided, this will try to retreive the ``filetype``
from the file's ``attrs``. If the file does not exist yet, an IOError will
be raised if ``filetype`` is ... | python | {
"resource": ""
} |
q31546 | check_integrity | train | def check_integrity(filename):
"""Checks the integrity of an InferenceFile.
Checks done are:
* can the file open?
* do all of the datasets in the samples group have the same shape?
* can the first and last sample in all of the datasets in the samples
group be read?
If an... | python | {
"resource": ""
} |
q31547 | get_common_parameters | train | def get_common_parameters(input_files, collection=None):
"""Gets a list of variable params that are common across all input files.
If no common parameters are found, a ``ValueError`` is raised.
Parameters
----------
input_files : list of str
List of input files to load.
collection : st... | python | {
"resource": ""
} |
q31548 | results_from_cli | train | def results_from_cli(opts, load_samples=True, **kwargs):
"""Loads an inference result file along with any labels associated with it
from the command line options.
Parameters
----------
opts : ArgumentParser options
The options from the command line.
load_samples : bool, optional
... | python | {
"resource": ""
} |
q31549 | ResultsArgumentParser._unset_required | train | def _unset_required(self):
"""Convenience function to turn off required arguments for first parse.
"""
self._required_args = | python | {
"resource": ""
} |
q31550 | ResultsArgumentParser.parse_known_args | train | def parse_known_args(self, args=None, namespace=None):
"""Parse args method to handle input-file dependent arguments."""
# run parse args once to make sure the name space is populated with
# the input files. We'll turn off raising NoInputFileErrors on this
# pass
self.no_input_fi... | python | {
"resource": ""
} |
q31551 | ResultsArgumentParser.add_results_option_group | train | def add_results_option_group(self):
"""Adds the options used to call pycbc.inference.io.results_from_cli
function to the parser.
These are options releated to loading the results from a run of
pycbc_inference, for purposes of plotting and/or creating tables.
Any argument string... | python | {
"resource": ""
} |
q31552 | setup_tmpltbank_workflow | train | def setup_tmpltbank_workflow(workflow, science_segs, datafind_outs,
output_dir=None, psd_files=None, tags=None,
return_format=None):
'''
Setup template bank section of CBC workflow. This function is responsible
for deciding which of the various templ... | python | {
"resource": ""
} |
q31553 | get_version_info | train | def get_version_info():
"""Get VCS info and write version info to version.py
"""
from pycbc import _version_helper
class vdummy(object):
def __getattr__(self, attr):
return ''
# If this is a pycbc git repo always populate version information using GIT
try:
vinfo = _... | python | {
"resource": ""
} |
q31554 | table | train | def table(columns, names, page_size=None, format_strings=None):
""" Return an html table of this data
Parameters
----------
columns : list of numpy arrays
names : list of strings
The list of columns names
page_size : {int, None}, optional
The number of items to show on each page... | python | {
"resource": ""
} |
q31555 | load_timeseries | train | def load_timeseries(path, group=None):
"""
Load a TimeSeries from a .hdf, .txt or .npy file. The
default data types will be double precision floating point.
Parameters
----------
path: string
source file path. Must end with either .npy or .txt.
group: string
Additional name... | python | {
"resource": ""
} |
q31556 | TimeSeries.prepend_zeros | train | def prepend_zeros(self, num):
"""Prepend num zeros onto the beginning of this TimeSeries. Update also
epoch to include this prepending.
| python | {
"resource": ""
} |
q31557 | TimeSeries.time_slice | train | def time_slice(self, start, end):
"""Return the slice of the time series that contains the time range
in GPS seconds.
"""
if start < self.start_time:
raise ValueError('Time series does not contain a time as early as %s' % start)
if end > self.end_time:
ra... | python | {
"resource": ""
} |
q31558 | TimeSeries.get_sample_times | train | def get_sample_times(self):
"""Return an Array containing the sample times.
"""
if self._epoch is None:
return Array(range(len(self))) * self._delta_t | python | {
"resource": ""
} |
q31559 | TimeSeries.at_time | train | def at_time(self, time, nearest_sample=False):
""" Return the value at the specified gps time
| python | {
"resource": ""
} |
q31560 | TimeSeries.almost_equal_elem | train | def almost_equal_elem(self,other,tol,relative=True,dtol=0.0):
"""
Compare whether two time series are almost equal, element
by element.
If the 'relative' parameter is 'True' (the default) then the
'tol' parameter (which must be positive) is interpreted as a
relative tole... | python | {
"resource": ""
} |
q31561 | TimeSeries.lal | train | def lal(self):
"""Produces a LAL time series object equivalent to self.
Returns
-------
lal_data : {lal.*TimeSeries}
LAL time series object containing the same data as self.
The actual type depends on the sample's dtype. If the epoch of
self is 'None... | python | {
"resource": ""
} |
q31562 | TimeSeries.crop | train | def crop(self, left, right):
""" Remove given seconds from either end of time series
Parameters
----------
left : float
Number of seconds of data to remove from the left of the time series.
right : float
Number of seconds of data to remove from the right ... | python | {
"resource": ""
} |
q31563 | TimeSeries.save_to_wav | train | def save_to_wav(self, file_name):
""" Save this time series to a wav format audio file.
Parameters
----------
file_name : string
The output file name
| python | {
"resource": ""
} |
q31564 | TimeSeries.psd | train | def psd(self, segment_duration, **kwds):
""" Calculate the power spectral density of this time series.
Use the `pycbc.psd.welch` method to estimate the psd of this time segment.
For more complete options, please see that function.
Parameters
----------
segment_duration:... | python | {
"resource": ""
} |
q31565 | TimeSeries.whiten | train | def whiten(self, segment_duration, max_filter_duration, trunc_method='hann',
remove_corrupted=True, low_frequency_cutoff=None,
return_psd=False, **kwds):
""" Return a whitened time series
Parameters
----------
segment_duration: float
... | python | {
"resource": ""
} |
q31566 | TimeSeries.qtransform | train | def qtransform(self, delta_t=None, delta_f=None, logfsteps=None,
frange=None, qrange=(4,64), mismatch=0.2, return_complex=False):
""" Return the interpolated 2d qtransform of this data
Parameters
----------
delta_t : {self.delta_t, float}
The time resolutio... | python | {
"resource": ""
} |
q31567 | TimeSeries.save | train | def save(self, path, group = None):
"""
Save time series to a Numpy .npy, hdf, or text file. The first column
contains the sample times, the second contains the values.
In the case of a complex time series saved as text, the imaginary
part is written as a third column. When using... | python | {
"resource": ""
} |
q31568 | TimeSeries.to_frequencyseries | train | def to_frequencyseries(self, delta_f=None):
""" Return the Fourier transform of this time series
Parameters
----------
delta_f : {None, float}, optional
The frequency resolution of the returned frequency series. By
default the resolution is determined by the duration... | python | {
"resource": ""
} |
q31569 | TimeSeries.add_into | train | def add_into(self, other):
"""Return the sum of the two time series accounting for the time stamp.
The other vector will be resized and time shifted wiht sub-sample
precision before adding. This assumes that one can assume zeros
outside of the original vector range.
"""
... | python | {
"resource": ""
} |
q31570 | TimeSeries.detrend | train | def detrend(self, type='linear'):
""" Remove linear trend from the data
Remove a linear trend from the data to improve the approximation that
the data is circularly convolved, this helps reduce the size of filter
transients from a circular convolution / filter.
Parameters
... | python | {
"resource": ""
} |
q31571 | fRD | train | def fRD( a, M):
"""Calculate the ring-down frequency for the final Kerr BH. Using Eq. 5.5 of Main paper"""
f | python | {
"resource": ""
} |
q31572 | sigma_cached | train | def sigma_cached(self, psd):
""" Cache sigma calculate for use in tandem with the FilterBank class
"""
if not hasattr(self, '_sigmasq'):
from pycbc.opt import LimitedSizeDict
self._sigmasq = LimitedSizeDict(size_limit=2**5)
key = id(psd)
if not hasattr(psd, '_sigma_cached_key'):
... | python | {
"resource": ""
} |
q31573 | boolargs_from_apprxstr | train | def boolargs_from_apprxstr(approximant_strs):
"""Parses a list of strings specifying an approximant and where that
approximant should be used into a list that can be understood by
FieldArray.parse_boolargs.
Parameters
----------
apprxstr : (list of) string(s)
The strings to parse. Each ... | python | {
"resource": ""
} |
q31574 | add_approximant_arg | train | def add_approximant_arg(parser, default=None, help=None):
"""Adds an approximant argument to the given parser.
Parameters
----------
parser : ArgumentParser
The argument parser to add the argument to.
default : {None, str}
Specify a default for the approximant argument. Defaults to ... | python | {
"resource": ""
} |
q31575 | find_variable_start_frequency | train | def find_variable_start_frequency(approximant, parameters, f_start, max_length,
delta_f = 1):
""" Find a frequency value above the starting frequency that results in a
waveform shorter than max_length.
"""
l = max_length + 1
f = f_start - delta_f
while | python | {
"resource": ""
} |
q31576 | TemplateBank.ensure_hash | train | def ensure_hash(self):
"""Ensure that there is a correctly populated template_hash.
Check for a correctly populated template_hash and create if it doesn't
already exist.
"""
fields = self.table.fieldnames
if 'template_hash' in fields:
return
# The fi... | python | {
"resource": ""
} |
q31577 | TemplateBank.write_to_hdf | train | def write_to_hdf(self, filename, start_index=None, stop_index=None,
force=False, skip_fields=None,
write_compressed_waveforms=True):
"""Writes self to the given hdf file.
Parameters
----------
filename : str
The name of the file to w... | python | {
"resource": ""
} |
q31578 | TemplateBank.end_frequency | train | def end_frequency(self, index):
""" Return the end frequency of the waveform at the given index value
"""
from pycbc.waveform.waveform import props
return pycbc.waveform.get_waveform_end_frequency(
| python | {
"resource": ""
} |
q31579 | TemplateBank.approximant | train | def approximant(self, index):
""" Return the name of the approximant ot use at the given index
"""
if 'approximant' not in self.table.fieldnames:
raise ValueError("approximant not found | python | {
"resource": ""
} |
q31580 | TemplateBank.template_thinning | train | def template_thinning(self, inj_filter_rejector):
"""Remove templates from bank that are far from all injections."""
if not inj_filter_rejector.enabled or \
inj_filter_rejector.chirp_time_window is None:
# Do nothing!
return
injection_parameters = inj_fil... | python | {
"resource": ""
} |
q31581 | TemplateBank.ensure_standard_filter_columns | train | def ensure_standard_filter_columns(self, low_frequency_cutoff=None):
""" Initialize FilterBank common fields
Parameters
----------
low_frequency_cutoff: {float, None}, Optional
A low frequency cutoff which overrides any given within the
template bank file.
... | python | {
"resource": ""
} |
q31582 | LiveFilterBank.round_up | train | def round_up(self, num):
"""Determine the length to use for this waveform by rounding.
Parameters
----------
num : int
Proposed size of waveform in seconds
Returns
-------
size: int
The rounded size to use for the waveform buffer in secon... | python | {
"resource": ""
} |
q31583 | FilterBank.get_decompressed_waveform | train | def get_decompressed_waveform(self, tempout, index, f_lower=None,
approximant=None, df=None):
"""Returns a frequency domain decompressed waveform for the template
in the bank corresponding to the index taken in as an argument. The
decompressed waveform is obtain... | python | {
"resource": ""
} |
q31584 | FilterBank.generate_with_delta_f_and_max_freq | train | def generate_with_delta_f_and_max_freq(self, t_num, max_freq, delta_f,
low_frequency_cutoff=None,
cached_mem=None):
"""Generate the template with index t_num using custom length."""
approximant = self.approximant(t_num... | python | {
"resource": ""
} |
q31585 | select_waveform_generator | train | def select_waveform_generator(approximant):
"""Returns the single-IFO generator for the approximant.
Parameters
----------
approximant : str
Name of waveform approximant. Valid names can be found using
``pycbc.waveform`` methods.
Returns
-------
generator : (PyCBC generator... | python | {
"resource": ""
} |
q31586 | BaseGenerator.generate_from_args | train | def generate_from_args(self, *args):
"""Generates a waveform. The list of arguments must be in the same
order as self's variable_args attribute.
| python | {
"resource": ""
} |
q31587 | TDomainCBCGenerator._postgenerate | train | def _postgenerate(self, res):
"""Applies a taper if it is in current params.
"""
hp, hc = res
try:
hp = taper_timeseries(hp, tapermethod=self.current_params['taper'])
hc | python | {
"resource": ""
} |
q31588 | FDomainDetFrameGenerator.generate_from_args | train | def generate_from_args(self, *args):
"""Generates a waveform, applies a time shift and the detector response
function from the given args.
The args are assumed | python | {
"resource": ""
} |
q31589 | FDomainDetFrameGenerator.generate | train | def generate(self, **kwargs):
"""Generates a waveform, applies a time shift and the detector response
function from the given kwargs.
"""
self.current_params.update(kwargs)
rfparams = {param: self.current_params[param]
for param in kwargs if param not in self.location... | python | {
"resource": ""
} |
q31590 | positive_float | train | def positive_float(s):
"""
Ensure argument is a positive real number and return it as float.
To be used as type in argparse arguments.
"""
err_msg = "must be a positive number, not %r" % s
try:
value = float(s)
except ValueError:
| python | {
"resource": ""
} |
q31591 | nonnegative_float | train | def nonnegative_float(s):
"""
Ensure argument is a positive real number or zero and return it as float.
To be used as type in argparse arguments.
"""
err_msg = "must be either positive or zero, not %r" % s
try:
value = float(s)
except | python | {
"resource": ""
} |
q31592 | from_cli | train | def from_cli(opt, length, delta_f, low_frequency_cutoff,
strain=None, dyn_range_factor=1, precision=None):
"""Parses the CLI options related to the noise PSD and returns a
FrequencySeries with the corresponding PSD. If necessary, the PSD is
linearly interpolated to achieve the resolution specif... | python | {
"resource": ""
} |
q31593 | from_cli_single_ifo | train | def from_cli_single_ifo(opt, length, delta_f, low_frequency_cutoff, ifo,
**kwargs):
"""
Get the PSD for a single ifo when using the multi-detector CLI
"""
single_det_opt = copy_opts_for_single_ifo(opt, ifo) | python | {
"resource": ""
} |
q31594 | from_cli_multi_ifos | train | def from_cli_multi_ifos(opt, length_dict, delta_f_dict,
low_frequency_cutoff_dict, ifos, strain_dict=None,
**kwargs):
"""
Get the PSD for all ifos when using the multi-detector CLI
"""
psd = {}
for ifo in ifos:
if strain_dict is not None:
... | python | {
"resource": ""
} |
q31595 | generate_overlapping_psds | train | def generate_overlapping_psds(opt, gwstrain, flen, delta_f, flow,
dyn_range_factor=1., precision=None):
"""Generate a set of overlapping PSDs to cover a stretch of data. This
allows one to analyse a long stretch of data with PSD measurements that
change with time.
Paramete... | python | {
"resource": ""
} |
q31596 | associate_psds_to_segments | train | def associate_psds_to_segments(opt, fd_segments, gwstrain, flen, delta_f, flow,
dyn_range_factor=1., precision=None):
"""Generate a set of overlapping PSDs covering the data in GWstrain.
Then associate these PSDs with the appropriate segment in strain_segments.
Parameters
... | python | {
"resource": ""
} |
q31597 | associate_psds_to_single_ifo_segments | train | def associate_psds_to_single_ifo_segments(opt, fd_segments, gwstrain, flen,
delta_f, flow, ifo,
dyn_range_factor=1., precision=None):
"""
Associate PSDs to | python | {
"resource": ""
} |
q31598 | associate_psds_to_multi_ifo_segments | train | def associate_psds_to_multi_ifo_segments(opt, fd_segments, gwstrain, flen,
delta_f, flow, ifos,
dyn_range_factor=1., precision=None):
"""
Associate PSDs to segments for all ifos when using the multi-detector CLI
"""
for if... | python | {
"resource": ""
} |
q31599 | CubicSpline.apply_calibration | train | def apply_calibration(self, strain):
"""Apply calibration model
This applies cubic spline calibration to the strain.
Parameters
----------
strain : FrequencySeries
The strain to be recalibrated.
Return
------
strain_adjusted : FrequencySerie... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.