MNGuenther / allesfitter

allesfitter is a convenient wrapper around the packages ellc (light curve and RV models), dynesty (static and dynamic nested sampling) emcee (Markov Chain Monte Carlo sampling) and celerite (Gaussian Process models).
MIT License
60 stars 36 forks source link

Issue with 01 tutorial #51

Closed jmccormac01 closed 2 years ago

jmccormac01 commented 2 years ago

Hey Max! I hope you are well. I'm checking out allesfitter (very nice btw) and I get an error when running the first tutorial. Have you seen this before? Let m know if you need more info. Below is a dump of the output and traceback.

I simply ran the run.py file using the files from the git repo. Cheers, James

allesfitter version
---------------------
v1.2.8

Shifting epochs into the data center
------------------------------------
Companion b
        input epoch: 1.09
        shifted epoch: 4.5
        shifted by 1 periods
Nested Sampling output files already exists in allesfit/results
---------------------------------------------------------------
What do you want to do?
1 : overwrite the output files
2 : abort
1

Plotting collage for companion b...
100%|█████████████████████████████████████████████| 9/9 [00:00<00:00, 50.29it/s]
Plotting individual transits for companion b and instrument Leonardo...
100%|█████████████████████████████████████████████| 3/3 [00:00<00:00, 14.83it/s]

Results:
----------
log(Z) = 450.0570070110617 +- 0.13039549733445518
Nr. of posterior samples: 20532
Traceback (most recent call last):
  File "run.py", line 23, in <module>
    allesfitter.ns_output('allesfit')
  File "/Users/jmcc/.pyenv/versions/miniconda3-latest/lib/python3.7/site-packages/allesfitter/nested_sampling_output.py", line 158, in ns_output
    results2 = results.copy()                    
AttributeError: 'Results' object has no attribute 'copy'
>>> results
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'results' is not defined
MNGuenther commented 2 years ago

Hi James!

Do I understand right that you copied all the existing files to your local directory and then ran "run.py" (which then tries to overwrite the existing output files copied over from GitHub)?

Could you send me a log of which OS and which versions of Python, allesfitter, and dynesty you are using?

MNGuenther commented 2 years ago

Confirmed, the results.copy() feature was removed by dynesty>=1.2. All prior dynesty versions allow it and work well. You can chose one of the following solutions for now:

Solution 1: Downgrade to dynesty 1.1.

Solution 2: Amend your local file "nested_sampling_output.py" by adding the line from copy import deepcopy into the imports and replacing line 158 with results2 = deepcopy(results).

I'll push the updated version in the next allesfitter release, so it will be compatible with dynesty>=1.2 going forward.

MNGuenther commented 2 years ago

Confirmed again, this was a bug in dynesty 1.2, 1.2.1, and 1.2.2. The .copy() functionality will be re-added in dynesty v1.2.3.

For future reference: please upgrade to allesfitter 1.2.9 to bypass this problem.