Rotate particle locations

Hi @cryofun!

You can rotate particles using cryosparc-tools using the following transformation:

direction = "clockwise" # either clockwise or counterclockwise

if direction == "counterclockwise":
    new_x = 1 - particles["location/center_y_frac"]
    new_y = particles["location/center_x_frac"].copy()
elif direction == "clockwise":
    new_x = particles["location/center_y_frac"]
    new_y = 1 - particles["location/center_x_frac"].copy()

particles["location/center_x_frac"] = new_x
particles["location/center_y_frac"] = new_y

You could then save this dataset with rotated particles as described elsewhere.

As with any time you manipulate particle metadata, I’d recommend double-checking that the results are what you expect, perhaps with a 3D reconstruction of extracted particles. It’s also probably worth ensuring that the micrographs have only been rotated and not reflected in some way.

I hope that helps!