[Yt-dev] yt: parameters in analysis

Matthew Turk matthewturk at gmail.com
Wed Jan 14 15:20:38 PST 2009


Okay, what this speaks to is a failure of the field detection
mechanism.  What it is going on is that it is trying to identify your
field dependencies.  Because you directly address parameters instead
of using the __getitem__ method, it's crapping out -- because the
parameter file is mocked up with a defaultdict.

So what I'd say needs to happen is twofold --

1. Directly address data.pf["EquationOfState"]
2. The line "deps +=
ensure_list(fi[field].get_dependencies().requested)" should include a
"pf = whatevs" so that it can directly address the parameter file.
This will obviate the need for #1, but it might cause other problems,
so it needs to be tested.

However, all of that aside, what I think should be happening here is
we need to get into a flow where you are not instantiating
EnzoStaticOutput objects, but ratehr DaveStaticOutputs, which have
their own field_info objects with your field subsets.  Sometime I'll
send you some code to do that; I think it will, ultimately, be the
best thing for all of this.

-Matt

On Wed, Jan 14, 2009 at 3:10 PM, david collins <antpuncher at gmail.com> wrote:
> Sure:
>
> http://paste.enzotools.org/show/24/
>
> And when I do a post mortem, I get:
>>>> pdb.pm()
>> /nics/b/home/collins/yt/xtra_fields.py(191)_SoundSpeedSquared()
> -> else:
> (Pdb) data.pf
> defaultdict(<function <lambda> at 0x8ccef50>, {})
> (Pdb) data.pf.keys()
> []
> (Pdb) data.keys()
> []
>
> both of which are odd...
>
> d.
>
> On Wed, Jan 14, 2009 at 2:57 PM, Matthew Turk <matthewturk at gmail.com> wrote:
>> Hey Dave,
>>
>> Can you send a bit more context in the traceback?  This looks okay to
>> me at first glance, because it's roughly the same thing as:
>>
>> http://yt.enzotools.org/browser/branches/yt-generalization/yt/lagos/EnzoFields.py?rev=1111#L49
>>
>> but it's tough to say without seeing a bit more, specifically how the
>> field is getting called -- from which datatype.  Feel free to submit
>> to paste.enzotools.org as a traceback, if you like.
>>
>> -Matt
>>
>> On Wed, Jan 14, 2009 at 2:33 PM, david collins <antpuncher at gmail.com> wrote:
>>> Hey, Matt--
>>>
>>> My equation of state is driven by a flag in the parameter file, and
>>> for isothermal runs, I don't have an energy field, and I store Sound
>>> Speed as a parameter.  So to get around this, when I need to get at
>>> things like sound speed or gas pressure, I do the following:
>>>
>>> def _SoundSpeedSquared(field,data):
>>>    if data.pf.parameters['EquationOfState'] == 0:
>>>        return data.pf['Gamma']*data['GasPressure']/data['Density']
>>>    else:
>>>        return data['Density']*0 +
>>> (data.pf.parameters['IsothermalSoundSpeed'])**2
>>>
>>> When I do a projection, it chokes in the following way:
>>>
>>> if data.pf.parameters['EquationOfState'] == 0:
>>>   AttributeError: 'collections.defaultdict' object has no attribute
>>> 'parameters'
>>>
>>> What's the YT Approved way of getting to the parameter file info in analysis?
>>>
>>> d.
>>>
>> _______________________________________________
>> Yt-dev mailing list
>> Yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>>
>



More information about the yt-dev mailing list