_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31900 | BaseModel.update | train | def update(self, **params):
"""Updates the current parameter positions and resets stats.
If any sampling transforms are specified, they are applied to the
params before being stored.
"""
| python | {
"resource": ""
} |
q31901 | BaseModel.get_current_stats | train | def get_current_stats(self, names=None):
"""Return one or more of the current stats as a tuple.
This function does no computation. It only returns what has already
been calculated. If a stat hasn't been calculated, it will be returned
as ``numpy.nan``.
Parameters
------... | python | {
"resource": ""
} |
q31902 | BaseModel._trytoget | train | def _trytoget(self, statname, fallback, **kwargs):
"""Helper function to get a stat from ``_current_stats``.
If the statistic hasn't been calculated, ``_current_stats`` will raise
an ``AttributeError``. In that case, the ``fallback`` function will
be called. If that call is successful, ... | python | {
"resource": ""
} |
q31903 | BaseModel._logjacobian | train | def _logjacobian(self):
"""Calculates the logjacobian of the current parameters."""
if self.sampling_transforms is None:
logj = 0.
else:
| python | {
"resource": ""
} |
q31904 | BaseModel._logprior | train | def _logprior(self):
"""Calculates the log prior at the current parameters."""
logj = self.logjacobian
logp | python | {
"resource": ""
} |
q31905 | BaseModel.logposterior | train | def logposterior(self):
"""Returns the log of the posterior of the current parameter values.
The logprior is calculated first. If the logprior returns ``-inf``
(possibly indicating a non-physical point), then the ``loglikelihood``
is not called.
""" | python | {
"resource": ""
} |
q31906 | BaseModel.prior_rvs | train | def prior_rvs(self, size=1, prior=None):
"""Returns random variates drawn from the prior.
If the ``sampling_params`` are different from the ``variable_params``,
the variates are transformed to the `sampling_params` parameter space
before being returned.
Parameters
-----... | python | {
"resource": ""
} |
q31907 | BaseModel._transform_params | train | def _transform_params(self, **params):
"""Applies all transforms to the given params.
Parameters
----------
\**params :
Key, value pairs of parameters to apply the transforms to.
Returns
-------
dict
A dictionary of the transformed parame... | python | {
"resource": ""
} |
q31908 | BaseModel.extra_args_from_config | train | def extra_args_from_config(cp, section, skip_args=None, dtypes=None):
"""Gets any additional keyword in the given config file.
Parameters
----------
cp : WorkflowConfigParser
Config file parser to read.
section : str
The name of the section to read.
... | python | {
"resource": ""
} |
q31909 | BaseModel.prior_from_config | train | def prior_from_config(cp, variable_params, prior_section,
constraint_section):
"""Gets arguments and keyword arguments from a config file.
Parameters
----------
cp : WorkflowConfigParser
Config file parser to read.
variable_params : list
... | python | {
"resource": ""
} |
q31910 | BaseModel._init_args_from_config | train | def _init_args_from_config(cls, cp):
"""Helper function for loading parameters.
This retrieves the prior, variable parameters, static parameterss,
constraints, sampling transforms, and waveform transforms
(if provided).
Parameters
----------
cp : ConfigParser
... | python | {
"resource": ""
} |
q31911 | BaseModel.write_metadata | train | def write_metadata(self, fp):
"""Writes metadata to the given file handler.
Parameters
----------
fp : pycbc.inference.io.BaseInferenceFile instance
The inference file to write to.
"""
fp.attrs['model'] = self.name
fp.attrs['variable_params'] | python | {
"resource": ""
} |
q31912 | get_cov_params | train | def get_cov_params(mass1, mass2, spin1z, spin2z, metricParams, fUpper,
lambda1=None, lambda2=None, quadparam1=None,
quadparam2=None):
"""
Function to convert between masses and spins and locations in the xi
parameter space. Xi = Cartesian metric and rotated to principal... | python | {
"resource": ""
} |
q31913 | get_conv_params | train | def get_conv_params(mass1, mass2, spin1z, spin2z, metricParams, fUpper,
lambda1=None, lambda2=None, quadparam1=None,
quadparam2=None):
"""
Function to convert between masses and spins and locations in the mu
parameter space. Mu = Cartesian metric, but not principal co... | python | {
"resource": ""
} |
q31914 | get_mu_params | train | def get_mu_params(lambdas, metricParams, fUpper):
"""
Function to rotate from the lambda coefficients into position in the mu
coordinate system. Mu = Cartesian metric, but not principal components.
Parameters
-----------
lambdas : list of floats or numpy.arrays
Position of the system(s)... | python | {
"resource": ""
} |
q31915 | calc_point_dist | train | def calc_point_dist(vsA, entryA):
"""
This function is used to determine the distance between two points.
Parameters
----------
vsA : list or numpy.array or similar
An array of point 1's position in the \chi_i coordinate system
entryA : list or numpy.array or similar
An array of... | python | {
"resource": ""
} |
q31916 | read_injections | train | def read_injections(sim_files, m_dist, s_dist, d_dist):
''' Read all the injections from the files in the provided folder.
The files must belong to individual set i.e. no files that combine
all the injections in a run.
Identify injection strategies and finds parameter boundaries.
Col... | python | {
"resource": ""
} |
q31917 | process_injections | train | def process_injections(hdffile):
"""Function to read in the injection file and
extract the found injections and all injections
Parameters
----------
hdffile: hdf file
File for which injections are to be processed
Returns
-------
data: dictionary
... | python | {
"resource": ""
} |
q31918 | astro_redshifts | train | def astro_redshifts(min_z, max_z, nsamples):
'''Sample the redshifts for sources, with redshift
independent rate, using standard cosmology
Parameters
----------
min_z: float
Minimum redshift
max_z: float
Maximum redshift
nsamples: int
... | python | {
"resource": ""
} |
q31919 | inj_mass_pdf | train | def inj_mass_pdf(key, mass1, mass2, lomass, himass, lomass_2 = 0, himass_2 = 0):
'''Estimate the probability density based on the injection strategy
Parameters
----------
key: string
Injection strategy
mass1: array
First mass of the injections
mass2: array
... | python | {
"resource": ""
} |
q31920 | inj_spin_pdf | train | def inj_spin_pdf(key, high_spin, spinz):
''' Estimate the probability density of the
injections for the spin distribution.
Parameters
----------
key: string
Injections strategy
high_spin: float
Maximum spin used in the strategy
spinz: array
... | python | {
"resource": ""
} |
q31921 | inj_distance_pdf | train | def inj_distance_pdf(key, distance, low_dist, high_dist, mchirp = 1):
''' Estimate the probability density of the
injections for the distance distribution.
Parameters
----------
key: string
Injections strategy
distance: array
Array of distances
lo... | python | {
"resource": ""
} |
q31922 | get_common_cbc_transforms | train | def get_common_cbc_transforms(requested_params, variable_args,
valid_params=None):
"""Determines if any additional parameters from the InferenceFile are
needed to get derived parameters that user has asked for.
First it will try to add any base parameters that are required to ... | python | {
"resource": ""
} |
q31923 | apply_transforms | train | def apply_transforms(samples, transforms, inverse=False):
"""Applies a list of BaseTransform instances on a mapping object.
Parameters
----------
samples : {FieldArray, dict}
Mapping object to apply transforms to.
transforms : list
List of BaseTransform instances to apply. Nested tr... | python | {
"resource": ""
} |
q31924 | compute_jacobian | train | def compute_jacobian(samples, transforms, inverse=False):
"""Computes the jacobian of the list of transforms at the given sample
points.
Parameters
----------
samples : {FieldArray, dict}
Mapping object specifying points at which to compute jacobians.
transforms : list
List of B... | python | {
"resource": ""
} |
q31925 | order_transforms | train | def order_transforms(transforms):
"""Orders transforms to ensure proper chaining.
For example, if `transforms = [B, A, C]`, and `A` produces outputs needed
by `B`, the transforms will be re-rorderd to `[A, B, C]`.
Parameters
----------
transforms : list
List of transform instances to o... | python | {
"resource": ""
} |
q31926 | read_transforms_from_config | train | def read_transforms_from_config(cp, section="transforms"):
"""Returns a list of PyCBC transform instances for a section in the
given configuration file.
If the transforms are nested (i.e., the output of one transform is the
input of another), the returned list will be sorted by the order of the
nes... | python | {
"resource": ""
} |
q31927 | BaseTransform.format_output | train | def format_output(old_maps, new_maps):
""" This function takes the returned dict from `transform` and converts
it to the same datatype as the input.
Parameters
----------
old_maps : {FieldArray, dict}
The mapping object to add new maps to.
new_maps : dict
... | python | {
"resource": ""
} |
q31928 | BaseTransform.from_config | train | def from_config(cls, cp, section, outputs, skip_opts=None,
additional_opts=None):
"""Initializes a transform from the given section.
Parameters
----------
cp : pycbc.workflow.WorkflowConfigParser
A parsed configuration file that contains the transform opt... | python | {
"resource": ""
} |
q31929 | CustomTransform._createscratch | train | def _createscratch(self, shape=1):
"""Creates a scratch FieldArray to use for transforms."""
| python | {
"resource": ""
} |
q31930 | CustomTransform._copytoscratch | train | def _copytoscratch(self, maps):
"""Copies the data in maps to the scratch space.
If the maps contain arrays that are not the same shape as the scratch
space, a new scratch space will be created.
"""
try:
for p in self.inputs:
self._scratch[p][:] = map... | python | {
"resource": ""
} |
q31931 | CustomTransform._getslice | train | def _getslice(self, maps):
"""Determines how to slice the scratch for returning values."""
invals = maps[list(self.inputs)[0]]
if not isinstance(invals, (numpy.ndarray, list)):
| python | {
"resource": ""
} |
q31932 | CustomTransform.transform | train | def transform(self, maps):
"""Applies the transform functions to the given maps object.
Parameters
----------
maps : dict, or FieldArray
Returns
-------
dict or FieldArray
A map object containing the transformed variables, along with the
... | python | {
"resource": ""
} |
q31933 | CustomTransform.from_config | train | def from_config(cls, cp, section, outputs):
"""Loads a CustomTransform from the given config file.
Example section:
.. code-block:: ini
[{section}-outvar1+outvar2]
name = custom
inputs = inputvar1, inputvar2
outvar1 = func1(inputs)
o... | python | {
"resource": ""
} |
q31934 | MchirpQToMass1Mass2.transform | train | def transform(self, maps):
"""This function transforms from chirp mass and mass ratio to component
masses.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy
>>> from pycbc imp... | python | {
"resource": ""
} |
q31935 | MchirpQToMass1Mass2.inverse_transform | train | def inverse_transform(self, maps):
"""This function transforms from component masses to chirp mass and
mass ratio.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy
>>> from p... | python | {
"resource": ""
} |
q31936 | MchirpQToMass1Mass2.jacobian | train | def jacobian(self, maps):
"""Returns the Jacobian for transforming mchirp and q to mass1 and
| python | {
"resource": ""
} |
q31937 | MchirpQToMass1Mass2.inverse_jacobian | train | def inverse_jacobian(self, maps):
"""Returns the Jacobian for transforming mass1 and mass2 to
mchirp and | python | {
"resource": ""
} |
q31938 | MchirpEtaToMass1Mass2.transform | train | def transform(self, maps):
"""This function transforms from chirp mass and symmetric mass ratio to
component masses.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy
>>> from... | python | {
"resource": ""
} |
q31939 | MchirpEtaToMass1Mass2.jacobian | train | def jacobian(self, maps):
"""Returns the Jacobian for transforming mchirp and eta to mass1 and
mass2.
"""
mchirp = maps[parameters.mchirp]
eta = maps[parameters.eta]
| python | {
"resource": ""
} |
q31940 | MchirpEtaToMass1Mass2.inverse_jacobian | train | def inverse_jacobian(self, maps):
"""Returns the Jacobian for transforming mass1 and mass2 to
mchirp and eta.
"""
m1 = maps[parameters.mass1]
m2 = maps[parameters.mass2]
| python | {
"resource": ""
} |
q31941 | ChirpDistanceToDistance.transform | train | def transform(self, maps):
"""This function transforms from chirp distance to luminosity distance,
given the chirp mass.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy as np
... | python | {
"resource": ""
} |
q31942 | ChirpDistanceToDistance.inverse_transform | train | def inverse_transform(self, maps):
"""This function transforms from luminosity distance to chirp distance,
given the chirp mass.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy as n... | python | {
"resource": ""
} |
q31943 | SphericalSpin1ToCartesianSpin1.transform | train | def transform(self, maps):
""" This function transforms from spherical to cartesian spins.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy
>>> from pycbc import transforms
>... | python | {
"resource": ""
} |
q31944 | SphericalSpin1ToCartesianSpin1.inverse_transform | train | def inverse_transform(self, maps):
""" This function transforms from cartesian to spherical spins.
Parameters
----------
maps : a mapping object
Returns
-------
out : dict
| python | {
"resource": ""
} |
q31945 | DistanceToRedshift.transform | train | def transform(self, maps):
""" This function transforms from distance to redshift.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
>>> import numpy
>>> from pycbc import transforms
>>> t = t... | python | {
"resource": ""
} |
q31946 | AlignedMassSpinToCartesianSpin.transform | train | def transform(self, maps):
""" This function transforms from aligned mass-weighted spins to
cartesian spins aligned along the z-axis.
Parameters
----------
maps : a mapping object
Returns
-------
out : dict
A dict with key as parameter name a... | python | {
"resource": ""
} |
q31947 | AlignedMassSpinToCartesianSpin.inverse_transform | train | def inverse_transform(self, maps):
""" This function transforms from component masses and cartesian spins
to mass-weighted spin parameters aligned with the angular momentum.
Parameters
----------
maps : a mapping object
Returns
-------
out : dict
... | python | {
"resource": ""
} |
q31948 | PrecessionMassSpinToCartesianSpin.transform | train | def transform(self, maps):
""" This function transforms from mass-weighted spins to caretsian spins
in the x-y plane.
Parameters
----------
maps : a mapping object
Returns
-------
out : dict
A dict with key as parameter name and value as nump... | python | {
"resource": ""
} |
q31949 | PrecessionMassSpinToCartesianSpin.inverse_transform | train | def inverse_transform(self, maps):
""" This function transforms from component masses and cartesian spins to
mass-weighted spin parameters perpendicular with the angular momentum.
Parameters
----------
maps : a mapping object
Returns
-------
out : dict
... | python | {
"resource": ""
} |
q31950 | CartesianSpinToChiP.transform | train | def transform(self, maps):
""" This function transforms from component masses and caretsian spins
to chi_p.
Parameters
----------
maps : a mapping object
Examples
--------
Convert a dict of numpy.array:
Returns
-------
out : dict... | python | {
"resource": ""
} |
q31951 | Logistic.from_config | train | def from_config(cls, cp, section, outputs, skip_opts=None,
additional_opts=None):
"""Initializes a Logistic transform from the given section.
The section must specify an input and output variable name. The
codomain of the output may be specified using `min-{output}`,
... | python | {
"resource": ""
} |
q31952 | get_options_from_group | train | def get_options_from_group(option_group):
"""
Take an option group and return all the options that are defined in that
group.
"""
option_list = option_group._group_actions
| python | {
"resource": ""
} |
q31953 | insert_base_bank_options | train | def insert_base_bank_options(parser):
"""
Adds essential common options for template bank generation to an
ArgumentParser instance.
"""
def match_type(s):
err_msg = "must be a number between 0 and 1 excluded, not %r" % s
try:
value = float(s)
except ValueError:
... | python | {
"resource": ""
} |
q31954 | insert_metric_calculation_options | train | def insert_metric_calculation_options(parser):
"""
Adds the options used to obtain a metric in the bank generation codes to an
argparser as an OptionGroup. This should be used if you want to use these
options in your code.
"""
metricOpts = parser.add_argument_group(
"Options rela... | python | {
"resource": ""
} |
q31955 | verify_ethinca_metric_options | train | def verify_ethinca_metric_options(opts, parser):
"""
Checks that the necessary options are given for the ethinca metric
calculation.
Parameters
----------
opts : argparse.Values instance
Result of parsing the input options with OptionParser
parser : object
The OptionParser i... | python | {
"resource": ""
} |
q31956 | check_ethinca_against_bank_params | train | def check_ethinca_against_bank_params(ethincaParams, metricParams):
"""
Cross-check the ethinca and bank layout metric calculation parameters
and set the ethinca metric PN order equal to the bank PN order if not
previously set.
Parameters
----------
ethincaParams: instance of ethincaParamet... | python | {
"resource": ""
} |
q31957 | metricParameters.from_argparse | train | def from_argparse(cls, opts):
"""
Initialize an instance of the metricParameters class from an
argparse.OptionParser instance. This assumes that
insert_metric_calculation_options
and
verify_metric_calculation_options
have already been called before initializing th... | python | {
"resource": ""
} |
q31958 | metricParameters.psd | train | def psd(self):
"""
A pyCBC FrequencySeries holding the appropriate PSD.
Return the PSD used in the metric calculation.
"""
if not self._psd:
errMsg = "The PSD | python | {
"resource": ""
} |
q31959 | metricParameters.evals | train | def evals(self):
"""
The eigenvalues of the parameter space.
This is a Dictionary of numpy.array
Each entry in the dictionary corresponds to the different frequency
ranges described in vary_fmax. If vary_fmax = False, the only entry
will be f_upper, this corresponds to in... | python | {
"resource": ""
} |
q31960 | metricParameters.evecs | train | def evecs(self):
"""
The eigenvectors of the parameter space.
This is a Dictionary of numpy.matrix
Each entry in the dictionary is as described under evals.
Each numpy.matrix contains the eigenvectors which, with the eigenvalues
in evals, are needed to rotate the
... | python | {
"resource": ""
} |
q31961 | metricParameters.metric | train | def metric(self):
"""
The metric of the parameter space.
This is a Dictionary of numpy.matrix
Each entry in the dictionary is as described under evals.
Each numpy.matrix contains the metric of the parameter space in the
Lambda_i coordinate system.
"""
| python | {
"resource": ""
} |
q31962 | metricParameters.evecsCV | train | def evecsCV(self):
"""
The eigenvectors of the principal directions of the mu space.
This is a Dictionary of numpy.matrix
Each entry in the dictionary is as described under evals.
Each numpy.matrix contains the eigenvectors which, with the eigenvalues
in evals, are needed... | python | {
"resource": ""
} |
q31963 | massRangeParameters.from_argparse | train | def from_argparse(cls, opts, nonSpin=False):
"""
Initialize an instance of the massRangeParameters class from an
argparse.OptionParser instance. This assumes that
insert_mass_range_option_group
and
verify_mass_range_options
have already been called before initiali... | python | {
"resource": ""
} |
q31964 | massRangeParameters.is_outside_range | train | def is_outside_range(self, mass1, mass2, spin1z, spin2z):
"""
Test if a given location in mass1, mass2, spin1z, spin2z is within the
range of parameters allowed by the massParams object.
"""
# Mass1 test
if mass1 * 1.001 < self.minMass1:
return 1
if ma... | python | {
"resource": ""
} |
q31965 | ethincaParameters.from_argparse | train | def from_argparse(cls, opts):
"""
Initialize an instance of the ethincaParameters class from an
argparse.OptionParser instance. This assumes that
insert_ethinca_metric_options
and
verify_ethinca_metric_options
have already been called before initializing the class... | python | {
"resource": ""
} |
q31966 | set_sim_data | train | def set_sim_data(inj, field, data):
"""Sets data of a SimInspiral instance."""
try:
sim_field = sim_inspiral_map[field]
except KeyError:
sim_field = field
# for tc, map to geocentric times
if sim_field == 'tc':
| python | {
"resource": ""
} |
q31967 | get_hdf_injtype | train | def get_hdf_injtype(sim_file):
"""Gets the HDFInjectionSet class to use with the given file.
This looks for the ``injtype`` in the given file's top level ``attrs``. If
that attribute isn't set, will default to :py:class:`CBCHDFInjectionSet`.
Parameters
| python | {
"resource": ""
} |
q31968 | hdf_injtype_from_approximant | train | def hdf_injtype_from_approximant(approximant):
"""Gets the HDFInjectionSet class to use with the given approximant.
Parameters
----------
approximant : str
Name of the approximant.
Returns
-------
HDFInjectionSet :
The type of HDFInjectionSet to use.
"""
retcls = No... | python | {
"resource": ""
} |
q31969 | _XMLInjectionSet.write | train | def write(filename, samples, write_params=None, static_args=None):
"""Writes the injection samples to the given xml.
Parameters
----------
filename : str
The name of the file to write to.
samples : io.FieldArray
FieldArray of parameters.
write_par... | python | {
"resource": ""
} |
q31970 | PartitionedTmpltbank.get_point_from_bins_and_idx | train | def get_point_from_bins_and_idx(self, chi1_bin, chi2_bin, idx):
"""Find masses and spins given bin numbers and index.
Given the chi1 bin, chi2 bin and an index, return the masses and spins
of the point at that index. Will fail if no point exists there.
Parameters
-----------
... | python | {
"resource": ""
} |
q31971 | PartitionedTmpltbank.find_point_bin | train | def find_point_bin(self, chi_coords):
"""
Given a set of coordinates in the chi parameter space, identify the
indices of the chi1 and chi2 bins that the point occurs in. Returns
these indices.
Parameters
-----------
chi_coords : numpy.array
The positi... | python | {
"resource": ""
} |
q31972 | PartitionedTmpltbank.calc_point_distance | train | def calc_point_distance(self, chi_coords):
"""
Calculate distance between point and the bank. Return the closest
distance.
Parameters
-----------
chi_coords : numpy.array
The position of the point in the chi coordinates.
Returns
--------
... | python | {
"resource": ""
} |
q31973 | PartitionedTmpltbank.calc_point_distance_vary | train | def calc_point_distance_vary(self, chi_coords, point_fupper, mus):
"""
Calculate distance between point and the bank allowing the metric to
vary based on varying upper frequency cutoff. Slower than
calc_point_distance, but more reliable when upper frequency cutoff can
change a lo... | python | {
"resource": ""
} |
q31974 | PartitionedTmpltbank.add_point_by_chi_coords | train | def add_point_by_chi_coords(self, chi_coords, mass1, mass2, spin1z, spin2z,
point_fupper=None, mus=None):
"""
Add a point to the partitioned template bank. The point_fupper and mus
kwargs must be provided for all templates if the vary fupper capability
is desire... | python | {
"resource": ""
} |
q31975 | PartitionedTmpltbank.add_tmpltbank_from_xml_table | train | def add_tmpltbank_from_xml_table(self, sngl_table, vary_fupper=False):
"""
This function will take a sngl_inspiral_table of templates and add them
into the partitioned template bank object.
Parameters
-----------
sngl_table : sngl_inspiral_table
| python | {
"resource": ""
} |
q31976 | PartitionedTmpltbank.add_tmpltbank_from_hdf_file | train | def add_tmpltbank_from_hdf_file(self, hdf_fp, vary_fupper=False):
"""
This function will take a pointer to an open HDF File object containing
a list of templates and add them into the partitioned template bank
object.
Parameters
-----------
hdf_fp : h5py.File obj... | python | {
"resource": ""
} |
q31977 | PartitionedTmpltbank.output_all_points | train | def output_all_points(self):
"""Return all points in the bank.
Return all points in the bank as lists of m1, m2, spin1z, spin2z.
Returns
-------
mass1 : list
List of mass1 values.
mass2 : list
List of mass2 values.
spin1z : list
... | python | {
"resource": ""
} |
q31978 | _get_freq | train | def _get_freq(freqfunc, m1, m2, s1z, s2z):
"""
Wrapper of the LALSimulation function returning the frequency
for a given frequency function and template parameters.
Parameters
----------
freqfunc : lalsimulation FrequencyFunction wrapped object e.g.
lalsimulation.fEOBNRv2RD
m1 : flo... | python | {
"resource": ""
} |
q31979 | get_freq | train | def get_freq(freqfunc, m1, m2, s1z, s2z):
"""
Returns the LALSimulation function which evaluates the frequency
for the given frequency function and template parameters.
Parameters
----------
freqfunc : string
Name of the frequency function to use, e.g., 'fEOBNRv2RD'
m1 : float or nu... | python | {
"resource": ""
} |
q31980 | frequency_cutoff_from_name | train | def frequency_cutoff_from_name(name, m1, m2, s1z, s2z):
"""
Returns the result of evaluating the frequency cutoff function
specified by 'name' on a template with given parameters.
Parameters
----------
name : string
Name of the cutoff function
m1 : float or numpy.array
First... | python | {
"resource": ""
} |
q31981 | _get_imr_duration | train | def _get_imr_duration(m1, m2, s1z, s2z, f_low, approximant="SEOBNRv4"):
"""Wrapper of lalsimulation template duration approximate formula"""
m1, m2, s1z, s2z, f_low = float(m1), float(m2), float(s1z), float(s2z),\
float(f_low)
if approximant == "SEOBNRv2":
chi = lalsimu... | python | {
"resource": ""
} |
q31982 | get_inspiral_tf | train | def get_inspiral_tf(tc, mass1, mass2, spin1, spin2, f_low, n_points=100,
pn_2order=7, approximant='TaylorF2'):
"""Compute the time-frequency evolution of an inspiral signal.
Return a tuple of time and frequency vectors tracking the evolution of an
inspiral signal in the time-frequency plane.
""... | python | {
"resource": ""
} |
q31983 | kerr_lightring_velocity | train | def kerr_lightring_velocity(chi):
"""Return the velocity at the Kerr light ring"""
# If chi > 0.9996, the algorithm cannot solve the function
if chi >= 0.9996:
| python | {
"resource": ""
} |
q31984 | hybrid_meco_velocity | train | def hybrid_meco_velocity(m1, m2, chi1, chi2, qm1=None, qm2=None):
"""Return the velocity of the hybrid MECO
Parameters
----------
m1 : float
Mass of the primary object in solar masses.
m2 : float
Mass of the secondary object in solar masses.
chi1: float
Dimensionless spi... | python | {
"resource": ""
} |
q31985 | hybrid_meco_frequency | train | def hybrid_meco_frequency(m1, m2, chi1, chi2, qm1=None, qm2=None):
"""Return the frequency of the hybrid MECO
Parameters
----------
m1 : float
Mass of the primary object in solar masses.
m2 : float
Mass of the secondary object in solar masses.
chi1: float
Dimensionless s... | python | {
"resource": ""
} |
q31986 | BaseInferenceFile.parse_parameters | train | def parse_parameters(self, parameters, array_class=None):
"""Parses a parameters arg to figure out what fields need to be loaded.
Parameters
----------
parameters : (list of) strings
The parameter(s) to retrieve. A parameter can be the name of any
field in ``samp... | python | {
"resource": ""
} |
q31987 | BaseInferenceFile._get_optional_args | train | def _get_optional_args(args, opts, err_on_missing=False, **kwargs):
"""Convenience function to retrieve arguments from an argparse
namespace.
Parameters
----------
args : list of str
List of arguments to retreive.
opts : argparse.namespace
Namespa... | python | {
"resource": ""
} |
q31988 | BaseInferenceFile.samples_from_cli | train | def samples_from_cli(self, opts, parameters=None, **kwargs):
"""Reads samples from the given command-line options.
Parameters
----------
opts : argparse Namespace
The options with the settings to use for loading samples (the sort
of thing returned by ``ArgumentPa... | python | {
"resource": ""
} |
q31989 | BaseInferenceFile.write_logevidence | train | def write_logevidence(self, lnz, dlnz):
"""Writes the given log evidence and its error.
Results are saved to file's 'log_evidence' and 'dlog_evidence'
attributes.
| python | {
"resource": ""
} |
q31990 | BaseInferenceFile.write_random_state | train | def write_random_state(self, group=None, state=None):
"""Writes the state of the random number generator from the file.
The random state is written to ``sampler_group``/random_state.
Parameters
----------
group : str
Name of group to write random state to.
s... | python | {
"resource": ""
} |
q31991 | BaseInferenceFile.read_random_state | train | def read_random_state(self, group=None):
"""Reads the state of the random number generator from the file.
Parameters
----------
group : str
Name of group to read random state from.
Returns
-------
tuple
A tuple with 5 elements that can be... | python | {
"resource": ""
} |
q31992 | BaseInferenceFile.write_strain | train | def write_strain(self, strain_dict, group=None):
"""Writes strain for each IFO to file.
Parameters
-----------
strain : {dict, FrequencySeries}
A dict of FrequencySeries where the key is the IFO.
group : {None, str}
The group to write the strain to. If No... | python | {
"resource": ""
} |
q31993 | BaseInferenceFile.write_stilde | train | def write_stilde(self, stilde_dict, group=None):
"""Writes stilde for each IFO to file.
Parameters
-----------
stilde : {dict, FrequencySeries}
A dict of FrequencySeries where the key is the IFO.
group : {None, str}
The group to write the strain to. If No... | python | {
"resource": ""
} |
q31994 | BaseInferenceFile.write_psd | train | def write_psd(self, psds, group=None):
"""Writes PSD for each IFO to file.
Parameters
-----------
psds : {dict, FrequencySeries}
A dict of FrequencySeries where the key is the IFO.
group : {None, str}
The group to write the psd to. Default is ``data_group... | python | {
"resource": ""
} |
q31995 | BaseInferenceFile.write_injections | train | def write_injections(self, injection_file):
"""Writes injection parameters from the given injection file.
Everything in the injection file is copied to ``injections_group``.
Parameters
----------
injection_file : str
Path to HDF injection file.
"""
t... | python | {
"resource": ""
} |
q31996 | BaseInferenceFile.read_injections | train | def read_injections(self):
"""Gets injection parameters.
Returns
-------
FieldArray
Array of the injection parameters.
"""
injset = InjectionSet(self.filename, hdf_group=self.injections_group)
| python | {
"resource": ""
} |
q31997 | BaseInferenceFile.write_command_line | train | def write_command_line(self):
"""Writes command line to attributes.
The command line is written to the file's ``attrs['cmd']``. If this
attribute already exists in the file (this can happen when resuming
from a checkpoint), ``attrs['cmd']`` will be a list storing the current
com... | python | {
"resource": ""
} |
q31998 | BaseInferenceFile.get_slice | train | def get_slice(self, thin_start=None, thin_interval=None, thin_end=None):
"""Formats a slice using the given arguments that can be used to
retrieve a thinned array from an InferenceFile.
Parameters
----------
thin_start : int, optional
The starting index to use. If No... | python | {
"resource": ""
} |
q31999 | BaseInferenceFile.copy_metadata | train | def copy_metadata(self, other):
"""Copies all metadata from this file to the other file.
Metadata is defined as everything in the top-level ``.attrs``.
Parameters
----------
other : InferenceFile
An open inference file | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.