Exemple #1
0
def multispec(data, doxs=1):

    """Compute power and cross spectra.

    power, cross = multispec(data[, doxs=1])

    data is expected to be a numeric sequence, representing a binned light
    curve.

    If doxs is false or data is one-dimensional, the cross spectra will not
    be calculated as described below, and only the power spectra will be
    returned.

    If data is one-dimensional, its periodogram will be calculated.

    If data is two-dimensional, it will be interpreted as an array of
    one-dimensional curves.  The periodogram will be calculated for each,
    and the cross spectra of all but the first relative to the first.

    If data has more than two dimensions, it will be interpreted as an array
    of two-dimensional sets, and each will be treated as described above."""

    # Figure out what we've got.
    data = num.asarray(data)
    npoints = data.shape[-1]
    if len(data.shape) < 2:
        doxs = 0

    # crunch
    transform = None
    if num.__name__ == 'numarray':
        transform = FFT.real_fft(data)
    else:
        transform = FFT.fft(data)
    conj = num.conjugate(transform)

    # Get the periodogram.
    power = transform * conj
    power = num.array(power.real)

    if doxs:
        # Calculate the cross spectrum.
        cross = transform[..., :1, :] * conj[..., 1:, :] 
        return power, cross
    else:
        return power
Exemple #2
0
def multispec(data, doxs=1):
    """Compute power and cross spectra.

    power, cross = multispec(data[, doxs=1])

    data is expected to be a numeric sequence, representing a binned light
    curve.

    If doxs is false or data is one-dimensional, the cross spectra will not
    be calculated as described below, and only the power spectra will be
    returned.

    If data is one-dimensional, its periodogram will be calculated.

    If data is two-dimensional, it will be interpreted as an array of
    one-dimensional curves.  The periodogram will be calculated for each,
    and the cross spectra of all but the first relative to the first.

    If data has more than two dimensions, it will be interpreted as an array
    of two-dimensional sets, and each will be treated as described above."""

    # Figure out what we've got.
    data = num.asarray(data)
    npoints = data.shape[-1]
    if len(data.shape) < 2:
        doxs = 0

    # crunch
    transform = None
    if num.__name__ == 'numarray':
        transform = FFT.real_fft(data)
    else:
        transform = FFT.fft(data)
    conj = num.conjugate(transform)

    # Get the periodogram.
    power = transform * conj
    power = num.array(power.real)

    if doxs:
        # Calculate the cross spectrum.
        cross = transform[..., :1, :] * conj[..., 1:, :]
        return power, cross
    else:
        return power
Exemple #3
0
 def __invert__(self):
     return Matrix(conjugate(self))
Exemple #4
0
 def __invert__(self):
     return Matrix(conjugate(self))