<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=""><div class="">Hi Hilary and other yt users,</div><div class=""><br class=""></div>It solved my convert_to_units problem! However, it does raise the error you said it would, the unit comparison problem, and even using your suggestion, I’m not able to resolve the issue. I’ve also tried using the suggestions from the FAQ (<a href="http://yt-project.org/docs/3.1/faq/index.html?highlight=convert units#how-do-i-get-the-convert-between-code-units-and-physical-units-for-my-dataset" class="">http://yt-project.org/docs/3.1/faq/index.html?highlight=convert%20units#how-do-i-get-the-convert-between-code-units-and-physical-units-for-my-dataset</a>), but when I do that, it then reverses the order of the problem (saying code_velocity and then cm/s in my error output).<div class=""><br class=""></div><div class="">Updated code (<a href="http://paste.yt-project.org/show/5736/" class="">http://paste.yt-project.org/show/5736/</a>) and updated error message (<a href="http://paste.yt-project.org/show/5735/" class="">http://paste.yt-project.org/show/5735/</a>).</div><div class=""><br class=""></div><div class="">Thank you,</div><div class="">Madison</div><div class=""><br class=""><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">Madison Fitzgerald</div><div class=""><br class=""></div><div class="">Astrophysics | Lyman Briggs College</div><div class="">Women’s & Gender Studies | College of Arts & Letters</div><div class="">LGBTQ and Sexuality Studies Specialization</div><div class=""><div class="">Women in Science, President</div><div class="">Undergraduate Teaching Assistant</div><div class="">Undergraduate Research Assistant</div><div class="">Department of Physics and Astronomy</div></div><div class="">Honors College</div><div class="">Michigan State University</div></div></div></div></div></div></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 22, 2015, at 11:01 AM, Hilary Egan <<a href="mailto:hilaryye@gmail.com" class="">hilaryye@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Madison,<div class=""><br class=""></div><div class="">When using the data object within a derived field, you have to specify what field you want to access. So line 13 should look like </div><div class=""><br class=""></div><div class=""><pre style="margin-top: 0px; margin-bottom: 0px; padding: 5px 0px; font-family: 'Bitstream Vera Sans Mono', monospace; font-size: 13px; line-height: normal;" class=""><span class="n">new_field</span> <span class="o" style="color:rgb(102,102,102)">=</span> <span class="n">np</span><span class="o" style="color:rgb(102,102,102)">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">data['radial_velocity']</span><span class="p">,</span> <span class="mf" style="color:rgb(64,160,112)">0.0</span><span class="p">)</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; padding: 5px 0px; font-family: 'Bitstream Vera Sans Mono', monospace; font-size: 13px; line-height: normal;" class=""><span class="p"><br class=""></span></pre>Right now the field is trying to find the maximum of the YTSphere object rather than the radial velocity data contained within the YTSphere, which isn't well defined. </div><div class=""><br class=""></div><div class="">One other quick comment, once that's fixed your script is going to try and compare data['radial_velocity'] which has units of velocity, and 0.0 which is unitless. In order for that to be a valid comparison, you should give 0.0 in the appropriate units by doing something like this:</div><div class=""><br class=""></div><div class=""><pre style="font-size: 13px; margin-top: 0px; margin-bottom: 0px; padding: 5px 0px; font-family: 'Bitstream Vera Sans Mono', monospace; line-height: normal;" class="">zero_vel = data.ds.quan(0.0, 'km/s')</pre><pre style="font-size:13px;margin-top:0px;margin-bottom:0px;padding:5px 0px;font-family:'Bitstream Vera Sans Mono',monospace;line-height:normal" class=""><span style="" class=""><span class="n">new_field</span> <span class="o" style="color:rgb(102,102,102)">=</span> <span class="n">np</span><span class="o" style="color:rgb(102,102,102)">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">data['radial_velocity']</span><span class="p">, zero_vel</span></span><span class="p" style="">)</span></pre></div><div class=""><br class=""></div>Hope that helps!<div class="">-Hilary</div><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Jul 22, 2015 at 8:49 AM Madison Fitzgerald <<a href="mailto:fitzg152@msu.edu" class="">fitzg152@msu.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">I am trying to create two new derived fields and then make a simple phase plot using one of these fields, but I am running into a pretty consistent error involving “convert_to_units". I get basically the same error when using the ds.sphere object and a ds.all_data object, so if there’s something I’ve messed up on, it’s not obvious to me and I would appreciate any help figuring out what’s wrong.</div><div class=""><br class=""></div><div class="">I am running yt on a MacBook Pro with OS 10.10.4. I have the newest version of stable yt (3.1 and changeset 665e2b6cdf78), and you can find my script at this link (<a href="http://paste.yt-project.org/show/5733/" target="_blank" class="">http://paste.yt-project.org/show/5733/</a>) and my error output at this link (<a href="http://paste.yt-project.org/show/5734/" target="_blank" class="">http://paste.yt-project.org/show/5734/</a>).</div><div class=""><br class=""></div><div class="">Thank you very much,</div><div class="">Madison Fitzgerald</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="">Madison Fitzgerald</div><div class=""><br class=""></div><div class="">Astrophysics | Lyman Briggs College</div><div class="">Women’s & Gender Studies | College of Arts & Letters</div><div class="">LGBTQ and Sexuality Studies Specialization</div><div class=""><div class="">Women in Science, President</div><div class="">Undergraduate Teaching Assistant</div><div class="">Undergraduate Research Assistant</div><div class="">Department of Physics and Astronomy</div></div><div class="">Honors College</div><div class="">Michigan State University</div></div></div></div></div></div></div></div>
</div>
<br class=""></div>_______________________________________________<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/listinfo.cgi/yt-users-spacepope.org</a><br class="">
</blockquote></div></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></div></body></html>