[yt-users] yt errors

Nathan Goldbaum nathan12343 at gmail.com
Mon Feb 8 20:18:54 PST 2016


Hi Tazkera,

It works if I do this:

http://paste.yt-project.org/show/6233/

The issue with your example is that your derived field definition either
returns 1 or 0, when instead it should return an array with the same shape
as E_total.

-Nathan

On Mon, Feb 8, 2016 at 9:49 PM, tazkera haque <h.tazkera at gmail.com> wrote:

> I am trying to derive a new field here and will test it with one of the
> scripts first. but I am getting  error when I am checking if that field has
> been added already. please take a look at the errors for me.
>
> import yt
>
> from yt import derived_field
>
>
> @derived_field(name = "__mass_ejects")
> def shock(field,data):
>     dm = data['cell_mass']
>     xv = data['velx']
>     yv = data['vely']
>     zv = data['velz']
>     grav_pot= data['gpot']
> #define total energy
>     E_total=0.5*dm*(xv**2+yv**2+zv**2)+grav_pot*dm
>
>
>     if E_total >0:
>         return 0
>     else :
>         return 1
> ds.index
> print ds.field_info["gas", "cell_mass"].get_source()
> print ds.field_info["gas", "__mass_ejects"].get_source()
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>  def _cell_mass(field, data):
>         return data[ftype, "density"] * data["index", "cell_volume"]
>
>
> ---------------------------------------------------------------------------KeyError                                  Traceback (most recent call last)<ipython-input-29-bfb3007289ba> in <module>()      1 ds.index      2 print ds.field_info["gas", "cell_mass"].get_source()----> 3 print ds.field_info["gas", "__mass_ejects"].get_source()
> /home/trina/anaconda2/lib/python2.7/site-packages/yt/fields/field_info_container.pyc in __missing__(self, key)    285     def __missing__(self, key):    286         if self.fallback is None:--> 287             raise KeyError("No field named %s" % (key,))    288         return self.fallback[key]    289
> KeyError: "No field named ('gas', '__mass_ejects')"
>
>
>
>
> On Mon, Feb 8, 2016 at 11:18 AM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> This error happens when yt can't find a field for a given dataset. In
>> this case it's looking for a field named 'absReynoldsStress'. It reports it
>> with the funny spelling "('all', 'absReynoldsStrss')" because it's guessing
>> that it's a particle field.
>>
>> Since that isn't a field in your FLASH dataset (unless you've modified
>> FLASH to output such a field), and it's not defined as a derived field in
>> that script or in yt itself, yt isn't able to generate it.
>>
>> Do you have an 'absReynoldsStress' derived field defined somewhere else?
>>
>> -Nathan
>>
>> On Sun, Feb 7, 2016 at 9:53 PM, tazkera haque <h.tazkera at gmail.com>
>> wrote:
>>
>>> Hi, can anyone please check my script and the corresponding error?
>>>
>>> On Sun, Feb 7, 2016 at 1:29 PM, tazkera haque <h.tazkera at gmail.com>
>>> wrote:
>>>
>>>> thanks very much everyone. solves my problem.
>>>>
>>>> On Sun, Feb 7, 2016 at 11:15 AM, Kacper Kowalik <
>>>> xarthisius.kk at gmail.com> wrote:
>>>>
>>>>> On 02/06/2016 09:03 PM, tazkera haque wrote:
>>>>>
>>>>>> Hi , thanks very much for the helps. but I happen to get the errors
>>>>>> still
>>>>>> though I did the exact same things as suggested. I am attaching the
>>>>>> summary
>>>>>> and error.
>>>>>>
>>>>>
>>>>> Hi Tazkera,
>>>>>
>>>>> clean.sh unfortunately doesn't remove cythonized modules (.c files).
>>>>> You can either manually remove the offending file
>>>>> (yt/geometry/grid_container.c) or use hg purge. In order to do the latter
>>>>> you'll need to add the following to $HOME/.hgrc:
>>>>>
>>>>> [extensions]
>>>>> hgext.purge =
>>>>>
>>>>> Then try:
>>>>>
>>>>> $ cd /work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/
>>>>> $ hg purge --all
>>>>> $ python setup.py build_ext -i  # (or python setup.py develop)
>>>>>
>>>>> Cheers,
>>>>> Kacper
>>>>>
>>>>>
>>>>> On Sat, Feb 6, 2016 at 9:05 PM, Nathan Goldbaum <nathan12343 at gmail.com
>>>>>> >
>>>>>> wrote:
>>>>>>
>>>>>> It looks like yt's C extensions need to be recompiled. Can you
>>>>>>> activate
>>>>>>> the yt environment and do the following:
>>>>>>>
>>>>>>> $ cd /work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/
>>>>>>> $ bash ./clean.sh
>>>>>>> $ hg pull
>>>>>>> $ hg update
>>>>>>> $ python setup.py develop
>>>>>>>
>>>>>>> If that doesn't work, can you reply with the output of "hg summary",
>>>>>>> as
>>>>>>> well as the error that you see?
>>>>>>>
>>>>>>> Hope that helps,
>>>>>>>
>>>>>>> Nathan
>>>>>>>
>>>>>>> On Sat, Feb 6, 2016 at 7:25 PM, tazkera haque <h.tazkera at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hi , I am trying to run a python file with yt packages on STAMPEDE.
>>>>>>>> and
>>>>>>>> getting some errors each time. I think the error is due to some
>>>>>>>> installation error of yt at first place. can you please look at
>>>>>>>> both my
>>>>>>>> code and error and send me the solutions to solve the problem. both
>>>>>>>> the
>>>>>>>> files are attached for your convenience.
>>>>>>>>
>>>>>>>> regards
>>>>>>>> Tazkera
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> yt-users mailing list
>>>>>>>> yt-users at lists.spacepope.org
>>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> yt-users mailing list
>>>>>>> yt-users at lists.spacepope.org
>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> yt-users mailing list
>>>>>> yt-users at lists.spacepope.org
>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users at lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160208/d352577b/attachment.html>


More information about the yt-users mailing list