# Script for converting PISCES images to ushort fits files. # This version waits 20 sec after a file has been detected to be sure # that the files are complete. Thus, it can be run in the background # to convert incoming files continuously. # The PC FITS files are put in the TEMP directory specified by the user, # then converted to "ushort" type, analyzed for stats, gzipped, # and relocated to a directory (dd) specified by the user # To use, type: # cd /d1/bokobs/rawdata/TEMP # pisces * (dd) verbose+ & # example of (dd): /d1/bokobs/rawdata/DATAxxxx # History: original on 27 Feb 99 by D. McCarthy # You'll need to add a line to the loginuser.cl file: # task pisces = "/home/bokobs/pisces.cl" # changing the paths in the task definition as appropriate. # to kill, search for process ID: ps -def| grep bkg procedure pisces(names,directoryname) string names string directoryname bool verbose {yes} begin string nn,dd,ff string f string newname string statsec nn = names dd = directory statsec = "["//718//":"//768//","//718//":"//768//"]" task $gzip = "$foreign" if (access(dd)) { if (verbose) print ("Files will be put in existing directory ",dd) } else { if (verbose) print ("Files will be put in NEW directory ",dd) mkdir(dd) } while (yes) { ff = mktemp("tmp$") files (nn,>ff) list = ff while (fscan(list,f)!=EOF) { sleep (20) # wait for completed file if (access(f)) { if (verbose) print (f," exists") imarith (f,"*",1.0,f,pixtype="ushort") # convert to ushort # display (f,1) imstat (f//statsec,fields="image,npix,mean,stdev,min,max") gzip (f) movefiles (f//".gz",dd,verbose=verbose) # movefiles (f,dd,verbose=verbose) if (verbose) print (" waiting for new file") } } list = "" delete(ff) sleep (1) } end