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


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

本文整理汇总了Python中pycbc.types.FrequencySeries.data[:kmin]方法的典型用法代码示例。如果您正苦于以下问题:Python FrequencySeries.data[:kmin]方法的具体用法?Python FrequencySeries.data[:kmin]怎么用?Python FrequencySeries.data[:kmin]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycbc.types.FrequencySeries的用法示例。


在下文中一共展示了FrequencySeries.data[:kmin]方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: from_string

# 需要导入模块: from pycbc.types import FrequencySeries [as 别名]
# 或者: from pycbc.types.FrequencySeries import data[:kmin] [as 别名]
def from_string(psd_name, length, delta_f, low_freq_cutoff):
    """Generate a frequency series containing a LALSimulation PSD specified by name.

    Parameters
    ----------
    psd_name : string
        PSD name as found in LALSimulation, minus the SimNoisePSD prefix.
    length : int
        Length of the frequency series in samples.
    delta_f : float
        Frequency resolution of the frequency series.
    low_freq_cutoff : float
        Frequencies below this value are set to zero.

    Returns
    -------
    psd : FrequencySeries
        The generated frequency series.
    """
    if psd_name not in _psd_list:
        raise ValueError(psd_name + ' not found among LALSimulation PSD functions.')
    kmin = int(low_freq_cutoff / delta_f)
    lalseries = lal.CreateREAL8FrequencySeries(
        '', lal.LIGOTimeGPS(0), 0, delta_f, lal.DimensionlessUnit, length)
    try:
        func = lalsimulation.__dict__[_name_prefix + psd_name + _name_suffix]
    except KeyError:
        func = lalsimulation.__dict__[_name_prefix + psd_name]
        func(lalseries, low_freq_cutoff)
    else:
        lalsimulation.SimNoisePSD(lalseries, 0, func)
    psd = FrequencySeries(lalseries.data.data, delta_f=delta_f)
    psd.data[:kmin] = 0
    return psd
开发者ID:prayush,项目名称:pycbc,代码行数:36,代码来源:analytical.py

示例2: from_string

# 需要导入模块: from pycbc.types import FrequencySeries [as 别名]
# 或者: from pycbc.types.FrequencySeries import data[:kmin] [as 别名]
def from_string(psd_name, length, delta_f, low_freq_cutoff):
    """Generate a frequency series containing a LALSimulation PSD specified
    by name.

    Parameters
    ----------
    psd_name : string
        PSD name as found in LALSimulation, minus the SimNoisePSD prefix.
    length : int
        Length of the frequency series in samples.
    delta_f : float
        Frequency resolution of the frequency series.
    low_freq_cutoff : float
        Frequencies below this value are set to zero.

    Returns
    -------
    psd : FrequencySeries
        The generated frequency series.
    """

    # check if valid PSD model
    if psd_name not in get_psd_model_list():
        raise ValueError(psd_name + ' not found among analytical '
                         'PSD functions.')

    # if PSD model is in LALSimulation
    if psd_name in get_lalsim_psd_list():
        lalseries = lal.CreateREAL8FrequencySeries(
            '', lal.LIGOTimeGPS(0), 0, delta_f, lal.DimensionlessUnit, length)
        try:
            func = lalsimulation.__dict__[
                                        _name_prefix + psd_name + _name_suffix]
        except KeyError:
            func = lalsimulation.__dict__[_name_prefix + psd_name]
            func(lalseries, low_freq_cutoff)
        else:
            lalsimulation.SimNoisePSD(lalseries, 0, func)
        psd = FrequencySeries(lalseries.data.data, delta_f=delta_f)

    # if PSD model is coded in PyCBC
    else:
        func = pycbc_analytical_psds[psd_name]
        psd = func(length, delta_f, low_freq_cutoff)

    # zero-out content below low-frequency cutoff
    kmin = int(low_freq_cutoff / delta_f)
    psd.data[:kmin] = 0

    return psd
开发者ID:bhooshan-gadre,项目名称:pycbc,代码行数:52,代码来源:analytical.py

示例3: flat_unity

# 需要导入模块: from pycbc.types import FrequencySeries [as 别名]
# 或者: from pycbc.types.FrequencySeries import data[:kmin] [as 别名]
def flat_unity(length, delta_f, low_freq_cutoff):
    """ Returns a FrequencySeries of ones above the low_frequency_cutoff.

    Parameters
    ----------
    length : int
        Length of output Frequencyseries.
    delta_f : float
        Frequency step for output FrequencySeries.
    low_freq_cutoff : int
        Low-frequency cutoff for output FrequencySeries.

    Returns
    -------
    FrequencySeries
        Returns a FrequencySeries containing the unity PSD model.
    """
    fseries = FrequencySeries(numpy.ones(length), delta_f=delta_f)
    kmin = int(low_freq_cutoff / fseries.delta_f)
    fseries.data[:kmin] = 0
    return fseries
开发者ID:bhooshan-gadre,项目名称:pycbc,代码行数:23,代码来源:analytical.py


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