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

QuadraticModel fails in evaluation #149

Open
jvines opened this issue Aug 17, 2021 · 1 comment
Open

QuadraticModel fails in evaluation #149

jvines opened this issue Aug 17, 2021 · 1 comment

Comments

@jvines
Copy link

jvines commented Aug 17, 2021

Describe the bug
Running a simple evaluation of the QuadraticModel raises a numba TypingError. What's odd to me is that calling evaluate_ps doesn't raise any issue.

The issue itself is:

---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
<ipython-input-16-d3c5206936e9> in <module>
      1 ldc = np.array([0.2, 0.4])
----> 2 flux = tm.evaluate(k=0.1, ldc=ldc, t0=0, p=1, a=3, i=np.pi/2, e=0, w=np.pi/2)

~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/ma_quadratic.py in evaluate(self, k, ldc, t0, p, a, i, e, w, copy)
    131             w = zeros(npv) if w is None else w
    132 
--> 133             flux = quadratic_model_v(self.time, k, t0, p, a, i, e, w, ldc,
    134                                      self.lcids, self.pbids, self.epids, self.nsamples, self.exptimes, self.npb,
    135                                      self.ed, self.ld, self.le, self.kt, self.zt, self.interpolate)

~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/numba/core/dispatcher.py in _compile_for_args(self, *args, **kws)
    418                 e.patch_message(msg)
    419 
--> 420             error_rewrite(e, 'typing')
    421         except errors.UnsupportedError as e:
    422             # Something unsupported is present in the user code, add help info

~/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/numba/core/dispatcher.py in error_rewrite(e, issue_type)
    359                 raise e
    360             else:
--> 361                 raise e.with_traceback(None)
    362 
    363         argtypes = []

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function atleast_1d at 0x7ff5c5f89a60>) found for signature:
 
 >>> atleast_1d(int64)
 
There are 2 candidate implementations:
      - Of which 2 did not match due to:
      Overload of function 'atleast_1d': File: numba/core/typing/npydecl.py: Line 724.
        With argument(s): '(int64)':
       No match.

During: resolving callee type: Function(<function atleast_1d at 0x7ff5c5f89a60>)
During: typing of call at /Users/jayvains/opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/numba/ma_quadratic_nb.py (584)


File "../../../../opt/anaconda3/envs/emperor/lib/python3.9/site-packages/pytransit/models/numba/ma_quadratic_nb.py", line 584:
def quadratic_model_v(t, k, t0, p, a, i, e, w, ldc, lcids, pbids, epids, nsamples, exptimes, npb,  edt, ldt, let, kt, zt, interpolate):
    p, a, i, e, w = atleast_1d(p), atleast_1d(a), atleast_1d(i), atleast_1d(e), atleast_1d(w)
    ^

To Reproduce
Steps to reproduce the behavior:

tm = QuadraticModel()
tim = np.linspace(-0.2, 0.2, 10000)
tm.set_data(tim)

ldc = np.array([0.2, 0.4])
flux = tm.evaluate(k=0.1, ldc=ldc, t0=0, p=1, a=3, i=np.pi/2, e=0, w=np.pi/2)

Expected behavior
I expect the code to evaluate and produce a light curve

Desktop (please complete the following information):

  • OS: macOS Big sur (11.4)
  • Python 3.9
  • numba 0.53.1
  • pytransit 2.5.12
@hpparvi
Copy link
Owner

hpparvi commented Oct 8, 2021

Hi @jvines,

This bug was caused by giving p as an integer instead of a float or an array of floats, and should be fixed now. Please pull the latest changes, reinstall, and give it a go :)

Cheers,
Hannu

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