forked from saltastro/timDIMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
east_search_gto900.py
executable file
·65 lines (45 loc) · 1.05 KB
/
east_search_gto900.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
60
61
62
63
64
65
#!/usr/bin/env python
import os
import time
import sys
import numpy as np
from find_boxes import *
def check_image():
os.system("./ave_frames 30 \!spiral.fits")
os.system("cat spiral.fits | xpaset timDIMM fits")
hdu = rfits("spiral.fits")
image = hdu.data
n, stars = daofind(image)
if n == 2:
print "Found the stars!"
return True
else:
print "No dice."
return False
def plus_x():
os.system("./gto900_nudge.rb s")
def minus_x():
os.system("./gto900_nudge.rb n")
def plus_y():
os.system("./gto900_nudge.rb e")
def minus_y():
os.system("./gto900_nudge.rb w")
n = 0
x = 0
y = 0
has_stars = check_image()
if has_stars:
print "Got stars right away!"
else:
while n < 1000:
n = n + 1
for i in range(n):
y = y + 1
plus_y()
print "At (x, y) = (%d, %d)" % (x, y)
if check_image():
has_stars = True
break
if has_stars:
break
print "Found stars after %d iterations." % n