nicer.fourier

Fourier (harmonic) analysis of pulse phases.

Functions

compute_fourier(phases[, nh, pow_phase, ...])

Compute the Fourier components of a set of pulse phases.

evaluate_chi2(hist, model)

Compute the chi-squared of a binned profile against a model.

evaluate_fourier(n, c, s, nbins[, k])

Evaluate a Fourier model of a pulse profile at the bin centers.

nicer.fourier.compute_fourier(phases, nh=10, pow_phase=False, with_phase_errors=False)[source]

Compute the Fourier components of a set of pulse phases.

The DC term is not computed or returned.

Parameters:
  • phases (array_like) -- Pulse phases, in the range [0, 1).

  • nh (int, optional) -- Number of harmonics (1 = fundamental only).

  • pow_phase (bool, optional) -- If True, return powers and phases instead of cosine and sine components.

  • with_phase_errors (bool, optional) -- If True (and pow_phase is True), also return the phase uncertainties.

Returns:

  • n (int) -- Number of phases.

  • c, s (numpy.ndarray) -- Cosine and sine components of each harmonic, normalized so that a pure sinusoid with 100% modulation has amplitude 1. Returned if pow_phase is False.

  • fourier_pow (numpy.ndarray) -- Leahy-normalized power of each harmonic. Returned if pow_phase is True.

  • fourier_phases (numpy.ndarray) -- Phase of each harmonic, in radians. Returned if pow_phase is True.

  • phase_errs (numpy.ndarray) -- 1-sigma uncertainty of each phase, in radians. Returned if with_phase_errors is also True. The Gaussian approximation used breaks down below a signal-to-noise ratio of about 3.

nicer.fourier.evaluate_fourier(n, c, s, nbins, k=None)[source]

Evaluate a Fourier model of a pulse profile at the bin centers.

Parameters:
  • n (int) -- Total number of counts in the profile.

  • c (array_like) -- Cosine and sine components, as returned by compute_fourier().

  • s (array_like) -- Cosine and sine components, as returned by compute_fourier().

  • nbins (int) -- Number of profile bins.

  • k (int, optional) -- If given, include only harmonic k + 1 (plus the constant level).

Returns:

numpy.ndarray -- Model counts in each bin.

nicer.fourier.evaluate_chi2(hist, model)[source]

Compute the chi-squared of a binned profile against a model.

The model is used for the variance in each bin.

Parameters:
  • hist (array_like) -- Counts in each bin.

  • model (array_like) -- Model counts in each bin.

Returns:

float -- The chi-squared value.