// DataPKZ.txt // John Meriwether Clemson University // 25 September, 2008 // The following code has an OVERLAY of this script file at the end which allows // convenient modification of the script. // It also serves to recalculate twilight and night times every day // // Sequence of 630 cycle, laser, and dark count images // Bias image at the beginning of the night // Observatory log closed at end of night observations d = DateToInteger($CurrentTime) date = ConvertToString("%8d",d) dirImages = "D:\\PKZdata2010\\" + date logDir = "C:\\PKRZenithprograms\\Logs_2010" logID = "PKZ_" logOrder = 321 LOG_DIRECTORY Master,dirImages // this creates a directory for data images // create log file names LOG_DIRECTORY Master,logDir,logID,logOrder LOG_DIRECTORY Observatory,logDir,logID,logOrder LOG_DIRECTORY Camera,logDir,logID,logOrder LOG_DIRECTORY Analyze,logDir,logID,logOrder CALL "TwilightNightTimes.txt" // get values for startTime, twilightTime, // beginNightTime, endNightTime,endTime DateStart = DateToInteger(beginNightTime) DateEnd = DateToInteger(endNightTime) TimeStart = TimeToInteger(beginNightTime)/1000 TimeEnd = TimeToInteger(endNightTime)/1000 DateStart = ConvertToString("%8d",DateStart) TimeStart = ConvertToString("%6d",TimeStart) DateEnd = ConvertToString("%8d",DateEnd) TimeEnd = ConvertToString("%6d",TimeEnd) LOG_DISPLAY 1 "Start: " + TimeStart+ " " + DateStart + " End: "+TimeEnd + " " + DateEnd ControlFileRead("XTimes.txt","xTimeLaser","xTime630","xTimeDark","xTimeHCL") // Read in exposure times BiasTime = 0.01 // very short exposure time for a bias image /// Define the angles for Laser Calibrations PHLasAz = 108. // PHLasZe = 179. /// Define image-type counters. I.e. in L07302005001.img, 001 is the ImageSeqeuence counter ImageSequenceL = 0 // L refers to laser images ImageSequenceB = 0 // B refers to bias images ImageSequenceX = 0 // X refers to 630 images ImageSequenceD = 0 // D refers to dark count image in sky mode ImageSequenceK = 0 // K refers to dark count image for laser images iCycle=-1 // Initialize iCycle counter CALL "NextPositionInCycle" // Reads direction file // containing (az, ze) for each exposure // need to comment out this loop for datataking // when no WAIT_UNTIL command // command and the OVERLAY command are both commented out. Otherwise, no stop on datataking if(endNightTime < beginNightTime) { endNightTime = endNightTime + 86400 } WAIT_UNTIL beginNightTime SETUP ANALYZE // clear quick look graphics SETUP FPI SKYSCAN // put the SkyScanner to the home position - need to wait for this to be done SETUP CAMERA FPI // Initialize Andor camera SETUP COOLER FPI // Turn on Andor cooling //LEVEL 5,0 // Turns on Laser outlet //DELAY 30 // Wait while laser warms up //LEVEL 4,0 // Turns on HCL outlet //DELAY 30 // Give camera coolers time for cooling cycle CoolingStatus = 0 while(CoolingStatus == 0) { GET_STATUS CAMERA FPI, TEMPERATURE, temperature if(temperature <= -78.) { CoolingStatus = 1 } if($CurrentTime-beginNightTime >= 480.) { CoolingStatus = 1 } DELAY 30 } GET_STATUS CAMERA FPI, TEMPERATURE,CurrentTemp GET_STATUS CAMERA FPI, STATE, CurrentState // Take a bias image xTime = BiasTime SET_PARAMETER CAMERA FPI, ShutterMode = CLOSE SET_PARAMETER CAMERA FPI, ExposureTime = xTime dataType = "B" ImageSequenceB = ImageSequenceB + 1 seq = ImageSequenceB TAKE_IMAGE FPI,dataType CALL "AcquireStoreDisplayImageFPI" LOG_OUTPUT ANALYZE, OPEN /// Take an initial dark count image xTime = xTimeDark SET_PARAMETER CAMERA FPI, ShutterMode = CLOSE SET_PARAMETER CAMERA FPI, ExposureTime = xTime dataType = "D" ImageSequenceD = ImageSequenceD + 1 seq = ImageSequenceD TAKE_IMAGE FPI,dataType CALL "AcquireStoreDisplayImageFPI" /// Take an initial dark image for laser calibration // xTime = xTimeLaser // SET_PARAMETER CAMERA FPI, ShutterMode = CLOSE // SET_PARAMETER CAMERA FPI, ExposureTime = xTime // dataType = "K" // ImageSequenceK = ImageSequenceK + 1 // seq = ImageSequenceK //// TAKE_IMAGE FPI,dataType CALL "AcquireStoreDisplayImageFPI" /// Take an initial laser calibration // xTime = xTimeLaser // SET_PARAMETER CAMERA FPI, ShutterMode = AUTO // MOVE_PH 0., PHLasZe // First move only zenith (az = 0, initial value) // MOVE_PH PHLasAz, PHLasZe // Second move only azmith (ze = laser ze) // LEVEL 0,1 // Open the LASER shutter (not camera shutter, as in Arequipa!) // SET_PARAMETER CAMERA FPI, ExposureTime = xTime // dataType = "L" // ImageSequenceL = ImageSequenceL + 1 // seq = ImageSequenceL // TAKE_IMAGE FPI,dataType // CALL "AcquireStoreDisplayImageFPI" // LEVEL 0,0 // Close the laser shutter (not camera shutter, as in Arequipa!) /// Begin night-time operation iseq = 0 nExposuresInCycle = 10 while($CurrentTime < endNightTime) { ControlFileRead("XTimes.txt","xTimeLaser","xTime630","xTimeDark","xTimeHCL") // Re-read exposure times. This allows for // alteration in the midst of running the program for (iCycle=0; iCycle=0.65) //corresponding to 37 degrees cone { MOVE_PH az,ze xTime = xTime630 SET_PARAMETER CAMERA FPI, ExposureTime = xTime // Collect FPI Images SET_PARAMETER CAMERA FPI, ShutterMode = AUTO dataType = "X" ImageSequenceX = ImageSequenceX + 1 seq = ImageSequenceX tagtype = "N" if ( abs(ze) < 0.5 ) { tagtype = "Z" } TAKE_IMAGE FPI,tagtype CALL "AcquireStoreDisplayImageFPI" GET_STATUS OBSERVATORY, TEMPERATURE,temp } // End of if moonAngle loop } // End of iCycle FOR loop iseq = iseq + 1 iseqString = ConvertToString("%3d",iseq) LOG_DISPLAY 3 " Cycle " + iseqString /// END of FOR loop and beginning of dark/laser images /// Dark count xTime = xTimeDark SET_PARAMETER CAMERA FPI, ShutterMode = CLOSE SET_PARAMETER CAMERA FPI, ExposureTime = xTime dataType = "D" ImageSequenceD = ImageSequenceD + 1 seq = ImageSequenceD TAKE_IMAGE FPI,dataType CALL "AcquireStoreDisplayImageFPI" /// Laser dark count // xTime = xTimeLaser // SET_PARAMETER CAMERA FPI, ShutterMode = CLOSE // SET_PARAMETER CAMERA FPI, ExposureTime = xTime // dataType = "K" // ImageSequenceK = ImageSequenceK + 1 // seq = ImageSequenceK // TAKE_IMAGE FPI,dataType // CALL "AcquireStoreDisplayImageFPI" /// Laser calibration // xTime = xTimeLaser // SET_PARAMETER CAMERA FPI, ShutterMode = AUTO // MOVE_PH az, PHLasZe // First move only zenith (az = skydata az) // MOVE_PH PHLasAz, PHLasZe // Second move only azimith (ze = laser ze) // LEVEL 0,1 // Open the LASER shutter (not camera shutter, as in Arequipa!) // SET_PARAMETER CAMERA FPI, ExposureTime = xTime // dataType = "L" // ImageSequenceL = ImageSequenceL + 1 // seq = ImageSequenceL // TAKE_IMAGE FPI,dataType // CALL "AcquireStoreDisplayImageFPI" // LEVEL 0,0 // Close the LASER shutter (not camera shutter, as in Arequipa!) // } // end of 630 night cycle (outermost WHILE loop) /// End night-time operations /// BEGIN shutdown MOVE_PH 0., 90. // move mirrors to park position SHUTDOWN COOLER FPI GET_STATUS CAMERA FPI, TEMPERATURE, temperature GET_STATUS CAMERA FPI, STATE, CurrentState while(temperature<0.) { GET_STATUS CAMERA FPI, TEMPERATURE, temperature DELAY 30 } // ENDWHILE SHUTDOWN CAMERA FPI // be sure, wait for cooler warmup to take place LOG_OUTPUT OBSERVATORY, ClOSE LOG_OUTPUT CAMERA, CLOSE LOG_OUTPUT MASTER, CLOSE LOG_OUTPUT ANALYZE, CLOSE LOG_OUTPUT OBSERVATORY, OPEN LOG_OUTPUT CAMERA, OPEN LOG_OUTPUT MASTER, OPEN OVERLAY "DataPKZ.txt"