本文整理汇总了Python中pycbc.types.TimeSeries.get_start_time方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.get_start_time方法的具体用法?Python TimeSeries.get_start_time怎么用?Python TimeSeries.get_start_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycbc.types.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.get_start_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply
# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import get_start_time [as 别名]
def apply(self, strain, detector_name, f_lower=None, distance_scale=1,
simulation_ids=None):
"""Add injections (as seen by a particular detector) to a time series.
Parameters
----------
strain : TimeSeries
Time series to inject signals into, of type float32 or float64.
detector_name : string
Name of the detector used for projecting injections.
f_lower : {None, float}, optional
Low-frequency cutoff for injected signals. If None, use value
provided by each injection.
distance_scale: {1, float}, optional
Factor to scale the distance of an injection with. The default is
no scaling.
simulation_ids: iterable, optional
If given, only inject signals with the given simulation IDs.
Returns
-------
None
Raises
------
TypeError
For invalid types of `strain`.
"""
if not strain.dtype in (float32, float64):
raise TypeError("Strain dtype must be float32 or float64, not " \
+ str(strain.dtype))
lalstrain = strain.lal()
detector = Detector(detector_name)
earth_travel_time = lal.REARTH_SI / lal.C_SI
t0 = float(strain.start_time) - earth_travel_time
t1 = float(strain.end_time) + earth_travel_time
# pick lalsimulation injection function
add_injection = injection_func_map[strain.dtype]
injections = self.table
if simulation_ids:
injections = [inj for inj in injections \
if inj.simulation_id in simulation_ids]
for inj in injections:
if f_lower is None:
f_l = inj.f_lower
else:
f_l = f_lower
if inj.numrel_data != None and inj.numrel_data != "":
# performing NR waveform injection
# reading Hp and Hc from the frame files
swigrow = self.getswigrow(inj)
import lalinspiral
Hp, Hc = lalinspiral.NRInjectionFromSimInspiral(swigrow,
strain.delta_t)
# converting to pycbc timeseries
hp = TimeSeries(Hp.data.data[:], delta_t=Hp.deltaT,
epoch=Hp.epoch)
hc = TimeSeries(Hc.data.data[:], delta_t=Hc.deltaT,
epoch=Hc.epoch)
hp /= distance_scale
hc /= distance_scale
end_time = float(hp.get_end_time())
start_time = float(hp.get_start_time())
if end_time < t0 or start_time > t1:
continue
else:
# roughly estimate if the injection may overlap with the segment
end_time = inj.get_time_geocent()
inj_length = sim.SimInspiralTaylorLength(
strain.delta_t, inj.mass1 * lal.MSUN_SI,
inj.mass2 * lal.MSUN_SI, f_l, 0)
start_time = end_time - 2 * inj_length
if end_time < t0 or start_time > t1:
continue
name, phase_order = legacy_approximant_name(inj.waveform)
# compute the waveform time series
hp, hc = get_td_waveform(
inj, approximant=name, delta_t=strain.delta_t,
phase_order=phase_order,
f_lower=f_l, distance=inj.distance * distance_scale,
**self.extra_args)
hp._epoch += float(end_time)
hc._epoch += float(end_time)
if float(hp.start_time) > t1:
continue
# compute the detector response, taper it if requested
# and add it to the strain
signal = detector.project_wave(
hp, hc, inj.longitude, inj.latitude, inj.polarization)
# the taper_timeseries function converts to a LAL TimeSeries
#.........这里部分代码省略.........