<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks for your help. I have submitted a new issue about the documentation problem as you suggested.<div class=""><br class=""></div><div class="">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?</div><div class=""><br class=""></div><div class="">Many thanks,</div><div class="">Ashley</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 12 Sep 2017, at 21:57, <a href="mailto:nathan12343@gmail.com" class="">nathan12343@gmail.com</a> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="auto" class="">Hi Ashley,</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">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.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">I think what's happening here is that you are dealing with a non-cosmological simulation which does not have Mpccm defined.</div><div dir="auto" class=""><br class=""></div><div class="">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 <a href="https://github.com/yt-project/yt/issues/new" class="">https://github.com/yt-project/yt/issues/new</a>) that will help us to avoid losing track of this deficiency.</div><div class=""><br class=""></div><div class="">Rather than using the StarFormationRate class, I'd suggest looking at this example in the cookbook section of the docs:</div><div class=""><br class=""></div><div class=""><a href="http://yt-project.org/doc/cookbook/calculating_information.html#using-particle-filters-to-calculate-star-formation-rates" target="_blank" class="">http://yt-project.org/doc/<wbr class="">cookbook/calculating_<wbr class="">information.html#using-<wbr class="">particle-filters-to-calculate-<wbr class="">star-formation-rates</a><br class=""></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Hope that helps,</div><div class=""><br class=""></div><div class="">Nathan</div><div dir="auto" class=""><br class=""></div><div class="gmail_quote"><div class="">On Tue, Sep 12, 2017 at 3:23 PM Stephanie Tonnesen <<a href="mailto:stonnes@gmail.com" target="_blank" class="">stonnes@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div dir="auto" class="">I am not sure, but the first thing I would do would be to add</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">from yt.units import Mpccm </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">At the top and see what happens next. </div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Best,</div><div dir="auto" class="">Stephanie </div></div><div class=""><br class=""><div class="gmail_quote"><div class="">On Tue, Sep 12, 2017 at 11:36 AM Ashley Jarvis <<a href="mailto:ajarvis@star.sr.bham.ac.uk" target="_blank" class="">ajarvis@star.sr.bham.ac.uk</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word" class="">Hi all,<div class=""><br class=""></div><div class="">I’m attempting to adapt the example script for plotting star formation rates (found at <a href="http://yt-project.org/doc/analyzing/analysis_modules/star_analysis.html#star-formation-rate" target="_blank" class="">http://yt-project.org/doc/a<wbr class="">nalyzing/analysis_modules/star<wbr class="">_analysis.html#star-formation-<wbr class="">rate</a>) to work with output data from a simulation run using Enzo. However, when I attempt to run the script, I get the following error:</div><div class=""><br class=""></div><div class="">———————————————————</div><div class=""><br class=""></div><div class="">File "PlotSFR.py", line 26, in <module><br class="">    sfr = StarFormationRate(data, star_mass=mass_old, star_creation_time=ct_old, volume=sp.volume())<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/analysis<wbr class="">_modules/star_analysis/sfr_<wbr class="">spectrum.py", line 115, in __init__<br class="">    self._ds.quan(1.0, 'Mpccm**3').units<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">yt_array.py", line 1355, in __new__<br class="">    dtype=dtype, bypass_validation=bypass_valid<wbr class="">ation)<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">yt_array.py", line 430, in __new__<br class="">    units = Unit(input_units, registry=registry)<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">unit_object.py", line 257, in __new__<br class="">    unit_data = _get_unit_data_from_expr(unit_<wbr class="">expr, registry.lut)<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">unit_object.py", line 572, in _get_unit_data_from_expr<br class="">    unit_data = _get_unit_data_from_expr(unit_<wbr class="">expr.args[0], unit_symbol_lut)<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">unit_object.py", line 566, in _get_unit_data_from_expr<br class="">    return _lookup_unit_symbol(str(unit_e<wbr class="">xpr), unit_symbol_lut)<br class="">  File "/usr/local/anaconda/lib/pytho<wbr class="">n2.7/site-packages/yt/units/<wbr class="">unit_object.py", line 657, in _lookup_unit_symbol<br class="">    "symbols." % symbol_str)<br class="">yt.units.unit_registry.UnitPar<wbr class="">seError: Could not find unit symbol 'Mpccm' in the provided symbols.</div><div class=""><br class=""></div><div class="">———————————————————</div><div class=""><br class=""></div><div class="">I am using version 3.3.5 of yt.</div><div class=""><br class=""></div><div class="">Does anyone know how I can resolve this? Any suggestions would be greatly appreciated.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Ashley</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div>______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.<wbr class="">org</a><br class="">
</blockquote></div></div><div class="">-- <br class=""></div><div class=""><div class=""><div class=""><div class=""><div class=""><font face="garamond,serif" class="">--<br class="">Dr. Stephanie Tonnesen<br class=""></font></div><font face="garamond,serif" class="">Alvin E. Nashman Postdoctoral Fellow<br class=""></font></div><font face="garamond,serif" class="">Carnegie Observatories, Pasadena, CA<br class=""></font></div><font face="garamond,serif" class=""><a href="mailto:stonnes@gmail.com" target="_blank" class="">stonnes@gmail.com</a><br class=""></font></div></div>
______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.<wbr class="">org</a><br class="">
</blockquote></div></div>
_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br class=""></div></blockquote></div><br class=""></div></body></html>