Functions | |
def | parse_slidespec (slidespec) |
Accepts a string in the format instrument=first:last:step[,first:last:step]... and returns the tuple (instrument, [offset1, offset2, .... More... | |
def | parse_slides (slides) |
Accepts a list of strings of the format understood by parse_slidespec(), and returns a dictionary mapping instrument names to sorted lists of unique offsets. More... | |
def | parse_inspiral_num_slides_slidespec (slidespec) |
Accepts a string in the format count:instrument=offset[,instrument=offset...] and returns the tuple (count, {instrument: offset, ...}) More... | |
def | SlidesIter (slides) |
Accepts a dictionary mapping instrument --> list-of-offsets (for example, as returned by parse_slides()), and iterates over the cartesian (outer) product of the offset lists, yielding all possible N-way instrument --> offset mappings. More... | |
def | Inspiral_Num_Slides_Iter (count, offsets) |
This generator yields a sequence of time slide dictionaries in the style of lalapps_thinca's time slides. More... | |
def | vacuum (time_slides, verbose=False) |
Given a dictionary mapping time slide ID to offsetvector, for example as returned by the .as_dict() method of the TimeSlideTable class in ligolw.lsctables, construct and return a mapping indicating time slide equivalences. More... | |
def lalburst.timeslides.parse_slidespec | ( | slidespec | ) |
Accepts a string in the format instrument=first:last:step[,first:last:step]... and returns the tuple (instrument, [offset1, offset2, ....
]) where the offsets are the sorted list of unique numbers described by the ranges. A range with a positive step describes the offsets (first + n * step) where n is an integer such that first <= offset <= last. A range with a negative step describes the offsets (first + n * step) where n is an integer such that last <= offset <= first.
Example:
parse_slidespec("H1=-5:+5:0.5") ('H1', [-5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) parse_slidespec("H1=+5:-5:-0.5") ('H1', [-5.0, -4.5, -4.0, -3.5, -3.0, -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) parse_slidespec("H1=-5:+5:8") ('H1', [-5.0, 3.0])
Definition at line 67 of file timeslides.py.
def lalburst.timeslides.parse_slides | ( | slides | ) |
Accepts a list of strings of the format understood by parse_slidespec(), and returns a dictionary mapping instrument names to sorted lists of unique offsets.
Example:
parse_slides(["H1=-1:+1:+1", "H2=-1:+1:+1", "L1=0:0:0"]) {'H2': [-1.0, 0.0, 1.0], 'H1': [-1.0, 0.0, 1.0], 'L1': [0.0]}
Definition at line 104 of file timeslides.py.
def lalburst.timeslides.parse_inspiral_num_slides_slidespec | ( | slidespec | ) |
Accepts a string in the format count:instrument=offset[,instrument=offset...] and returns the tuple (count, {instrument: offset, ...})
Example:
parse_inspiral_num_slides_slidespec("3:H1=0,H2=5,L1=10") (3, offsetvector({'H2': 5.0, 'H1': 0.0, 'L1': 10.0}))
Definition at line 128 of file timeslides.py.
def lalburst.timeslides.SlidesIter | ( | slides | ) |
Accepts a dictionary mapping instrument --> list-of-offsets (for example, as returned by parse_slides()), and iterates over the cartesian (outer) product of the offset lists, yielding all possible N-way instrument --> offset mappings.
Example:
slides = {"H1": [-1, 0, 1], "H2": [-1, 0, 1], "L1": [0]} list(SlidesIter(slides)) [offsetvector({'H2': -1, 'H1': -1, 'L1': 0}), offsetvector({'H2': -1, 'H1': 0, 'L1': 0}), offsetvector({'H2': -1, 'H1': 1, 'L1': 0}), offsetvector({'H2': 0, 'H1': -1, 'L1': 0}), offsetvector({'H2': 0, 'H1': 0, 'L1': 0}), offsetvector({'H2': 0, 'H1': 1, 'L1': 0}), offsetvector({'H2': 1, 'H1': -1, 'L1': 0}), offsetvector({'H2': 1, 'H1': 0, 'L1': 0}), offsetvector({'H2': 1, 'H1': 1, 'L1': 0})]
Definition at line 155 of file timeslides.py.
def lalburst.timeslides.Inspiral_Num_Slides_Iter | ( | count, | |
offsets | |||
) |
This generator yields a sequence of time slide dictionaries in the style of lalapps_thinca's time slides.
Each resulting dictionary maps instrument to offset. The input is a count of time slides (an integer), and a dictionary mapping instrument to offset. The output dictionaries describe time slides that are integer multiples of the input time shifts.
Example:
list(Inspiral_Num_Slides_Iter(3, {"H1": 0.0, "H2": 5.0,"L1": 10.0})) [offsetvector({'H2': -15.0, 'H1': -0.0, 'L1': -30.0}), offsetvector({'H2': -10.0, 'H1': -0.0, 'L1': -20.0}), offsetvector({'H2': -5.0, 'H1': -0.0, 'L1': -10.0}), offsetvector({'H2': 0.0, 'H1': 0.0, 'L1': 0.0}), offsetvector({'H2': 5.0, 'H1': 0.0, 'L1': 10.0}), offsetvector({'H2': 10.0, 'H1': 0.0, 'L1': 20.0}), offsetvector({'H2': 15.0, 'H1': 0.0, 'L1': 30.0})]
The output time slides are all integer multiples of the input time shift vector in the range [-count, +count], and are returned in increasing order of mupltiplier.
Definition at line 188 of file timeslides.py.
def lalburst.timeslides.vacuum | ( | time_slides, | |
verbose = False |
|||
) |
Given a dictionary mapping time slide ID to offsetvector, for example as returned by the .as_dict() method of the TimeSlideTable class in ligolw.lsctables, construct and return a mapping indicating time slide equivalences.
This can be used to delete redundant time slides from a time slide table, and then also used via the .applyKeyMapping() method of ligolw.table.Table instances to update cross references (for example in the coinc_event table).
Example:
slides = {0: offsetvector({"H1": 0, "H2": 0}), 1: offsetvector({"H1": 10, "H2": 10}), 2: offsetvector({"H1": 0, "H2": 10})} vacuum(slides) {1: 0}
indicating that time slide ID 1 describes a time slide that is equivalent to time slide ID 0. The calling code could use this information to delete time slide ID 1 from the time_slide table, and replace references to that ID in other tables with references to time slide ID 0.
Definition at line 215 of file timeslides.py.