Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d9fa175
add time domain solar wind covariance
Feb 23, 2026
fcc9bbd
make phi 2d
Feb 23, 2026
a65be32
add td sw noise models to init.py
Feb 23, 2026
37e6386
fix fitter phi inversion to be more stable (hopefully)
Feb 23, 2026
ef6d8db
bug fix noise model
Feb 23, 2026
f3ab176
refactor get_phiinv so that normalization is outside
Feb 23, 2026
d53cb23
bugfix circular imports
Feb 23, 2026
75a1af8
add prefix param for nodes
Feb 23, 2026
18a0a12
small commit
Feb 24, 2026
2f999e5
rename *SWNoise to TD*SWNoise
Feb 24, 2026
4d9e8e5
add prefix parameter for custom basis nodes; add interpolation kind
Feb 24, 2026
693587e
run black
Feb 24, 2026
b7494a2
add matern kernel
Feb 24, 2026
74abc38
Merge branch 'nanograv:master' into feat/jgb-td-solar-wind-gp
jeremy-baier Feb 26, 2026
c99a59c
change noise design matrix to be double precision rather than long do…
jeremy-baier Feb 27, 2026
9009482
move change to before the fourier design matrix is created
jeremy-baier Feb 28, 2026
63575a6
cache noise designmatrix U with checks to make sure noise parameters …
jeremy-baier Feb 28, 2026
b5e7183
black
jeremy-baier Feb 28, 2026
b8ec690
add PINT caching for phi matrix
jeremy-baier Mar 4, 2026
e4a1a27
Implement SolarWindProxyRegression formal PINT model
jeremy-baier Mar 20, 2026
a793ea5
update sw proxy code
jeremy-baier Mar 20, 2026
7e9bae6
Clean up proxy tests: keep 7 core functionality tests
jeremy-baier Mar 20, 2026
91a9361
fix derivative registration
jeremy-baier Apr 4, 2026
19e9f60
resolve merge conflict w/ PULL in changelog
jeremy-baier Apr 6, 2026
5b5039c
Merge remote-tracking branch 'origin/feat/jgb-td-solar-wind-gp' into …
jeremy-baier Apr 6, 2026
f2d9c1d
refactor TDSWNOISE into one class; edit tests
jeremy-baier Apr 23, 2026
ff39084
fix merge conflicts in changlog, wideband state
May 26, 2026
edb5648
Merge branch 'nanograv:master' into feat/jgb-td-solar-wind-gp
jeremy-baier May 26, 2026
52104b7
Merge branch 'feat/jgb-td-solar-wind-gp' of github.com:jeremy-baier/P…
jeremy-baier May 27, 2026
7376364
update docstring on interpolation basis
jeremy-baier May 27, 2026
69d92a0
Merge branch 'nanograv:master' into feat/jgb-td-solar-wind-gp
jeremy-baier May 28, 2026
c934dd6
Merge branch 'feat/jgb-td-solar-wind-gp' of github.com:jeremy-baier/P…
jeremy-baier May 28, 2026
9fe8490
overhaul docstring with example; refactor unit tests and make sure th…
jeremy-baier May 28, 2026
519eb45
bug fix in fitter.py from hand resolved merge conflict
jeremy-baier May 29, 2026
f6e7f3e
Merge branch 'feat/jgb-td-solar-wind-gp' into feat/jgb-sw-proxy-regre…
jeremy-baier May 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ the released changes.
- `pintk` Diff/Unc calculation now uses post-fit uncertainties.
### Added
- Plot whitened DM residuals in pintk.
- Time-domain solar wind GP noise components: ridge, squared-exponential, Matérn, and quasi-periodic kernels
- Regression tests for noise design-matrix caching, including multi-basis coverage (red, DMGP, SWGP, and chromatic GP)
### Fixed
- `WidebandTOAFitter` raises a warning if the model has correlated errors (It used to give wrong results before).
- Fixed bug where "include_bipm" flag was being ignored when loading Fermi TOAs with weights, now defaults to using EPHEM, CLOCK and PLANET_SHAPIRO from the timing model
Expand Down
39 changes: 31 additions & 8 deletions src/pint/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
)
from pint.residuals import Residuals, WidebandTOAResiduals
from pint.toa import TOAs
from pint.utils import FTest, normalize_designmatrix
from pint.utils import FTest, get_phiinv, normalize_designmatrix

__all__ = [
"Fitter",
Expand Down Expand Up @@ -1341,7 +1341,9 @@ def step(self) -> np.ndarray:
else:
M, params, units = self.model.full_designmatrix(self.fitter.toas)
M, norm = normalize_designmatrix(M, params)
phiinv = 1 / self.model.full_basis_weight(self.fitter.toas) / norm**2
phi = self.model.full_basis_weight(self.fitter.toas)
phiinv = get_phiinv(phi)
phiinv = (phiinv / norm).T / norm # normalize the phi^-1 matrix
Nvec = (
self.model.scaled_toa_uncertainty(self.fitter.toas).to_value(u.s) ** 2
)
Expand Down Expand Up @@ -1902,7 +1904,9 @@ def fit_toas(
else:
M, params, units = self.model.full_designmatrix(self.toas)
M, norm = normalize_designmatrix(M, params)
phiinv = 1 / self.model.full_basis_weight(self.toas) / norm**2
phi = self.model.full_basis_weight(self.toas)
phiinv = get_phiinv(phi)
phiinv = (phiinv / norm).T / norm # normalize the phi^-1 matrix
Nvec = self.model.scaled_toa_uncertainty(self.toas).to(u.s).value ** 2
mtcm, mtcy = get_gls_mtcm_mtcy(phiinv, Nvec, M, residuals)

Expand Down Expand Up @@ -2205,13 +2209,19 @@ def fit_toas(
phi = self.model.noise_model_basis_weight(self.toas)
phiinv = np.zeros(M.shape[1])
if Mn is not None and phi is not None:
phiinv = np.concatenate((phiinv, 1 / phi))
n_tm = M.shape[1]
new_d_matrix = combine_design_matrices_by_param(d_matrix, Mn)
M, params, units = (
new_d_matrix.matrix,
new_d_matrix.derivative_params,
new_d_matrix.param_units,
)
if np.ndim(phi) == 1:
phiinv = np.zeros(M.shape[1])
phiinv[n_tm:] = 1 / phi
else:
phiinv = np.zeros((M.shape[1], M.shape[1]))
phiinv[n_tm:, n_tm:] = get_phiinv(phi)

ntmpar = self.model.ntmpar

Expand All @@ -2228,11 +2238,17 @@ def fit_toas(
mtcy = np.dot(cm.T, residuals)
# mtcm, mtcy = get_gls_mtcm_mtcy_fullcov(cov, M, residuals)
else:
phiinv /= norm**2
if np.ndim(phiinv) == 1:
phiinv /= norm**2
else:
phiinv = (phiinv / norm).T / norm
Nvec = self.scaled_all_sigma() ** 2
cinv = 1 / Nvec
mtcm = np.dot(M.T, cinv[:, None] * M)
mtcm += np.diag(phiinv)
if np.ndim(phiinv) == 1:
mtcm += np.diag(phiinv)
else:
mtcm += phiinv
mtcy = np.dot(M.T, cinv * residuals)
# mtcm, mtcy = get_gls_mtcm_mtcy(phiinv, Nvec, M, residuals)

Expand All @@ -2249,7 +2265,11 @@ def fit_toas(
if full_cov:
chi2 = np.dot(newres, scipy.linalg.cho_solve(cf, newres))
else:
chi2 = np.dot(newres, cinv * newres) + np.dot(xhat, phiinv * xhat)
if np.ndim(phiinv) == 1:
prior_chi2 = np.dot(xhat, phiinv * xhat)
else:
prior_chi2 = np.dot(xhat, phiinv @ xhat)
chi2 = np.dot(newres, cinv * newres) + prior_chi2

# compute absolute estimates, normalized errors, covariance matrix
dpars = xhat / norm
Expand Down Expand Up @@ -2631,7 +2651,10 @@ def get_gls_mtcm_mtcy(
"""
cinv = 1 / Nvec
mtcmplain = np.dot(M.T, cinv[:, None] * M)
mtcm = mtcmplain + np.diag(phiinv)
if np.ndim(phiinv) == 1:
mtcm = mtcmplain + np.diag(phiinv)
else:
mtcm = mtcmplain + phiinv
mtcy = np.dot(M.T, cinv * residuals)
return (mtcm, mtcy) if not return_mtcmplain else (mtcm, mtcy, mtcmplain)

Expand Down
1 change: 1 addition & 0 deletions src/pint/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
PLRedNoise,
ScaleToaError,
ScaleDmError,
TimeDomainSWNoise,
)
from pint.models.phase_offset import PhaseOffset
from pint.models.piecewise import PiecewiseSpindown
Expand Down
7 changes: 7 additions & 0 deletions src/pint/models/model_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ def _validate_components(self):
if v.category == "pulsar_system":
# The pulsar system will be selected by parameter BINARY
continue
elif self.all_components.components[superset].category == v.category:
# Same-category components are mutually exclusive alternatives.
# A superset component in the same category is selected over a
# subset when its extra parameters appear in the parfile, so
# there is no ambiguity. (E.g. SolarWindProxyRegression vs
# SolarWindDispersion, discriminated by SWPRBETA1.)
continue
else:
raise ComponentConflict(m)

Expand Down
Loading
Loading