<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="">Hi Axel,<div class=""><br class=""></div><div class="">You can assign new symbols as well. It sounds like you want to do this for a number of datasets, so you could define new symbols and add them to yt’s unit registry (though you could also add them to a specific dataset’s unit registry). To do the former, you could do something like this in your plugins [1] file (which would ensure they got loaded every time you used yt):</div><div class=""><br class=""></div><div class="">```python</div><div class="">from yt.units.unit_object import default_unit_registry</div><div class="">from yt.units import dimensions</div><div class=""><br class=""></div><div class="">default_unit_registry.add("lambda_0", 8.0e-5, dimensions.length, 0.0, r"$\lambda_0$")</div><div class="">default_unit_registry.add("omega_pe", 1.0e15, dimensions.rate, 0.0, r"$\omega_\text{pe}$") </div><div class="">```</div><div class=""><br class=""></div><div class="">The arguments in .add are the name of the symbol, the conversion to CGS+Ampere, the dimensions of the unit, the unit offset (only used for temperature and angle units), and the last is the LaTeX representation. </div><div class=""><br class=""></div><div class="">Note that I defined omega_pe as a rate, so you’d have to use its inverse when creating your unit system to define the base time units.</div><div class=""><br class=""></div><div class="">And yes, as I mentioned above the internal base by which all yt units reference is cgs units + Amperes for current (for historical reasons, mostly). </div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">John</div><div class=""><br class=""></div><div class="">[1] <a href="http://yt-project.org/doc/reference/configuration.html#the-plugin-file" class="">http://yt-project.org/doc/reference/configuration.html#the-plugin-file</a></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jan 5, 2017, at 8:24 AM, Axel Huebl <<a href="mailto:a.huebl@hzdr.de" class="">a.huebl@hzdr.de</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Ha, I oversaw a link in [1] linking to [2].<br class=""><br class="">Ok, so I can just specify my own unit system in user-code with that.<br class="">But anyhow, I can't assign it new symbols. Also, do all conversion<br class="">factors need to go through CGS?<br class=""><br class="">Also, microns turns out to be<br class="">   .in_units("um")<br class="">:)<br class=""><br class=""><br class="">Axel<br class=""><br class="">[2] <a href="http://yt-project.org/docs/dev/analyzing/units/unit_systems.html" class="">http://yt-project.org/docs/dev/analyzing/units/unit_systems.html</a><br class=""><br class="">On 05.01.2017 13:59, Axel Huebl wrote:<br class=""><blockquote type="cite" class="">Hi yt-devs!<br class=""><br class="">I have a quick user-question (sorry) and a devel question:<br class=""><br class="">First, how to convert to a unit like microns (10^-6 meters) or<br class="">pico-seconds? I can't find an example here [1]. I tried<br class=""><br class="">  .in_units("mum")<br class="">  .in_units("mu m)<br class="">  .in_units("1.e-6 m")<br class="">  .in_units("microns")<br class="">  .in_units("micro meter")<br class="">  .in_units("micro meters")<br class="">  .in_units("micro m")<br class="">  .in_units("μm")<br class=""><br class="">and only<br class="">  .in_units("1.e-6 * m")<br class=""><br class="">does not fail but looks ugly.<br class=""><br class="">An orthogonal question: in our domain (laser-plasma physics) unit<br class="">systems are scaled by something like the applied laser wavelength or the<br class="">plasma density (and more to make a full set).<br class=""><br class="">Following again [1] I would implement something like .in_base('plasma')<br class="">or .in_base('laserplasma') but those are not scaled to "fixed" reference<br class="">quantities as the other base systems but are depending on either user input<br class="">  [ length = ("$\lambda_0$", "800 nm"),<br class="">    time   = ("$\omega_\text{pe}^{-1}$", "1.e-15 s"),<br class="">     ...]<br class="">or alternatively scalings the data file already provided. (Ok, the<br class="">symbol is always fixed per "in_base" but the value to scale with needs<br class="">to be provided.)<br class=""><br class="">Is that already possible or any ideas how we could implement that?<br class=""><br class=""><br class="">Thanks,<br class="">Axel<br class=""><br class="">[1]<br class=""><a href="http://yt-project.org/docs/dev/analyzing/units/fields_and_unit_conversion.html#data-selection-and-fields" class="">http://yt-project.org/docs/dev/analyzing/units/fields_and_unit_conversion.html#data-selection-and-fields</a><br class=""><br class=""></blockquote><br class="">-- <br class=""><br class="">Axel Huebl<br class="">Phone +49 351 260 3582<br class=""><a href="https://www.hzdr.de/crp" class="">https://www.hzdr.de/crp</a><br class="">Computational Radiation Physics<br class="">Laser Particle Acceleration Division<br class="">Helmholtz-Zentrum Dresden - Rossendorf e.V.<br class=""><br class="">Bautzner Landstrasse 400, 01328 Dresden<br class="">POB 510119, D-01314 Dresden<br class="">Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey<br class="">          Prof. Dr.Dr.h.c. P. Joehnk<br class="">VR 1693 beim Amtsgericht Dresden<br class="">_______________________________________________<br class="">yt-dev mailing list<br class="">yt-dev@lists.spacepope.org<br class="">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org<br class=""></div></div></blockquote></div><br class=""></div></body></html>