本文整理汇总了Python中pycbc.types.TimeSeries.data[kmin:kmax]方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.data[kmin:kmax]方法的具体用法?Python TimeSeries.data[kmin:kmax]怎么用?Python TimeSeries.data[kmin:kmax]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycbc.types.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.data[kmin:kmax]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_td_qnm
# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import data[kmin:kmax] [as 别名]
def get_td_qnm(template=None, delta_t=None, t_lower=None, t_final=None, **kwargs):
"""Return a time domain damped sinusoid.
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.
f_0 : float
The ringdown-frequency.
tau : float
The damping time of the sinusoid.
t_0 : {0, float}, optional
The starting time of the ringdown.
phi_0 : {0, float}, optional
The initial phase of the ringdown.
Amp : {1, float}, optional
The amplitude of the ringdown (constant for now).
delta_t : {None, float}, optional
The time step used to generate the ringdown.
If None, it will be set to the inverse of the frequency at which the
amplitude is 1/100 of the peak amplitude.
t_lower: {None, float}, optional
The starting time of the output time series.
If None, it will be set to delta_t.
t_final : {None, float}, optional
The ending time of the output time series.
If None, it will be set to the time at which the amplitude is
1/1000 of the peak amplitude.
Returns
-------
hplus: TimeSeries
The plus phase of the ringdown in time domain.
hcross: TimeSeries
The cross phase of the ringdown in time domain.
"""
input_params = props_ringdown(template,**kwargs)
f_0 = input_params['f_0']
tau = input_params['tau']
t_0 = input_params['t_0']
phi_0 = input_params['phi_0']
Amp = input_params['Amp']
if delta_t is None:
delta_t = 1. / qnm_freq_decay(f_0, tau, 1./100)
if t_lower is None:
t_lower = delta_t
kmin = 0
else:
kmin=int(t_lower / delta_t)
if t_final is None:
t_final = qnm_time_decay(tau, 1./1000)
kmax = int(t_final / delta_t)
n = int(t_final / delta_t) + 1
two_pi = 2 * numpy.pi
times = numpy.arange(t_lower, t_final, delta_t)
hp = Amp * numpy.exp(-times/tau) * numpy.cos(two_pi*f_0*times + phi_0)
hc = Amp * numpy.exp(-times/tau) * numpy.sin(two_pi*f_0*times + phi_0)
hplus = TimeSeries(zeros(n), delta_t=delta_t)
hcross = TimeSeries(zeros(n), delta_t=delta_t)
hplus.data[kmin:kmax] = hp
hcross.data[kmin:kmax] = hc
return hplus, hcross