當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。