forked from lund0946/smdt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
len_slits.py
59 lines (37 loc) · 1.37 KB
/
len_slits.py
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
pandas dataframe
def slit_len():
# call slit_sort (Memr[bufx], Memi[bufi], nslit)
fdx=open(XPROJ_MAP) # distortion map
gs_ingest(fdx,asfx,asfy) # distortion map -> polynomial function
for i in range(len(ra)-1):
pc1=df['pcode'][i]
pc2=df['pcode'][i+1]
if pc1<0 and pc2<0:
continue # both alignment/guide stars no problem
xlow=X2+param['slit_gap']
xupp=X1-param['slit_gap']
xcen=0.5*(xlow+xupp)
yas=Y2
dxlow=gseval(asfx,xcen,yas) #<-evaluate polynomial distortion at x,y
yas=Y1
dxupp=gseval(asfx,xcen,yas)
dxavg = 0.5 * (dxupp + dxlow)
dxlow = dxlow - dxavg
dxupp = dxupp - dxavg
if pc1<0:
del1=0
del2=X1-xlow-(dxupp-dxlow)
elif pc2<0:
del1 = xupp - X2(sdat,ndx1) + (dxlow - dxupp)
del2 = 0.
else:
del1 = xcen - 0.5*param['slit_gap'] - X2 + dxlow
del2 = X1 - (xcen + 0.5*param['slit_gap']) - dxupp
X2 = X2 + del1
if (del1 != 0. && RELPA != INDEF)
tana = np.tan (RELPA)
Y2 = Y2 + del1 * FLIP * tana #FLIP=-1
X1 = X1 - del2
if (del2 != 0. && RELPA != INDEF)
tana = np.tan (RELPA)
Y1 = Y1 - del2 * FLIP * tana #FLIP=-1