-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacklashCalib.py
More file actions
108 lines (63 loc) · 2.18 KB
/
Copy pathbacklashCalib.py
File metadata and controls
108 lines (63 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 20 10:40:30 2023
@author: cardoso
"""
import _thread
import win32event
import numpy as np
import matplotlib.pyplot as plt
import scipy.constants as const
import sys
import os
import time
import single_shot_module_v0 as ss
from PIStages.StageControllerClass import PI_controller
def fs2mm(t):
return 0.5*const.c*t*1e-12
def createDir(basefolder):
direxists=os.path.exists(basefolder+"/meas_0")
i=0
while direxists:
i+=1
direxists=os.path.exists(basefolder+"/meas_"+str(i))
os.makedirs(basefolder+"/meas_"+str(i))
return (basefolder+"/meas_"+str(i)+'/')
basefolder='D:/HCF1/FS_irradiation_data/hysteresis/20221202/run_01'
basefolder='D:/HCF1/FS_irradiation_data/filamentation calibrations/evacuated hcf1 (sample 3)'
basefolder="D:/HCF1/FS_irradiation_data/hysteresis_singleshot/20230302/run_02"
basefolder="D:/HCF1/FS_irradiation_data/hysteresis_singleshot/tests/backlash"
dir1=basefolder
try:
pm=None
rl=None
ms=None
pm=ss.PMeter('565030',1)
rl=ss.rotationLogging()
ms=ss.Measure(pm,rl)
ms.loadCalibration(dir1+"/single_shot_calibration.txt")
####### ENERGIES #######
Emin_angle=109
E_start_angle=0 #degrees from minimum
E_end_angle=19 #degrees from minimum
N_E=10 #number of E points
E_points=np.linspace(Emin_angle+E_start_angle,Emin_angle+E_end_angle,N_E)
saveFolder=createDir(dir1)
try:
for polindex, polAngle in enumerate( E_points[2:]):
rl.gotopos(Emin_angle)
saveFile=saveFolder+str(polindex)+".txt"
ms.calibrateBacklash(Emin_angle,polAngle)
header="Energy in (J) Energy out (J) Transmission Polarizer angle"
ms.saveData(saveFile,header)
except:
raise
except:
raise
finally:
if pm is not None:
del pm
if rl is not None:
del rl
if ms is not None:
del ms