<jupyter_start><jupyter_text>In order to effectively use focus information from previously imaged chips, we need to account for changes in chip location and rotation. To do this, we follow these steps:- Find the focus and alignment at three corners. We will call these $\vec{p_{new_1}}, \vec{p_{new_2}}, \vec{p_{new_3}}$ - Load the corner PositionList from the previously imaged chip, $\vec{p_{prev_1}}, \vec{p_{prev_2}}, \vec{p_{prev_3}}$ - Find the rotation angles from the +x direction of both lists of corners, $\theta_{prev}, \theta_{new}$ - Rotate the new corners to match the previous corners in the x,y plane: $$ \vec{p_{rot_new_n}} = \begin{bmatrix} \cos(\theta_{prev} - \theta_{new}) & \sin(\theta_{prev} - \theta_{new}) \\-\sin(\theta_{prev} - \theta_{new}) & \cos(\theta_{prev} - \theta_{new})\end{bmatrix} * \vec{p_{new_n}} $$- Find the translation from the origin: $$\vec{t} = \vec{p_{new_1}} - \vec{p_{prev_1}}$$focus data from the previously focused chip into a PositionList, focused_pl. Then we  $$ R = \begin{bmatrix} \cos \theta +u_x^2 \left(1-\cos \theta\right) & u_x u_y \left(1-\cos \theta\right) - u_z \sin \theta & u_x u_z \left(1-\cos \theta\right) + u_y \sin \theta \\ u_y u_x \left(1-\cos \theta\right) + u_z \sin \theta & \cos \theta + u_y^2\left(1-\cos \theta\right) & u_y u_z \left(1-\cos \theta\right) - u_x \sin \theta \\ u_z u_x \left(1-\cos \theta\right) - u_y \sin \theta & u_z u_y \left(1-\cos \theta\right) + u_x \sin \theta & \cos \theta + u_z^2\left(1-\cos \theta\right)\end{bmatrix} $$<jupyter_code>move to first location -> focus
move to corner 2 - first location -> focus
move to corner 3 - first location x + first location z -> focus
align corners 
p1, p2, p3<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16503173687247547, 'fraction_numerical': 0.014425851125216388, 'mean_word_length': 3.7900552486187844, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '529139', 'license': 'MIT', 'n_tokens_mistral': 619, 'n_tokens_neox': 609, 'n_words': 201, 'path': 'SmartScope/smartscope/notebook/testing/.ipynb_checkpoints/plane_fitting-checkpoint.ipynb', 'repo_name': 'calebsanfo/IncubatorImaging', 'size': '1733'}