[yt-users] Absorption Spectrum from Gadget snapshot problem

Jared Coughlin Jared.W.Coughlin.29 at nd.edu
Wed Aug 19 13:34:37 PDT 2015


Hello! I have a custom gadget snapshot distributed onto four files, and I'm
trying to make an absorption spectrum from a LOS through the middle of the
box parallel to the x-axis. To this end, I have done:

lr = LightRay(fname, load_kwargs={'unit_base' : my_unit_base, 'field_spec'
: my_field_def})
lr.make_light_ray(start_position=[0.0, 25000.0, 25000.0],
                             end_position=[50000.0, 25000.0, 25000.0],
                             solution_filename='lrsol.txt',
                             data_filename='lr.h5',
                             fields=['temperature', 'density'],
                             get_los_velocity=True)

sp = AbsorptionSpectrum(4862.4, 4949.04, 3000)
my_label = 'HI Lya'
field = 'H_number_density'
wavelength = 1215.67
f_value = 4.164E-01
gamma = 6.265E+08
mass = 1.00794

sp.add_line(my_label, field, wavelength, f_value, gamma, mass,
label_threshold=1e10)

wl, flux = sp.make_spectrum('lr.h5', output_file='spectrum.txt',
                                               line_list_file='lines.txt',
use_peculiar_velocity=True)

And I get the error: KeyError: "Unable to open object (Object
'h_number_density' doesn't exist)"
I didn't post the traceback because it's kind of long.

I have two questions. First: When calling make_light_ray and passing it
fields, do I need to pass it H_number_density? Second: Does yt read in
those fields from the gadget snapshot, or does it calculate them from the
data in the snapshot (for example, a standard gadget snapshot does not
write the temperature, but rather the internal energy)?  Thanks!
-Jared
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150819/4fd41740/attachment.htm>


More information about the yt-users mailing list