Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pint.pint_matrix.combine_design_matrices_by_param throws wrong exception when duplicate parameters are present. #1355

Closed
abhisrkckl opened this issue Jul 22, 2022 · 0 comments

Comments

@abhisrkckl
Copy link
Contributor

abhisrkckl commented Jul 22, 2022

Here is how to reproduce the issue:

import pint, pint.models
import astropy.units as u
from pint.pint_matrix import DesignMatrixMaker, combine_design_matrices_by_param

parfile = pint.config.examplefile("B1855+09_NANOGrav_dfg+12_TAI.par")
timfile = pint.config.examplefile("B1855+09_NANOGrav_dfg+12.tim")
model, toas = pint.models.get_model_and_toas(parfile, timfile)

dmm = DesignMatrixMaker('phase', u.Quantity(1,''))
dm1 = dmm(toas, model, ['F0'], offset=True)
dm2 = dmm(toas, model, ['F1'], offset=True)

dm12 = combine_design_matrices_by_param(dm1, dm2)

The expected error message is "Input design matrix {} has duplicated parameters with matrix {}".
The actual error message I get is the following. There seems to be an undefined variable "ii" used in the raise statement.

NameError Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 dm12 = combine_design_matrices_by_param(dm1, dm2)

File ~/anaconda3/envs/pint-devel/lib/python3.9/site-packages/pint_pulsar-0.7+2686.gbfa227ef.dirty-py3.9.egg/pint/pint_matrix.py:611, in combine_design_matrices_by_param(matrix1, matrix2, padding)
607 for d_param in matrix2.derivative_params:
608 if d_param in base_params:
609 raise ValueError(
610 "Input design matrix {} has duplicated "
--> 611 "parameters with matrix {}".format(ii, 0)
612 )
613 # check if input design matrix has same quantity and padding.
614 new_quantity_index = {}

NameError: name 'ii' is not defined

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

No branches or pull requests

2 participants