Expose.pgm

expose.pgm (takes multiple exposures with Spyder)

rem an Andor Basic program to automate taking repeated exposures rem Oliver Fraser rem September 2005   rem function to print out the help function ~PrintHelp() print : print("Command Reference") print("  take exposure(s) [0-9999]") print("  directory -- change the working directory (a subdirectory of the 'My Documents' folder)") print("  root -- change the rootname") print("  number -- change the sequence number") print("  exposure -- change the exposure time") print("  show -- show the exposure time (among other things)") print("  help -- print this!") print("  Quit (hitting 'cancel' doesn't do a damn thing!)") print("Remember that you need only type the first letter.") print return   rem The function that actually takes a bunch of exposures rem Give it full path and a filename function ~expose(path$, filename$) rem Concern: rootname doesn't get printed unless it includes an rem alpha character -- make sure everything else works okay print("Exposing image ";filename$) run() SaveFITS(#0, path$;"\";filename$, 1) :rem This function will clobber existing files return   rem rem The main program! rem cls() :rem clear output window  rem set some defaults SetAcquisitionMode(1) SetAcquisitionType(0) SetShutter(2,1) input("Please enter your working directory (a subdirectory of the 'My Documents' folder, no trailing slash!):", workingdirectory$) input("Please enter a rootname (the sequence number will be appended to this, and no slashes!):", rootname$) i = 0 :rem image number (of a sequence) quit = 0 :rem set to anything else to quit the program  ~PrintHelp()  while quit==0 filename$ = rootname$;i;".fits" input("Next exposure: ";workingdirectory$;"/";filename$, command$) c$ = left$(command$,1) if !strcomp(c$,"t",1) then n = 1 :rem default number of exposures rem First, test to see if there's an argument whitespace = instr(command$," ") :rem returns the location of the first space if whitespace then n$=mid$(command$,whitespace+1,4) :rem extract the argument if whitespace then n = val(n$) :rem convert to a number print("Taking ";n;" exposure(s)") while n>0 path$ = "C:\Documents and Settings\MRO Observer\My Documents\";workingdirectory$ filename$ = rootname$;i;".fits" ~expose(path$, filename$) i = i + 1 n = n - 1 print("done -- ";n;" more to go!") wend endif if !strcomp(c$,"d",1) then input("New working directory (a subdirectory of the 'My Documents' folder):", workingdirectory$) if !strcomp(c$,"r",1) then input("New root name: ", rootname$) i = 0 endif if !strcomp(c$,"n",1) then input("Sequence number to start from: ", i) if !strcomp(c$,"e",1) then input("New Exposure time: ", exptime) SetExposureTime(exptime) endif if !strcomp(c$,"s",1) then ShowTimings() if !strcomp(c$,"h",1) then ~PrintHelp() if !strcomp(c$,"Q",0) then quit = 1 wend  end