Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m.write() not working #233

Open
astrofroger opened this issue Jun 11, 2023 · 1 comment
Open

m.write() not working #233

astrofroger opened this issue Jun 11, 2023 · 1 comment

Comments

@astrofroger
Copy link

astrofroger commented Jun 11, 2023

Hi Thomas!

I am trying to run the model following http://docs.hyperion-rt.org/en/stable/tutorials/example_class1.html
but it fails with:
###################################################

m.write('class1_example1.rtin')
/home/user/.local/lib/python3.11/site-packages/hyperion/densities/ulrich_envelope.py:434: RuntimeWarning: invalid value encountered in log

  • (np.log((np.sqrt(gamma_1) + 1) / (1. - np.sqrt(gamma_1)))
    Traceback (most recent call last):
    File "", line 1, in
    File "/home/user/.local/lib/python3.11/site-packages/hyperion/model/analytical_yso_model.py", line 862, in write
    m = self.to_model(merge_if_possible=merge_if_possible)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/user/.local/lib/python3.11/site-packages/hyperion/model/analytical_yso_model.py", line 729, in to_model
    g = virtual_file()
    ^^^^^^^^^^^^^^
    File "/home/user/.local/lib/python3.11/site-packages/hyperion/util/functions.py", line 24, in virtual_file
    return h5py.File(random_id(), driver='core', backing_store=False)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib64/python3.11/site-packages/h5py/_hl/files.py", line 533, in init
    fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib64/python3.11/site-packages/h5py/_hl/files.py", line 226, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
    File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
    File "h5py/h5f.pyx", line 106, in h5py.h5f.open
    OSError: Unable to open file (unable to open file)
    ###################################################

Actually it worked before, but failed after a reinstallation of Hyperion (0.9.10) and updating of the system baded python (3.11 currently).

Any way to fix this? Thanks a lot!

@astrofroger
Copy link
Author

My solution to this issue is to change
#######################################
return h5py.File(random_id(), driver='core', backing_store=False)
#######################################
to
#######################################
return h5py.File(random_id(), 'w', driver='core', backing_store=False)
#######################################
Is it ok? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant