_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31700 | FrequencySeries.lal | train | def lal(self):
"""Produces a LAL frequency series object equivalent to self.
Returns
-------
lal_data : {lal.*FrequencySeries}
LAL frequency series object containing the same data as self.
The actual type depends on the sample's dtype. If the epoch of
... | python | {
"resource": ""
} |
q31701 | FrequencySeries.save | train | def save(self, path, group=None, ifo='P1'):
"""
Save frequency series to a Numpy .npy, hdf, or text file. The first column
contains the sample frequencies, the second contains the values.
In the case of a complex frequency series saved as text, the imaginary
part is written as a ... | python | {
"resource": ""
} |
q31702 | FrequencySeries.to_timeseries | train | def to_timeseries(self, delta_t=None):
""" Return the Fourier transform of this time series.
Note that this assumes even length time series!
Parameters
----------
delta_t : {None, float}, optional
The time resolution of the returned series. By default the
... | python | {
"resource": ""
} |
q31703 | FrequencySeries.cyclic_time_shift | train | def cyclic_time_shift(self, dt):
"""Shift the data and timestamps by a given number of seconds
Shift the data and timestamps in the time domain a given number of
seconds. To just change the time stamps, do ts.start_time += dt.
The time shift may be smaller than the intrinsic sample ra... | python | {
"resource": ""
} |
q31704 | stack_xi_direction_brute | train | def stack_xi_direction_brute(xis, bestMasses, bestXis, direction_num,
req_match, massRangeParams, metricParams, fUpper,
scaleFactor=0.8, numIterations=3000):
"""
This function is used to assess the depth of the xi_space in a specified
dimension at a ... | python | {
"resource": ""
} |
q31705 | find_xi_extrema_brute | train | def find_xi_extrema_brute(xis, bestMasses, bestXis, direction_num, req_match, \
massRangeParams, metricParams, fUpper, \
find_minimum=False, scaleFactor=0.8, \
numIterations=3000):
"""
This function is used to find the largest or s... | python | {
"resource": ""
} |
q31706 | is_main_process | train | def is_main_process():
""" Check if this is the main control process and may handle one time tasks
"""
try:
| python | {
"resource": ""
} |
q31707 | _lockstep_fcn | train | def _lockstep_fcn(values):
""" Wrapper to ensure that all processes execute together """
numrequired, fcn, args = values
with _process_lock:
_numdone.value += 1
| python | {
"resource": ""
} |
q31708 | BroadcastPool.broadcast | train | def broadcast(self, fcn, args):
""" Do a function call on every worker.
Parameters
----------
fcn: funtion
Function to call.
args: tuple
The arguments for Pool.map
| python | {
"resource": ""
} |
q31709 | BroadcastPool.allmap | train | def allmap(self, fcn, args):
""" Do a function call on every worker with different arguments
Parameters
----------
fcn: funtion
Function to call.
args: tuple
The arguments for Pool.map
| python | {
"resource": ""
} |
q31710 | BroadcastPool.map | train | def map(self, func, items, chunksize=None):
""" Catch keyboard interuppts to allow the pool to exit cleanly.
Parameters
----------
func: function
Function to call
items: list of tuples
Arguments to pass
chunksize: int, Optional
Number ... | python | {
"resource": ""
} |
q31711 | lfilter | train | def lfilter(coefficients, timeseries):
""" Apply filter coefficients to a time series
Parameters
----------
coefficients: numpy.ndarray
Filter coefficients to apply
timeseries: numpy.ndarray
Time series to be filtered.
Returns
-------
tseries: numpy.ndarray
filt... | python | {
"resource": ""
} |
q31712 | resample_to_delta_t | train | def resample_to_delta_t(timeseries, delta_t, method='butterworth'):
"""Resmple the time_series to delta_t
Resamples the TimeSeries instance time_series to the given time step,
delta_t. Only powers of two and real valued time series are supported
at this time. Additional restrictions may apply to partic... | python | {
"resource": ""
} |
q31713 | highpass | train | def highpass(timeseries, frequency, filter_order=8, attenuation=0.1):
"""Return a new timeseries that is highpassed.
Return a new time series that is highpassed above the `frequency`.
Parameters
----------
Time Series: TimeSeries
The time series to be high-passed.
frequency: float
... | python | {
"resource": ""
} |
q31714 | interpolate_complex_frequency | train | def interpolate_complex_frequency(series, delta_f, zeros_offset=0, side='right'):
"""Interpolate complex frequency series to desired delta_f.
Return a new complex frequency series that has been interpolated to the
desired delta_f.
Parameters
----------
series : FrequencySeries
Frequenc... | python | {
"resource": ""
} |
q31715 | multiifo_noise_coinc_rate | train | def multiifo_noise_coinc_rate(rates, slop):
"""
Calculate the expected rate of noise coincidences for multiple detectors
Parameters
----------
rates: dict
Dictionary keyed on ifo string
Value is a sequence of single-detector trigger rates, units assumed
to be Hz
slop: fl... | python | {
"resource": ""
} |
q31716 | multiifo_noise_coincident_area | train | def multiifo_noise_coincident_area(ifos, slop):
"""
calculate the total extent of time offset between 2 detectors,
or area of the 2d space of time offsets for 3 detectors, for
which a coincidence can be generated
Parameters
----------
ifos: list of strings
list of interferometers
... | python | {
"resource": ""
} |
q31717 | multiifo_signal_coincident_area | train | def multiifo_signal_coincident_area(ifos):
"""
Calculate the area in which signal time differences are physically allowed
Parameters
----------
ifos: list of strings
list of interferometers
Returns
-------
allowed_area: float
area in units of seconds^(n_ifos-1) that coi... | python | {
"resource": ""
} |
q31718 | lm_amps_phases | train | def lm_amps_phases(**kwargs):
""" Take input_params and return dictionaries with amplitudes and phases
of each overtone of a specific lm mode, checking that all of them are given.
"""
l, m = kwargs['l'], kwargs['m']
amps, phis = {}, {}
# amp220 is always required, because the amplitudes of subdo... | python | {
"resource": ""
} |
q31719 | lm_freqs_taus | train | def lm_freqs_taus(**kwargs):
""" Take input_params and return dictionaries with frequencies and damping
times of each overtone of a specific lm mode, checking that all of them
are given.
"""
lmns = kwargs['lmns']
freqs, taus = {}, {}
for lmn in lmns:
l, m, nmodes = int(lmn[0]), int(... | python | {
"resource": ""
} |
q31720 | qnm_freq_decay | train | def qnm_freq_decay(f_0, tau, decay):
"""Return the frequency at which the amplitude of the
ringdown falls to decay of the peak amplitude.
Parameters
----------
f_0 : float
The ringdown-frequency, which gives the peak amplitude.
tau : float
The damping time of the sinusoid.
d... | python | {
"resource": ""
} |
q31721 | spher_harms | train | def spher_harms(l, m, inclination):
"""Return spherical harmonic polarizations
"""
# FIXME: we are using spin -2 weighted spherical harmonics for now,
# when possible switch to spheroidal harmonics.
Y_lm = lal.SpinWeightedSphericalHarmonic(inclination, 0., -2, l, m).real
Y_lminusm | python | {
"resource": ""
} |
q31722 | apply_taper | train | def apply_taper(delta_t, taper, f_0, tau, amp, phi, l, m, inclination):
"""Return tapering window.
"""
# Times of tapering do not include t=0
taper_times = -numpy.arange(1, int(taper*tau/delta_t))[::-1] * delta_t
Y_plus, Y_cross = spher_harms(l, m, inclination)
taper_hp = amp * Y_plus * numpy.e... | python | {
"resource": ""
} |
q31723 | get_td_qnm | train | def get_td_qnm(template=None, taper=None, **kwargs):
"""Return a time domain damped sinusoid.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row in an xml table.
taper: ... | python | {
"resource": ""
} |
q31724 | get_fd_qnm | train | def get_fd_qnm(template=None, **kwargs):
"""Return a frequency domain damped sinusoid.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row in an xml table.
f_0 : float
... | python | {
"resource": ""
} |
q31725 | get_td_lm | train | def get_td_lm(template=None, taper=None, **kwargs):
"""Return time domain lm mode with the given number of overtones.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row in a... | python | {
"resource": ""
} |
q31726 | get_fd_lm | train | def get_fd_lm(template=None, **kwargs):
"""Return frequency domain lm mode with a given number of overtones.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row in an xml tab... | python | {
"resource": ""
} |
q31727 | normalize_pdf | train | def normalize_pdf(mu, pofmu):
"""
Takes a function pofmu defined at rate sample values mu and
normalizes it to be a suitable pdf. Both mu and pofmu must be
arrays or lists of the same length.
"""
if min(pofmu) < 0:
raise ValueError("Probabilities cannot be negative, don't ask me to "
... | python | {
"resource": ""
} |
q31728 | compute_upper_limit | train | def compute_upper_limit(mu_in, post, alpha=0.9):
"""
Returns the upper limit mu_high of confidence level alpha for a
posterior distribution post on the given parameter mu.
The posterior need not be normalized.
"""
if 0 < alpha < 1:
dp = integral_element(mu_in, post)
high_idx = bi... | python | {
"resource": ""
} |
q31729 | compute_lower_limit | train | def compute_lower_limit(mu_in, post, alpha=0.9):
"""
Returns the lower limit mu_low of confidence level alpha for a
posterior distribution post on the given parameter mu.
The posterior need not be normalized.
"""
if 0 < alpha < 1:
dp = integral_element(mu_in, post)
low_idx = bise... | python | {
"resource": ""
} |
q31730 | hpd_coverage | train | def hpd_coverage(mu, pdf, thresh):
'''
Integrates a pdf over mu taking only bins where
the mean over the bin is above a given threshold
| python | {
"resource": ""
} |
q31731 | hpd_threshold | train | def hpd_threshold(mu_in, post, alpha, tol):
'''
For a PDF post over samples mu_in, find a density
threshold such that the region having higher density
has coverage of at least alpha, and less than alpha
plus a given tolerance.
'''
norm_post = normalize_pdf(mu_in, post)
# initialize bisec... | python | {
"resource": ""
} |
q31732 | compute_volume_vs_mass | train | def compute_volume_vs_mass(found, missed, mass_bins, bin_type, dbins=None):
"""
Compute the average luminosity an experiment was sensitive to
Assumes that luminosity is uniformly distributed in space.
Input is the sets of found and missed injections.
"""
# mean and std estimate for luminosity
... | python | {
"resource": ""
} |
q31733 | calculate_acf | train | def calculate_acf(data, delta_t=1.0, unbiased=False):
r"""Calculates the one-sided autocorrelation function.
Calculates the autocorrelation function (ACF) and returns the one-sided
ACF. The ACF is defined as the autocovariance divided by the variance. The
ACF can be estimated using
.. math::
... | python | {
"resource": ""
} |
q31734 | insert_fft_options | train | def insert_fft_options(optgroup):
"""
Inserts the options that affect the behavior of this backend
Parameters
----------
optgroup: fft_option
OptionParser argument group whose options are extended
"""
optgroup.add_argument("--fftw-measure-level",
help="Determine... | python | {
"resource": ""
} |
q31735 | kl | train | def kl(samples1, samples2, pdf1=False, pdf2=False,
bins=30, hist_min=None, hist_max=None):
""" Computes the Kullback-Leibler divergence for a single parameter
from two distributions.
Parameters
----------
samples1 : numpy.array
Samples or probability density function (must also set `... | python | {
"resource": ""
} |
q31736 | rst_dict_table | train | def rst_dict_table(dict_, key_format=str, val_format=str, header=None,
sort=True):
"""Returns an RST-formatted table of keys and values from a `dict`
Parameters
----------
dict_ : dict
data to display in table
key_format : callable
callable function with which to ... | python | {
"resource": ""
} |
q31737 | read_model_from_config | train | def read_model_from_config(cp, ifo, section="calibration"):
"""Returns an instance of the calibration model specified in the
given configuration file.
Parameters
----------
cp : WorflowConfigParser
An open config file to read.
ifo : string
| python | {
"resource": ""
} |
q31738 | _gates_from_cli | train | def _gates_from_cli(opts, gate_opt):
"""Parses the given `gate_opt` into something understandable by
`strain.gate_data`.
"""
gates = {}
if getattr(opts, gate_opt) is None:
return gates
for gate in getattr(opts, gate_opt):
try:
ifo, central_time, half_dur, taper_dur = ... | python | {
"resource": ""
} |
q31739 | apply_gates_to_td | train | def apply_gates_to_td(strain_dict, gates):
"""Applies the given dictionary of gates to the given dictionary of
strain.
Parameters
----------
strain_dict : dict
Dictionary of time-domain strain, keyed by the ifos.
gates : dict
Dictionary of gates. Keys should be the ifo to | python | {
"resource": ""
} |
q31740 | apply_gates_to_fd | train | def apply_gates_to_fd(stilde_dict, gates):
"""Applies the given dictionary of gates to the given dictionary of
strain in the frequency domain.
Gates are applied by IFFT-ing the strain data to the time domain, applying
the gate, then FFT-ing back to the frequency domain.
Parameters
----------
... | python | {
"resource": ""
} |
q31741 | add_gate_option_group | train | def add_gate_option_group(parser):
"""Adds the options needed to apply gates to data.
Parameters
----------
parser : object
ArgumentParser instance.
"""
gate_group = parser.add_argument_group("Options for gating data.")
gate_group.add_argument("--gate", nargs="+", type=str,
... | python | {
"resource": ""
} |
q31742 | power_chisq_at_points_from_precomputed | train | def power_chisq_at_points_from_precomputed(corr, snr, snr_norm, bins, indices):
"""Calculate the chisq timeseries from precomputed values for only select points.
This function calculates the chisq at each point by explicitly time shifting
and summing each bin. No FFT is involved.
Parameters
------... | python | {
"resource": ""
} |
q31743 | power_chisq_from_precomputed | train | def power_chisq_from_precomputed(corr, snr, snr_norm, bins, indices=None, return_bins=False):
"""Calculate the chisq timeseries from precomputed values.
This function calculates the chisq at all times by performing an
inverse FFT of each bin.
Parameters
----------
corr: FrequencySeries
... | python | {
"resource": ""
} |
q31744 | power_chisq | train | def power_chisq(template, data, num_bins, psd,
low_frequency_cutoff=None,
high_frequency_cutoff=None,
return_bins=False):
"""Calculate the chisq timeseries
Parameters
----------
template: FrequencySeries or TimeSeries
A time or frequency series th... | python | {
"resource": ""
} |
q31745 | SingleDetSkyMaxPowerChisq.calculate_chisq_bins | train | def calculate_chisq_bins(self, template, psd):
""" Obtain the chisq bins for this template and PSD.
"""
num_bins = int(self.parse_option(template, self.num_bins))
if hasattr(psd, 'sigmasq_vec') and \
template.approximant in psd.sigmasq_vec:
... | python | {
"resource": ""
} |
q31746 | build_includes | train | def build_includes():
"""Creates rst files in the _include directory using the python scripts
there.
This will ignore any files in the _include directory that start with ``_``.
"""
print("Running scripts in _include:")
cwd = os.getcwd()
os.chdir('_include')
pyfiles = glob.glob('*.py')
... | python | {
"resource": ""
} |
q31747 | apply_cyclic | train | def apply_cyclic(value, bounds):
"""Given a value, applies cyclic boundary conditions between the minimum
and maximum bounds.
Parameters
----------
value : float
The value to apply the cyclic conditions to.
bounds : Bounds instance
Boundaries to use for applying cyclic condition... | python | {
"resource": ""
} |
q31748 | reflect_well | train | def reflect_well(value, bounds):
"""Given some boundaries, reflects the value until it falls within both
boundaries. This is done iteratively, reflecting left off of the
`boundaries.max`, then right off of the `boundaries.min`, etc.
Parameters
----------
value : float
The value to apply... | python | {
"resource": ""
} |
q31749 | ReflectedBound.reflect_left | train | def reflect_left(self, value):
"""Only reflects the value if is > self."""
if value > self:
| python | {
"resource": ""
} |
q31750 | ReflectedBound.reflect_right | train | def reflect_right(self, value):
"""Only reflects the value if is < self."""
if value < self:
| python | {
"resource": ""
} |
q31751 | Bounds.apply_conditions | train | def apply_conditions(self, value):
"""Applies any boundary conditions to the given value.
The value is manipulated according based on the following conditions:
* If `self.cyclic` is True then `value` is wrapped around to the
minimum (maximum) bound if `value` is `>= self.max` (`< s... | python | {
"resource": ""
} |
q31752 | parse_veto_definer | train | def parse_veto_definer(veto_def_filename):
""" Parse a veto definer file from the filename and return a dictionary
indexed by ifo and veto definer category level.
Parameters
----------
veto_def_filename: str
The path to the veto definer file
Returns:
parsed_definition: dict
... | python | {
"resource": ""
} |
q31753 | query_cumulative_flags | train | def query_cumulative_flags(ifo, segment_names, start_time, end_time,
source='any', server="segments.ligo.org",
veto_definer=None,
bounds=None,
padding=None,
override_ifos=None,
... | python | {
"resource": ""
} |
q31754 | parse_flag_str | train | def parse_flag_str(flag_str):
""" Parse a dq flag query string
Parameters
----------
flag_str: str
String needing to be parsed
Returns
-------
flags: list of strings
List of reduced name strings which can be passed to lower level
query commands
signs: dict
D... | python | {
"resource": ""
} |
q31755 | query_str | train | def query_str(ifo, flag_str, start_time, end_time, server="segments.ligo.org",
veto_definer=None):
""" Query for flags based on a special str syntax
Parameters
----------
ifo: str
The ifo to be mainly quering for. (may be overriden in syntax)
flag_str: str
Specificatio... | python | {
"resource": ""
} |
q31756 | BaseDataModel.data | train | def data(self, data):
"""Store a copy of the data."""
| python | {
"resource": ""
} |
q31757 | BaseDataModel.logplr | train | def logplr(self):
"""Returns the log of the prior-weighted likelihood ratio at the
current parameter values.
The logprior is calculated first. If the logprior returns ``-inf``
(possibly indicating a non-physical point), then ``loglr`` is not
called.
| python | {
"resource": ""
} |
q31758 | BaseDataModel.write_metadata | train | def write_metadata(self, fp):
"""Adds data to the metadata that's written.
Parameters
----------
fp : pycbc.inference.io.BaseInferenceFile instance
The inference file | python | {
"resource": ""
} |
q31759 | apply_fseries_time_shift | train | def apply_fseries_time_shift(htilde, dt, kmin=0, copy=True):
"""Shifts a frequency domain waveform in time. The waveform is assumed to
be sampled at equal frequency intervals.
"""
if htilde.precision != 'single':
raise NotImplementedError("CUDA version of apply_fseries_time_shift only supports s... | python | {
"resource": ""
} |
q31760 | UniformF0Tau.from_config | train | def from_config(cls, cp, section, variable_args):
"""Initialize this class from a config file.
Bounds on ``f0``, ``tau``, ``final_mass`` and ``final_spin`` should
be specified by providing ``min-{param}`` and ``max-{param}``. If
the ``f0`` or ``tau`` param should be renamed, ``rdfreq`` ... | python | {
"resource": ""
} |
q31761 | UniformSolidAngle.apply_boundary_conditions | train | def apply_boundary_conditions(self, **kwargs):
"""Maps the given values to be within the domain of the azimuthal and
polar angles, before applying any other boundary conditions.
Parameters
----------
\**kwargs :
The keyword args must include values for both the azimu... | python | {
"resource": ""
} |
q31762 | UniformSolidAngle._pdf | train | def _pdf(self, **kwargs):
"""
Returns the pdf at the given angles.
Parameters
----------
\**kwargs:
The keyword arguments should specify the value for each angle,
using the names of the polar and azimuthal angles as the keywords.
Unrecognized ... | python | {
"resource": ""
} |
q31763 | UniformSolidAngle._logpdf | train | def _logpdf(self, **kwargs):
"""
Returns the logpdf at the given angles.
Parameters
----------
\**kwargs:
The keyword arguments should specify the value for each angle,
| python | {
"resource": ""
} |
q31764 | create_axes_grid | train | def create_axes_grid(parameters, labels=None, height_ratios=None,
width_ratios=None, no_diagonals=False):
"""Given a list of parameters, creates a figure with an axis for
every possible combination of the parameters.
Parameters
----------
parameters : list
Names of the ... | python | {
"resource": ""
} |
q31765 | construct_kde | train | def construct_kde(samples_array, use_kombine=False):
"""Constructs a KDE from the given samples.
"""
if use_kombine:
try:
import kombine
except ImportError:
raise ImportError("kombine is not installed.")
# construct the kde
if use_kombine:
| python | {
"resource": ""
} |
q31766 | create_marginalized_hist | train | def create_marginalized_hist(ax, values, label, percentiles=None,
color='k', fillcolor='gray', linecolor='navy',
linestyle='-',
title=True, expected_value=None,
expected_color='red', rotated=False,
... | python | {
"resource": ""
} |
q31767 | set_marginal_histogram_title | train | def set_marginal_histogram_title(ax, fmt, color, label=None, rotated=False):
""" Sets the title of the marginal histograms.
Parameters
----------
ax : Axes
The `Axes` instance for the plot.
fmt : str
The string to add to the title.
color : str
The color of the text to ad... | python | {
"resource": ""
} |
q31768 | remove_common_offset | train | def remove_common_offset(arr):
"""Given an array of data, removes a common offset > 1000, returning the
removed value.
"""
offset = 0
isneg = (arr <= 0).all()
# make sure all values have the same sign
if isneg or (arr >= 0).all():
# only remove offset if the minimum and maximum value... | python | {
"resource": ""
} |
q31769 | reduce_ticks | train | def reduce_ticks(ax, which, maxticks=3):
"""Given a pyplot axis, resamples its `which`-axis ticks such that are at most
`maxticks` left.
Parameters
----------
ax : axis
The axis to adjust.
which : {'x' | 'y'}
Which axis to adjust.
maxticks : {3, int}
Maximum number o... | python | {
"resource": ""
} |
q31770 | BinnedRatios.logregularize | train | def logregularize(self, epsilon=2**-1074):
"""
Find bins in the denominator that are 0, and set them to 1,
while setting the corresponding bin in the numerator to
float epsilon. This has the effect of allowing the
logarithm of the ratio array to be evaluated without error.
| python | {
"resource": ""
} |
q31771 | median_bias | train | def median_bias(n):
"""Calculate the bias of the median average PSD computed from `n` segments.
Parameters
----------
n : int
Number of segments used in PSD estimation.
Returns
-------
ans : float
Calculated bias.
Raises
------ | python | {
"resource": ""
} |
q31772 | inverse_spectrum_truncation | train | def inverse_spectrum_truncation(psd, max_filter_len, low_frequency_cutoff=None, trunc_method=None):
"""Modify a PSD such that the impulse response associated with its inverse
square root is no longer than `max_filter_len` time samples. In practice
this corresponds to a coarse graining or smoothing of the PS... | python | {
"resource": ""
} |
q31773 | process_full_data | train | def process_full_data(fname, rhomin, mass1, mass2, lo_mchirp, hi_mchirp):
"""Read the zero-lag and time-lag triggers identified by templates in
a specified range of chirp mass.
Parameters
----------
hdfile:
File that stores all the triggers
rhomin: float
... | python | {
"resource": ""
} |
q31774 | save_bkg_falloff | train | def save_bkg_falloff(fname_statmap, fname_bank, path, rhomin, lo_mchirp, hi_mchirp):
''' Read the STATMAP files to derive snr falloff for the background events.
Save the output to a txt file
Bank file is also provided to restrict triggers to BBH templates.
Parameters
----------
... | python | {
"resource": ""
} |
q31775 | log_rho_bg | train | def log_rho_bg(trigs, bins, counts):
''' Calculate the log of background fall-off
Parameters
----------
trigs: array
SNR values of all the triggers
bins: string
bins for histogrammed triggers
path: string
counts for histogrammed t... | python | {
"resource": ""
} |
q31776 | fgmc | train | def fgmc(log_fg_ratios, mu_log_vt, sigma_log_vt, Rf, maxfg):
'''
Function to fit the likelihood Fixme
'''
Lb = np.random.uniform(0., maxfg, len(Rf))
pquit = 0
while pquit < 0.1:
# quit when the posterior on Lf is very close to its prior
nsamp = len(Lb)
Rf_sel = np.rand... | python | {
"resource": ""
} |
q31777 | _optm | train | def _optm(x, alpha, mu, sigma):
'''Return probability density of skew-lognormal
See scipy.optimize.curve_fit | python | {
"resource": ""
} |
q31778 | draw_imf_samples | train | def draw_imf_samples(**kwargs):
''' Draw samples for power-law model
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
array
The first mass
array
The second mas... | python | {
"resource": ""
} |
q31779 | draw_lnm_samples | train | def draw_lnm_samples(**kwargs):
''' Draw samples for uniform-in-log model
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
array
The first mass
array
The secon... | python | {
"resource": ""
} |
q31780 | draw_flat_samples | train | def draw_flat_samples(**kwargs):
''' Draw samples for uniform in mass
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
array
| python | {
"resource": ""
} |
q31781 | mchirp_sampler_lnm | train | def mchirp_sampler_lnm(**kwargs):
''' Draw chirp mass samples for uniform-in-log model
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
mchirp-astro: array
| python | {
"resource": ""
} |
q31782 | mchirp_sampler_imf | train | def mchirp_sampler_imf(**kwargs):
''' Draw chirp mass samples for power-law model
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
mchirp-astro: array
| python | {
"resource": ""
} |
q31783 | mchirp_sampler_flat | train | def mchirp_sampler_flat(**kwargs):
''' Draw chirp mass samples for flat in mass model
Parameters
----------
**kwargs: string
Keyword arguments as model parameters and number of samples
Returns
-------
mchirp-astro: array
| python | {
"resource": ""
} |
q31784 | load_array | train | def load_array(path, group=None):
"""
Load an Array 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 for in... | python | {
"resource": ""
} |
q31785 | Array._return | train | def _return(self, ary):
"""Wrap the ary to return an Array type """
if isinstance(ary, Array):
| python | {
"resource": ""
} |
q31786 | Array._icheckother | train | def _icheckother(fn, self, other):
""" Checks the input to in-place operations """
self._typecheck(other)
if type(other) in _ALLOWED_SCALARS:
if self.kind == 'real' and type(other) == complex:
raise TypeError('dtypes are incompatible')
other = force_preci... | python | {
"resource": ""
} |
q31787 | Array.almost_equal_elem | train | def almost_equal_elem(self,other,tol,relative=True):
"""
Compare whether two array types 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 tolerance, an... | python | {
"resource": ""
} |
q31788 | Array.almost_equal_norm | train | def almost_equal_norm(self,other,tol,relative=True):
"""
Compare whether two array types are almost equal, normwise.
If the 'relative' parameter is 'True' (the default) then the
'tol' parameter (which must be positive) is interpreted as a
relative tolerance, and the comparison r... | python | {
"resource": ""
} |
q31789 | Array.resize | train | def resize(self, new_size):
"""Resize self to new_size
"""
if new_size == len(self):
return
else:
self._saved = LimitedSizeDict(size_limit=2**5)
new_arr = zeros(new_size, dtype=self.dtype)
if len(self) <= new_size:
| python | {
"resource": ""
} |
q31790 | Array.lal | train | def lal(self):
""" Returns a LAL Object that contains this data """
lal_data = None
if self._data.dtype == float32:
lal_data = _lal.CreateREAL4Vector(len(self))
elif self._data.dtype == float64:
lal_data = _lal.CreateREAL8Vector(len(self))
elif self._data... | python | {
"resource": ""
} |
q31791 | Array.save | train | def save(self, path, group=None):
"""
Save array to a Numpy .npy, hdf, or text file. When saving a complex array as
text, the real and imaginary parts are saved as the first and second
column respectively. When using hdf format, the data is stored
as a single vector, along with r... | python | {
"resource": ""
} |
q31792 | Array.trim_zeros | train | def trim_zeros(self):
"""Remove the leading and trailing zeros.
"""
tmp = self.numpy()
f = len(self)-len(_numpy.trim_zeros(tmp, trim='f'))
| python | {
"resource": ""
} |
q31793 | two_column_layout | train | def two_column_layout(path, cols, **kwargs):
""" Make a well layout in a two column format
Parameters
----------
path: str
Location to make the well html file
cols: list of tuples
The format of the items on the well result section. Each tuple
contains the two files that are ... | python | {
"resource": ""
} |
q31794 | single_layout | train | def single_layout(path, files, **kwargs):
""" Make a well layout in single column format
path: str
Location to make the well html file
files: list of pycbc.workflow.core.Files
| python | {
"resource": ""
} |
q31795 | group_layout | train | def group_layout(path, files, **kwargs):
""" Make a well layout in chunks of two from a list of files
path: str
Location to make the well html file
files: list of | python | {
"resource": ""
} |
q31796 | make_seg_table | train | def make_seg_table(workflow, seg_files, seg_names, out_dir, tags=None,
title_text=None, description=None):
""" Creates a node in the workflow for writing the segment summary
table. Returns a File instances for the output file.
"""
seg_files = list(seg_files)
seg_names = list(seg_na... | python | {
"resource": ""
} |
q31797 | make_veto_table | train | def make_veto_table(workflow, out_dir, vetodef_file=None, tags=None):
""" Creates a node in the workflow for writing the veto_definer
table. Returns a File instances for the output file.
"""
if vetodef_file is None:
vetodef_file = workflow.cp.get_opt_tags("workflow-segments",
... | python | {
"resource": ""
} |
q31798 | make_ifar_plot | train | def make_ifar_plot(workflow, trigger_file, out_dir, tags=None,
hierarchical_level=None):
""" Creates a node in the workflow for plotting cumulative histogram
of IFAR values.
"""
if hierarchical_level is not None and tags:
tags = [("HIERARCHICAL_LEVEL_{:02d}".format(
... | python | {
"resource": ""
} |
q31799 | MultiTemperedMetadataIO.write_sampler_metadata | train | def write_sampler_metadata(self, sampler):
"""Adds writing ntemps to file.
"""
super(MultiTemperedMetadataIO, | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.