hippke / Pandora

A fast transit-fitting algorithm to search for transits of exomoons
GNU General Public License v3.0
20 stars 4 forks source link

Crash while using default example.py #45

Closed nicholasjannsen closed 2 years ago

nicholasjannsen commented 2 years ago

Hi,

Thanks for this fun and useful software!

I was testing the example.py and got the following error simply copying the code into a ipython shell:

In [5]: model = pandora.moon_model(params)
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 model = pandora.moon_model(params)

File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/pandora.py:114, in moon_model.__init__(self, params)
    112 self.numerical_grid = params.numerical_grid
    113 self.time = params.time
--> 114 self.cache = create_occult_cache(self.u1, self.u2, dim=300)

File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/dispatcher.py:415, in _DispatcherBase._compile_for_args(self, *args, **kws)
    409         msg = str(e).rstrip() + (
    410             "\n\nThis error may have been caused by the following argument(s):\n%s\n"
    411             % "\n".join("- argument %d: %s" % (i, err)
    412                         for i, err in failed_args))
    413         e.patch_message(msg)
--> 415     error_rewrite(e, 'typing')
    416 except errors.UnsupportedError as e:
    417     # Something unsupported is present in the user code, add help info
    418     error_rewrite(e, 'unsupported_error')

File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/dispatcher.py:358, in _DispatcherBase._compile_for_args.<locals>.error_rewrite(e, issue_type)
    356     raise e
    357 else:
--> 358     reraise(type(e), e, None)

File ~/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/numba/core/utils.py:80, in reraise(tp, value, tb)
     78     value = tp()
     79 if value.__traceback__ is not tb:
---> 80     raise value.with_traceback(tb)
     81 raise value

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function empty>) found for signature:

 >>> empty(UniTuple(int64 x 2), dtype=Literal[str](float32))

There are 2 candidate implementations:
  - Of which 2 did not match due to:
  Overload of function 'empty': File: numba/core/typing/npydecl.py: Line 504.
    With argument(s): '(UniTuple(int64 x 2), dtype=unicode_type)':
   No match.

During: resolving callee type: Function(<built-in function empty>)
During: typing of call at /lhome/nicholas/.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/occult.py (15)

File "../../.cache/pypoetry/virtualenvs/platonium-nqdyOqtx-py3.8/lib/python3.8/site-packages/pandoramoon/occult.py", line 15:
def create_occult_cache(u1, u2, dim):
    <source elided>
    ks = np.linspace(0.001, k_max, dim)
    fs = np.empty((dim, dim), dtype="float32")
    ^

I'm using numba 0.51.2 and pandoramoon 1.0.

Cheers, Nicholas

hippke commented 2 years ago

Thank you for trying and the feedback! It works for me in iPython (although the shell hangs after saving the video, but this might be a matplotlib issue). Can you try updating to a later numba? pip install numba --upgrade I suspect that the 2D array cache requires numba >=0.54

nicholasjannsen commented 2 years ago

Thanks for the quick respond! Indeed updating numba to v. 0.54 did the trick. Cheers