hyperion-rt / hyperion

Hyperion Radiative Transfer Code
http://www.hyperion-rt.org
BSD 2-Clause "Simplified" License
52 stars 26 forks source link

Error when running set_model script #82

Closed spezzuto closed 10 years ago

spezzuto commented 10 years ago

I tried to setup a model for Hyperion. The command

python setup_model.py

gives the error

ERROR: TypeError: _set_polar_grid_auto() argument after ** must be a mapping, not SphericalPolarGrid [hyperion.model.analytical_yso_model]
Traceback (most recent call last):
  File "setup_model.py", line 41, in <module>
    m.write('test.rtin', compression=False)
  File "/usr/local/lib/python2.7/dist-packages/hyperion/model/analytical_yso_model.py", line 832, in write
    m = self.to_model(merge_if_possible=merge_if_possible)
  File "/usr/local/lib/python2.7/dist-packages/hyperion/model/analytical_yso_model.py", line 669, in to_model
    m.grid = self._set_polar_grid_auto(**self.grid)
TypeError: _set_polar_grid_auto() argument after ** must be a mapping, not SphericalPolarGrid

I attach the script as jpeg file. The original script contained the commented lines; then I copied the new lines

r = np.logspace(np.log10(rsun), np.log10(100 * au), 400)
r = np.hstack([0., r])  # add cell wall at r=0
theta = np.linspace(0., pi, 201)
phi = np.array([0., 2 * pi])
m.set_spherical_polar_grid(r, theta, phi)

from the web pages but I got the same error.

here is the script

script

astrofrog commented 10 years ago

@spezzuto - I don't see the JPEG attachment here. Could you just paste the whole file here or send it to me by email?

astrofrog commented 10 years ago

@spezzuto - what version of Hyperion are you using? You can find this with (in Python):

import hyperion
print hyperion.__version__

Thanks!

spezzuto commented 10 years ago

version 0.9.2

astrofrog commented 10 years ago

@spezzuto - looking at the changelog, I see that this is a bug that was fixed in 0.9.3. Could you try updating and let me know if this helps?

spezzuto commented 10 years ago

Yes, it works now. Thanks