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:
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.
On Wed, Jan 14, 2009 at 2:33 PM, david collins email@example.com wrote:
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?