[yt-users] Runtime Error: unitsystem cgs unrecognized
John ZuHone
jzuhone at gmail.com
Thu Nov 15 18:56:15 PST 2012
Hi Patrick,
Ok, so I have reproduced your error. It's very odd, actually. I also do FLASH simulations with magnetic fields, and I have the unitsystem = 'none' in my sims, and yt seems to catch this ok, but it's not catching the 'cgs' in yours. I can verify that I get this error whether I try to use your field or the magnetic fields already defined in yt.
I'll see what I can do about this.
Best,
John Z
On Nov 15, 2012, at 3:52 PM, Patrick Rieser wrote:
> Hi John,
>
> The files are from FLASH3. Ah and by the way, I am using the yt-dev version, updated some hours ago.
>
> Here is the main script:
> http://paste.yt-project.org/show/2877/
>
> and here the field is defined:
> http://paste.yt-project.org/show/2878/
>
> I did split my program in way too many modules, so if I should upload all scripts somewhere, just tell me!
>
> Best wishes,
> Patrick
>
>
> Am 15.11.2012 21:43, schrieb John ZuHone:
>> Hi Patrick,
>>
>> How old is your file, by chance? FLASH3? FLASH2?
>>
>> Also, if you don't mind, can you paste the script somewhere too?
>>
>> Thanks,
>>
>> John Z
>>
>> On Nov 15, 2012, at 3:41 PM, Patrick Rieser wrote:
>>
>>> Hey all!
>>>
>>> When I try to call my own added field magB I get a runtime error saying that the cgs unitsystem is
>>> unrecognized. When I insert pf["unitsystem"] == "cgs" directly before the call where the traceback
>>> starts, it returns true.
>>>
>>>
>>> Best wishes,
>>> Patrick
>>>
>>>
>>>
>>> I add the field with:
>>>
>>> def _magB(field,data):
>>> return (na.sqrt(data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
>>> add_field("magB", function=_magB, units=r"\rm{Gauss}")
>>>
>>> and then call:
>>>
>>> rad_profile.add_fields("magB")
>>>
>>> Traceback:
>>>
>>> File "rad_profile_magb.py", line 100, in <module>
>>> rad_profile.add_fields("magB")
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 170, in add_fields
>>> self._unlazy_add_fields(fields, weight, accumulation)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 151, in _unlazy_add_fields
>>> accumulation, self._args, check_cut = False)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 55, in save_state
>>> tr = func(*args, **kwargs)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 264, in _bin_field
>>> source_data = self._get_field(source, field, check_cut)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/profiles.py", line 204, in _get_field
>>> data.append(source[field][pointI].ravel().astype('float64'))
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 328, in __getitem__
>>> self.get_data(key)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 2593, in get_data
>>> if self._generate_field(field):
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 358, in _generate_field
>>> self[field] = self.pf.field_info[field](self)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 378, in __call__
>>> dd = self._function(self, data)
>>> File "/home/patrick/Auswertung/yt-bit/Plot/common_fields.py", line 7, in _magB
>>> return (na.sqrt(data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 328, in __getitem__
>>> self.get_data(key)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 2593, in get_data
>>> if self._generate_field(field):
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 358, in _generate_field
>>> self[field] = self.pf.field_info[field](self)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 378, in __call__
>>> dd = self._function(self, data)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/frontends/flash/fields.py", line 357, in _Bx
>>> factor = GetMagRescalingFactor(data.pf)
>>> File "/home/patrick/Programme/yt-x86_64/src/yt-hg/yt/frontends/flash/fields.py", line 353, in GetMagRescalingFactor
>>> "value %s is unrecognized" % pf['unitsystem'])
>>> RuntimeError: Runtime parameter unitsystem withvalue cgs is unrecognized
>>>
>>> _______________________________________________
>>> 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
More information about the yt-users
mailing list