Objects for managing the procedure of fitting models to TOAs.

The objects defined here can be used to set up a fitting problem and carry out the fit, adjust the model, and repeat the fit as necessary.

The primary objects of interest will be pint.fitter.WLSFitter for basic fitting, pint.fitter.GLSFitter for fitting with noise models that imply correlated errors, and pint.fitter.WidebandTOAFitter for TOAs that contain DM information. However, the Downhill fitter variants may offer better convergence.

Fitters in use:

>>> fitter = WLSFitter(toas, model)
>>> fitter.fit_toas()
>>> fitter.print_summary()
Fitted model using weighted_least_square method with 5 free parameters to 62 TOAs
Prefit residuals Wrms = 1090.5802622239905 us, Postfit residuals Wrms = 21.182038012901092 us
Chisq = 59.574 for 56 d.o.f. for reduced Chisq of 1.064

PAR                        Prefit                  Postfit            Units
=================== ==================== ============================ =====
PSR                           1748-2021E                              None
EPHEM                              DE421                              None
UNITS                                TDB                              None
START                                                         53478.3 d
FINISH                                                        54187.6 d
POSEPOCH                           53750                              d
PX                                     0                              mas
RAJ                         17h48m52.75s    17h48m52.8003s +/- 0.00014 hourangle_second
DECJ                          -20d21m29s   -20d21m29.3833s +/- 0.033 arcsec
PMRA                                   0                              mas / yr
PMDEC                                  0                              mas / yr
F0                               61.4855          61.485476554373(18) Hz
F1                            -1.181e-15            -1.1813(14)x10-15 Hz / s
PEPOCH                             53750                              d
CORRECT_TROPOSPHERE                    N                              None
PLANET_SHAPIRO                         N                              None
NE_SW                                  0                              1 / cm3
SWM                                    0
DM                                 223.9                  224.114(35) pc / cm3
DM1                                    0                              pc / (cm3 yr)
TZRMJD                           53801.4                              d
TZRSITE                                1                              None
TZRFRQ                           1949.61                              MHz

Derived Parameters:
Period = 0.01626400340437608 s +/- 4.784091376048965e-15 s
Pdot = 3.1248325489308735e-19 +/- 3.8139606793005067e-22
Characteristic age = 8.246e+08 yr (braking index = 3)
Surface magnetic field = 2.28e+09 G
Magnetic field at light cylinder = 4806 G
Spindown Edot = 2.868e+33 erg / s (I=1e+45 cm2 g)

To automatically select a fitter based on the properties of the data and model:

>>> fitter =, model)


DownhillFitter(toas, model[, track_mode, ...])

Abstract base class for downhill fitters.

DownhillGLSFitter(toas, model[, track_mode, ...])

Fitter that uses the shortening-step procedure for GLS fits.

DownhillWLSFitter(toas, model[, track_mode, ...])

Fitter that uses the shortening-step procedure for WLS fits.

Fitter(toas, model[, track_mode, residuals])

Base class for objects encapsulating fitting problems.

GLSFitter([toas, model, track_mode, residuals])

Generalized least-squares fitting.

GLSState(fitter, model[, full_cov, threshold])

LMFitter(toas, model[, track_mode, residuals])

ModelState(fitter, model)

Record a model state and cache calculations

PowellFitter(toas, model[, track_mode, ...])

A fitter that demonstrates how to work with a generic fitting function.

WLSFitter(toas, model[, track_mode, residuals])

Weighted Least Squares fitter.

WLSState(fitter, model[, threshold])

WidebandDownhillFitter(toas, model[, ...])

Fitter that uses the shortening-step procedure for wideband GLS fits.

WidebandLMFitter(toas, model[, track_mode, ...])

Fitter for wideband data based on Levenberg-Marquardt.

WidebandState(fitter, model[, full_cov, ...])

WidebandTOAFitter(fit_data, model[, ...])

A class to for fitting TOAs and other independent measured data.