Code formatting

This commit is contained in:
Joel Collins 2020-10-13 15:02:19 +01:00
parent 0234b20ce3
commit 2bfb988460
60 changed files with 392 additions and 396 deletions

View file

@ -1,5 +1,6 @@
import numpy as np
from abc import ABCMeta, abstractmethod
import numpy as np
from labthings import StrictLock

View file

@ -1,11 +1,12 @@
import logging
import time
from collections.abc import Iterable
import numpy as np
from openflexure_microscope.stage.base import BaseStage
from openflexure_microscope.utilities import axes_to_array
from collections.abc import Iterable
import numpy as np
import time
import logging
class MissingStage(BaseStage):
def __init__(self, port=None, **kwargs):

View file

@ -1,8 +1,10 @@
import numpy as np
import time
import logging
import time
from collections.abc import Iterable
import numpy as np
from sangaboard import Sangaboard
from openflexure_microscope.stage.base import BaseStage
from openflexure_microscope.utilities import axes_to_array
@ -189,39 +191,48 @@ class SangaStage(BaseStage):
print("Move completed, raising exception...")
raise value # Propagate the exception
class SangaDeltaStage(SangaStage):
def __init__(self, port=None, flex_h=80, flex_a=50, flex_b=50, camera_angle=0, **kwargs):
def __init__(
self, port=None, flex_h=80, flex_a=50, flex_b=50, camera_angle=0, **kwargs
):
self.flex_h = flex_h
self.flex_a = flex_a
self.flex_b = flex_b
# Set up camera rotation relative to stage
camera_theta = (camera_angle/180)*np.pi
self.R_camera = np.array([
[np.cos(camera_theta), -np.sin(camera_theta), 0],
[np.sin(camera_theta), np.cos(camera_theta), 0],
[0, 0, 1]
])
camera_theta = (camera_angle / 180) * np.pi
self.R_camera = np.array(
[
[np.cos(camera_theta), -np.sin(camera_theta), 0],
[np.sin(camera_theta), np.cos(camera_theta), 0],
[0, 0, 1],
]
)
logging.debug(self.R_camera)
# Transformation matrix converting delta into cartesian
x_fac = -1 * np.multiply(np.divide(2, np.sqrt(3)), np.divide(self.flex_b, self.flex_h))
x_fac = -1 * np.multiply(
np.divide(2, np.sqrt(3)), np.divide(self.flex_b, self.flex_h)
)
y_fac = -1 * np.divide(self.flex_b, self.flex_h)
z_fac = np.multiply(np.divide(1, 3), np.divide(self.flex_b, self.flex_a))
self.Tvd = np.array([
[-x_fac, x_fac, 0],
[0.5 * y_fac, 0.5 * y_fac, -y_fac],
[z_fac, z_fac, z_fac]
])
self.Tvd = np.array(
[
[-x_fac, x_fac, 0],
[0.5 * y_fac, 0.5 * y_fac, -y_fac],
[z_fac, z_fac, z_fac],
]
)
logging.debug(self.Tvd)
self.Tdv = np.linalg.inv(self.Tvd)
logging.debug(self.Tdv)
SangaStage.__init__(self, port=port, **kwargs)
@property
def position(self):
# TODO: Account for camera rotation
@ -253,4 +264,4 @@ class SangaDeltaStage(SangaStage):
logging.debug("Delta final: {}".format(final))
# Do the move
SangaStage.move_abs(self, final, **kwargs)
SangaStage.move_abs(self, final, **kwargs)