New issue 1203: Incorrect particle_velocity_cylindrical_theta and particle_velocity_cylindrical_radius when “center” != [0, 0, 0] https://bitbucket.org/yt_analysis/yt/issues/1203/incorrect

Ji-hoon Kim:

Dear All,

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:

![Star_500Myr_art-ii_rotational_vel.png](https://bitbucket.org/repo/BXbAb/images/2072696308-Star_500Myr_art-ii_rotational_vel.png)

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”:

``` #!python

    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"])

# theta = get_cyl_theta(pos, normal)

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

```

Then, the same ParticleProjectionPlot() creates the following (correct) image:

![Star_500Myr_art-ii_rotational_vel_new.png](https://bitbucket.org/repo/BXbAb/images/4051851566-Star_500Myr_art-ii_rotational_vel_new.png)

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!

Best regards, Ji-hoon