Skip to content
Snippets Groups Projects
Commit 9df761b4 authored by Jan Caron's avatar Jan Caron
Browse files

fielddata: added order=1 as default to get rid of ripples for rotate().

environment.yml: upgraded to scipy=1.0
parent 62f23a80
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ dependencies:
# Basic:
- python=3.5 # TODO: upgrade to 3.6!
- numpy=1.11
- scipy=1.0 # TODO: upgrade to 1.0 (if channels exist...)!
- scipy=1.0
- tqdm=4.14
- scikit-image=0.13
# Fast computation:
......
......@@ -669,12 +669,13 @@ class VectorData(FieldData):
raise ValueError("Wrong input! 'x', 'y', 'z' allowed!")
return VectorData(self.a, field_flip)
def rotate(self, angle, axis='z', reshape=False, **kwargs):
def rotate(self, angle, axis='z', reshape=False, order=1, **kwargs):
# TODO: Docstring!
# Define axes of rotation plane (axis 0 for vector component!) and rotate coord. system:
axes = {'x': (1, 2), 'y': (1, 3), 'z': (2, 3)}[axis]
field_coord_rot = rotate(self.field, angle, axes=axes, reshape=reshape, **kwargs)
# Rotate vectors inside the voxels (- signs determined by scipy rotate axes in firt step):
field_coord_rot = rotate(self.field, angle, axes=axes, reshape=reshape,
order=order, **kwargs)
# Rotate vectors inside the voxels (- signs determined by scipy rotate axes in first step):
vec_dict = {'x': (-1, 0, 0), 'y': (0, 1, 0), 'z': (0, 0, -1)}
quat = Quaternion.from_axisangle(vec_dict[axis], np.deg2rad(angle))
field_rot = quat.matrix.dot(field_coord_rot.reshape(3, -1)).reshape(field_coord_rot.shape)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment