vallis / libstempo

libstempo — a Python wrapper for tempo2
MIT License
29 stars 33 forks source link

crashing when making ideal pulsar #56

Open tsmith2 opened 1 year ago

tsmith2 commented 1 year ago

I have been trying to load J1713+0747 from the 15 year data and when I try to run 'LT.make_ideal(psr)' it fails and gives me the following errors:

Warning: one or more of the design-matrix columns is null. Disabling renormalization (if active), but fit may fail.

and then fails with the following output

`--------------------------------------------------------------------------- LinAlgError Traceback (most recent call last) Cell In[5], line 1 ----> 1 LT.make_ideal(psr)

File /opt/anaconda3/envs/ent15y/lib/python3.9/site-packages/libstempo/toasim.py:159, in make_ideal(psr) 156 """Adjust the TOAs so that the residuals to zero, then refit.""" 158 psr.stoas[:] -= psr.residuals() / 86400.0 --> 159 psr.fit()

File libstempo/libstempo.pyx:2087, in libstempo.libstempo.tempopulsar.fit()

File libstempo/libstempo.pyx:2054, in libstempo.libstempo.tempopulsar._fit()

File /opt/anaconda3/envs/ent15y/lib/python3.9/site-packages/scipy/linalg/_decomp_cholesky.py:154, in cho_factor(a, lower, overwrite_a, check_finite) 94 def cho_factor(a, lower=False, overwrite_a=False, check_finite=True): 95 """ 96 Compute the Cholesky decomposition of a matrix, to use in cho_solve 97 (...) 152 153 """ --> 154 c, lower = _cholesky(a, lower=lower, overwrite_a=overwrite_a, clean=False, 155 check_finite=check_finite) 156 return c, lower

File /opt/anaconda3/envs/ent15y/lib/python3.9/site-packages/scipy/linalg/_decomp_cholesky.py:37, in _cholesky(a, lower, overwrite_a, clean, check_finite) 35 c, info = potrf(a1, lower=lower, overwrite_a=overwrite_a, clean=clean) 36 if info > 0: ---> 37 raise LinAlgError("%d-th leading minor of the array is not positive " 38 "definite" % info) 39 if info < 0: 40 raise ValueError('LAPACK reported an illegal value in {}-th argument' 41 'on entry to "POTRF".'.format(-info))

LinAlgError: 19-th leading minor of the array is not positive definite`

I am trying to produce a synthetic data set which matches as close as possible the NG15yr data-- if this is my goal, is it necessary to re fit?

Any help on resolving this would be much appreciated.

tsmith2 commented 1 year ago

I realized that I needed to use the tempo2 par files (in 'narrowband/alternate/tempo2/')-- once I did, this error went away.