Skip to content

feat: Rename DM/chromatic Fourier bases, add FFT-cov DM/chrom GPs and priors#129

Open
danielreardon wants to merge 1 commit into
nanograv:mainfrom
danielreardon:chromatic-naming-and-fftcov
Open

feat: Rename DM/chromatic Fourier bases, add FFT-cov DM/chrom GPs and priors#129
danielreardon wants to merge 1 commit into
nanograv:mainfrom
danielreardon:chromatic-naming-and-fftcov

Conversation

@danielreardon

Copy link
Copy Markdown

Renaming of chromatic GP functions and and extend the fftcov GPs to dm and chromatic function.

Naming: the old dmfourierbasis / dmfourierbasis_alpha names implied a DM process even when the chromatic index is a free parameter (in which case the process is not DM). Add clearly-named replacements:

  • fourierbasis_dm / make_fourierbasis_dm (fixed alpha = 2, genuine DM)
  • fourierbasis_chrom / make_fourierbasis_chrom (variable alpha, chromatic) The old dmfourierbasis, dmfourierbasis_alpha, make_dmfourierbasis, and make_dmtimeinterpbasis are kept as thin wrappers that emit a DeprecationWarning and delegate to the new functions, so existing code keeps working.

New FFT-covariance GPs: makegp_fftcov_dm and makegp_fftcov_chrom (time-domain covariance, analogous to the existing achromatic makegp_fftcov), backed by new make_timeinterpbasis_dm / make_timeinterpbasis_chromatic bases. Their default GP names are dm_gp / chrom_gp so their parameters resolve against the standard priors.

Priors: add default uniform priors for the DM/chromatic GP parameters (dm_gp_*, chrom_gp_*, chromgp_*) to priordict_standard.

Measurement noise: extend makenoise_measurement_simple with add_equad and tnequad options (EFAC-only and TempoNest-EQUAD conventions).

Also propagate the renames through models/epta.py, the README, and the docs, and add tests/test_chromatic_signals.py covering basis scaling, the deprecated aliases, the FFT-cov GPs, the new default priors, and the measurement-noise model.

Clarify chromatic GP naming and extend the FFT-covariance GP family.

Naming: the old `dmfourierbasis` / `dmfourierbasis_alpha` names implied a DM
process even when the chromatic index is a free parameter (in which case the
process is not DM). Add clearly-named replacements:
  - `fourierbasis_dm` / `make_fourierbasis_dm` (fixed alpha = 2, genuine DM)
  - `fourierbasis_chrom` / `make_fourierbasis_chrom` (variable alpha, chromatic)
The old `dmfourierbasis`, `dmfourierbasis_alpha`, `make_dmfourierbasis`, and
`make_dmtimeinterpbasis` are kept as thin wrappers that emit a DeprecationWarning
and delegate to the new functions, so existing code keeps working.

New FFT-covariance GPs: `makegp_fftcov_dm` and `makegp_fftcov_chrom` (time-domain
covariance, analogous to the existing achromatic `makegp_fftcov`), backed by new
`make_timeinterpbasis_dm` / `make_timeinterpbasis_chromatic` bases. Their default
GP names are `dm_gp` / `chrom_gp` so their parameters resolve against the
standard priors.

Priors: add default uniform priors for the DM/chromatic GP parameters
(`dm_gp_*`, `chrom_gp_*`, `chromgp_*`) to `priordict_standard`.

Measurement noise: extend `makenoise_measurement_simple` with `add_equad` and
`tnequad` options (EFAC-only and TempoNest-EQUAD conventions).

Also propagate the renames through `models/epta.py`, the README, and the docs,
and add `tests/test_chromatic_signals.py` covering basis scaling, the deprecated
aliases, the FFT-cov GPs, the new default priors, and the measurement-noise model.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@danielreardon danielreardon marked this pull request as ready for review June 15, 2026 11:10
@danielreardon danielreardon changed the title Rename DM/chromatic Fourier bases, add FFT-cov DM/chrom GPs and priors feat: Rename DM/chromatic Fourier bases, add FFT-cov DM/chrom GPs and priors Jun 15, 2026

@meyers-academic meyers-academic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Let me know if the comment about the structure of the Fourier bases makes sense? It might just be a cleaner construction, but I don't know if it would have downstream effects. I do think the measurement noise stuff can move to the test_measurement_noise.py tests. But otherwise, I think this is basically ready.

Comment thread src/discovery/signals.py
shape = solar.make_solardm(psr)(1.0)

return f, df, fmat * shape[:, None]
def make_fourierbasis_dm(alpha=2.0, tndm=False):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I even realized this code was in here, which is maybe silly of me. Would it make sense for us to have some construction here where alpha=None is the default, and then fourierbasis_dm = make_fourierbasis_dm(alpha=2.0) and if alpha is not None then we just return a static matrix? Then we don't need both fourierbasis_dm and this closure.

I think this would be cleaner overall (I was just looking at a very similar construction for a larger refactor for functions like powerlaw(), etc.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Though I have been constructing everything with makegp_fourier as below, so my current codes would need fourierbasis_dm. Having both maintains flexibility

signals.makegp_fourier(psr, signals.powerlaw, components=psr_components, fourierbasis=signals.fourierbasis_dm, name='dm_gp')

and

signals.makegp_fourier(psr, signals.powerlaw, components=psr_components, fourierbasis=signals.fourierbasis_chrom, name='chrom_gp'

# ---------------------------------------------------------------------------

@pytest.mark.unit
def test_measurement_simple_default_params(psr):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a test_measurement_noise.py that these can go in. I think it would make more sense for them to live there.

danielreardon added a commit to danielreardon/discovery that referenced this pull request Jun 18, 2026
…#129 naming convention)

Already the equivalent of upstream's make_solardmfourierbasis, so no new
function needed - just align the name with the direct-basis convention
(fourierbasis_dm / fourierbasis_chrom). Renamed outright (no alias) and
updated the mpta.py reference and tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants