当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.data[kmin:kmax]方法代码示例

本文整理汇总了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
开发者ID:lppekows,项目名称:pycbc,代码行数:72,代码来源:ringdown.py


注:本文中的pycbc.types.TimeSeries.data[kmin:kmax]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。