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

ValueError when plotting analysis results due to timeshift #280

Closed
bfhealy opened this issue Nov 29, 2023 · 0 comments · Fixed by #281
Closed

ValueError when plotting analysis results due to timeshift #280

bfhealy opened this issue Nov 29, 2023 · 0 comments · Fixed by #281
Assignees

Comments

@bfhealy
Copy link
Collaborator

bfhealy commented Nov 29, 2023

I'm getting the an error after sampling completes when running lightcurve-analysis on demo transient photometry from SkyPortal.

Command:

lightcurve-analysis --model Bu2022Ye --svd-path svdmodels --outdir outdir --label ZTF21aaqjmps_Bu2022Ye --trigger-time 59294.2687730999 --data ZTF21aaqjmps.dat --prior priors/Bu2022Ye.prior --tmin 0.01 --tmax 7 --dt 0.1 --error-budget 1.0 --nlive 51 --Ebv-max 0.5724 --interpolation-type tensorflow --sampler pymultinest --plot

Error:

2023-11-29 10:05:53 nmma: Traceback (most recent call last):
  File "/Users/bhealy/nmma/api/app.py", line 216, in run_nmma_model
    main(args=parser.parse_args(args))
  File "/Users/bhealy/nmma/nmma/em/analysis.py", line 993, in main
    analysis(args)
  File "/Users/bhealy/nmma/nmma/em/analysis.py", line 808, in analysis
    num = (y_det - interp(t_det)) ** 2
  File "/Users/bhealy/miniforge3/envs/nmma_env/lib/python3.10/site-packages/scipy/interpolate/_polyint.py", line 80, in __call__
    y = self._evaluate(x)
  File "/Users/bhealy/miniforge3/envs/nmma_env/lib/python3.10/site-packages/scipy/interpolate/_interpolate.py", line 755, in _evaluate
    below_bounds, above_bounds = self._check_bounds(x_new)
  File "/Users/bhealy/miniforge3/envs/nmma_env/lib/python3.10/site-packages/scipy/interpolate/_interpolate.py", line 789, in _check_bounds
    raise ValueError("A value ({}) in x_new is above "
ValueError: A value (6.070891298244533) in x_new is above the interpolation range's maximum value (5.154269626136102).

I think this is happening because a time value (6.07 days) is beyond the interpolation range (up to 5.15 days) after the latter was shortened by a nonzero timeshift. The line performing the interpolation, added ~2 weeks ago, is below:

num = (y_det - interp(t_det)) ** 2

I'll be following up shortly with a PR to shift all times in this part of the code by the same timeshift, which should hopefully resolve this issue.

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

Successfully merging a pull request may close this issue.

1 participant