paulray / NICERsoft

Analysis software for the NICER mission
MIT License
17 stars 22 forks source link

Bug with option --usez in script ni_Htest_sortGTI.py #58

Closed sguillot closed 4 years ago

sguillot commented 5 years ago

Weird bug with a data set happened when adding the option --usez; and only with some values of --emin and --emax. For example, --emin=0.4 --emax=2.0 works fine, but --emin=0.3 --emax=2.0 doesn't.

Traceback (most recent call last):
  File "/Users/sebastien/Softwares/NICERsoft/scripts/ni_Htest_sortgti.py", line 305, in <module>
    hsig = sig2sigma(chi2.sf(hs,4))
  File "/Users/sebastien/Softwares/anaconda3/lib/python3.6/site-packages/pint-0.5.4+360.ga4b33ea-py3.6.egg/pint/eventstats.py", line 76, in sig2sigma
    results[isig] = fsolve(inverfc, [8], (sig,))
  File "/Users/sebastien/Softwares/anaconda3/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 147, in fsolve
    res = _root_hybr(func, x0, args, jac=fprime, **options)
  File "/Users/sebastien/Softwares/anaconda3/lib/python3.6/site-packages/scipy/optimize/minpack.py", line 225, in _root_hybr
    ml, mu, epsfcn, factor, diag)
ValueError: The array returned by a function changed size between calls
paulray commented 5 years ago

Maybe @kerrm can have a look

kerrm commented 5 years ago

@sguillot could you send me the .evt file and full invocation you were using when you got this? It does look weird... but maybe due to the auto-vectorization in sig2sigma.

sguillot commented 5 years ago

@sguillot could you send me the .evt file and full invocation you were using when you got this? It does look weird... but maybe due to the auto-vectorization in sig2sigma.

It's for the whole data set of J0740 (all ObsIDs in many separate files). Let me find a way to send you this, either in a single event file, or a subset.

sguillot commented 4 years ago

I'll check again if this issue persists.

kerrm commented 4 years ago

Oh yeah -- there is a bug I fixed in PINT in sig2sigma, and that needs to propagated. But I've been reluctant to do PRs with PINT trying to converge on the paper etc. Maybe a better fix at the moment is to just copy the correct code over to NICERsoft? We already have a special Htest version, anyway...

On Thu, 23 Apr 2020 at 10:33, Sebastien Guillot notifications@github.com wrote:

I'll check again if this issue persists.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulray/NICERsoft/issues/58#issuecomment-618429856, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LAGZD3FU6KZA57CGXH53ROBGTZANCNFSM4JB2ZWFQ .

paulray commented 4 years ago

Let's not leave bugs in PINT. Now is the time to fix them, before we tag v0.7. Please do a PR.

kerrm commented 4 years ago

It turned out I had actually committed this fix (you merged it in December), but I had some other updates so I went ahead and started a PR. It improves the test coverage so I'm sure someone will want to merge it :)

On Thu, 23 Apr 2020 at 10:39, Paul Ray notifications@github.com wrote:

Let's not leave bugs in PINT. Now is the time to fix them, before we tag v0.7. Please do a PR.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulray/NICERsoft/issues/58#issuecomment-618433488, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF3LAGZ4QSFLBQB6OO5VVM3ROBHLFANCNFSM4JB2ZWFQ .

sguillot commented 4 years ago

Works all fine :-)