<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 19, 2015 at 3:34 PM, Jared Coughlin <span dir="ltr"><<a href="mailto:Jared.W.Coughlin.29@nd.edu" target="_blank">Jared.W.Coughlin.29@nd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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:<div><br></div><div>lr = LightRay(fname, load_kwargs={'unit_base' : my_unit_base, 'field_spec' : my_field_def})<br></div><div>lr.make_light_ray(start_position=[0.0, 25000.0, 25000.0], </div><div>                             end_position=[50000.0, 25000.0, 25000.0], </div><div>                             solution_filename='lrsol.txt', </div><div>                             data_filename='lr.h5', </div><div>                             fields=['temperature', 'density'], </div><div>                             get_los_velocity=True)<br></div><div><br></div><div>sp = AbsorptionSpectrum(4862.4, 4949.04, 3000)<br></div><div><div>my_label = 'HI Lya'</div><div>field = 'H_number_density'</div><div>wavelength = 1215.67</div><div>f_value = 4.164E-01</div><div>gamma = 6.265E+08</div><div>mass = 1.00794</div><div><br></div><div>sp.add_line(my_label, field, wavelength, f_value, gamma, mass, label_threshold=1e10)</div></div><div><br></div><div>wl, flux = sp.make_spectrum('lr.h5', output_file='spectrum.txt', </div><div>                                               line_list_file='lines.txt', use_peculiar_velocity=True)<br></div><div><br></div><div>And I get the error: KeyError: "Unable to open object (Object 'h_number_density' doesn't exist)"</div><div>I didn't post the traceback because it's kind of long. </div></div></blockquote><div><br></div><div>We usually use a pastebin for this, e.g. <a href="http://paste.yt-project.org">paste.yt-project.org</a>.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>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!</div></div></blockquote><div><br></div><div>It can do both. If the hydrogen number density is available on disk, you might need to add it as a known alias to h_number_density in the gadget frontend. We already do this for the Enzo frontend, for example.</div><div><br></div><div>It's also possible to add a derived field to the gadget frontend that calculates the hydrogen number density based on other fields.  That's how the OWLS/EAGLE frontend does it.</div><div><br></div><div>As a stopgap, it should be possible to create a derived field in your script that defines ('gas', 'h_number_density'). I've never actually tried to get this to work, so I don't know if there might be obscure issues.</div><div><br></div><div>Cameron can likely comment on the light ray specific issues you're running into.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>-Jared</div></font></span></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>