10 def dither_phot(filters, nims, ndarks, dx, dy, subdir="", appendts=1):
14 subdir =
"phot_dither"
18 sdbase = visao.get_visao_filename_now(subdir)
25 for i
in range(len(filters)):
27 print "Changing filter to %s . . ." % filters[i]
28 resp = vis.fw2.set_filter(filters[i])
31 print "Moving to focus preset . . ."
34 resp = vis.fw2.wait_move()
36 filt = vis.fw2.get_filter()
38 print "In filter %s . . ." % filt
41 print "Filter not correct."
45 print "Focus motor error. "
50 filtname = filt.replace(
" ",
"_")
51 filtname = filt.replace(
"'",
"p")
53 sd =
"%s/%s" % (sdbase, filtname)
56 vis.dither(dx, dy, nims, ndarks, sd, 0,0)
60 visao_script_complete()
63 print '******************\nSomething bad happened\n******************\n'
68 def scan(xcen, ycen, r0, dr, ang, ims, ndarks, subdir=""):
70 ang = ang*3.14159/180.0
72 x0 = xcen - r0*cos(ang)
73 y0 = ycen - r0*sin(ang)
82 vis.gimbal.take_control()
88 subdir = visao.get_visao_filename_now(
"scan_")
90 print "Moving to %f %f . . ." % (x0 , y0)
92 rv = vis.gimbal.move_xabs(x0)
94 print "Error during x dither. Halting."
97 rv = vis.gimbal.move_yabs(y0)
99 print "Error during y dither. Halting."
102 vis.ccd47.subdir(subdir)
104 vis.take_darks(ndarks)
106 print "Saving %i images at position 1/%i" % (ims, len(dx))
107 vis.take_science(ims)
109 for i
in range(len(dx)):
110 x0 = xcen - r0*cos(ang) + dr*cos(ang)*i
111 y0 = ycen - r0*sin(ang) + dr*sin(ang)*i
113 print "Dither %i/%i: %f %f . . ." % (i,len(dx), x0 , y0)
114 rv = vis.gimbal.move_xabs(x0)
116 print "Error during x dither. Halting."
119 rv = vis.gimbal.move_yabs(y0)
121 print "Error during y dither. Halting."
124 rv = vis.gimbal.wait_move()
126 print "Error during dither. Halting."
129 rv = vis.take_science(ims)
131 rv = vis.gimbal.move_xabs(xcen)
133 rv = vis.gimbal.move_yabs(ycen)
135 rv = vis.gimbal.wait_move()
137 vis.ccd47.subdir(
".")