;---------------------------------------------------------------------- ; NAME: ; update_aimass ; PURPOSE: ; corrects the airmass in the image headers and puts a history ; in the header that the airmass was corrected. ; ; EXPLANATION: ; Takes a list of images and updates the airmass to the correct ; values. ; ; CALLING SEQUENCE: ; update_airmass, 'imlist' [, '00:00:00.0', '00:00:00.0'] ; INPUTS: ; imlist - a filename for a file containing a list of images ; that need to be pattern corrected. ; ; OPTIONAL INPUTS: ; ra2 - the RA of the object precessed to the appropriate epoch ; dec2 - the Dec of the object precessed to the appropriate epoch ; OPTIONAL INPUT KEYWORDS: ; ; OUTPUTS: ; ; OPTIONAL OUTPUTS: ; ; NOTES: ; This procedure requires that the path name for the filelist ; template is set to the appropriate path name. Pleas alter the ; path name for this file accordingly. ; ; PROCEDURE CALLS: ; airmass2 ; decparse ; raparse ; REVISION HISTORY: ;------------------------------------------------------------------------- pro update_airmass, imlist, ra2, dec2 ;retrieve the list of files files_file=make_array(1, /STRING) restore, '/d1/data1/mirsi/analysis/filelist_template.idl' files_file=read_ascii(imlist, template=filelist_template) filelist=files_file.field1 nfiles=n_elements(filelist) ;loop over the list of files for i=0, nfiles-1 DO BEGIN $ data = READFITS(filelist(i), header) ra_s = sxpar(header, 'RA') dec_s = sxpar(header, 'DEC') lat_s = sxpar(header, 'TEL-LAT') long_s = sxpar(header, 'TEL-LONG') ut_s = sxpar(header, 'TIME-STR') date = sxpar(header, 'DATE-OBS') ;if user supplies coordinates for the object the ; new coordinates are updated here. if n_params() EQ 3 THEN BEGIN ra_s = ra2 dec_s = dec2 ENDIF ;convert the dec, ra, lat, long, ut to the appropriate units dec = decparse(dec_s) ra = raparse(ra_s) lat = decparse(lat_s) long = decparse(long_s) ut = raparse(ut_s) ;compute the airmass air = airmass2( ra, dec, lat, long, ut, date) ;rewrite the data and the updated header information. sxaddpar, header, 'AIRMASS', air sxaddhist, 'Airmass corrected on ' + systime(), header writefits, filelist(i), data, header ENDFOR end