<div dir="ltr">Hi Bernhard,<div><br></div><div>I'm just starting to look at this now.  I haven't looked to closely yet, but I noticed an issue with your _metal_mass field function.  Right now, you've got:</div><div><div><br></div><div> <font face="monospace, monospace">       def _metal_mass(field, data):</font></div><div><font face="monospace, monospace">            return sum( data[(ptype, "%s_mass"%el)]</font></div><div><font face="monospace, monospace">                    for el in self.nuclei_names if el not in ["H","He"] )</font></div></div><div><br></div><div>The sum function is going to reduce the entire field array to a single number.  I think you need something like this:</div><div><br></div><div><font face="monospace, monospace">field_data = np.zeros_like(data[ptype, "particle_mass"])</font></div><div><font face="monospace, monospace">for el in self.nuclei_names if el not in ["H","He"]:<br></font></div><div><font face="monospace, monospace">    field_data += data[ptype, "%s_mass"% el]</font></div><div><br></div><div>The metallicity field is likely not showing up because it is quietly erroring.  This may fix that.  Let us know how it goes.</div><div><br></div><div>Britton</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 1:44 PM, Bernhard Röttgers <span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.mpg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi there,<div><br></div><div>I still have problems with the “gas”. I can access (“PartType0”, “metallicity”) but not (“gas”, “metallicity”). Why is the alias not being created automatically as I understood it should?</div><div><br></div><div>Cheers,</div><div>Bernhard</div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On 26 Sep 2016, at 20:36, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank">brittonsmith@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Bernhard,<div><br></div><div>The "gas" alias points to a version of the fields that has been deposited on the octtree.  For the ion-specific fields, Trident will take care of adding this for you as long as the element fields are added correctly.  I am at the end of my day here, but I can take a look at the dataset you've uploaded tomorrow.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 6:51 PM, Bernhard Röttgers <span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.mpg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Got the new fields. I had a little typo in the names.<div>Couldn’t  solve the problems with the unit system though.</div><div>And I have the additional problem, that I need to define a particle group “gas” for trident. How do I do this?</div><div><br></div><div>Cheers,</div><div>Bernhard</div><div><div><div><br><div><blockquote type="cite"><div>On 26 Sep 2016, at 18:55, Bernhard Röttgers <<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@MPA-Garching.MPG.DE</a>> wrote:</div><br><div><div style="word-wrap:break-word"><div>Okay, so the (HDF5) snapshot is now available at:</div><a href="http://use.yt/upload/09111d2e" target="_blank">http://use.yt/upload/09111d2e</a><br><div><br></div><div>I used the FIRE frontend by Britton (<a href="https://bitbucket.org/brittonsmith/yt_fire" target="_blank">https://bitbucket.org/britton<wbr>smith/yt_fire</a>) as a basis to create my own:</div><div><a href="https://bitbucket.org/broett/my_yt/overview" target="_blank">https://bitbucket.org/broett/m<wbr>y_yt/overview</a> (it’s git, not hg!)</div><div><br></div><div>I can load a snapshot with the front-end, but I still don’t have the self-defined fields. Meaning that after</div><div><br></div><div><div>ds = my_yt.MyGadgetDataset(‘path/to<wbr>/snapshot/snap_M0664_4x_940.hd<wbr>f5', unit_base=…, bounding_box=…)</div><div>ds.index</div><div>ad = ds.all_data()</div></div><div><br></div><div>the following fails:</div><div>ad[('PartType0','metallicity’)<wbr>]</div><div><br></div><div>I also cannot use self.ds.unit_system["code_<wbr>metallicity”] in class MyGadgetFieldInfo(GadgetFieldI<wbr>nfo) as Britton did.</div><div><br></div><div><br></div><div>Cheers,</div><div>Bernhard</div><div><br></div><div><br></div><div><div><br><div><blockquote type="cite"><div>On 26 Sep 2016, at 18:10, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 11:07 AM, Bernhard Röttgers <span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.mpg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Okay, then I upload HDF5 for now. Called the file “snap_M6782_4x_470.hdf5”.<div>So what are we gonna do with it?</div><div><br></div></div></blockquote><div><br></div><div>You can upload it using the yt curldrop:</div><div><br></div><div>$ curl -T snap_M6782_4x_470.hdf5 <a href="http://use.yt/upload/" target="_blank">http://use.yt/upload/</a></div><div><br></div><div>That will print out a URL once the upload is finished, just share that URL here.</div><div><br></div><div>Alternatively generating a share link via google drive or dropbox will also work.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div></div><div>Oops… I mixed up the field info and the data structure classes. My bad!</div><div><br></div><div>Cheers,</div><div>Bernhard</div><div><div><div><br></div><div><br><div><blockquote type="cite"><div>On 26 Sep 2016, at 17:55, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:</div><br><div><div dir="ltr" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 10:42 AM, Bernhard Röttgers<span> </span><span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.<wbr>mpg.de</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hi Nathan,<div><br></div><div>Yes, I have some smaller (~85MB) sample I could upload. I guess it should ideally be HDF5? (Originally it is format 2, but I can easily convert.) What naming should I use?</div><div>I would guess, my format is pretty much “the standard” except for the metallicity block (which in fact is element masses for 12 different elements).</div></div></blockquote><div><br></div><div>The naming and format doesn't matter too much. HDF5 is probably easiest to deal with, although yt supports both binary formats as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>So again, how am I supposed the data set class I derive from GadgetHDF5Dataset? Simply replacing `yt.load` yields an exception complaining that the `bounding_box` keyword argument is unexpected.</div></div></blockquote><div><br></div><div>I think all you need to do is declare the subclass and then load your dataset directly:</div><div><br></div><div>my_ds = MyGadgetHDF5DatasetSubclass(un<wbr>it_base=..., bbox=...)</div><div><br></div><div>It should also be possible to make your subclass work with yt.load() (i'm not sure how to do that offhand as I've never tried to add a new Dataset subclass outside of yt), but instantiating your subclass directly should be fine for now.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Cheers,</div><div>Bernhard</div><div><div><div><br><div><blockquote type="cite"><div>On 26 Sep 2016, at 17:24, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:</div><br><div><div dir="ltr" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 10:15 AM, Bernhard Röttgers<span> </span><span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.<wbr>mpg.de</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hi Britton,<div><br></div><div>thanks for the answer and sorry for my late answer!</div><div><br></div><div>No, I don’t have OWLS/EAGLE/Gizmo snapshots. I actually just wanted to compare my results with yt/trident, but your solution does not seem to be too complicated. How, am I supposed to use it? (Sorry for asking dump questions. I’m not familiar with yt.) I understood that I can load a Gadget snapshot with like:</div><div><br></div><div><div>ds = yt.load(YT_FNAME, unit_base=UNIT_BASE, bounding_box=bbox)</div><div>ds.index</div></div><div><br></div><div>The data structure `ds` then is what is passed to trident. Where does the new frontend come into play?</div></div></blockquote><div><br></div><div>Right now yt makes certain assumptions about the structure and meaning of data in Gadget output files. The assumptions currently used in yt are based on the public data the yt developers have access to (e.g. the datasets on<span> </span><a href="http://yt-project.org/data" target="_blank">yt-project.org/data</a>) and are only valid in so far as those datasets are representative of Gadget data in general. Due to the history of the Gadget's code, there are in reality many different flavors of Gadget that make different assumptions about what the data they write to disk means, and it seems yt doesn't currently make incorrect assumptions for your flavor of Gadget data.</div><div><br></div><div>Do you happen to have a test dataset that you can share? In principle the necessary modification should be simple, and having a dataset to test with would be helpful. One way to share files with us is to use the yt curldrop:</div><div><br></div><div><a href="https://docs.hub.yt/services.html#curldrop" target="_blank">https://docs.hub.yt/services.h<wbr>tml#curldrop</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>And some more questions:</div><div>What exactly are the code metallicity units? In my case yt says its in units of 1. Is this interpreted as absolute units or in solar metallicity?</div></div></blockquote><div><br></div><div>In units of solar metallicity. There is also the metal_density, which should have units of g/cm**3 (by default, if may be different if you specified a value for the `unit_system` keyword when you called the load() function.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Cheers,</div><div>Bernhard</div><div><div><div><br></div><div><br><div><blockquote type="cite"><div>On 19 Sep 2016, at 15:04, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank">brittonsmith@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Bernhard,<div><br></div><div>Does your data come from a specific flavor of Gadget that is supported by yt?  For example, we currently support OWLS, EAGLE, and Gizmo data that have fields for individual elements.  If not, then it is probably best to try and put together a new frontend for this data.  If the type of data that you're working with is not public or widely used, the best thing may be to create a frontend that exists as a yt extension (an external module not inside the main yt codebase).  Here is an example of one that I created a while back for the FIRE simulation data:</div><div><a href="https://bitbucket.org/brittonsmith/yt_fire" target="_blank">https://bitbucket.org/brittons<wbr>mith/yt_fire</a><br></div><div><br></div><div>If the only thing that is different about your data is the way that the metallicity fields are defined, then it shouldn't be too difficult to create a subclass of an existing Gadget frontend that overrides the field definitions.  Please, let us know if you're interested in pursuing this and we can work with you.</div><div><br></div><div>Britton</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 17, 2016 at 11:45 AM, Bernhard Röttgers<span> </span><span dir="ltr"><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank">broett@mpa-garching.<wbr>mpg.de</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hello!<div><br></div><div>I am trying to use <a href="https://bitbucket.org/trident-project/trident" target="_blank">trident</a> (yt-based code) to generate spectra out of my Gadget simulations (stored in HDF5). I could get the code running, but the spectra are scaled weirdly. I was able to track the problem down to a weirdly scaled metallicity block within yt. I am guessing that the issue is related to the fact, that my block “Metallicity” is in fact element masses for individual elements, i.e. for each particle I have an array of masses for the 12 elements He, C, Mg, O, Fe, Si, H, N, Ne, S, Ca, and the rest (I know, a crappy naming for such a block, but that’s the way it is).</div><div><br></div><div>Is there a way to force yt to create the metallicity block correctly?.</div><div><br></div><div>Cheers,</div><div>Bernhard</div></div><br>______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br><br></blockquote></div><br></div>______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br><br></blockquote></div><br></div></div><span style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">______________________________<wbr>_________________</span><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">yt-users mailing list</span><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:yt-users@lists.spacepope.org" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">yt-users@lists.spacepope.org</a><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br><br></blockquote></div><br></div></div><span style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">______________________________<wbr>_________________</span><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline">yt-users mailing list</span><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:yt-users@lists.spacepope.org" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">yt-users@lists.spacepope.org</a><br style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" style="font-family:helvetica;font-size:16px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
<br></blockquote></div><br></div></div>
______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br></div></blockquote></div><br></div></div></div>______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
<br></blockquote></div><br></div>
______________________________<wbr>_________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<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/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br></div>