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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org