<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 9:36 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</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 dir="ltr">Hi Jill,<div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Nov 20, 2014 at 6:27 PM, Jill Naiman <span dir="ltr"><<a href="mailto:jill.naiman@cfa.harvard.edu" target="_blank">jill.naiman@cfa.harvard.edu</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 dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>As the title states, I am confused - specifically about units.  I want to create a derived field where parts of the field are different values, dependent upon some cutoff criteria like so:<br><br>def _dene2(field,data):<br>    tl = data['temperature']<br>    dl = data['density']<br>    print("TEMP")<br>    print(tl.in_cgs())<br>    aux = np.where(tl.in_cgs() > 5000.)<br>    np.putmask(dl,aux, 0.0)<br>    dene = dl<br>    return dene<br><br><br>ds.add_field("dene", units="g/cm**3", function = _dene2)<br><br><br></div>Not only does this produce a very worrisome error:  "RuntimeError: Something has gone terribly wrong, _function is NullFunc for ('flash', 'temp')"<br></div></div></div></div></blockquote><div><br></div></span><div>This happens when field detection fails badly.  I'm a bit surprised to see it referencing a "temp" field - have you defined a "temp" field somewhere?</div></div></div></div></blockquote><div><br></div><div>I do not have a "temp" field defined anywhere, its actually one of the flash fields that is read in (I've printed out ds.field_list just to be sure and see: [('flash', 'dens'), ('flash', 'temp'), ('flash', 'pres'), ('flash', 'gpot'), ('flash', 'divb'), ('flash', 'velx'), ('flash', 'vely'), ('flash', 'velz'), ('flash', 'magx'), ('flash', 'magy'), ('flash', 'magz'), ('flash', 'magp')]<br><br></div><div>... I assume ('flash','temp') is 'temp'... or I am even more confused than previously thought :)<br><br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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 dir="ltr"><div><div><div><br></div>The print statement in there shows a bunch of values close to 1, which is why the "aux" mask never returns anything.But why is data a bunch of 1's in here?  How do I access/convert to the "real" units?</div></div></div></blockquote><div><br></div><div>yt's field detection algorithm will feed a field fake data that is close to 1 to see if there are errors in the field definition.  The values close to 1 you are seeing almost certainly come from field detection.  If the field validates correctly, real data will eventually be passed in.</div></div></div></div></blockquote><div><br></div><div>Makes sense, I assume in the actual plotting routine as that is where the actual error is happening, full error below:<br><br>Traceback (most recent call last):<br>  File "testderv.py", line 28, in <module><br>    plot = yt.PhasePlot(my_sphere, "dene", "radius", ["temperature"], weight_field="cell_volume")<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/visualization/profile_plotter.py", line 709, in __init__<br>    fractional=fractional)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 1151, in create_profile<br>    for f, l in zip(bin_fields, logs)]<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py", line 483, in __call__<br>    rv = super(Extrema, self).__call__(fields, non_zero)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py", line 59, in __call__<br>    sto.result = self.process_chunk(ds, *args, **kwargs)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py", line 491, in process_chunk<br>    fd = data[field]<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 214, in __getitem__<br>    self.get_data(f)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 623, in get_data<br>    self._generate_fields(fields_to_generate)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 640, in _generate_fields<br>    fd = self._generate_field(field)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 251, in _generate_field<br>    tr = self._generate_fluid_field(field)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 271, in _generate_fluid_field<br>    rv = finfo(gen_obj)<br>  File "/pfs/sw/yt-3.0/yt-x86_64/src/yt-hg/yt/fields/derived_field.py", line 176, in __call__<br>    "for %s" % (<a href="http://self.name">self.name</a>,))<br>RuntimeError: Something has gone terribly wrong, _function is NullFunc for ('flash', 'temp')<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Is there any chance you can reproduce this issue using one of the test datasets on <a href="http://yt-project.org/data" target="_blank">yt-project.org/data</a>?  If so, can you pastebin a script that causes the error you're seeing?  That should make it much easier to reproduce and figure out exactly what's going wrong.</div><div><br></div></div></div></div></blockquote><div><br></div><div>Done: <a href="http://paste.yt-project.org/show/5216/">http://paste.yt-project.org/show/5216/</a><br><br></div><div>Thanks!<br></div><div>-Jill<br></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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>-Nathan</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"><span class=""><div dir="ltr"><div><div><br></div>Any help is appreciated,<br></div>-Jill<br><div><div><div><div><br></div></div></div></div></div>
<br></span>_______________________________________________<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/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></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" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>