_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q31400
pvector_field
train
def pvector_field(item_type, optional=False, initial=()): """ Create checked ``PVector`` field. :param item_type: The required type for the items in the vector. :param optional: If true, ``None`` can be used as a value for this field. :param initial: Initial value to pass to factory if no v...
python
{ "resource": "" }
q31401
_restore_pmap_field_pickle
train
def _restore_pmap_field_pickle(key_type, value_type, data): """Unpickling function for auto-generated PMap field types.""" type_
python
{ "resource": "" }
q31402
_make_pmap_field_type
train
def _make_pmap_field_type(key_type, value_type): """Create a subclass of CheckedPMap with the given key and value types.""" type_ = _pmap_field_types.get((key_type, value_type)) if type_ is not None: return type_ class TheMap(CheckedPMap): __key_type__ = key_type
python
{ "resource": "" }
q31403
pmap_field
train
def pmap_field(key_type, value_type, optional=False, invariant=PFIELD_NO_INVARIANT): """ Create a checked ``PMap`` field. :param key: The required type for the keys of the map. :param value: The required type for the values of the map. :param optional: If true, ``None`` can be used as a value for ...
python
{ "resource": "" }
q31404
PyKeyboardMeta.tap_key
train
def tap_key(self, character='', n=1, interval=0): """Press and release a given character key n times.""" for i in range(n):
python
{ "resource": "" }
q31405
PyKeyboardMeta.type_string
train
def type_string(self, char_string, interval=0): """ A convenience method for typing longer strings of characters. Generates as few Shift events as possible.""" shift = False for char in char_string: if self.is_char_shifted(char): if not shift: # Only ...
python
{ "resource": "" }
q31406
keysym_definitions
train
def keysym_definitions(): """Yields all keysym definitions parsed as tuples. """ for keysym_line in keysym_lines(): # As described in the input text, the format of a line is: # 0x20 U0020 . # space /* optional comment */ keysym_number, codepoint, status, _, name_part = [
python
{ "resource": "" }
q31407
PyKeyboard.release_key
train
def release_key(self, character=''): """ Release a given character key. """ try: shifted = self.is_char_shifted(character) except AttributeError: win32api.keybd_event(character, 0, KEYEVENTF_KEYUP, 0) else:
python
{ "resource": "" }
q31408
PyKeyboard._handle_key
train
def _handle_key(self, character, event): """Handles either a key press or release, depending on ``event``. :param character: The key to handle. See :meth:`press_key` and :meth:`release_key` for information about this parameter. :param event: The *Xlib* event. This should be either ...
python
{ "resource": "" }
q31409
PyKeyboardEvent.stop
train
def stop(self): """Stop listening for keyboard input events.""" self.state = False with display_manager(self.display) as d:
python
{ "resource": "" }
q31410
PyKeyboardEvent.lookup_char_from_keycode
train
def lookup_char_from_keycode(self, keycode): """ This will conduct a lookup of the character or string associated with a given keycode. """ #TODO: Logic should be strictly adapted from X11's src/KeyBind.c #Right now the logic is based off of #http://tronche.com/g...
python
{ "resource": "" }
q31411
PyKeyboardEvent.get_translation_dicts
train
def get_translation_dicts(self): """ Returns dictionaries for the translation of keysyms to strings and from strings to keysyms. """ keysym_to_string_dict = {} string_to_keysym_dict = {} #XK loads latin1 and miscellany on its own; load latin2-4 and greek X...
python
{ "resource": "" }
q31412
PyKeyboardEvent.ascii_printable
train
def ascii_printable(self, keysym): """ If the keysym corresponds to a non-printable ascii character this will return False. If it is printable, then True will be returned. ascii 11 (vertical tab) and ascii 12 are printable, chr(11) and chr(12) will return '\x0b' and '\x0c' respe...
python
{ "resource": "" }
q31413
Clickonacci.click
train
def click(self, x, y, button, press): '''Print Fibonacci numbers when the left click is pressed.''' if button == 1: if press:
python
{ "resource": "" }
q31414
PyMouseMeta.click
train
def click(self, x, y, button=1, n=1): """ Click a mouse button n times on a given x, y. Button is defined
python
{ "resource": "" }
q31415
NodeMixin.siblings
train
def siblings(self): """ Tuple of nodes with the same parent. >>> from anytree import Node >>> udo = Node("Udo") >>> marc = Node("Marc", parent=udo) >>> lian = Node("Lian", parent=marc) >>> loui = Node("Loui", parent=marc) >>> lazy = Node("Lazy", parent=ma...
python
{ "resource": "" }
q31416
NodeMixin.height
train
def height(self): """ Number of edges on the longest path to a leaf `Node`. >>> from anytree import Node >>> udo = Node("Udo") >>> marc = Node("Marc", parent=udo)
python
{ "resource": "" }
q31417
JsonImporter.import_
train
def import_(self, data): """Read JSON from `data`."""
python
{ "resource": "" }
q31418
JsonImporter.read
train
def read(self, filehandle): """Read JSON from `filehandle`.""" return
python
{ "resource": "" }
q31419
Walker.walk
train
def walk(self, start, end): """ Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: WalkError: on no c...
python
{ "resource": "" }
q31420
JsonExporter.export
train
def export(self, node): """Return JSON for tree starting at `node`.""" dictexporter = self.dictexporter or DictExporter()
python
{ "resource": "" }
q31421
JsonExporter.write
train
def write(self, node, filehandle): """Write JSON to `filehandle` starting at `node`."""
python
{ "resource": "" }
q31422
findall
train
def findall(node, filter_=None, stop=None, maxlevel=None, mincount=None, maxcount=None): """ Search nodes matching `filter_` but stop at `maxlevel` or `stop`. Return tuple with matching nodes. Args: node: top node, start searching. Keyword Args: filter_: function called with every...
python
{ "resource": "" }
q31423
findall_by_attr
train
def findall_by_attr(node, value, name="name", maxlevel=None, mincount=None, maxcount=None): """ Search nodes with attribute `name` having `value` but stop at `maxlevel`. Return tuple with matching nodes. Args: node: top node, start searching. value: value which need to match Keywo...
python
{ "resource": "" }
q31424
Resolver.get
train
def get(self, node, path): """ Return instance at `path`. An example module tree: >>> from anytree import Node >>> top = Node("top", parent=None) >>> sub0 = Node("sub0", parent=top) >>> sub0sub0 = Node("sub0sub0", parent=sub0) >>> sub0sub1 = Node("sub0su...
python
{ "resource": "" }
q31425
Resolver.glob
train
def glob(self, node, path): """ Return instances at `path` supporting wildcards. Behaves identical to :any:`get`, but accepts wildcards and returns a list of found nodes. * `*` matches any characters, except '/'. * `?` matches a single character, except '/'. An...
python
{ "resource": "" }
q31426
DotExporter.to_dotfile
train
def to_dotfile(self, filename): """ Write graph to `filename`. >>> from anytree import Node >>> root = Node("root") >>> s0 = Node("sub0", parent=root) >>> s0b = Node("sub0B", parent=s0) >>> s0a = Node("sub0A", parent=s0) >>> s1 = Node("sub1", parent=root)...
python
{ "resource": "" }
q31427
DotExporter.to_picture
train
def to_picture(self, filename): """ Write graph to a temporary file and invoke `dot`. The output file type is automatically detected from the file suffix. *`graphviz` needs to be installed, before usage of this method.* """ fileformat = path.splitext(filename)[1][1:] ...
python
{ "resource": "" }
q31428
commonancestors
train
def commonancestors(*nodes): """ Determine common ancestors of `nodes`. >>> from anytree import Node >>> udo = Node("Udo") >>> marc = Node("Marc", parent=udo) >>> lian = Node("Lian", parent=marc) >>> dan = Node("Dan", parent=udo) >>> jet = Node("Jet", parent=dan) >>> jan = Node("Jan...
python
{ "resource": "" }
q31429
leftsibling
train
def leftsibling(node): """ Return Left Sibling of `node`. >>> from anytree import Node >>> dan = Node("Dan") >>> jet = Node("Jet", parent=dan) >>> jan = Node("Jan", parent=dan) >>> joe = Node("Joe", parent=dan) >>> leftsibling(dan) >>> leftsibling(jet) >>> leftsibling(jan) N...
python
{ "resource": "" }
q31430
rightsibling
train
def rightsibling(node): """ Return Right Sibling of `node`. >>> from anytree import Node >>> dan = Node("Dan") >>> jet = Node("Jet", parent=dan) >>> jan = Node("Jan", parent=dan) >>> joe = Node("Joe", parent=dan) >>> rightsibling(dan) >>> rightsibling(jet) Node('/Dan/Jan') >...
python
{ "resource": "" }
q31431
DictExporter.export
train
def export(self, node): """Export tree starting at `node`.""" attriter = self.attriter or (lambda attr_values: attr_values)
python
{ "resource": "" }
q31432
compute_u_val_for_sky_loc_stat
train
def compute_u_val_for_sky_loc_stat(hplus, hcross, hphccorr, hpnorm=None, hcnorm=None, indices=None): """The max-over-sky location detection statistic maximizes over a phase, an amplitude and the ratio of F+ and Fx, encoded in a variable called u. Here we return the value of ...
python
{ "resource": "" }
q31433
make_frequency_series
train
def make_frequency_series(vec): """Return a frequency series of the input vector. If the input is a frequency series it is returned, else if the input vector is a real time series it is fourier transformed and returned as a frequency series. Parameters ---------- vector : TimeSeries or Fre...
python
{ "resource": "" }
q31434
sigmasq_series
train
def sigmasq_series(htilde, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None): """Return a cumulative sigmasq frequency series. Return a frequency series containing the accumulated power in the input up to that frequency. Parameters ---------- htilde : TimeSeries or F...
python
{ "resource": "" }
q31435
sigma
train
def sigma(htilde, psd = None, low_frequency_cutoff=None, high_frequency_cutoff=None): """ Return the sigma of the waveform. See sigmasq for more details. Parameters ---------- htilde : TimeSeries or FrequencySeries The input vector containing a waveform. psd : {None, FrequencySeries...
python
{ "resource": "" }
q31436
get_cutoff_indices
train
def get_cutoff_indices(flow, fhigh, df, N): """ Gets the indices of a frequency series at which to stop an overlap calculation. Parameters ---------- flow: float The frequency (in Hz) of the lower index. fhigh: float The frequency (in Hz) of the upper index. df: float ...
python
{ "resource": "" }
q31437
smear
train
def smear(idx, factor): """ This function will take as input an array of indexes and return every unique index within the specified factor of the inputs. E.g.: smear([5,7,100],2) = [3,4,5,6,7,8,9,98,99,100,101,102] Parameters -----------
python
{ "resource": "" }
q31438
matched_filter
train
def matched_filter(template, data, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, sigmasq=None): """ Return the complex snr. Return the complex snr, along with its associated normalization of the template, matched filtered against the data. Parameters ----------...
python
{ "resource": "" }
q31439
overlap
train
def overlap(vec1, vec2, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, normalized=True): """ Return the overlap between the two TimeSeries or FrequencySeries. Parameters ---------- vec1 : TimeSeries or FrequencySeries The input vector containing a waveform. vec2 ...
python
{ "resource": "" }
q31440
overlap_cplx
train
def overlap_cplx(vec1, vec2, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, normalized=True): """Return the complex overlap between the two TimeSeries or FrequencySeries. Parameters ---------- vec1 : TimeSeries or FrequencySeries The input vector containing a wavefor...
python
{ "resource": "" }
q31441
quadratic_interpolate_peak
train
def quadratic_interpolate_peak(left, middle, right): """ Interpolate the peak and offset using a quadratic approximation Parameters ---------- left : numpy array Values at a relative bin value of [-1] middle : numpy array Values at a relative bin value of [0] right : numpy array...
python
{ "resource": "" }
q31442
followup_event_significance
train
def followup_event_significance(ifo, data_reader, bank, template_id, coinc_times, coinc_threshold=0.005, lookback=150, duration=0.095): """ Followup an event in another detector and determine its significance """ ...
python
{ "resource": "" }
q31443
compute_followup_snr_series
train
def compute_followup_snr_series(data_reader, htilde, trig_time, duration=0.095, check_state=True, coinc_window=0.05): """Given a StrainBuffer, a template frequency series and a trigger time, compute a portion of the SNR time series centered on the ...
python
{ "resource": "" }
q31444
LiveBatchMatchedFilter.combine_results
train
def combine_results(self, results): """Combine results from different batches of filtering"""
python
{ "resource": "" }
q31445
LiveBatchMatchedFilter.process_all
train
def process_all(self): """Process every batch group and return as single result""" results = [] veto_info = [] while 1: result, veto = self._process_batch() if result is False: return False if result is None: break results.append(result) ...
python
{ "resource": "" }
q31446
LiveBatchMatchedFilter._process_vetoes
train
def _process_vetoes(self, results, veto_info): """Calculate signal based vetoes""" chisq = numpy.array(numpy.zeros(len(veto_info)), numpy.float32, ndmin=1) dof = numpy.array(numpy.zeros(len(veto_info)), numpy.uint32, ndmin=1) sg_chisq = numpy.array(numpy.zeros(len(veto_info)), numpy.floa...
python
{ "resource": "" }
q31447
calc_psd_variation
train
def calc_psd_variation(strain, psd_short_segment, psd_long_segment, short_psd_duration, short_psd_stride, psd_avg_method, low_freq, high_freq): """Calculates time series of PSD variability This function first splits the segment up into 512 second chunks. It the...
python
{ "resource": "" }
q31448
find_trigger_value
train
def find_trigger_value(psd_var, idx, start, sample_rate): """ Find the PSD variation value at a particular time Parameters ---------- psd_var : TimeSeries Time series of the varaibility in the PSD estimation idx : numpy.ndarray Time indices of the triggers start : float ...
python
{ "resource": "" }
q31449
setup_foreground_minifollowups
train
def setup_foreground_minifollowups(workflow, coinc_file, single_triggers, tmpltbank_file, insp_segs, insp_data_name, insp_anal_name, dax_output, out_dir, tags=None): """ Create plots that followup the Nth loudest coincident injection from a statmap produced HDF file...
python
{ "resource": "" }
q31450
make_plot_waveform_plot
train
def make_plot_waveform_plot(workflow, params, out_dir, ifos, exclude=None, require=None, tags=None): """ Add plot_waveform jobs to the workflow. """ tags = [] if tags is None else tags makedir(out_dir) name = 'single_template_plot' secs = requirestr(workflow.cp.get_su...
python
{ "resource": "" }
q31451
make_sngl_ifo
train
def make_sngl_ifo(workflow, sngl_file, bank_file, trigger_id, out_dir, ifo, tags=None, rank=None): """Setup a job to create sngl detector sngl ifo html summary snippet. """ tags = [] if tags is None else tags makedir(out_dir) name = 'page_snglinfo' files = FileList([]) node...
python
{ "resource": "" }
q31452
make_qscan_plot
train
def make_qscan_plot(workflow, ifo, trig_time, out_dir, injection_file=None, data_segments=None, time_window=100, tags=None): """ Generate a make_qscan node and add it to workflow. This function generates a single node of the singles_timefreq executable and adds it to the current workflo...
python
{ "resource": "" }
q31453
make_singles_timefreq
train
def make_singles_timefreq(workflow, single, bank_file, trig_time, out_dir, veto_file=None, time_window=10, data_segments=None, tags=None): """ Generate a singles_timefreq node and add it to workflow. This function generates a single node of the singles_timefr...
python
{ "resource": "" }
q31454
JointDistribution.apply_boundary_conditions
train
def apply_boundary_conditions(self, **params): """Applies each distributions' boundary conditions to the given list of parameters, returning a new list with the conditions applied. Parameters ---------- **params : Keyword arguments should give the parameters to apply...
python
{ "resource": "" }
q31455
JointDistribution.rvs
train
def rvs(self, size=1): """ Rejection samples the parameter space. """ # create output FieldArray out = record.FieldArray(size, dtype=[(arg, float) for arg in self.variable_args]) # loop until enough samples accepted n = 0 whil...
python
{ "resource": "" }
q31456
_check_lal_pars
train
def _check_lal_pars(p): """ Create a laldict object from the dictionary of waveform parameters Parameters ---------- p: dictionary The dictionary of lalsimulation paramaters Returns ------- laldict: LalDict The lal type dictionary to pass to the lalsimulation waveform funct...
python
{ "resource": "" }
q31457
_spintaylor_aligned_prec_swapper
train
def _spintaylor_aligned_prec_swapper(**p): """ SpinTaylorF2 is only single spin, it also struggles with anti-aligned spin waveforms. This construct chooses between the aligned-twospin TaylorF2 model and the precessing singlespin SpinTaylorF2 models. If aligned spins are given, use TaylorF2, if nonal...
python
{ "resource": "" }
q31458
get_obj_attrs
train
def get_obj_attrs(obj): """ Return a dictionary built from the attributes of the given object. """ pr = {} if obj is not None: if isinstance(obj, numpy.core.records.record): for name in obj.dtype.names: pr[name] = getattr(obj, name) elif hasattr(obj, '__dict__...
python
{ "resource": "" }
q31459
get_fd_waveform_sequence
train
def get_fd_waveform_sequence(template=None, **kwds): """Return values of the waveform evaluated at the sequence of frequency points. Parameters ---------- template: object An object that has attached properties. This can be used to substitute for keyword arguments. A common example ...
python
{ "resource": "" }
q31460
get_td_waveform
train
def get_td_waveform(template=None, **kwargs): """Return the plus and cross polarizations of a time domain waveform. Parameters ---------- template: object An object that has attached properties. This can be used to subsitute for keyword arguments. A common example would be a row in an x...
python
{ "resource": "" }
q31461
get_fd_waveform
train
def get_fd_waveform(template=None, **kwargs): """Return a frequency domain gravitational waveform. 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. {p...
python
{ "resource": "" }
q31462
get_interpolated_fd_waveform
train
def get_interpolated_fd_waveform(dtype=numpy.complex64, return_hc=True, **params): """ Return a fourier domain waveform approximant, using interpolation """ def rulog2(val): return 2.0 ** numpy.ceil(numpy.log2(float(val))) orig_approx = params['approximant'] ...
python
{ "resource": "" }
q31463
get_sgburst_waveform
train
def get_sgburst_waveform(template=None, **kwargs): """Return the plus and cross polarizations of a time domain sine-Gaussian burst waveform. Parameters ---------- template: object An object that has attached properties. This can be used to subsitute for keyword arguments. A common e...
python
{ "resource": "" }
q31464
get_imr_length
train
def get_imr_length(approx, **kwds): """Call through to pnutils to obtain IMR waveform durations """ m1 = float(kwds['mass1']) m2 = float(kwds['mass2']) s1z = float(kwds['spin1z']) s2z = float(kwds['spin2z'])
python
{ "resource": "" }
q31465
get_waveform_filter
train
def get_waveform_filter(out, template=None, **kwargs): """Return a frequency domain waveform filter for the specified approximant """ n = len(out) input_params = props(template, **kwargs) if input_params['approximant'] in filter_approximants(_scheme.mgr.state): wav_gen = filter_wav[type(_s...
python
{ "resource": "" }
q31466
get_two_pol_waveform_filter
train
def get_two_pol_waveform_filter(outplus, outcross, template, **kwargs): """Return a frequency domain waveform filter for the specified approximant. Unlike get_waveform_filter this function returns both h_plus and h_cross components of the waveform, which are needed for searches where h_plus and h_cross ...
python
{ "resource": "" }
q31467
get_template_amplitude_norm
train
def get_template_amplitude_norm(template=None, **kwargs): """ Return additional constant template normalization. This only affects the effective distance calculation. Returns None for all templates with
python
{ "resource": "" }
q31468
get_waveform_filter_precondition
train
def get_waveform_filter_precondition(approximant, length, delta_f): """Return the data preconditioning factor for this approximant. """ if approximant in _filter_preconditions:
python
{ "resource": "" }
q31469
get_waveform_filter_norm
train
def get_waveform_filter_norm(approximant, psd, length, delta_f, f_lower): """ Return the normalization vector for the approximant """ if approximant in _filter_norms:
python
{ "resource": "" }
q31470
get_waveform_end_frequency
train
def get_waveform_end_frequency(template=None, **kwargs): """Return the stop frequency of a template """ input_params =
python
{ "resource": "" }
q31471
get_waveform_filter_length_in_time
train
def get_waveform_filter_length_in_time(approximant, template=None, **kwargs): """For filter templates, return the length in time of the template. """ kwargs = props(template, **kwargs)
python
{ "resource": "" }
q31472
MarginalizedGaussianNoise._extra_stats
train
def _extra_stats(self): """Adds ``loglr``, ``optimal_snrsq`` and matched filter snrsq in each detector to the default stats.""" return ['loglr'] + \
python
{ "resource": "" }
q31473
MarginalizedGaussianNoise._margtime_mfsnr
train
def _margtime_mfsnr(template, data): """Returns a time series for the matched filter SNR assuming that the template and data have both been normalised and whitened. """
python
{ "resource": "" }
q31474
MarginalizedGaussianNoise._margtimedist_loglr
train
def _margtimedist_loglr(self, mf_snr, opt_snr): """Returns the log likelihood ratio marginalized over time and distance. """ logl = special.logsumexp(mf_snr, b=self._deltat) logl_marg = logl/self._dist_array
python
{ "resource": "" }
q31475
MarginalizedGaussianNoise._margtimephase_loglr
train
def _margtimephase_loglr(self, mf_snr, opt_snr): """Returns the log likelihood ratio marginalized over time and phase. """
python
{ "resource": "" }
q31476
MarginalizedGaussianNoise._margdistphase_loglr
train
def _margdistphase_loglr(self, mf_snr, opt_snr): """Returns the log likelihood ratio marginalized over distance and phase. """ logl = numpy.log(special.i0(mf_snr)) logl_marg = logl/self._dist_array
python
{ "resource": "" }
q31477
MarginalizedGaussianNoise._margdist_loglr
train
def _margdist_loglr(self, mf_snr, opt_snr): """Returns the log likelihood ratio marginalized over distance. """ mf_snr_marg = mf_snr/self._dist_array opt_snr_marg = opt_snr/self._dist_array**2
python
{ "resource": "" }
q31478
MarginalizedGaussianNoise._margtime_loglr
train
def _margtime_loglr(self, mf_snr, opt_snr): """Returns the log likelihood ratio marginalized over time. """
python
{ "resource": "" }
q31479
add_workflow_command_line_group
train
def add_workflow_command_line_group(parser): """ The standard way of initializing a ConfigParser object in workflow will be to do it from the command line. This is done by giving a --local-config-files filea.ini fileb.ini filec.ini command. You can also set config file override commands on the com...
python
{ "resource": "" }
q31480
WorkflowConfigParser.perform_exe_expansion
train
def perform_exe_expansion(self): """ This function will look through the executables section of the ConfigParser object and replace any values using macros with full paths. For any values that look like ${which:lalapps_tmpltbank} will be replaced with the equivalent of
python
{ "resource": "" }
q31481
WorkflowConfigParser.interpolate_exe
train
def interpolate_exe(self, testString): """ Replace testString with a path to an executable based on the format. If this looks like ${which:lalapps_tmpltbank} it will return the equivalent of which(lalapps_tmpltbank) Otherwise it will return an unchanged string. ...
python
{ "resource": "" }
q31482
WorkflowConfigParser.get_subsections
train
def get_subsections(self, section_name): """ Return a list of subsections for the given section name """ # Keep only subsection names subsections = [sec[len(section_name)+1:] for sec in self.sections()\ if sec.startswith(section_name + '-')] for sec in sub...
python
{ "resource": "" }
q31483
WorkflowConfigParser.interpolate_string
train
def interpolate_string(self, testString, section): """ Take a string and replace all example of ExtendedInterpolation formatting within the string with the exact value. For values like ${example} this is replaced with the value that corresponds to the option called example ***in...
python
{ "resource": "" }
q31484
WorkflowConfigParser.add_options_to_section
train
def add_options_to_section(self ,section, items, overwrite_options=False): """ Add a set of options and values to a section of a ConfigParser object. Will throw an error if any of the options being added already exist, this behaviour can be overridden if desired Parameters ...
python
{ "resource": "" }
q31485
WorkflowConfigParser.check_duplicate_options
train
def check_duplicate_options(self, section1, section2, raise_error=False): """ Check for duplicate options in two sections, section1 and section2. Will return a list of the duplicate options. Parameters ---------- section1 : string The name of the first sectio...
python
{ "resource": "" }
q31486
WorkflowConfigParser.add_config_opts_to_parser
train
def add_config_opts_to_parser(parser): """Adds options for configuration files to the given parser.""" parser.add_argument("--config-files", type=str, nargs="+", required=True, help="A file parsable by " "pycbc.work...
python
{ "resource": "" }
q31487
WorkflowConfigParser.from_cli
train
def from_cli(cls, opts): """Loads a config file from the given options, with overrides and deletes applied. """ # read configuration file logging.info("Reading configuration file") if opts.config_overrides is not None: overrides = [override.split(":") ...
python
{ "resource": "" }
q31488
fft
train
def fft(invec, outvec): """ Fourier transform from invec to outvec. Perform a fourier transform. The type of transform is determined by the dtype of invec and outvec. Parameters ---------- invec : TimeSeries or FrequencySeries The input vector. outvec : TimeSeries or FrequencySerie...
python
{ "resource": "" }
q31489
ifft
train
def ifft(invec, outvec): """ Inverse fourier transform from invec to outvec. Perform an inverse fourier transform. The type of transform is determined by the dtype of invec and outvec. Parameters ---------- invec : TimeSeries or FrequencySeries The input vector. outvec : TimeSeries...
python
{ "resource": "" }
q31490
render_workflow_html_template
train
def render_workflow_html_template(filename, subtemplate, filelists, **kwargs): """ Writes a template given inputs from the workflow generator. Takes a list of tuples. Each tuple is a pycbc File object. Also the name of the subtemplate to render and the filename of the output. """ dirnam = os.path.d...
python
{ "resource": "" }
q31491
get_embedded_config
train
def get_embedded_config(filename): """ Attempt to load config data attached to file """ def check_option(self, section, name): return (self.has_section(section) and (self.has_option(section, name) or (name in self.defaults()))) try: cp
python
{ "resource": "" }
q31492
setup_template_render
train
def setup_template_render(path, config_path): """ This function is the gateway for rendering a template for a file. """ # initialization cp = get_embedded_config(path) output = '' filename = os.path.basename(path) # use meta-data if not empty for rendering if cp.has_option(filename, 'r...
python
{ "resource": "" }
q31493
render_default
train
def render_default(path, cp): """ This is the default function that will render a template to a string of HTML. The string will be for a drop-down tab that contains a link to the file. If the file extension requires information to be read, then that is passed to the content variable (eg. a segmentlistd...
python
{ "resource": "" }
q31494
render_glitchgram
train
def render_glitchgram(path, cp): """ Render a glitchgram file template. """ # define filename and slug from path filename = os.path.basename(path) slug = filename.replace('.', '_') # render template template_dir = pycbc.results.__path__[0] + '/templates/files' env = Environment(loader=...
python
{ "resource": "" }
q31495
get_available_detectors
train
def get_available_detectors(): """Return list of detectors known in the currently sourced lalsuite. This function will query lalsuite about which detectors are known to lalsuite. Detectors are identified by a two character string e.g. 'K1', but also by a longer, and clearer name, e.g. KAGRA. This funct...
python
{ "resource": "" }
q31496
Detector.light_travel_time_to_detector
train
def light_travel_time_to_detector(self, det): """ Return the light travel time from this detector Parameters ---------- det: Detector The other detector to determine the light travel time to. Returns -------
python
{ "resource": "" }
q31497
Detector.antenna_pattern
train
def antenna_pattern(self, right_ascension, declination, polarization, t_gps): """Return the detector response. Parameters ---------- right_ascension: float or numpy.ndarray The right ascension of the source declination: float or numpy.ndarray The declinat...
python
{ "resource": "" }
q31498
Detector.time_delay_from_earth_center
train
def time_delay_from_earth_center(self, right_ascension, declination, t_gps): """Return the time delay from the earth center """ return self.time_delay_from_location(np.array([0, 0, 0]),
python
{ "resource": "" }
q31499
Detector.time_delay_from_location
train
def time_delay_from_location(self, other_location, right_ascension, declination, t_gps): """Return the time delay from the given location to detector for a signal with the given sky location In other words return `t1 - t2` where `t1` is the arrival time ...
python
{ "resource": "" }