<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Deskia,<div class=""><br class=""></div><div class="">Correct. To me it seems they are off (e.g. max. Z from yt is larger than from my well trusted particle code). In the end I try to use trident (which uses yt) in order to generate absorption spectra. These were initially (with the standard Gadget front end) roughly off from another code by the factor the metallicities are off, which is why I think if I fix those, I get correct spectra.</div><div class=""><br class=""></div><div class="">That’s exactly what I do as can be seen in the repository I linked: <a href="https://bitbucket.org/broett/my_yt/overview" class="">https://bitbucket.org/broett/my_yt/overview</a></div><div class="">Still, the metallicities are not what I expect (max. values too large).</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 29 Sep 2016, at 15:48, Desika Narayanan <<a href="mailto:desika.narayanan@gmail.com" class="">desika.narayanan@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">H Bernhard,<div class=""><br class=""></div><div class="">I don't think there's a front end out there, and to be honest I'm not entirely sure what the problem is, but it kind of looks to me like the metallicity you infer from yt is different from the Gadget SPH particles - is that right?</div><div class=""><br class=""></div><div class="">One thing that occured to me when I saw this thread (which is something you may have already taken care of) is that I think the Scannapieco/Naab metallicity blocks are different from typical Gadget.  I've copied below an email I got from Ena Choi a while ago about the ordering of these blocks:<br class=""></div><div class=""><br class=""></div><div class=""><span style="font-size:12.8px" class="">Metallicity_00 contains 'He' mass (in code unit),</span><br style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">and Metallicity_06 is 'H' mass. So yes, we need to to the separate</span><br style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">calculation to get the total metallicity in solar unit as:</span><br style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">metal_in_solar = (Metallicity_01+Metallicity+</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">02+Metallicity03+</span><br style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">Metallicity04+Metallicity05+</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">Metallicity07+ … + Metallicity11)/(Masses*Zsol).</span><br class=""></div><div class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8px" class="">I bet yt isn't reading these in in this order.  You might need to build a new front end.  You could have yt look for the field:  </span><span style="font-size:12.8px" class=""> ('PartType0', '</span><span class="gmail-il" style="background-color:rgb(255,255,255);font-size:12.8px">CS</span><span style="font-size:12.8px" class=""> Temperature') which I think is unique to this flavor of gadget.  I think it would be mostly the same as the normal gadget front end, other than getting the metallicity ordering right.</span></div><div class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8px" class="">That said, all of this could be totally wrong since I'm not 100% sure I understand the problem.</span></div><div class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-size:12.8px" class="">-d</span></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Sep 29, 2016 at 8:17 AM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Desika,<div class=""><br class=""></div><div class="">yes, that’s exactly what I am using (at least snapshot-wise). Is there already some frontend out there?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class="h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 17:35, Desika Narayanan <<a href="mailto:desika.narayanan@gmail.com" target="_blank" class="">desika.narayanan@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">Is there any chance you're using the Scannapieco/Naab et al. version of Gadget (with their metallicity blocks)?</div><div class=""><br class=""></div><div class="">-d</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 11:28 AM, Nathan Goldbaum <span dir="ltr" class=""><<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Wed, Sep 28, 2016 at 10:22 AM, Britton Smith <span dir="ltr" class=""><<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>></span> wrote:<br class=""></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><span class=""><div class="">Yes, I think I agree with you, but I'm not 100% sure.  If someone knows of an instance where that might happen, please speak up.  You should be able to pass units of "" (i.e., no units).  It looks like you're using "code_metallicity", which looks to be the same thing.  "Zsun" should be defined, so you can do:</div><div class="">ds.r["gas", "metallicity"].to("Zsun")</div><div class="">to see things in solar.  The metallicities will be in linear units.</div><div class=""><br class=""></div><div class="">Does anyone else have any ideas?</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Britton</div></font></span></span></div><span class=""><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 3:56 PM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi Britton,<div class=""><br class=""></div><div class="">thanks a lot! I finally can access the metallicity block :)</div><div class="">However, I am stilled puzzled by the result: The maximum value I have for the particles is ~0.08, but the maximum value I see in yt is ~0.10. That seems be to wrong. Regardless of the details of the mapping onto a grid, I should never get larger metallicities than for the individual particles, right?</div></div></blockquote></div></div></div></div></span></blockquote><div class=""><br class=""></div><div class="">Hi Bernhard,</div><div class=""><br class=""></div><div class="">Can you share the code snippet that generates that result?</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">-Nathan</div></font></span><div class=""><div class=""><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">And what units do I have to pass? Did I correctly understand that yt always assumes the metallicities to be in solar metallicities? And is it in linear units or logarithmic units?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 16:03, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">Sorry, the previous suggestion I gave you was completely wrong.</div><div class=""><br class=""></div><div class="">The issue is that the step where the ("gas", "metallicity") field is being created is happening before your setup_gas_particle_fields function is getting called.  The field never gets created because the ("PartType0", "metallicity") field does not yet exist.  I think yt is expecting it to be there because "metallicity" is typically aliased to a specific field on disk and that step happens earlier on.  Some rearranging of the order or operations might make this possible, but this simplest solution is to directly add the ("gas", "metallicity") field in your setup_gas_particle_fields.  If did it in the following way and it worked for me:</div><div class=""><br class=""></div><div class=""><div class=""><font face="monospace, monospace" class="">from yt.fields.particle_fields import \</font></div><div class=""><font face="monospace, monospace" class="">    add_volume_weighted_smoothed_f<wbr class="">ield</font></div></div><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class=""><font face="monospace, monospace" class=""># end of setup_gas_particle_fields</font></div><div class=""><div class=""><font face="monospace, monospace" class="">        num_neighbors = 64</font></div><div class=""><font face="monospace, monospace" class="">        fn = add_volume_weighted_smoothed_f<wbr class="">ield(</font></div><div class=""><font face="monospace, monospace" class="">            ptype, "particle_position", "particle_mass",</font></div><div class=""><font face="monospace, monospace" class="">            "smoothing_length", "density", "metallicity",</font></div><div class=""><font face="monospace, monospace" class="">            self, num_neighbors)</font></div><div class=""><font face="monospace, monospace" class="">        self.alias(("gas", "metallicity"), fn[0])</font></div><div class=""><br class=""></div></div><div class="">Britton</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 2:44 PM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Never mind! `sum` also accepts <a href="https://www.python.org/dev/peps/pep-0289/" target="_blank" class="">generator expressions</a>. So in my little example the last statement is equivalent with a+b+c. Since the <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.add.html" target="_blank" class="">addition of numpy arrays</a> of the same shape is defined as an element-wise operation, we end up with the intended result.<div class=""><br class=""></div><div class="">The thing that does not work is the for loop with the if-statement. This combination is only allowed in list comprehension and generator expressions.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 15:34, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">My apologies, I was not familiar with that syntax.  yt arrays will behave like NumPy arrays, so if that works as in your example, it should work in that function.  Can you elaborate at why my suggestion doesn't work in Python 2.7?  I will try to debug this here.</div><div class=""><br class=""></div><div class="">Britton</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 2:29 PM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">PS:<div class="">I also cannot access (‘PartType0’,’metallici<wbr class="">ty’) including you attempt to fix.</div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 15:27, Bernhard Röttgers <<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@MPA-Garching.MPG.DE</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">Hi Britton,<div class=""><br class=""></div><div class="">thanks for spotting this error! So that means yt arrays do not behave like numpy arrays, since:</div><div class=""><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)" class=""><span style="color:#35a327" class="">In [</span><span style="color:#2de621" class="">2</span><span style="color:#35a327" class="">]: </span><span class="">a = np.arange(</span><span style="color:#35a327" class="">10</span><span class="">)</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0);min-height:25px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)" class=""><span style="color:#35a327" class="">In [</span><span style="color:#2de621" class="">3</span><span style="color:#35a327" class="">]: </span><span class="">b = np.arange(</span><span style="color:#35a327" class="">10</span><span class="">)</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0);min-height:25px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)" class=""><span style="color:#35a327" class="">In [</span><span style="color:#2de621" class="">4</span><span style="color:#35a327" class="">]: </span><span class="">c = np.arange(</span><span style="color:#35a327" class="">10</span><span class="">)</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0);min-height:25px" class=""><span class=""></span><br class=""></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)" class=""><span style="color:#35a327" class="">In [</span><span style="color:#2de621" class="">5</span><span style="color:#35a327" class="">]: sum</span><span class="">( x </span><span style="color:#35a327" class="">for</span><span class=""> x </span><span style="color:#d03cff" class="">in</span><span class=""> [a,b,c] )</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)" class=""><span style="color:#b23622" class="">Out[</span><span style="color:#ff3b1d" class="">5</span><span style="color:#b23622" class="">]: </span><span class="">array([ 0,  3,  6,  9, 12, 15, 18, 21, 24, 27])</span></div><div class="">Which is what I had in mind, but apparently does not happen with yt arrays.</div><div class=""><br class=""></div><div class="">However, you proposed code seem to have problems, too. First of all the loop you propose is not Python 2.7, which I use. And second, even after fixing that, the problem is not solved. Actually even the particle_mass block seems to be broken somehow. I cannot access it by (“gas”, “particle_mass”) but only via (“partType0”, “particle_mass”).</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 28 Sep 2016, at 15:08, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">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 class=""><div class=""><br class=""></div><div class=""> <font face="monospace, monospace" class="">       def _metal_mass(field, data):</font></div><div class=""><font face="monospace, monospace" class="">            return sum( data[(ptype, "%s_mass"%el)]</font></div><div class=""><font face="monospace, monospace" class="">                    for el in self.nuclei_names if el not in ["H","He"] )</font></div></div><div class=""><br class=""></div><div class="">The sum function is going to reduce the entire field array to a single number.  I think you need something like this:</div><div class=""><br class=""></div><div class=""><font face="monospace, monospace" class="">field_data = np.zeros_like(data[ptype, "particle_mass"])</font></div><div class=""><font face="monospace, monospace" class="">for el in self.nuclei_names if el not in ["H","He"]:<br class=""></font></div><div class=""><font face="monospace, monospace" class="">    field_data += data[ptype, "%s_mass"% el]</font></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Britton</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 28, 2016 at 1:44 PM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi there,<div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 26 Sep 2016, at 20:36, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">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 class=""><div class="gmail_quote">On Mon, Sep 26, 2016 at 6:51 PM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Got the new fields. I had a little typo in the names.<div class="">Couldn’t  solve the problems with the unit system though.</div><div class="">And I have the additional problem, that I need to define a particle group “gas” for trident. How do I do this?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 26 Sep 2016, at 18:55, Bernhard Röttgers <<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@MPA-Garching.MPG.DE</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">Okay, so the (HDF5) snapshot is now available at:</div><a href="http://use.yt/upload/09111d2e" target="_blank" class="">http://use.yt/upload/09111d2e</a><br class=""><div class=""><br class=""></div><div class="">I used the FIRE frontend by Britton (<a href="https://bitbucket.org/brittonsmith/yt_fire" target="_blank" class="">https://bitbucket.org/britton<wbr class="">smith/yt_fire</a>) as a basis to create my own:</div><div class=""><a href="https://bitbucket.org/broett/my_yt/overview" target="_blank" class="">https://bitbucket.org/broett/m<wbr class="">y_yt/overview</a> (it’s git, not hg!)</div><div class=""><br class=""></div><div class="">I can load a snapshot with the front-end, but I still don’t have the self-defined fields. Meaning that after</div><div class=""><br class=""></div><div class=""><div class="">ds = my_yt.MyGadgetDataset(‘path/to<wbr class="">/snapshot/snap_M0664_4x_940.hd<wbr class="">f5', unit_base=…, bounding_box=…)</div><div class="">ds.index</div><div class="">ad = ds.all_data()</div></div><div class=""><br class=""></div><div class="">the following fails:</div><div class="">ad[('PartType0','metallicity’)<wbr class="">]</div><div class=""><br class=""></div><div class="">I also cannot use self.ds.unit_system["code_<wbr class="">metallicity”] in class MyGadgetFieldInfo(GadgetFieldI<wbr class="">nfo) as Britton did.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 26 Sep 2016, at 18:10, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Sep 26, 2016 at 11:07 AM, Bernhard Röttgers <span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.mpg.de</a>></span> wrote:<br class=""><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" class="">Okay, then I upload HDF5 for now. Called the file “snap_M6782_4x_470.hdf5”.<div class="">So what are we gonna do with it?</div><div class=""><br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">You can upload it using the yt curldrop:</div><div class=""><br class=""></div><div class="">$ curl -T snap_M6782_4x_470.hdf5 <a href="http://use.yt/upload/" target="_blank" class="">http://use.yt/upload/</a></div><div class=""><br class=""></div><div class="">That will print out a URL once the upload is finished, just share that URL here.</div><div class=""><br class=""></div><div class="">Alternatively generating a share link via google drive or dropbox will also work.</div><div class=""> </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" class=""><div class=""></div><div class="">Oops… I mixed up the field info and the data structure classes. My bad!</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 26 Sep 2016, at 17:55, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>> wrote:</div><br class=""><div class=""><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" class=""><div class="gmail_extra"><br class=""><br class=""><div class="gmail_quote">On Mon, Sep 26, 2016 at 10:42 AM, Bernhard Röttgers<span class=""> </span><span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.<wbr class="">mpg.de</a>></span><span class=""> </span>wrote:<br class=""><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" class="">Hi Nathan,<div class=""><br class=""></div><div class="">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 class="">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 class=""><br class=""></div><div class="">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 class=""> </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" class=""><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">I think all you need to do is declare the subclass and then load your dataset directly:</div><div class=""><br class=""></div><div class="">my_ds = MyGadgetHDF5DatasetSubclass(un<wbr class="">it_base=..., bbox=...)</div><div class=""><br class=""></div><div class="">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 class=""> </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" class=""><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 26 Sep 2016, at 17:24, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>> wrote:</div><br class=""><div class=""><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" class=""><div class="gmail_extra"><br class=""><br class=""><div class="gmail_quote">On Mon, Sep 26, 2016 at 10:15 AM, Bernhard Röttgers<span class=""> </span><span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.<wbr class="">mpg.de</a>></span><span class=""> </span>wrote:<br class=""><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" class="">Hi Britton,<div class=""><br class=""></div><div class="">thanks for the answer and sorry for my late answer!</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><div class="">ds = yt.load(YT_FNAME, unit_base=UNIT_BASE, bounding_box=bbox)</div><div class="">ds.index</div></div><div class=""><br class=""></div><div class="">The data structure `ds` then is what is passed to trident. Where does the new frontend come into play?</div></div></blockquote><div class=""><br class=""></div><div class="">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 class=""> </span><a href="http://yt-project.org/data" target="_blank" class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><a href="https://docs.hub.yt/services.html#curldrop" target="_blank" class="">https://docs.hub.yt/services.h<wbr class="">tml#curldrop</a></div><div class=""> </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" class=""><div class=""><br class=""></div><div class="">And some more questions:</div><div class="">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 class=""><br class=""></div><div class="">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 class=""> </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" class=""><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 19 Sep 2016, at 15:04, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank" class="">brittonsmith@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi Bernhard,<div class=""><br class=""></div><div class="">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 class=""><a href="https://bitbucket.org/brittonsmith/yt_fire" target="_blank" class="">https://bitbucket.org/brittons<wbr class="">mith/yt_fire</a><br class=""></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Britton</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Sep 17, 2016 at 11:45 AM, Bernhard Röttgers<span class=""> </span><span dir="ltr" class=""><<a href="mailto:broett@mpa-garching.mpg.de" target="_blank" class="">broett@mpa-garching.<wbr class="">mpg.de</a>></span><span class=""> </span>wrote:<br class=""><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" class="">Hello!<div class=""><br class=""></div><div class="">I am trying to use <a href="https://bitbucket.org/trident-project/trident" target="_blank" class="">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 class=""><br class=""></div><div class="">Is there a way to force yt to create the metallicity block correctly?.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Bernhard</div></div><br class="">______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""><br class=""></blockquote></div><br class=""></div>______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""><br class=""></blockquote></div><br class=""></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" class="">______________________________<wbr class="">_________________</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" class=""><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" class="">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" class=""><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" class="">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" class=""><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" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""><br class=""></blockquote></div><br class=""></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" class="">______________________________<wbr class="">_________________</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" class=""><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" class="">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" class=""><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" class="">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" class=""><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" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div>______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div>______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class=""></div></blockquote></div><br class=""></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></div><br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.o<wbr class="">rg</a><br class="">
<br class=""></blockquote></div></div></div><br class=""></div></div>
<br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.<wbr class="">org</a><br class="">
<br class=""></blockquote></div><br class=""></div>
______________________________<wbr class="">_________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/<wbr class="">listinfo.cgi/yt-users-<wbr class="">spacepope.org</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></body></html>