Skip to content

Commit

Permalink
adding calibration and movable demo
Browse files Browse the repository at this point in the history
  • Loading branch information
edyoshikun committed Dec 8, 2023
1 parent ac7f824 commit a8249a6
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions copylot/assemblies/photom/photom.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
from copylot.hardware.stages.abstract_stage import AbstractStage
from copylot.hardware.daqs.abstract_daq import AbstractDAQ
from copylot.assemblies.photom.utils.affine_transform import AffineTransform
from copylot.assemblies.photom.utils.scanning_algorithms import (
calculate_rectangle_corners,
)
from pathlib import Path
from copylot import logger
from typing import Tuple
import time


class PhotomAssembly:
def __init__(
Expand All @@ -25,16 +30,27 @@ def __init__(
self.mirror = mirror
self.DAC = dac

self._calibrating = False

assert len(self.mirror) == len(affine_matrix_path)

# Apply AffineTransform to each mirror
for i, tx_path in enumerate(affine_matrix_path):
self.mirror[i].affine_transform_obj = AffineTransform(config_file=tx_path)

def calibrate(self, mirror_index: int):
def calibrate(self, mirror_index: int, rectangle_size_xy: tuple[int, int]):
if mirror_index < len(self.mirror):
# Logic for calibrating the mirror
pass
print("Calibrating mirror...")
rectangle_coords = calculate_rectangle_corners(rectangle_size_xy)
# iterate over each corner and move the mirror
i = 0
while self._calibrating:
# Logic for calibrating the mirror
self.position(mirror_index, rectangle_coords[i])
time.sleep(1)
i += 1
if i == 3:
i = 0
# moving the mirror in a rectangle
else:
raise IndexError("Mirror index out of range.")
Expand All @@ -45,7 +61,7 @@ def capture(self):
pass

## Mirror Functions
def get_position(self, mirror_index: int)->list[float, float]:
def get_position(self, mirror_index: int) -> list[float, float]:
if mirror_index < len(self.mirror):
if self.DAC is None:
NotImplementedError("No DAC found.")
Expand Down

0 comments on commit a8249a6

Please sign in to comment.