_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31600 | save_html_with_metadata | train | def save_html_with_metadata(fig, filename, fig_kwds, kwds):
""" Save a html output to file with metadata """
if isinstance(fig, str):
text = fig
else:
from mpld3 import fig_to_html
text = fig_to_html(fig, **fig_kwds)
f = open(filename, 'w')
for key, value in kwds.items():
... | python | {
"resource": ""
} |
q31601 | load_html_metadata | train | def load_html_metadata(filename):
""" Get metadata from html file """
parser = MetaParser()
data = open(filename, 'r').read()
if 'pycbc-meta' in data:
print("LOADING HTML FILE %s" | python | {
"resource": ""
} |
q31602 | save_png_with_metadata | train | def save_png_with_metadata(fig, filename, fig_kwds, kwds):
""" Save a matplotlib figure to a png with metadata
"""
from PIL import Image, PngImagePlugin
fig.savefig(filename, **fig_kwds)
im = Image.open(filename)
| python | {
"resource": ""
} |
q31603 | save_fig_with_metadata | train | def save_fig_with_metadata(fig, filename, fig_kwds=None, **kwds):
""" Save plot to file with metadata included. Kewords translate to metadata
that is stored directly in the plot file. Limited format types available.
Parameters
----------
fig: matplotlib figure
The matplotlib figure to save ... | python | {
"resource": ""
} |
q31604 | load_metadata_from_file | train | def load_metadata_from_file(filename):
""" Load the plot related metadata saved in a file
Parameters
----------
filename: str
Name of file load metadata from.
Returns
-------
cp: ConfigParser
A configparser object containing the metadata
"""
try:
extension =... | python | {
"resource": ""
} |
q31605 | get_code_version_numbers | train | def get_code_version_numbers(cp):
"""Will extract the version information from the executables listed in
the executable section of the supplied ConfigParser object.
Returns
--------
dict
A dictionary keyed by the executable name with values giving the
version string for each executa... | python | {
"resource": ""
} |
q31606 | initialize_page | train | def initialize_page(title, style, script, header=None):
"""
A function that returns a markup.py page object with the required html
header.
"""
page | python | {
"resource": ""
} |
q31607 | write_table | train | def write_table(page, headers, data, cl=''):
"""
Write table in html
"""
page.table(class_=cl)
# list
if cl=='list':
for i in range(len(headers)):
page.tr()
page.th()
page.add('%s' % headers[i])
page.th.close()
page.td()
... | python | {
"resource": ""
} |
q31608 | write_offsource | train | def write_offsource(page, args, grbtag, onsource=False):
"""
Write offsource SNR versus time plots to markup.page object page
"""
th = ['Re-weighted SNR', 'Coherent SNR']
if args.time_slides:
if onsource:
out_dir = 'ZEROLAG_ALL'
else:
out_dir = 'ZEROLAG... | python | {
"resource": ""
} |
q31609 | write_recovery | train | def write_recovery(page, injList):
"""
Write injection recovery plots to markup.page object page
"""
th = ['']+injList
td = []
plots = ['sky_error_time','sky_error_mchirp','sky_error_distance']
text = { 'sky_error_time':'Sky error vs time',\
'sky_error_mchirp':'S... | python | {
"resource": ""
} |
q31610 | generate_hexagonal_lattice | train | def generate_hexagonal_lattice(maxv1, minv1, maxv2, minv2, mindist):
"""
This function generates a 2-dimensional lattice of points using a hexagonal
lattice.
Parameters
-----------
maxv1 : float
Largest value in the 1st dimension to cover
minv1 : float
Smallest value in the ... | python | {
"resource": ""
} |
q31611 | newsnr_sgveto | train | def newsnr_sgveto(snr, bchisq, sgchisq):
""" Combined SNR derived from NewSNR and Sine-Gaussian Chisq"""
nsnr = numpy.array(newsnr(snr, bchisq), ndmin=1)
sgchisq = numpy.array(sgchisq, ndmin=1)
t = numpy.array(sgchisq > 4, ndmin=1)
if len(t):
nsnr[t] = nsnr[t] / (sgchisq[t] / 4.0) ** 0.5
| python | {
"resource": ""
} |
q31612 | newsnr_sgveto_psdvar | train | def newsnr_sgveto_psdvar(snr, bchisq, sgchisq, psd_var_val):
""" Combined SNR derived from NewSNR, Sine-Gaussian Chisq and PSD
variation statistic """
nsnr = numpy.array(newsnr_sgveto(snr, bchisq, sgchisq), ndmin=1)
psd_var_val = numpy.array(psd_var_val, ndmin=1)
lgc = psd_var_val >= 1.8 | python | {
"resource": ""
} |
q31613 | get_newsnr_sgveto | train | def get_newsnr_sgveto(trigs):
"""
Calculate newsnr re-weigthed by the sine-gaussian veto
Parameters
----------
trigs: dict of numpy.ndarrays, h5py group (or similar dict-like object)
Dictionary-like object holding single detector trigger information.
| python | {
"resource": ""
} |
q31614 | get_newsnr_sgveto_psdvar | train | def get_newsnr_sgveto_psdvar(trigs):
"""
Calculate newsnr re-weighted by the sine-gaussian veto and psd variation
statistic
Parameters
----------
trigs: dict of numpy.ndarrays
Dictionary holding single detector trigger information.
'chisq_dof', 'snr', 'chisq' and 'psd_var_val' are r... | python | {
"resource": ""
} |
q31615 | drop_trailing_zeros | train | def drop_trailing_zeros(num):
"""
Drops the trailing zeros in a float that is printed.
"""
txt = '%f' %(num)
| python | {
"resource": ""
} |
q31616 | get_signum | train | def get_signum(val, err, max_sig=numpy.inf):
"""
Given an error, returns a string for val formated to the appropriate
number of significant figures.
"""
coeff, pwr = ('%e' % err).split('e')
if pwr.startswith('-'):
pwr = int(pwr[1:])
if round(float(coeff)) == 10.:
pwr ... | python | {
"resource": ""
} |
q31617 | from_cli_single_ifo | train | def from_cli_single_ifo(opt, ifo, **kwargs):
"""
Get the strain for a single ifo when using | python | {
"resource": ""
} |
q31618 | from_cli_multi_ifos | train | def from_cli_multi_ifos(opt, ifos, **kwargs):
"""
Get the strain for all ifos when using the multi-detector CLI
"""
strain = {}
| python | {
"resource": ""
} |
q31619 | gate_data | train | def gate_data(data, gate_params):
"""Apply a set of gating windows to a time series.
Each gating window is
defined by a central time, a given duration (centered on the given
time) to zero out, and a given duration of smooth tapering on each side of
the window. The window function used for tapering ... | python | {
"resource": ""
} |
q31620 | StrainSegments.fourier_segments | train | def fourier_segments(self):
""" Return a list of the FFT'd segments.
Return the list of FrequencySeries. Additional properties are
added that describe the strain segment. The property 'analyze'
is a slice corresponding to the portion of the time domain equivelant
of the segment t... | python | {
"resource": ""
} |
q31621 | StrainBuffer.end_time | train | def end_time(self):
""" Return the end time of the current valid segment of data """
| python | {
"resource": ""
} |
q31622 | StrainBuffer.add_hard_count | train | def add_hard_count(self):
""" Reset the countdown timer, so that we don't analyze data long enough
to generate a new PSD.
"""
| python | {
"resource": ""
} |
q31623 | StrainBuffer.recalculate_psd | train | def recalculate_psd(self):
""" Recalculate the psd
"""
seg_len = self.sample_rate * self.psd_segment_length
e = len(self.strain)
s = e - ((self.psd_samples + 1) * self.psd_segment_length / 2) * self.sample_rate
psd = pycbc.psd.welch(self.strain[s:e], seg_len=seg_len, seg... | python | {
"resource": ""
} |
q31624 | StrainBuffer.overwhitened_data | train | def overwhitened_data(self, delta_f):
""" Return overwhitened data
Parameters
----------
delta_f: float
The sample step to generate overwhitened frequency domain data for
Returns
-------
htilde: FrequencySeries
Overwhited strain data
... | python | {
"resource": ""
} |
q31625 | StrainBuffer.near_hwinj | train | def near_hwinj(self):
"""Check that the current set of triggers could be influenced by
a hardware injection.
"""
if not self.state:
return False
if | python | {
"resource": ""
} |
q31626 | StrainBuffer.advance | train | def advance(self, blocksize, timeout=10):
"""Advanced buffer blocksize seconds.
Add blocksize seconds more to the buffer, push blocksize seconds
from the beginning.
Parameters
----------
blocksize: int
The number of seconds to attempt to read from the channe... | python | {
"resource": ""
} |
q31627 | from_string | train | def from_string(psd_name, length, delta_f, low_freq_cutoff):
"""Generate a frequency series containing a LALSimulation PSD specified
by name.
Parameters
----------
psd_name : string
PSD name as found in LALSimulation, minus the SimNoisePSD prefix.
length : int
Length of the freq... | python | {
"resource": ""
} |
q31628 | flat_unity | train | def flat_unity(length, delta_f, low_freq_cutoff):
""" Returns a FrequencySeries of ones above the low_frequency_cutoff.
Parameters
----------
length : int
Length of output Frequencyseries.
delta_f : float
Frequency step for output FrequencySeries.
low_freq_cutoff : int
L... | python | {
"resource": ""
} |
q31629 | rough_time_estimate | train | def rough_time_estimate(m1, m2, flow, fudge_length=1.1, fudge_min=0.02):
""" A very rough estimate of the duration of the waveform.
An estimate of the waveform duration starting from flow. This is intended
to be fast but not necessarily accurate. It should be an overestimate of
the length. It is derive... | python | {
"resource": ""
} |
q31630 | mchirp_compression | train | def mchirp_compression(m1, m2, fmin, fmax, min_seglen=0.02, df_multiple=None):
"""Return the frequencies needed to compress a waveform with the given
chirp mass. This is based on the estimate in rough_time_estimate.
Parameters
----------
m1: float
mass of first component object in solar mas... | python | {
"resource": ""
} |
q31631 | vecdiff | train | def vecdiff(htilde, hinterp, sample_points, psd=None):
"""Computes a statistic indicating between which sample points a waveform
and the interpolated waveform differ the most.
"""
vecdiffs = numpy.zeros(sample_points.size-1, dtype=float)
| python | {
"resource": ""
} |
q31632 | fd_decompress | train | def fd_decompress(amp, phase, sample_frequencies, out=None, df=None,
f_lower=None, interpolation='inline_linear'):
"""Decompresses an FD waveform using the given amplitude, phase, and the
frequencies at which they are sampled at.
Parameters
----------
amp : array
The ampli... | python | {
"resource": ""
} |
q31633 | CompressedWaveform.decompress | train | def decompress(self, out=None, df=None, f_lower=None, interpolation=None):
"""Decompress self.
Parameters
----------
out : {None, FrequencySeries}
Write the decompressed waveform to the given frequency series. The
decompressed waveform will have the same `delta_f... | python | {
"resource": ""
} |
q31634 | CompressedWaveform.write_to_hdf | train | def write_to_hdf(self, fp, template_hash, root=None, precision=None):
"""Write the compressed waveform to the given hdf file handler.
The waveform is written to:
`fp['[{root}/]compressed_waveforms/{template_hash}/{param}']`,
where `param` is the `sample_points`, `amplitude`, and `phase`... | python | {
"resource": ""
} |
q31635 | CompressedWaveform.from_hdf | train | def from_hdf(cls, fp, template_hash, root=None, load_to_memory=True,
load_now=False):
"""Load a compressed waveform from the given hdf file handler.
The waveform is retrieved from:
`fp['[{root}/]compressed_waveforms/{template_hash}/{param}']`,
where `param` is the `samp... | python | {
"resource": ""
} |
q31636 | SingleDetAutoChisq.values | train | def values(self, sn, indices, template, psd, norm, stilde=None,
low_frequency_cutoff=None, high_frequency_cutoff=None):
"""
Calculate the auto-chisq at the specified indices.
Parameters
-----------
sn : Array[complex]
SNR time series of the template fo... | python | {
"resource": ""
} |
q31637 | get_param_bounds_from_config | train | def get_param_bounds_from_config(cp, section, tag, param):
"""Gets bounds for the given parameter from a section in a config file.
Minimum and maximum values for bounds are specified by adding
`min-{param}` and `max-{param}` options, where `{param}` is the name of
the parameter. The types of boundary (... | python | {
"resource": ""
} |
q31638 | check_status | train | def check_status(status):
""" Check the status of a mkl functions and raise a python exeption if
there is an error.
"""
if status:
| python | {
"resource": ""
} |
q31639 | Node.add_arg | train | def add_arg(self, arg):
""" Add an argument
"""
if not isinstance(arg, File):
| python | {
"resource": ""
} |
q31640 | Node.add_opt | train | def add_opt(self, opt, value=None):
""" Add a option
"""
if value is not None:
if not isinstance(value, File):
value = str(value)
| python | {
"resource": ""
} |
q31641 | Node._add_output | train | def _add_output(self, out):
""" Add as destination of output data
"""
self._outputs | python | {
"resource": ""
} |
q31642 | Node.add_input_opt | train | def add_input_opt(self, opt, inp):
""" Add an option that determines an input
"""
| python | {
"resource": ""
} |
q31643 | Node.add_output_opt | train | def add_output_opt(self, opt, out):
""" Add an option that determines an output
"""
| python | {
"resource": ""
} |
q31644 | Node.add_output_list_opt | train | def add_output_list_opt(self, opt, outputs):
""" Add an option that determines a list of outputs | python | {
"resource": ""
} |
q31645 | Node.add_input_list_opt | train | def add_input_list_opt(self, opt, inputs):
""" Add an option that determines a list of inputs | python | {
"resource": ""
} |
q31646 | Node.add_list_opt | train | def add_list_opt(self, opt, values):
""" Add an option with a list of non-file parameters.
"""
| python | {
"resource": ""
} |
q31647 | Node.add_input_arg | train | def add_input_arg(self, inp):
""" Add an input as an argument
"""
| python | {
"resource": ""
} |
q31648 | Node.add_output_arg | train | def add_output_arg(self, out):
""" Add an output as an argument
"""
| python | {
"resource": ""
} |
q31649 | Node.new_output_file_opt | train | def new_output_file_opt(self, opt, name):
""" Add an option and return a new file handle
"""
| python | {
"resource": ""
} |
q31650 | Node.add_profile | train | def add_profile(self, namespace, key, value, force=False):
""" Add profile information to this node at the DAX level
"""
try:
entry = dax.Profile(namespace, key, value)
self._dax_node.addProfile(entry)
except dax.DuplicateError:
| python | {
"resource": ""
} |
q31651 | Workflow.add_workflow | train | def add_workflow(self, workflow):
""" Add a sub-workflow to this workflow
This function adds a sub-workflow of Workflow class to this workflow.
Parent child relationships are determined by data dependencies
Parameters
----------
workflow : Workflow instance
... | python | {
"resource": ""
} |
q31652 | Workflow.add_node | train | def add_node(self, node):
""" Add a node to this workflow
This function adds nodes to the workflow. It also determines
parent/child relations from the DataStorage inputs to this job.
Parameters
----------
node : pycbc.workflow.pegasus_workflow.Node
A node th... | python | {
"resource": ""
} |
q31653 | Workflow.save | train | def save(self, filename=None, tc=None):
""" Write this workflow to DAX file
"""
if filename is None:
filename = self.filename
for sub in self.sub_workflows:
sub.save()
# FIXME this is ugly as pegasus 4.9.0 does not support the full
# transformati... | python | {
"resource": ""
} |
q31654 | File.has_pfn | train | def has_pfn(self, url, site=None):
""" Wrapper of the pegasus hasPFN function, that allows it to be called
outside of specific pegasus functions.
| python | {
"resource": ""
} |
q31655 | File.from_path | train | def from_path(cls, path):
"""Takes a path and returns a File object with the path as the PFN."""
urlparts = urlparse.urlsplit(path)
site = 'nonlocal'
if (urlparts.scheme == '' or urlparts.scheme == 'file'):
| python | {
"resource": ""
} |
q31656 | read_from_config | train | def read_from_config(cp, **kwargs):
"""Initializes a model from the given config file.
The section must have a ``name`` argument. The name argument corresponds to
the name of the class to initialize.
Parameters
----------
cp : WorkflowConfigParser
Config file parser to read.
\**kwa... | python | {
"resource": ""
} |
q31657 | read_distributions_from_config | train | def read_distributions_from_config(cp, section="prior"):
"""Returns a list of PyCBC distribution instances for a section in the
given configuration file.
Parameters
----------
cp : WorflowConfigParser
An open config file to read.
section : {"prior", string}
Prefix on section nam... | python | {
"resource": ""
} |
q31658 | read_params_from_config | train | def read_params_from_config(cp, prior_section='prior',
vargs_section='variable_args',
sargs_section='static_args'):
"""Loads static and variable parameters from a configuration file.
Parameters
----------
cp : WorkflowConfigParser
An open ... | python | {
"resource": ""
} |
q31659 | read_constraints_from_config | train | def read_constraints_from_config(cp, transforms=None,
constraint_section='constraint'):
"""Loads parameter constraints from a configuration file.
Parameters
----------
cp : WorkflowConfigParser
An open config parser to read from.
transforms : list, optional
... | python | {
"resource": ""
} |
q31660 | insert_injfilterrejector_option_group | train | def insert_injfilterrejector_option_group(parser):
"""Add options for injfilterrejector to executable."""
injfilterrejector_group = \
parser.add_argument_group(_injfilterrejector_group_help)
curr_arg = "--injection-filter-rejector-chirp-time-window"
injfilterrejector_group.add_argument(curr_arg,... | python | {
"resource": ""
} |
q31661 | InjFilterRejector.from_cli | train | def from_cli(cls, opt):
"""Create an InjFilterRejector instance from command-line options."""
injection_file = opt.injection_file
chirp_time_window = \
opt.injection_filter_rejector_chirp_time_window
match_threshold = opt.injection_filter_rejector_match_threshold
coar... | python | {
"resource": ""
} |
q31662 | InjFilterRejector.generate_short_inj_from_inj | train | def generate_short_inj_from_inj(self, inj_waveform, simulation_id):
"""Generate and a store a truncated representation of inj_waveform."""
if not self.enabled:
# Do nothing!
return
if simulation_id in self.short_injections:
err_msg = "An injection with simulat... | python | {
"resource": ""
} |
q31663 | InjFilterRejector.template_segment_checker | train | def template_segment_checker(self, bank, t_num, segment, start_time):
"""Test if injections in segment are worth filtering with template.
Using the current template, current segment, and injections within that
segment. Test if the injections and sufficiently "similar" to any of
the inje... | python | {
"resource": ""
} |
q31664 | fit_above_thresh | train | def fit_above_thresh(distr, vals, thresh=None):
"""
Maximum likelihood fit for the coefficient alpha
Fitting a distribution of discrete values above a given threshold.
Exponential p(x) = alpha exp(-alpha (x-x_t))
Rayleigh p(x) = alpha x exp(-alpha (x**2-x_t**2)/2)
Power p(x) = ((alp... | python | {
"resource": ""
} |
q31665 | fit_fn | train | def fit_fn(distr, xvals, alpha, thresh):
"""
The fitted function normalized to 1 above threshold
To normalize to a given total count multiply by the count.
Parameters
----------
xvals : sequence of floats
Values where the function is to be evaluated
| python | {
"resource": ""
} |
q31666 | tail_threshold | train | def tail_threshold(vals, N=1000):
"""Determine a threshold above which there are N louder values"""
vals = numpy.array(vals)
if len(vals) < N:
| python | {
"resource": ""
} |
q31667 | MultiTemperedAutocorrSupport.compute_acl | train | def compute_acl(cls, filename, start_index=None, end_index=None,
min_nsamples=10):
"""Computes the autocorrleation length for all model params and
temperatures in the given file.
Parameter values are averaged over all walkers at each iteration and
temperature. The A... | python | {
"resource": ""
} |
q31668 | pycbc_compile_function | train | def pycbc_compile_function(code,arg_names,local_dict,global_dict,
module_dir,
compiler='',
verbose=1,
support_code=None,
headers=None,
customize=None,
type_converters=None,
... | python | {
"resource": ""
} |
q31669 | convert_bank_to_hdf | train | def convert_bank_to_hdf(workflow, xmlbank, out_dir, tags=None):
"""Return the template bank in hdf format"""
if tags is None:
tags = []
#FIXME, make me not needed
if len(xmlbank) > 1:
raise ValueError('Can only convert a single template bank')
| python | {
"resource": ""
} |
q31670 | convert_trig_to_hdf | train | def convert_trig_to_hdf(workflow, hdfbank, xml_trigger_files, out_dir, tags=None):
"""Return the list of hdf5 trigger files outputs"""
if tags is None:
tags = []
#FIXME, make me not needed
logging.info('convert single inspiral trigger files to hdf5')
make_analysis_dir(out_dir)
trig_file... | python | {
"resource": ""
} |
q31671 | setup_multiifo_interval_coinc_inj | train | def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files,
stat_files, background_file, veto_file, veto_name,
out_dir, pivot_ifo, fixed_ifo, tags=None):
"""
This function sets up exact match multiifo ... | python | {
"resource": ""
} |
q31672 | setup_multiifo_interval_coinc | train | def setup_multiifo_interval_coinc(workflow, hdfbank, trig_files, stat_files,
veto_files, veto_names, out_dir, pivot_ifo, fixed_ifo, tags=None):
"""
This function sets up exact match multiifo coincidence
"""
if tags is None:
tags = []
make_analysis_dir(out_dir)
lo... | python | {
"resource": ""
} |
q31673 | setup_multiifo_combine_statmap | train | def setup_multiifo_combine_statmap(workflow, final_bg_file_list, out_dir, tags):
"""
Combine the multiifo statmap files into one background file
"""
if tags is None:
tags = []
make_analysis_dir(out_dir)
logging.info('Setting up multiifo combine statmap')
cstat_exe = PyCBCMultiifoCom... | python | {
"resource": ""
} |
q31674 | first_phase | train | def first_phase(invec, outvec, N1, N2):
"""
This implements the first phase of the FFT decomposition, using
the standard FFT many plans.
Parameters
-----------
invec : array
| python | {
"resource": ""
} |
q31675 | second_phase | train | def second_phase(invec, indices, N1, N2):
"""
This is the second phase of the FFT decomposition that actually performs
the pruning. It is an explicit calculation for the subset of points. Note
that there seem to be some numerical accumulation issues at various values
of N1 and N2.
Parameters
... | python | {
"resource": ""
} |
q31676 | splay | train | def splay(vec):
""" Determine two lengths to split stride the input vector | python | {
"resource": ""
} |
q31677 | pruned_c2cifft | train | def pruned_c2cifft(invec, outvec, indices, pretransposed=False):
"""
Perform a pruned iFFT, only valid for power of 2 iffts as the
decomposition is easier to choose. This is not a strict requirement of the
functions, but it is unlikely to the optimal to use anything but power
of 2. (Alex to provide ... | python | {
"resource": ""
} |
q31678 | fd_sine_gaussian | train | def fd_sine_gaussian(amp, quality, central_frequency, fmin, fmax, delta_f):
""" Generate a Fourier domain sine-Gaussian
Parameters
----------
amp: float
Amplitude of the sine-Gaussian
quality: float
The quality factor
central_frequency: float
The central frequency of the... | python | {
"resource": ""
} |
q31679 | columns_from_file_list | train | def columns_from_file_list(file_list, columns, ifo, start, end):
""" Return columns of information stored in single detector trigger
files.
Parameters
----------
file_list_file : string
pickle file containing the list of single detector
triggers.
ifo : string
The ifo to retu... | python | {
"resource": ""
} |
q31680 | make_padded_frequency_series | train | def make_padded_frequency_series(vec,filter_N=None):
"""Pad a TimeSeries with a length of zeros greater than its length, such
that the total length is the closest power of 2. This prevents the effects
of wraparound.
"""
if filter_N is None:
power = ceil(log(len(vec),2))+1
N = 2 ** po... | python | {
"resource": ""
} |
q31681 | insert_processing_option_group | train | def insert_processing_option_group(parser):
"""
Adds the options used to choose a processing scheme. This should be used
if your program supports the ability to select the processing scheme.
Parameters
----------
parser : object
OptionParser instance
"""
processing_group = parse... | python | {
"resource": ""
} |
q31682 | from_cli | train | def from_cli(opt):
"""Parses the command line options and returns a precessing scheme.
Parameters
----------
opt: object
Result of parsing the CLI with OptionParser, or any object with
the required attributes.
Returns
-------
ctx: Scheme
Returns the requested proces... | python | {
"resource": ""
} |
q31683 | verify_processing_options | train | def verify_processing_options(opt, parser):
"""Parses the processing scheme options and verifies that they are
reasonable.
Parameters
----------
opt : object
Result of parsing the CLI with OptionParser, or any object with the
required attributes.
parser : object
Opt... | python | {
"resource": ""
} |
q31684 | convert_to_sngl_inspiral_table | train | def convert_to_sngl_inspiral_table(params, proc_id):
'''
Convert a list of m1,m2,spin1z,spin2z values into a basic sngl_inspiral
table with mass and spin parameters populated and event IDs assigned
Parameters
-----------
params : iterable
Each entry in the params iterable should be a se... | python | {
"resource": ""
} |
q31685 | output_sngl_inspiral_table | train | def output_sngl_inspiral_table(outputFile, tempBank, metricParams,
ethincaParams, programName="", optDict = None,
outdoc=None, **kwargs):
"""
Function that converts the information produced by the various pyCBC bank
generation codes into a valid ... | python | {
"resource": ""
} |
q31686 | spa_length_in_time | train | def spa_length_in_time(**kwds):
"""
Returns the length in time of the template,
based on the masses, PN order, and low-frequency
cut-off.
"""
m1 = kwds['mass1']
m2 = kwds['mass2']
flow = kwds['f_lower']
porder = int(kwds['phase_order'])
# For now, we call the swig-wrapped functi... | python | {
"resource": ""
} |
q31687 | spa_tmplt_precondition | train | def spa_tmplt_precondition(length, delta_f, kmin=0):
"""Return the amplitude portion of the TaylorF2 approximant, used to precondition
the strain data. The result is cached, and so should not be modified only read.
"""
global _prec
if _prec is None or _prec.delta_f != delta_f or len(_prec) < length:... | python | {
"resource": ""
} |
q31688 | combine_and_copy | train | def combine_and_copy(f, files, group):
""" Combine the same column from multiple files and save to a third"""
f[group] = np.concatenate([fi[group][:] if group in fi else \
| python | {
"resource": ""
} |
q31689 | HFile.select | train | def select(self, fcn, *args, **kwds):
""" Return arrays from an hdf5 file that satisfy the given function
Parameters
----------
fcn : a function
A function that accepts the same number of argument as keys given
and returns a boolean array of the same length.
... | python | {
"resource": ""
} |
q31690 | DictArray.select | train | def select(self, idx):
""" Return a new DictArray containing only the indexed values
"""
data = {}
for k in self.data:
| python | {
"resource": ""
} |
q31691 | DictArray.remove | train | def remove(self, idx):
""" Return a new DictArray that does not contain the indexed values
"""
data = {}
for k in self.data:
| python | {
"resource": ""
} |
q31692 | FileData.mask | train | def mask(self):
"""
Create a mask implementing the requested filter on the datasets
Returns
-------
array of Boolean
True for dataset indices to be returned by the get_column method
"""
if self.filter_func is None:
raise RuntimeError("Can'... | python | {
"resource": ""
} |
q31693 | DataFromFiles.get_column | train | def get_column(self, col):
"""
Loop over files getting the requested dataset values from each
Parameters
----------
col : string
Name of the dataset to be returned
Returns
-------
numpy array
Values from the dataset, filtered if r... | python | {
"resource": ""
} |
q31694 | SingleDetTriggers.get_param_names | train | def get_param_names(cls):
"""Returns a list of plottable CBC parameter variables"""
| python | {
"resource": ""
} |
q31695 | create_new_output_file | train | def create_new_output_file(sampler, filename, force=False, injection_file=None,
**kwargs):
"""Creates a new output file.
If the output file already exists, an ``OSError`` will be raised. This can
be overridden by setting ``force`` to ``True``.
Parameters
----------
s... | python | {
"resource": ""
} |
q31696 | initial_dist_from_config | train | def initial_dist_from_config(cp, variable_params):
r"""Loads a distribution for the sampler start from the given config file.
A distribution will only be loaded if the config file has a [initial-\*]
section(s).
Parameters
----------
cp : Config parser
The config parser to try to load f... | python | {
"resource": ""
} |
q31697 | BaseSampler.setup_output | train | def setup_output(self, output_file, force=False, injection_file=None):
"""Sets up the sampler's checkpoint and output files.
The checkpoint file has the same name as the output file, but with
``.checkpoint`` appended to the name. A backup file will also be
created.
If the outpu... | python | {
"resource": ""
} |
q31698 | load_frequencyseries | train | def load_frequencyseries(path, group=None):
"""
Load a FrequencySeries 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
Addi... | python | {
"resource": ""
} |
q31699 | FrequencySeries.almost_equal_elem | train | def almost_equal_elem(self,other,tol,relative=True,dtol=0.0):
"""
Compare whether two frequency 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... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.