<html><body>
<p>New issue 1203: Incorrect particle_velocity_cylindrical_theta and particle_velocity_cylindrical_radius when “center” != [0, 0, 0] <a href="https://bitbucket.org/yt_analysis/yt/issues/1203/incorrect">https://bitbucket.org/yt_analysis/yt/issues/1203/incorrect</a></p>
<p>Ji-hoon Kim:</p>
<p>Dear All,</p>
<p>The current implementations of “particle_velocity_cylindrical_theta” and “particle_velocity_cylindrical_radius” seem to incorrectly calculate “theta” when “center” is not at [0, 0, 0].  As an example, for a rotating stellar disk, currently the ParticleProjectionPlot() of “particle_velocity_cylindrical_theta” produces the following (incorrect) image:</p>
<p>![Star_500Myr_art-ii_rotational_vel.png](<a href="https://bitbucket.org/repo/BXbAb/images/2072696308-Star_500Myr_art-ii_rotational_vel.png">https://bitbucket.org/repo/BXbAb/images/2072696308-Star_500Myr_art-ii_rotational_vel.png</a>)</p>
<p>Note that the center in this particular dataset (ARTIO) is not at [0,0,0], but at ~[64, 64, 64] in a [0,0,0] – [128, 128, 128] box (in code_length units).  On the other hand, if you move “theta = get_cyl_theta(pos, normal)” a couple of lines down after “center” is subtracted out of “pos”:</p>
<p>``` #!python</p>
<pre>    def _particle_velocity_cylindrical_theta(field, data):
        """The cylindrical theta component of the particle velocities

        Relative to the coordinate system defined by the *normal* vector,
        *bulk_velocity* vector and *center* field parameters.
        """
        normal = data.get_field_parameter('normal')
        center = data.get_field_parameter('center')
        bv = data.get_field_parameter("bulk_velocity")
        pos = data.ds.arr([data[ptype, spos % ax] for ax in "xyz"])
        vel = data.ds.arr([data[ptype, svel % ax] for ax in "xyz"])</pre>
<p>#        theta = get_cyl_theta(pos, normal)</p>
<pre>pos = pos - np.reshape(center, (3, 1))
vel = vel - np.reshape(bv, (3, 1))
theta = get_cyl_theta(pos, normal)  #####  <=== HERE!
cylt = get_cyl_theta_component(vel, theta, normal)
return cylt</pre>
<p>```</p>
<p>Then, the same ParticleProjectionPlot() creates the following (correct) image:</p>
<p>![Star_500Myr_art-ii_rotational_vel_new.png](<a href="https://bitbucket.org/repo/BXbAb/images/4051851566-Star_500Myr_art-ii_rotational_vel_new.png">https://bitbucket.org/repo/BXbAb/images/4051851566-Star_500Myr_art-ii_rotational_vel_new.png</a>)</p>
<p>It would be great if someone could independently check this error and the proposed solution.  Any information or insight will be appreciated.  Thank you as always to the yt community!</p>
<p>Best regards, Ji-hoon</p>

<img src="http://link.bitbucket.org/wf/open?upn=JlBWjyZTyKwhM1rBKe-2BcAdFPwdECN4PBooLGVSVl7ELID94p3NAX-2FoAoKuR0aUO39Ou46jhbKd-2FWK0x4fCW00W-2B61E2-2BK2kVFuYtmt9gp9o3wYvzAWqB0xF4Cz1n1yMeaWgznXz2TK58UxFuDsHRnF0HuTyE8tr3iRxDozeWC1EjbwGm63PppgwkwnjaZHTtMHP4liG77ui6Q-2BX0rxkDlC-2B-2B5N-2Bx5jXSvIij-2Fljp9XE-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>