oslocyclotronlab / ompy

A python implementation of the Oslo method
https://ompy.readthedocs.io
GNU General Public License v3.0
6 stars 7 forks source link

No module named 'ompy.stats' #163

Closed fzeiser closed 3 years ago

fzeiser commented 3 years ago

@dortheg reports a bug using the latest verison of ompy (32e9489?) I have received only a part of the traceback. Here it is:

Jeg pullet nyeste versjon av OMpy fra Github, og da jeg kjørte fikk jeg følgende feilmelding:

Traceback (most recent call last):
  File "240Pu.py", line 1, in <module>
    import ompy as om
  File "/home/dorthea/Documents/FYS4515/ompy/ompy/__init__.py", line 45, in <module>
    from .normalizer_nld import (NormalizerNLD, load_levels_discrete,
  File "/home/dorthea/Documents/FYS4515/ompy/ompy/normalizer_nld.py", line 15, in <module>
    from .stats import truncnorm_ppf
ModuleNotFoundError: No module named 'ompy.stats'

Jeg satte linjen (i både normalizer_nld.py og normalizer_simultan.py) tilbake til:

from scipy.stats import truncnorm

I assume that it's was introduced in #155.

fzeiser commented 3 years ago

It's a bit strange that the Travis tests shouldn't fail on this.

@dortheg: Did you recompile ompy or just pull the latest version? ompy.stats is a cython module, so one needs to recompile ompy to make it available.

Here is the part in the readme:

Note: If you change any of the cython modules (*.pyx files), you will have to reinstall/recompile anyways. As they may have changed upstream, the easiest is probably if you install again every time you pull.

pip install -e .

dortheg commented 3 years ago

I only pulled :-) Then I guess that is my problem

fzeiser commented 3 years ago

Ok, could you please check this and report here if it is solved?

fzeiser commented 3 years ago

Note: ompy.stats is covered by the test:

https://github.com/oslocyclotronlab/ompy/blob/32e9489aa6d8cb8f69d0be70ee5a6c9d0c8d7213/tests/test_stats.py#L28-L38

dortheg commented 3 years ago

Running pip install -e . worked, now the code runs with from .stats import truncnorm_ppf. Thank you :-)