dear all i am using yt for enzo. my script reads: import yt # Load the dataset. ds = yt.load("~/enzo/run/CosmologySimulation/AMRCosmology/DD0001/DD0001") # Create a 1 Mpc radius sphere, centered on the max density. sp = ds.sphere("max", (0.1, "Mpc")) # Use the total_quantity derived quantity to sum up the # values of the cell_mass and particle_mass fields # within the sphere. baryon_mass, particle_mass = sp.quantities.total_quantity(["cell_mass", "particle_mass"]) print("Total mass in sphere is %0.3e Msun (gas = %0.3e Msun, particles = %0.3e Msun)" % \ ((baryon_mass + particle_mass).in_units('Msun'), \ baryon_mass.in_units('Msun'), particle_mass.in_units('Msun'))) ----------- the error i am getting is: ~/enzo/run/CosmologySimulation/AMRCosmology$ python trial.py Traceback (most recent call last): File "trial.py", line 4, in <module> ds = yt.load("~/enzo/run/CosmologySimulation/AMRCosmology/DD0001/DD0001") File "/usr/local/lib/python2.7/dist-packages/yt/convenience.py", line 79, in load if c._is_valid(*args, **kwargs): candidates.append(n) File "/usr/local/lib/python2.7/dist-packages/yt/frontends/flash/data_structures.py", line 493, in _is_valid fileh = HDF5FileHandler(args[0]) File "/usr/local/lib/python2.7/dist-packages/yt/utilities/file_handler.py", line 22, in __init__ self.handle = h5py.File(filename, 'r') File "/usr/local/lib/python2.7/dist-packages/yt/utilities/on_demand_imports.py", line 31, in __call__ raise self.error ImportError: This functionality requires the h5py package to be installed. ---------------- is my script outdated, there is something wrong with my installation or deficiencies in the python libraries? thank you cynthia
Hi Cynthia,
To load Enzo data you need both the HDF5 library and the H5py python
wrappers installed.
Nathan
On Sun, Jul 16, 2017 at 3:17 AM Cynthia Saad (Student)
dear all
i am using yt for enzo. my script reads:
import yt
# Load the dataset. ds = yt.load("~/enzo/run/CosmologySimulation/AMRCosmology/DD0001/DD0001")
# Create a 1 Mpc radius sphere, centered on the max density. sp = ds.sphere("max", (0.1, "Mpc"))
# Use the total_quantity derived quantity to sum up the # values of the cell_mass and particle_mass fields # within the sphere. baryon_mass, particle_mass = sp.quantities.total_quantity(["cell_mass", "particle_mass"])
print("Total mass in sphere is %0.3e Msun (gas = %0.3e Msun, particles = %0.3e Msun)" % \ ((baryon_mass + particle_mass).in_units('Msun'), \ baryon_mass.in_units('Msun'), particle_mass.in_units('Msun')))
-----------
the error i am getting is:
~/enzo/run/CosmologySimulation/AMRCosmology$ python trial.py Traceback (most recent call last): File "trial.py", line 4, in <module> ds = yt.load("~/enzo/run/CosmologySimulation/AMRCosmology/DD0001/DD0001") File "/usr/local/lib/python2.7/dist-packages/yt/convenience.py", line 79, in load if c._is_valid(*args, **kwargs): candidates.append(n) File "/usr/local/lib/python2.7/dist-packages/yt/frontends/flash/data_structures.py", line 493, in _is_valid fileh = HDF5FileHandler(args[0]) File "/usr/local/lib/python2.7/dist-packages/yt/utilities/file_handler.py", line 22, in __init__ self.handle = h5py.File(filename, 'r') File "/usr/local/lib/python2.7/dist-packages/yt/utilities/on_demand_imports.py", line 31, in __call__ raise self.error ImportError: This functionality requires the h5py package to be installed.
----------------
is my script outdated, there is something wrong with my installation or deficiencies in the python libraries?
thank you
cynthia _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Cynthia,
It seems a bit unusual that your yt installation doesn't have h5py
installed. Can you tell us how you installed yt? We can probably help you
get the necessary packages installed, if you haven't managed to do that yet.
Britton
On Sun, Jul 16, 2017 at 6:02 AM, Nathan Goldbaum
Hi Cynthia,
To load Enzo data you need both the HDF5 library and the H5py python wrappers installed.
Nathan
On Sun, Jul 16, 2017 at 3:17 AM Cynthia Saad (Student)
wrote: dear all
i am using yt for enzo. my script reads:
import yt
# Load the dataset. ds = yt.load("~/enzo/run/CosmologySimulation/AMRCosmology/DD0001/DD0001")
# Create a 1 Mpc radius sphere, centered on the max density. sp = ds.sphere("max", (0.1, "Mpc"))
# Use the total_quantity derived quantity to sum up the # values of the cell_mass and particle_mass fields # within the sphere. baryon_mass, particle_mass = sp.quantities.total_quantity(["cell_mass", "particle_mass"])
print("Total mass in sphere is %0.3e Msun (gas = %0.3e Msun, particles = %0.3e Msun)" % \ ((baryon_mass + particle_mass).in_units('Msun'), \ baryon_mass.in_units('Msun'), particle_mass.in_units('Msun')))
-----------
the error i am getting is:
~/enzo/run/CosmologySimulation/AMRCosmology$ python trial.py Traceback (most recent call last): File "trial.py", line 4, in <module> ds = yt.load("~/enzo/run/CosmologySimulation/ AMRCosmology/DD0001/DD0001") File "/usr/local/lib/python2.7/dist-packages/yt/convenience.py", line 79, in load if c._is_valid(*args, **kwargs): candidates.append(n) File "/usr/local/lib/python2.7/dist-packages/yt/frontends/flash/data_structures.py", line 493, in _is_valid fileh = HDF5FileHandler(args[0]) File "/usr/local/lib/python2.7/dist-packages/yt/utilities/file_handler.py", line 22, in __init__ self.handle = h5py.File(filename, 'r') File "/usr/local/lib/python2.7/dist-packages/yt/utilities/on_demand_imports.py", line 31, in __call__ raise self.error ImportError: This functionality requires the h5py package to be installed.
----------------
is my script outdated, there is something wrong with my installation or deficiencies in the python libraries?
thank you
cynthia _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Britton Smith
-
Cynthia Saad (Student)
-
Nathan Goldbaum