<jupyter_start><jupyter_text>calculate rotation and transposition matrix<jupyter_code>data_folder = r'D:\Pu\20210625-Thymus_IF_RNA'
before_position_file = os.path.join(data_folder, '10x_positions_before.txt')
after_position_file = os.path.join(data_folder, '10x_positions_after.txt')

R, T = alignment_tools.align_manual_points(before_position_file, after_position_file, save=False)<jupyter_output>- Manually picked points aligned, rotation:
[[ 0.99672227  0.08089936]
 [-0.08089936  0.99672227]],
 translation:[109.56080109 -56.9087515 ]<jupyter_text>transpose 60x positions<jupyter_code>old_positions = np.loadtxt(os.path.join(data_folder, 'positions.txt'), delimiter=',')
new_positions = np.dot(old_positions, R) + T
print(new_positions)
save_filename = os.path.join(data_folder, 'translated_positions.txt')
print(save_filename)
np.savetxt(save_filename, new_positions, fmt='%.2f', delimiter=',')<jupyter_output>D:\Pu\20210625-Thymus_IF_RNA\translated_positions.txt<jupyter_text>further adjust manually<jupyter_code>manual_shift = np.array([-28.1,  -8.7])
adjusted_new_positions = new_positions + manual_shift
adj_save_filename = os.path.join(data_folder, 'adjusted_translated_positions_all.txt')
print(adj_save_filename)
np.savetxt(adj_save_filename, adjusted_new_positions, fmt='%.2f', delimiter=',')<jupyter_output>\\storm6-pc\STORM6-FLASHDrive\Pu\20201127-NOAcr_CTP-08_E14_brain_no_clearing\adjusted_translated_positions_all.txt
{'fraction_non_alphanumeric': 0.12613240418118468, 'fraction_numerical': 0.06898954703832752, 'mean_word_length': 9.558823529411764, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '200639', 'license': 'MIT', 'n_tokens_mistral': 622, 'n_tokens_neox': 535, 'n_words': 62, 'path': 'jupyter/During_experiment/20210630-align_10x_positions_thymus.ipynb', 'repo_name': 'shiwei23/STORM6', 'size': '1435'}