Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisrkckl committed Jan 22, 2025
1 parent 9438a7e commit 8acdefa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/pint/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,7 @@ def fit_toas(
residuals = self.resids.calc_combined_resids()

# get any noise design matrices and weight vectors
M, params, units, units_d = self.model.full_designmatrix()
M, params, _, _ = self.model.full_designmatrix(self.toas)

# normalize the design matrix
M, norm = normalize_designmatrix(M, params)
Expand Down Expand Up @@ -2616,8 +2616,16 @@ def fit_toas(
covmat = (xvar / norm).T / norm
# TODO: seems like doing this on every iteration is wasteful, and we should just do it once and then update the matrix
covariance_matrix_labels = {
param: (i, i + 1, unit)
for i, (param, unit) in enumerate(zip(params, units))
param: (
i,
i + 1,
(
fitp[param].units
if param != "Offset"
else u.dimensionless_unscaled
),
)
for i, param in enumerate(params)
}
# covariance matrix is 2D and symmetric
covariance_matrix_labels = [covariance_matrix_labels] * covmat.ndim
Expand All @@ -2633,10 +2641,7 @@ def fit_toas(

for pn in fitp.keys():
uind = params.index(pn) # Index of designmatrix
# Here we use design matrix's label, so the unit goes to normal.
# instead of un = 1 / (units[uind])
un = units[uind]
pv, dpv = fitpv[pn] * fitp[pn].units, dpars[uind] * un
pv, dpv = fitpv[pn] * fitp[pn].units, dpars[uind] * fitp[pn].units
fitpv[pn] = np.longdouble((pv + dpv) / fitp[pn].units)
# NOTE We need some way to use the parameter limits.
fitperrs[pn] = errs[uind]
Expand Down

0 comments on commit 8acdefa

Please sign in to comment.