[yt-users] Fwd: calculate the Xray emissivity

Andrea Negri negri.andre at gmail.com
Sun Nov 20 04:19:35 PST 2016


Hi all,

I'm using yt to analize ZEUS simulations. I have been able to remap
all the native fields on a custom AMR grid that I created, and I load
the data in the GDF format.

I'm very happy with this, but when I try to calculate the Xray
emissivity using this little script here:

import yt
from yt.analysis_modules.spectral_integrator.api import \
     add_xray_emissivity_field

ds=yt.load('GDFhdfaa.0000073.hdf5')
xray_fields = add_xray_emissivity_field(ds, 0.2, 8.0,
with_metals=False, constant_metallicity=0.5)
plot = yt.ProjectionPlot(ds, 'x', 'xray_luminosity_0.2_8.0_keV')

I get the error:

Traceback (most recent call last):
  File "./xray.py", line 11, in <module>
    plot = yt.ProjectionPlot(ds, 'x', 'xray_luminosity_0.2_8.0_keV')
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/visualization/plot_window.py",
line 1495, in __init__
    max_level=max_level)
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/construction_data_containers.py",
line 263, in __init__
    self.get_data(field)
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/construction_data_containers.py",
line 337, in get_data
    self._handle_chunk(chunk, fields, tree)
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/construction_data_containers.py",
line 437, in _handle_chunk
    d = chunk[field] * dl
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/data_containers.py",
line 281, in __getitem__
    self.get_data(f)
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/data_containers.py",
line 1295, in get_data
    self._generate_fields(fields_to_generate)
  File "/home/andrea/.yt-dev/yt-conda/src/yt-hg/yt/data_objects/data_containers.py",
line 1346, in _generate_fields
    raise YTFieldUnitError(fi, fd.units)
yt.utilities.exceptions.YTFieldUnitError: The field function
associated with the field '('gas', 'H_number_density')' returned data
with units 'dimensionless/g' but was defined with units 'cm**-3'.



I tried to check the GDF frontend, but I'm able to understand if the
error is there or somewhere else... You can find a very light dataset
in the GDF format in attachment, if you want ot reproduce the error.
You need to download both files, since in the GDF file there are some
hard links to the amr2 file (still an hdf5 file).
I tried both the stable and the developer version of yt, and the error
is the same.

Any ideas? I really think that my GDF file is correct, since I'm able
to slice and project all the native fields (density, temperature,
velocities...).


Thanks,
Andrea
-------------- next part --------------
A non-text attachment was scrubbed...
Name: amr2
Type: application/octet-stream
Size: 53088 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20161120/dd8eb0d0/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GDFhdfaa.0000073.hdf5
Type: application/octet-stream
Size: 85827 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20161120/dd8eb0d0/attachment-0003.obj>


More information about the yt-users mailing list