tiny-hippo / planetsynth

A python package for generating giant planet cooling tracks.
MIT License
5 stars 1 forks source link

Error from function synthesize(planet_params) #6

Closed lorenaacuna closed 1 year ago

lorenaacuna commented 1 year ago

Hi,

I'm using the following snippet to test the installation of planetsynth:

from planetsynth import PlanetSynth

logt = 9 # log(planetary age) in yrs M = 0.4 # mass in Jupiter masses Z = 0.2 # bulk heavy-element content (mass fraction) Ze = 0.02 # atmospheric metallicity (mass fraction) logF = 5 # log(incident stellar irradiation) in erg/s/cm2 planet_params = [M, Z, Ze, logF]

pls = PlanetSynth() pred = pls.predict(logt, planet_params)

print(pred) print('it worked!')

I've tried with the latest version (1.0.2) in a macOSx laptop and a linux cluster, and they both produce the same error: Traceback (most recent call last): File "/vera/u/loacu/planetsynth-1.0.2/planetsynth_test.py", line 19, in pred = pls.predict(logt, planet_params) File "/vera/u/loacu/planetsynth-1.0.2/planetsynth/main.py", line 445, in predict prediction = self.synthesize(planet_params) File "/vera/u/loacu/planetsynth-1.0.2/planetsynth/main.py", line 357, in synthesize planet_params, self.check_params = self.check_input(planet_params) File "/vera/u/loacu/planetsynth-1.0.2/planetsynth/main.py", line 129, in check_input if np.less_equal(planet_params[self.i_M], self.max_M1, dtype=self.dtype): TypeError: No loop matching the specified signature and casting was found for ufunc less_equal

For the installation, I previously created a conda environment in the "planetsynth-1.0.2" with:

conda create -n for_planetsynth python=3.9 conda activate for_planetsynth pip install . (or "python setup.py install", I tried both)

Any help will be greatly appreciated.

tiny-hippo commented 1 year ago

Hey,

Thanks for the report. I think this was an issue with a newer version of numpy. I just pushed a commit that resolved the issue for me. Please let me know if it also works for you now.

lorenaacuna commented 1 year ago

That worked, thanks a lot!