_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31800 | walk | train | def walk(chains, start, end, step):
""" Calculates Gelman-Rubin conervergence statistic along chains of data.
This function will advance along the chains and calculate the
statistic for each step.
Parameters
----------
chains : iterable
An iterable of numpy.array instances that contain ... | python | {
"resource": ""
} |
q31801 | Arbitrary.rvs | train | def rvs(self, size=1, param=None):
"""Gives a set of random values drawn from the kde.
Parameters
----------
size : {1, int}
The number of values to generate; default is 1.
param : {None, string}
If provided, will just return values for the given paramete... | python | {
"resource": ""
} |
q31802 | FromFile.get_arrays_from_file | train | def get_arrays_from_file(params_file, params=None):
"""Reads the values of one or more parameters from an hdf file and
returns as a dictionary.
Parameters
----------
params_file : str
The hdf file that contains the values of the parameters.
params : {None, li... | python | {
"resource": ""
} |
q31803 | block | train | def block(seed):
""" Return block of normal random numbers
Parameters
----------
seed : {None, int}
The seed to generate the noise.sd
Returns
--------
noise : numpy.ndarray
Array of random numbers
"""
num | python | {
"resource": ""
} |
q31804 | colored_noise | train | def colored_noise(psd, start_time, end_time, seed=0, low_frequency_cutoff=1.0):
""" Create noise from a PSD
Return noise from the chosen PSD. Note that if unique noise is desired
a unique seed should be provided.
Parameters
----------
psd : pycbc.types.FrequencySeries
PSD to color the ... | python | {
"resource": ""
} |
q31805 | EmceePTFile.write_sampler_metadata | train | def write_sampler_metadata(self, sampler):
"""Adds writing betas to MultiTemperedMCMCIO.
"""
super(EmceePTFile, | python | {
"resource": ""
} |
q31806 | EmceePTFile.write_acceptance_fraction | train | def write_acceptance_fraction(self, acceptance_fraction):
"""Write acceptance_fraction data to file.
Results are written to ``[sampler_group]/acceptance_fraction``; the
resulting dataset has shape (ntemps, nwalkers).
Parameters
-----------
acceptance_fraction : numpy.nd... | python | {
"resource": ""
} |
q31807 | findchirp_cluster_over_window | train | def findchirp_cluster_over_window(times, values, window_length):
""" Reduce the events by clustering over a window using
the FindChirp clustering algorithm
Parameters
-----------
indices: Array
The list of indices of the SNR values
snr: Array
The list of SNR value
window_siz... | python | {
"resource": ""
} |
q31808 | cluster_reduce | train | def cluster_reduce(idx, snr, window_size):
""" Reduce the events by clustering over a window
Parameters
-----------
indices: Array
The list of indices of the SNR values
snr: Array
The list of SNR value
window_size: int
The size of the window in integer samples.
Retu... | python | {
"resource": ""
} |
q31809 | EventManager.from_multi_ifo_interface | train | def from_multi_ifo_interface(cls, opt, ifo, column, column_types, **kwds):
"""
To use this for a single ifo from the multi ifo interface requires
some small fixing of the opt structure. This does that. As we edit the
opt structure the process_params table will not be correct.
"""... | python | {
"resource": ""
} |
q31810 | EventManager.newsnr_threshold | train | def newsnr_threshold(self, threshold):
""" Remove events with newsnr smaller than given threshold
"""
if not self.opt.chisq_bins:
raise RuntimeError('Chi-square test must be enabled in order | python | {
"resource": ""
} |
q31811 | EventManager.save_performance | train | def save_performance(self, ncores, nfilters, ntemplates, run_time,
setup_time):
"""
Calls variables from pycbc_inspiral to be used in a timing calculation
"""
self.run_time = run_time
self.setup_time = setup_time | python | {
"resource": ""
} |
q31812 | EventManager.write_events | train | def write_events(self, outname):
""" Write the found events to a sngl inspiral table
"""
self.make_output_dir(outname)
if '.hdf' in outname:
| python | {
"resource": ""
} |
q31813 | EmceePTSampler.model_stats | train | def model_stats(self):
"""Returns the log likelihood ratio and log prior as a dict of arrays.
The returned array has shape ntemps x nwalkers x niterations.
Unfortunately, because ``emcee_pt`` does not have blob support, this
will only return the loglikelihood and logprior (with the log... | python | {
"resource": ""
} |
q31814 | EmceePTSampler.clear_samples | train | def clear_samples(self):
"""Clears the chain and blobs from memory.
"""
# store the iteration that the clear is occuring on
self._lastclear = self.niterations
| python | {
"resource": ""
} |
q31815 | EmceePTSampler.run_mcmc | train | def run_mcmc(self, niterations):
"""Advance the ensemble for a number of samples.
Parameters
----------
niterations : int
Number of samples to get from sampler.
"""
pos = self._pos
if pos is | python | {
"resource": ""
} |
q31816 | EmceePTSampler.calculate_logevidence | train | def calculate_logevidence(cls, filename, thin_start=None, thin_end=None,
thin_interval=None):
"""Calculates the log evidence from the given file using ``emcee_pt``'s
thermodynamic integration.
Parameters
----------
filename : str
Name of... | python | {
"resource": ""
} |
q31817 | EmceePTSampler.finalize | train | def finalize(self):
"""Calculates the log evidence and writes to the checkpoint file.
The thin start/interval/end for calculating the log evidence are
retrieved from the checkpoint file's thinning attributes.
"""
logging.info("Calculating log evidence")
# get the thinnin... | python | {
"resource": ""
} |
q31818 | losc_frame_json | train | def losc_frame_json(ifo, start_time, end_time):
""" Get the information about the public data files in a duration of time
Parameters
----------
ifo: str
The name of the IFO to find the information about.
start_time: int
The gps time in GPS seconds
end_time: int
The end t... | python | {
"resource": ""
} |
q31819 | losc_frame_urls | train | def losc_frame_urls(ifo, start_time, end_time):
""" Get a list of urls to losc frame files
Parameters
----------
ifo: str
The name of the IFO to find the information about.
start_time: int
The gps time in GPS seconds
end_time: int
The end time in GPS seconds
Returns... | python | {
"resource": ""
} |
q31820 | read_frame_losc | train | def read_frame_losc(channels, start_time, end_time):
""" Read channels from losc data
Parameters
----------
channels: str or list
The channel name to read or list of channel names.
start_time: int
The gps time in GPS seconds
end_time: int
The end time in GPS seconds
... | python | {
"resource": ""
} |
q31821 | read_strain_losc | train | def read_strain_losc(ifo, start_time, end_time):
""" Get the strain data from the LOSC data
Parameters
----------
ifo: str
The name of the IFO to read data for. Ex. 'H1', 'L1', 'V1'
start_time: int
The gps time in GPS seconds
end_time: int
The end time in GPS seconds
| python | {
"resource": ""
} |
q31822 | background_bin_from_string | train | def background_bin_from_string(background_bins, data):
""" Return template ids for each bin as defined by the format string
Parameters
----------
bins: list of strings
List of strings which define how a background bin is taken from the
list of templates.
data: dict of numpy.ndarrays... | python | {
"resource": ""
} |
q31823 | calculate_n_louder | train | def calculate_n_louder(bstat, fstat, dec, skip_background=False):
""" Calculate for each foreground event the number of background events
that are louder than it.
Parameters
----------
bstat: numpy.ndarray
Array of the background statistic values
fstat: numpy.ndarray
Array of th... | python | {
"resource": ""
} |
q31824 | timeslide_durations | train | def timeslide_durations(start1, start2, end1, end2, timeslide_offsets):
""" Find the coincident time for each timeslide.
Find the coincident time for each timeslide, where the first time vector
is slid to the right by the offset in the given timeslide_offsets vector.
Parameters
----------
star... | python | {
"resource": ""
} |
q31825 | time_coincidence | train | def time_coincidence(t1, t2, window, slide_step=0):
""" Find coincidences by time window
Parameters
----------
t1 : numpy.ndarray
Array of trigger times from the first detector
t2 : numpy.ndarray
Array of trigger times from the second detector
window : float
The coincide... | python | {
"resource": ""
} |
q31826 | time_multi_coincidence | train | def time_multi_coincidence(times, slide_step=0, slop=.003,
pivot='H1', fixed='L1'):
""" Find multi detector concidences.
Parameters
----------
times: dict of numpy.ndarrays
Dictionary keyed by ifo of the times of each single detector trigger.
slide_step: float
... | python | {
"resource": ""
} |
q31827 | mean_if_greater_than_zero | train | def mean_if_greater_than_zero(vals):
""" Calculate mean over numerical values, ignoring values less than zero.
E.g. used for mean time over coincident triggers when timestamps are set
to -1 for ifos not included in the coincidence.
Parameters
----------
| python | {
"resource": ""
} |
q31828 | cluster_over_time | train | def cluster_over_time(stat, time, window, argmax=numpy.argmax):
"""Cluster generalized transient events over time via maximum stat over a
symmetric sliding window
Parameters
----------
stat: numpy.ndarray
vector of ranking values to maximize
time: numpy.ndarray
time to use for c... | python | {
"resource": ""
} |
q31829 | MultiRingBuffer.discard_last | train | def discard_last(self, indices):
"""Discard the triggers added in the latest update"""
for i in indices:
| python | {
"resource": ""
} |
q31830 | MultiRingBuffer.add | train | def add(self, indices, values):
"""Add triggers in 'values' to the buffers indicated by the indices
"""
for i, v in | python | {
"resource": ""
} |
q31831 | MultiRingBuffer.data | train | def data(self, buffer_index):
"""Return the data vector for a given ring buffer"""
# Check for expired elements and discard if they exist
expired = self.time - self.max_time
exp = self.buffer_expire[buffer_index]
j = 0
while j < len(exp):
# Everything bef... | python | {
"resource": ""
} |
q31832 | CoincExpireBuffer.add | train | def add(self, values, times, ifos):
"""Add values to the internal buffer
Parameters
----------
values: numpy.ndarray
Array of elements to add to the internal buffer.
times: dict of arrays
The current time to use for each element being added.
ifos:... | python | {
"resource": ""
} |
q31833 | LiveCoincTimeslideBackgroundEstimator.pick_best_coinc | train | def pick_best_coinc(cls, coinc_results):
"""Choose the best two-ifo coinc by ifar first, then statistic if needed.
This function picks which of the available double-ifo coincs to use.
It chooses the best (highest) ifar. The ranking statistic is used as
a tie-breaker.
A trials fa... | python | {
"resource": ""
} |
q31834 | LiveCoincTimeslideBackgroundEstimator.background_time | train | def background_time(self):
"""Return the amount of background time that the buffers contain"""
time = 1.0 / self.timeslide_interval
for ifo in | python | {
"resource": ""
} |
q31835 | LiveCoincTimeslideBackgroundEstimator.ifar | train | def ifar(self, coinc_stat):
"""Return the far that would be associated with the coincident given.
"""
| python | {
"resource": ""
} |
q31836 | LiveCoincTimeslideBackgroundEstimator.set_singles_buffer | train | def set_singles_buffer(self, results):
"""Create the singles buffer
This creates the singles buffer for each ifo. The dtype is determined
by a representative sample of the single triggers in the results.
Parameters
----------
restuls: dict of dict
Dict index... | python | {
"resource": ""
} |
q31837 | LiveCoincTimeslideBackgroundEstimator._add_singles_to_buffer | train | def _add_singles_to_buffer(self, results, ifos):
"""Add single detector triggers to the internal buffer
Parameters
----------
results: dict of arrays
Dictionary of dictionaries indexed by ifo and keys such as 'snr',
'chisq', etc. The specific format it determined... | python | {
"resource": ""
} |
q31838 | LiveCoincTimeslideBackgroundEstimator.backout_last | train | def backout_last(self, updated_singles, num_coincs):
"""Remove the recently added singles and coincs
Parameters
----------
updated_singles: dict of numpy.ndarrays
Array of indices that have been just updated in the internal
buffers of single detector triggers.
... | python | {
"resource": ""
} |
q31839 | LiveCoincTimeslideBackgroundEstimator.add_singles | train | def add_singles(self, results):
"""Add singles to the bacckground estimate and find candidates
Parameters
----------
results: dict of arrays
Dictionary of dictionaries indexed by ifo and keys such as 'snr',
'chisq', etc. The specific format it determined by the
... | python | {
"resource": ""
} |
q31840 | IndependentChiPChiEff._constraints | train | def _constraints(self, values):
"""Applies physical constraints to the given parameter values.
Parameters
----------
values : {arr or dict}
A dictionary or structured array giving the values.
Returns
-------
bool
Whether or not the values... | python | {
"resource": ""
} |
q31841 | IndependentChiPChiEff._draw | train | def _draw(self, size=1, **kwargs):
"""Draws random samples without applying physical constrains.
"""
# draw masses
try:
mass1 = kwargs['mass1']
except KeyError:
mass1 = self.mass1_distr.rvs(size=size)['mass1']
try:
mass2 = kwargs['mass2... | python | {
"resource": ""
} |
q31842 | IndependentChiPChiEff.rvs | train | def rvs(self, size=1, **kwargs):
"""Returns random values for all of the parameters.
"""
size = int(size)
dtype = [(p, float) for p in self.params]
arr = numpy.zeros(size, dtype=dtype)
| python | {
"resource": ""
} |
q31843 | get_source | train | def get_source(source):
"""Get the source data for a particular GW catalog
"""
if source == 'gwtc-1':
fname = download_file(gwtc1_url, cache=True)
data = json.load(open(fname, 'r'))
| python | {
"resource": ""
} |
q31844 | init_logging | train | def init_logging(verbose=False, format='%(asctime)s %(message)s'):
""" Common utility for setting up logging in PyCBC.
Installs a signal handler such that verbosity can be activated at
run-time by sending a SIGUSR1 to the process.
"""
def sig_handler(signum, frame):
logger = logging.getLogg... | python | {
"resource": ""
} |
q31845 | makedir | train | def makedir(path):
"""
Make the analysis directory path and any parent directories that don't
already exist. Will do nothing if path already exists.
""" | python | {
"resource": ""
} |
q31846 | check_output_error_and_retcode | train | def check_output_error_and_retcode(*popenargs, **kwargs):
"""
This function is used to obtain the stdout of a command. It is only used
internally, recommend using the make_external_call command if you want
to call external executables.
"""
if 'stdout' in kwargs:
raise ValueError('stdout ... | python | {
"resource": ""
} |
q31847 | get_full_analysis_chunk | train | def get_full_analysis_chunk(science_segs):
"""
Function to find the first and last time point contained in the science segments
and return a single segment spanning that full time.
Parameters
-----------
science_segs : ifo-keyed dictionary of ligo.segments.segmentlist instances
The list... | python | {
"resource": ""
} |
q31848 | get_random_label | train | def get_random_label():
"""
Get a random label string to use when clustering jobs.
"""
| python | {
"resource": ""
} |
q31849 | Executable.ifo | train | def ifo(self):
"""Return the ifo.
If only one ifo in the ifo list this will be that ifo. Otherwise an
error is raised.
"""
if self.ifo_list and len(self.ifo_list) == 1:
return self.ifo_list[0]
else:
| python | {
"resource": ""
} |
q31850 | Executable.add_ini_profile | train | def add_ini_profile(self, cp, sec):
"""Add profile from configuration file.
Parameters
-----------
cp : ConfigParser object
The ConfigParser object holding the workflow configuration settings
sec : string
The section containing options for this job.
... | python | {
"resource": ""
} |
q31851 | Executable.add_ini_opts | train | def add_ini_opts(self, cp, sec):
"""Add job-specific options from configuration file.
Parameters
-----------
cp : ConfigParser object
The ConfigParser object holding the workflow configuration settings
sec : string
The section containing options for this ... | python | {
"resource": ""
} |
q31852 | Executable.add_opt | train | def add_opt(self, opt, value=None):
"""Add option to job.
Parameters
-----------
opt : string
Name of option (e.g. --output-file-format)
value : string, (default=None)
The value for the option (no value if set to None).
| python | {
"resource": ""
} |
q31853 | Executable.get_opt | train | def get_opt(self, opt):
"""Get value of option from configuration file
Parameters
-----------
opt : string
Name of option (e.g. output-file-format)
Returns
--------
value : string
The value for the option. Returns None if option not prese... | python | {
"resource": ""
} |
q31854 | Executable.has_opt | train | def has_opt(self, opt):
"""Check if option is present in configuration file
Parameters
-----------
opt : string
Name of option (e.g. output-file-format)
"""
for sec | python | {
"resource": ""
} |
q31855 | Executable.update_current_retention_level | train | def update_current_retention_level(self, value):
"""Set a new value for the current retention level.
This updates the value of self.retain_files for an updated value of the
retention level.
Parameters
-----------
value : int
The new value to use for the rete... | python | {
"resource": ""
} |
q31856 | Executable.update_current_tags | train | def update_current_tags(self, tags):
"""Set a new set of tags for this executable.
Update the set of tags that this job will use. This updated default
file naming and shared options. It will *not* update the pegasus
profile, which belong to the executable and cannot be different for
... | python | {
"resource": ""
} |
q31857 | Executable.update_output_directory | train | def update_output_directory(self, out_dir=None):
"""Update the default output directory for output files.
Parameters
-----------
out_dir : string (optional, default=None)
If provided use this as the output directory. Else choose this
automatically from the tags.
... | python | {
"resource": ""
} |
q31858 | Executable._set_pegasus_profile_options | train | def _set_pegasus_profile_options(self):
"""Set the pegasus-profile settings for this Executable.
These are a property of the Executable and not of nodes that it will
spawn. Therefore it *cannot* be updated without also changing values
for nodes that might already have been created. Ther... | python | {
"resource": ""
} |
q31859 | Workflow.execute_node | train | def execute_node(self, node, verbatim_exe = False):
""" Execute this node immediately on the local machine
"""
node.executed = True
# Check that the PFN is for a file or path
if node.executable.needs_fetching:
try:
# The pfn may have been marked local... | python | {
"resource": ""
} |
q31860 | Workflow.save_config | train | def save_config(self, fname, output_dir, cp=None):
""" Writes configuration file to disk and returns a pycbc.workflow.File
instance for the configuration file.
Parameters
-----------
fname : string
The filename of the configuration file written to disk.
outpu... | python | {
"resource": ""
} |
q31861 | Node.new_output_file_opt | train | def new_output_file_opt(self, valid_seg, extension, option_name, tags=None,
store_file=None, use_tmp_subdirs=False):
"""
This function will create a workflow.File object corresponding to the given
information and then add that file as output of this node.
Par... | python | {
"resource": ""
} |
q31862 | Node.output_file | train | def output_file(self):
"""
If only one output file return it. Otherwise raise an exception.
"""
out_files = self.output_files
if len(out_files) != 1:
err_msg = "output_file property is only valid if there is a single"
| python | {
"resource": ""
} |
q31863 | File.ifo | train | def ifo(self):
"""
If only one ifo in the ifo_list this will be that ifo. Otherwise an
error is raised.
"""
if len(self.ifo_list) == 1:
return self.ifo_list[0]
else:
| python | {
"resource": ""
} |
q31864 | File.segment | train | def segment(self):
"""
If only one segment in the segmentlist this will be that segment.
Otherwise an error is raised.
"""
if len(self.segment_list) == 1:
return self.segment_list[0]
else:
| python | {
"resource": ""
} |
q31865 | File.cache_entry | train | def cache_entry(self):
"""
Returns a CacheEntry instance for File.
"""
if self.storage_path is None:
raise ValueError('This file is temporary and so a lal '
'cache entry cannot be made')
file_url = urlparse.urlunparse(['file', 'localhost'... | python | {
"resource": ""
} |
q31866 | File._filename | train | def _filename(self, ifo, description, extension, segment):
"""
Construct the standard output filename. Should only be used internally
of the File class.
"""
if extension.startswith('.'):
extension = extension[1:]
# Follow the frame convention of using integer... | python | {
"resource": ""
} |
q31867 | FileList.find_output_at_time | train | def find_output_at_time(self, ifo, time):
'''
Return File that covers the given time.
Parameters
-----------
ifo : string
Name of the ifo (or ifos) that the File should correspond to
time : int/float/LIGOGPStime
Return the Files that covers the supp... | python | {
"resource": ""
} |
q31868 | FileList.find_outputs_in_range | train | def find_outputs_in_range(self, ifo, current_segment, useSplitLists=False):
"""
Return the list of Files that is most appropriate for the supplied
time range. That is, the Files whose coverage time has the
largest overlap with the supplied time range.
Parameters
--------... | python | {
"resource": ""
} |
q31869 | FileList.find_output_in_range | train | def find_output_in_range(self, ifo, start, end):
'''
Return the File that is most appropriate for the supplied
time range. That is, the File whose coverage time has the
largest overlap with the supplied time range. If no Files
overlap the supplied time window, will return None.
... | python | {
"resource": ""
} |
q31870 | FileList.find_all_output_in_range | train | def find_all_output_in_range(self, ifo, currSeg, useSplitLists=False):
"""
Return all files that overlap the specified segment.
"""
if not useSplitLists:
# Slower, but simpler method
outFiles = [i for i in self if ifo in i.ifo_list]
outFiles = [i for i... | python | {
"resource": ""
} |
q31871 | FileList.find_output_with_tag | train | def find_output_with_tag(self, tag):
"""
Find all files who have tag in self.tags
| python | {
"resource": ""
} |
q31872 | FileList.find_output_without_tag | train | def find_output_without_tag(self, tag):
"""
Find all files who do not have tag in self.tags
| python | {
"resource": ""
} |
q31873 | FileList.find_output_with_ifo | train | def find_output_with_ifo(self, ifo):
"""
Find all files who have ifo = ifo
| python | {
"resource": ""
} |
q31874 | FileList.get_times_covered_by_files | train | def get_times_covered_by_files(self):
"""
Find the coalesced intersection of the segments of all files in the
list.
"""
times = segments.segmentlist([])
| python | {
"resource": ""
} |
q31875 | FileList.convert_to_lal_cache | train | def convert_to_lal_cache(self):
"""
Return all files in this object as a glue.lal.Cache object
"""
lal_cache = gluelal.Cache([])
for entry in self:
try:
| python | {
"resource": ""
} |
q31876 | FileList._check_split_list_validity | train | def _check_split_list_validity(self):
"""
See _temporal_split_list above. This function checks if the current
split lists are still valid.
"""
# FIXME: Currently very primitive, but needs to be fast
| python | {
"resource": ""
} |
q31877 | FileList.dump | train | def dump(self, filename):
"""
Output this AhopeFileList to a pickle file
"""
| python | {
"resource": ""
} |
q31878 | FileList.to_file_object | train | def to_file_object(self, name, out_dir):
"""Dump to a pickle file and return an File object reference of this list
Parameters
----------
name : str
An identifier of this file. Needs to be unique.
out_dir : path
path to place this file
Returns
... | python | {
"resource": ""
} |
q31879 | SegFile.from_segment_list | train | def from_segment_list(cls, description, segmentlist, name, ifo,
seg_summ_list=None, **kwargs):
""" Initialize a SegFile object from a segmentlist.
Parameters
------------
description : string (required)
See File.__init__
segmentlist : ligo.s... | python | {
"resource": ""
} |
q31880 | SegFile.from_multi_segment_list | train | def from_multi_segment_list(cls, description, segmentlists, names, ifos,
seg_summ_lists=None, **kwargs):
""" Initialize a SegFile object from a list of segmentlists.
Parameters
------------
description : string (required)
See File.__init__
... | python | {
"resource": ""
} |
q31881 | SegFile.from_segment_list_dict | train | def from_segment_list_dict(cls, description, segmentlistdict,
ifo_list=None, valid_segment=None,
file_exists=False, seg_summ_dict=None,
**kwargs):
""" Initialize a SegFile object from a segmentlistdict.
Paramet... | python | {
"resource": ""
} |
q31882 | SegFile.from_segment_xml | train | def from_segment_xml(cls, xml_file, **kwargs):
"""
Read a ligo.segments.segmentlist from the file object file containing an
xml segment table.
Parameters
-----------
xml_file : file object
file object for segment xml file
"""
# load xmldocumen... | python | {
"resource": ""
} |
q31883 | SegFile.remove_short_sci_segs | train | def remove_short_sci_segs(self, minSegLength):
"""
Function to remove all science segments
shorter than a specific length. Also updates the file on disk to remove
these segments.
Parameters
-----------
minSegLength : int
Maximum length of science segm... | python | {
"resource": ""
} |
q31884 | SegFile.parse_segdict_key | train | def parse_segdict_key(self, key):
"""
Return ifo and name from the segdict key.
"""
splt = key.split(':')
if len(splt) == 2:
return splt[0], splt[1]
else: | python | {
"resource": ""
} |
q31885 | SegFile.to_segment_xml | train | def to_segment_xml(self, override_file_if_exists=False):
"""
Write the segment list in self.segmentList to self.storage_path.
"""
# create XML doc and add process table
outdoc = ligolw.Document()
outdoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.regist... | python | {
"resource": ""
} |
q31886 | complex_median | train | def complex_median(complex_list):
""" Get the median value of a list of complex numbers.
Parameters
----------
complex_list: list
List of complex numbers to calculate the median.
Returns
-------
a + 1.j*b: complex number
The median of the real and imaginary parts.
"""
... | python | {
"resource": ""
} |
q31887 | avg_inner_product | train | def avg_inner_product(data1, data2, bin_size):
""" Calculate the time-domain inner product averaged over bins.
Parameters
----------
data1: pycbc.types.TimeSeries
First data set.
data2: pycbc.types.TimeSeries
Second data set, with same duration and sample rate as data1.
bin_size... | python | {
"resource": ""
} |
q31888 | line_model | train | def line_model(freq, data, tref, amp=1, phi=0):
""" Simple time-domain model for a frequency line.
Parameters
----------
freq: float
Frequency of the line.
data: pycbc.types.TimeSeries
Reference data, to get delta_t, start_time, duration and sample_times.
tref: float
Ref... | python | {
"resource": ""
} |
q31889 | matching_line | train | def matching_line(freq, data, tref, bin_size=1):
""" Find the parameter of the line with frequency 'freq' in the data.
Parameters
----------
freq: float
Frequency of the line to find in the data.
data: pycbc.types.TimeSeries
Data from which the line wants to be measured.
tref: f... | python | {
"resource": ""
} |
q31890 | calibration_lines | train | def calibration_lines(freqs, data, tref=None):
""" Extract the calibration lines from strain data.
Parameters
----------
freqs: list
List containing the frequencies of the calibration lines.
data: pycbc.types.TimeSeries
Strain data to extract the calibration lines from.
tref: {N... | python | {
"resource": ""
} |
q31891 | compute_inj_optimal_snr | train | def compute_inj_optimal_snr(workflow, inj_file, precalc_psd_files, out_dir,
tags=None):
"Set up a job for computing optimal SNRs of a sim_inspiral file."
if tags is None:
tags = []
node = Executable(workflow.cp, 'optimal_snr', ifos=workflow.ifos,
ou... | python | {
"resource": ""
} |
q31892 | cut_distant_injections | train | def cut_distant_injections(workflow, inj_file, out_dir, tags=None):
"Set up a job for removing injections that are too distant to be seen"
if tags is None:
tags = []
node = Executable(workflow.cp, 'inj_cut', ifos=workflow.ifos,
| python | {
"resource": ""
} |
q31893 | read_sampling_params_from_config | train | def read_sampling_params_from_config(cp, section_group=None,
section='sampling_params'):
"""Reads sampling parameters from the given config file.
Parameters are read from the `[({section_group}_){section}]` section.
The options should list the variable args to transform... | python | {
"resource": ""
} |
q31894 | ModelStats.getstats | train | def getstats(self, names, default=numpy.nan):
"""Get the requested stats as a tuple.
If a requested stat is not an attribute (implying it hasn't been
stored), then the default value is returned for that stat.
Parameters
----------
names : list of str
The nam... | python | {
"resource": ""
} |
q31895 | ModelStats.getstatsdict | train | def getstatsdict(self, names, default=numpy.nan):
"""Get the requested stats as a dictionary.
If a requested stat is not an attribute (implying it hasn't been
stored), then the default value is returned for that stat.
Parameters
----------
names : list of str
... | python | {
"resource": ""
} |
q31896 | SamplingTransforms.logjacobian | train | def logjacobian(self, **params):
r"""Returns the log of the jacobian needed to transform pdfs in the
``variable_params`` parameter space to the ``sampling_params``
parameter space.
Let :math:`\mathbf{x}` be the set of variable parameters,
:math:`\mathbf{y} = f(\mathbf{x})` the s... | python | {
"resource": ""
} |
q31897 | SamplingTransforms.apply | train | def apply(self, samples, inverse=False):
"""Applies the sampling transforms to the given samples.
Parameters
----------
samples : dict or FieldArray
The samples to apply the transforms to.
inverse : bool, optional
Whether to apply the inverse transforms (... | python | {
"resource": ""
} |
q31898 | SamplingTransforms.from_config | train | def from_config(cls, cp, variable_params):
"""Gets sampling transforms specified in a config file.
Sampling parameters and the parameters they replace are read from the
``sampling_params`` section, if it exists. Sampling transforms are
read from the ``sampling_transforms`` section(s), u... | python | {
"resource": ""
} |
q31899 | BaseModel.sampling_params | train | def sampling_params(self):
"""Returns the sampling parameters.
If ``sampling_transforms`` is None, this is the same as the
``variable_params``.
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.