Hi All, When I access some derived fields (like StarFormationRate) in a galaxy simulation, the units are dimensionless: In [*4*]: ad = ds.all_data() In [*5*]: ad[("PartType0","StarFormationRate")] Out[*5*]: YTArray([ 0.00000000e+00, 0.00000000e+00, 8.29740111e-06, ..., 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]) (dimensionless) I'd like to assign the units to this field. I figure I could define a field with the right units, but it seems like it might be possible to just assign units to the ds StarFormationRate field as is. Is this possible, or should I just define a new field? thanks, desika _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Is this a derived field or a field that lives on disk in your data files? If it's the former, you can supply units using the "units" keyword argument of the add_field function. If it's the latter, I think you will need to make a small modification to the Gadget frontend to include StarFormationRate in the known_fields list. See "yt/frontends/gadget/fields.py" in the yt mercurial repository. On Sun, Dec 28, 2014 at 7:25 AM Desika Narayanan <dnarayan@haverford.edu> wrote:
Hi All,
When I access some derived fields (like StarFormationRate) in a galaxy simulation, the units are dimensionless:
In [*4*]: ad = ds.all_data()
In [*5*]: ad[("PartType0","StarFormationRate")]
Out[*5*]:
YTArray([ 0.00000000e+00, 0.00000000e+00, 8.29740111e-06, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00]) (dimensionless)
I'd like to assign the units to this field. I figure I could define a field with the right units, but it seems like it might be possible to just assign units to the ds StarFormationRate field as is. Is this possible, or should I just define a new field?
thanks, desika _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
it's the latter. cool, i'll try to issue a PR tonight. thanks, -d On Sun, Dec 28, 2014 at 11:26 AM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Is this a derived field or a field that lives on disk in your data files?
If it's the former, you can supply units using the "units" keyword argument of the add_field function.
If it's the latter, I think you will need to make a small modification to the Gadget frontend to include StarFormationRate in the known_fields list. See "yt/frontends/gadget/fields.py" in the yt mercurial repository. On Sun, Dec 28, 2014 at 7:25 AM Desika Narayanan <dnarayan@haverford.edu> wrote:
Hi All,
When I access some derived fields (like StarFormationRate) in a galaxy simulation, the units are dimensionless:
In [*4*]: ad = ds.all_data()
In [*5*]: ad[("PartType0","StarFormationRate")]
Out[*5*]:
YTArray([ 0.00000000e+00, 0.00000000e+00, 8.29740111e-06, ...,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00]) (dimensionless)
I'd like to assign the units to this field. I figure I could define a field with the right units, but it seems like it might be possible to just assign units to the ds StarFormationRate field as is. Is this possible, or should I just define a new field?
thanks, desika _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Desika Narayanan
-
Nathan Goldbaum