Thanks for your help. I have submitted a new issue about the documentation problem as you suggested.I have used the other example to produce a plot, but I’m not sure if the particles are being filtered correctly. I am using Enzo simulation data. I think I want to select all particles that are stars, and then only keep those that have a creation time greater than 0; I am unsure how to do this. Is it possible to combine two conditions within the filter definition?
Many thanks,AshleyOn 12 Sep 2017, at 21:57, nathan12343@gmail.com wrote:______________________________Hi Ashley,Unfortunately Stephanie's suggestion won't work, since units like Mpccm, which depend on details of the dataset, aren't available in yt.units. In particular the conversion from comoving megaparsecs to physical units depends on redshift and assumed cosmology.I think what's happening here is that you are dealing with a non-cosmological simulation which does not have Mpccm defined.It looks like yt's StarFormationRate class that you're trying to use assumes that it's being passed an output from a cosmological simulation and is failing in a less than graceful fashion when you try pass a non-cosmological output. We should probably emphasize more in the documentation that StarFormationRate only accepts a cosmological output (or improve it so that it *can* work with non-cosmological outputs) and improve the error message you saw. If you'd like to file an issue about this documentation problem (at https://github.com/yt-project/yt/issues/new ) that will help us to avoid losing track of this deficiency.Rather than using the StarFormationRate class, I'd suggest looking at this example in the cookbook section of the docs:To adapt that example for your data, you're going to need to figure out how to select the star particles in your simulation and then either adapt the particle filter definition in the example for your data, or if you are using a frontend like Gadget where the output format defines a star particle type, just use that instead of the particle filter. The rest of the cookbook recipe just uses numpy to bin the star particle ages according to the formation time of the particle, and then backs out the star formation rate history.Hope that helps,NathanOn Tue, Sep 12, 2017 at 3:23 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:I am not sure, but the first thing I would do would be to addfrom yt.units import MpccmAt the top and see what happens next.Best,StephanieOn Tue, Sep 12, 2017 at 11:36 AM Ashley Jarvis <ajarvis@star.sr.bham.ac.uk> wrote:Hi all,______________________________I’m attempting to adapt the example script for plotting star formation rates (found at http://yt-project.org/doc/analyzing/analysis_modules/star ) to work with output data from a simulation run using Enzo. However, when I attempt to run the script, I get the following error:_analysis.html#star-formation- rate ———————————————————File "PlotSFR.py", line 26, in <module>
sfr = StarFormationRate(data, star_mass=mass_old, star_creation_time=ct_old, volume=sp.volume())
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/analysis _modules/star_analysis/sfr_spe ctrum.py", line 115, in __init__
self._ds.quan(1.0, 'Mpccm**3').units
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/yt _array.py", line 1355, in __new__
dtype=dtype, bypass_validation=bypass_validation)
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/yt _array.py", line 430, in __new__
units = Unit(input_units, registry=registry)
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/un it_object.py", line 257, in __new__
unit_data = _get_unit_data_from_expr(unit_expr, registry.lut)
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/un it_object.py", line 572, in _get_unit_data_from_expr
unit_data = _get_unit_data_from_expr(unit_expr.args[0], unit_symbol_lut)
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/un it_object.py", line 566, in _get_unit_data_from_expr
return _lookup_unit_symbol(str(unit_expr), unit_symbol_lut)
File "/usr/local/anaconda/lib/python2.7/site-packages/yt/units/un it_object.py", line 657, in _lookup_unit_symbol
"symbols." % symbol_str)
yt.units.unit_registry.UnitParseError: Could not find unit symbol 'Mpccm' in the provided symbols. ———————————————————I am using version 3.3.5 of yt.Does anyone know how I can resolve this? Any suggestions would be greatly appreciated.Thanks,Ashley_________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.o rg
--______________________________stonnes@gmail.comCarnegie Observatories, Pasadena, CA--Alvin E. Nashman Postdoctoral Fellow
Dr. Stephanie Tonnesen_________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.o rg
_________________
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