signals#

discovery.signals.residuals(psr)[source]#
discovery.signals.makenoise_measurement_simple(psr, noisedict={}, add_equad=True, tnequad=False)[source]#

Single-EFAC (optionally single-EQUAD) white-noise model for a pulsar.

Builds a diagonal measurement-noise matrix using one efac for the whole pulsar. When add_equad is True an EQUAD term is included: tnequad=True uses the TempoNest convention (EQUAD added outside the EFAC scaling), while the default (tnequad=False) uses the tempo2/t2equad convention (EQUAD added in quadrature with the TOA errors, inside the EFAC scaling). Set add_equad=False for an EFAC-only model. If all required parameters are present in noisedict a constant matrix is returned, otherwise a variable one.

discovery.signals.selection_backend_flags(psr)[source]#
discovery.signals.makenoise_measurement(psr, noisedict={}, scale=1.0, tnequad=False, ecorr=False, selection=<function selection_backend_flags>, vectorize=True, outliers=False, enterprise=False)[source]#
discovery.signals.quantize(toas, dt=1.0)[source]#
discovery.signals.makegp_ecorr_simple(psr, noisedict={})[source]#
discovery.signals.makegp_ecorr(psr, noisedict={}, enterprise=False, scale=1.0, selection=<function selection_backend_flags>, variable=False, name='ecorrGP')[source]#
discovery.signals.makegp_improper(psr, fmat, constant=1e+40, name='improperGP', variable=False)[source]#
discovery.signals.makegp_timing(psr, constant=None, variance=None, svd=False, scale=1.0, variable=False)[source]#
discovery.signals.getspan(psrs)[source]#
discovery.signals.getstart(psrs)[source]#
discovery.signals.fourierbasis(psr, components, T=None)[source]#
discovery.signals.fourierbasis_dm(psr, components, T=None, fref=1400.0)[source]#

Fourier design matrix for a DM (dispersion measure) Gaussian process.

Identical to fourierbasis(), but each row is scaled by the cold-plasma dispersion factor (fref / psr.freqs) ** 2, i.e. a fixed chromatic index alpha = 2. Use fourierbasis_chrom() when the chromatic index is a free parameter, in which case the process is general chromatic noise rather than DM.

discovery.signals.fourierbasis_chrom(psr, components, T=None, fref=1400.0)[source]#

Fourier design matrix for a chromatic Gaussian process with variable index.

Returns a callable design-matrix factory fmatfunc(alpha) that scales the achromatic fourierbasis() columns by (fref / psr.freqs) ** alpha, where the chromatic index alpha is a free parameter. Because alpha is not fixed to 2 the resulting process is general chromatic noise, not DM; use fourierbasis_dm() for the alpha = 2 (DM) case.

discovery.signals.make_fourierbasis_dm(alpha=2.0, tndm=False)[source]#

Build a DM Fourier-basis function with a fixed chromatic index alpha.

Returns a basis(psr, components, T, fref) callable whose columns are the achromatic fourierbasis() scaled by (fref / psr.freqs) ** alpha. With tndm=True the tempo2/TempoNest DM normalisation is also applied. A genuine DM basis should keep alpha = 2; for a variable chromatic index use fourierbasis_chrom().

discovery.signals.make_fourierbasis_chrom(alpha=4.0, tndm=False)[source]#

Build a chromatic Fourier-basis function with a fixed chromatic index alpha.

Thin wrapper around make_fourierbasis_dm() with a default alpha = 4 (a common scattering-like index). The returned basis scales the achromatic fourierbasis() columns by (fref / psr.freqs) ** alpha. Use this for a fixed-index chromatic process; for DM use make_fourierbasis_dm() (alpha = 2).

discovery.signals.dmfourierbasis(psr, components, T=None, fref=1400.0)[source]#
discovery.signals.dmfourierbasis_alpha(psr, components, T=None, fref=1400.0)[source]#
discovery.signals.dmfourierbasis_solar(psr, components, T=None)[source]#
discovery.signals.make_dmfourierbasis(alpha=2.0, tndm=False)[source]#
discovery.signals.makegp_fourier(psr, prior, components, T=None, mean=None, fourierbasis=<function fourierbasis>, common=[], exclude=['f', 'df'], name='fourierGP')[source]#
discovery.signals.makecommongp_fourier(psrs, prior, components, T, fourierbasis=<function fourierbasis>, means=None, common=[], exclude=['f', 'df'], vector=False, name='fourierCommonGP', meansname='meanFourierCommonGP')[source]#
discovery.signals.makegp_fourier_delay(psr, components, T=None, name='fourierGP')[source]#
discovery.signals.makegp_fourier_variance(psr, components, T=None, name='fourierGP', noisedict={})[source]#
discovery.signals.makegp_fourier_allpsr(psrs, prior, components, T=None, fourierbasis=<function fourierbasis>, common=[], name='allpsrFourierGP')[source]#
discovery.signals.makeglobalgp_fourier(psrs, priors, orfs, components, T, fourierbasis=<function fourierbasis>, means=None, common=[], exclude=['f', 'df'], name='fourierGlobalGP', meansname='meanFourierGlobalGP')[source]#
discovery.signals.makegp_fourier_global(psrs, priors, orfs, components, T, fourierbasis=<function fourierbasis>, means=None, common=[], exclude=['f', 'df'], name='fourierGlobalGP', meansname='meanFourierGlobalGP')#
discovery.signals.epochavgbasis(psr, components, T=None, dt=1.0)[source]#
discovery.signals.cov2cov(covfunc)[source]#
discovery.signals.makegp_avgcov(psr, prior, epochavgbasis=<function epochavgbasis>, common=[], name='avgcovGP')[source]#
discovery.signals.makecommongp_avgcov(psrs, prior, epochavgbasis=<function epochavgbasis>, common=[], vector=False, name='avgcovCommonGP')[source]#
discovery.signals.makeglobalgp_avgcov(psrs, prior, epochavgbasis=<function epochavgbasis>, common=[], vector=False, name='avgcovCommonGP')[source]#
discovery.signals.timeinterpbasis(psr, components, T=None, start_time=None)[source]#
discovery.signals.make_timeinterpbasis(start_time=None, order=1)[source]#
discovery.signals.make_timeinterpbasis_dm(start_time=None, order=1, fref=1400.0)[source]#

Build a DM time-interpolation basis (fixed chromatic index alpha = 2).

Time-domain analogue of make_fourierbasis_dm() used by the FFT-covariance GPs: it scales the achromatic make_timeinterpbasis() basis by the cold-plasma dispersion factor (fref / psr.freqs) ** 2. Used by makegp_fftcov_dm().

discovery.signals.make_timeinterpbasis_chromatic(start_time=None, order=1, fref=1400.0)[source]#

Build a chromatic time-interpolation basis with a variable chromatic index.

Time-domain analogue of fourierbasis_chrom() used by the FFT-covariance GPs. The returned basis yields a callable Bmat_func(alpha) that scales the achromatic make_timeinterpbasis() basis by (fref / psr.freqs) ** alpha, with alpha a free parameter. Used by makegp_fftcov_chrom().

discovery.signals.make_dmtimeinterpbasis(alpha=2.0, tndm=False, start_time=None, order=1)[source]#
discovery.signals.psd2cov(psdfunc, components, T, oversample=3, fmax_factor=1, cutoff=1)[source]#
discovery.signals.makegp_fftcov(psr, prior, components, T=None, t0=None, order=1, oversample=3, fmax_factor=1, cutoff=1, fourierbasis=None, common=[], name='fftcovGP')[source]#
discovery.signals.makegp_fftcov_dm(psr, prior, components, T=None, t0=None, order=1, oversample=3, fmax_factor=1, cutoff=1, common=[], name='dm_gp', fref=1400.0)[source]#

FFT-covariance (time-domain) GP for DM noise (fixed chromatic index alpha = 2).

DM counterpart of makegp_fftcov(): the achromatic time-interpolation basis is replaced by make_timeinterpbasis_dm(), scaling each row by the cold-plasma dispersion factor (fref / psr.freqs) ** 2. prior is a power-spectral-density function (e.g. powerlaw()) that is converted to a time-domain covariance via psd2cov(). For a free chromatic index use makegp_fftcov_chrom().

discovery.signals.makegp_fftcov_chrom(psr, prior, components, T=None, t0=None, order=1, oversample=3, fmax_factor=1, cutoff=1, common=[], name='chrom_gp', fref=1400.0)[source]#

FFT-covariance (time-domain) GP for chromatic noise with a variable index.

Chromatic counterpart of makegp_fftcov(): the achromatic time-interpolation basis is replaced by make_timeinterpbasis_chromatic(), scaling each row by (fref / psr.freqs) ** alpha with the chromatic index alpha a free parameter. prior is a power-spectral-density function (e.g. powerlaw()) converted to a time-domain covariance via psd2cov(). For the alpha = 2 (DM) case use makegp_fftcov_dm().

discovery.signals.makecommongp_fftcov(psrs, prior, components, T, t0=None, order=1, oversample=3, fmax_factor=1, cutoff=1, fourierbasis=None, common=[], vector=False, name='fftcovCommonGP')[source]#
discovery.signals.makeglobalgp_fftcov(psrs, prior, orf, components, T, t0, order=1, oversample=3, fmax_factor=1, cutoff=1, fourierbasis=None, name='fftcovGlobalGP')[source]#
discovery.signals.makegp_intcov(psr, prior, components, T=None, timeinterpbasis=<function timeinterpbasis>, common=[], name='intcovGP')[source]#
discovery.signals.makecommongp_intcov(psr, prior, components, T, timeinterpbasis=<function timeinterpbasis>, common=[], name='intcovCommonGP')[source]#
discovery.signals.makeglobalgp_intcov(psr, prior, orf, components, T, timeinterpbasis=<function timeinterpbasis>, common=[], name='intcovGlobalGP')[source]#
discovery.signals.powerlaw(f, df, log10_A, gamma)[source]#
discovery.signals.brokenpowerlaw(f, df, log10_A, gamma, log10_fb)[source]#
discovery.signals.freespectrum(f, df, log10_rho)[source]#
Parameters:

log10_rho (Sequence)

discovery.signals.make_combined_crn(components, irn_psd, crn_psd, crn_prefix='crn_')[source]#

Combine an intrinsic red noise PSD and a common red noise PSD into a single PSD function that shares the same Fourier basis.

The intrinsic red noise PSD is evaluated over the full frequency basis, while the common red noise PSD is added only to the first 2 * components frequency bins (sine and cosine for each component).

Parameters:
  • components (int) – Number of shared Fourier frequency components used by the CRN model. This determines how many low-frequency bins of the intrinsic basis receive the CRN contribution (specifically, the first 2 * components entries, corresponding to sine/cosine pairs). This is not the same as the components argument passed to makegp_fourier — that controls the total number of Fourier components in the basis for the GP (and may be larger, since the intrinsic noise can extend to higher frequencies than the CRN).

  • irn_psd (callable) – PSD function for the intrinsic red noise. Must accept (f, df, ...) and return a PSD array over the full basis.

  • crn_psd (callable) – PSD function for the common red noise. Must accept (f, df, ...) and return a PSD array. Will only be called on the first 2 * components frequency bins.

  • crn_prefix (str or None) – Prefix applied to CRN parameter names that overlap with IRN names. For example, if both PSDs have log10_A and crn_prefix='crn_', the combined function will have log10_A (IRN) and crn_log10_A (CRN) as separate parameters. If None, overlapping names are shared (both PSDs receive the same value), which is valid when you intentionally want tied parameters.

Returns:

  • combined (callable) – A PSD function whose signature is the union of irn_psd and crn_psd signatures (with CRN overlaps prefixed). Compatible with makegp_fourier: argument names are inspectable via getfullargspec, and typing.Sequence annotations are preserved for parameter expansion.

  • crn_params (list of str) – The parameter names (as they appear in combined’s signature) that belong to the CRN PSD. Pass these directly as the common argument to makegp_fourier or makecommongp_fourier so that the CRN parameters are shared across pulsars rather than given per-pulsar names.

    Example:

    combined, crn_params = make_combined_crn(14, ds.powerlaw, ds.powerlaw)
    gp = makegp_fourier(psr, combined, components=30, common=crn_params)
    

discovery.signals.makepowerlaw_crn(components, crn_gamma='variable')[source]#
discovery.signals.powerlaw_brokencrn(f, df, log10_A, gamma, crn_log10_A, crn_gamma, crn_log10_fb)[source]#
discovery.signals.brokenpowerlaw_brokencrn(f, df, log10_A, gamma, log10_fb, crn_log10_A, crn_gamma, crn_log10_fb)[source]#
discovery.signals.makefreespectrum_crn(components)[source]#
discovery.signals.uncorrelated_orf(pos1, pos2)[source]#
discovery.signals.hd_orf(pos1, pos2)[source]#
discovery.signals.monopole_orf(pos1, pos2)[source]#
discovery.signals.dipole_orf(pos1, pos2)[source]#
discovery.signals.makedelay(psr, delay, components=None, common=[], name='delay')[source]#
discovery.signals.getresiduals(y)[source]#