;+ ; c3cal.pro IDL procedure ; ; PURPOSE ; Read a list of LASCO-C3 FITS images, calibrate, ; and write a FITS file with a new name. ; ; SYNTAX ; c2dnbsun, 'fits_list' ; ; PROCEDURES USED ; rdfits ; c3_calibrate ; writefits ; fxaddpar ; ; HISTORY ; Author: Andrew L. Stanger 18 September 1998 ;- pro c3cal, fits_list dn_to_bsun = 3.825e-12 ; fits_name = '' ; Define FITS file name variable. new_name = '' CLOSE, 1 ;PRINT, 'fits_list: ', fits_list OPENR, 1, fits_list ; Open list file. ;--- File Loop : WHILE (NOT EOF (1)) DO $ ; File processing loop. BEGIN READF, 1, fits_name ; Read FITS file name from list file. PRINT, 'fits_name: ', fits_name dn_img = rdfits (fits_name, header=dn_hdu) ; Read FITS image & header. cal_hdu = dn_hdu imin = MIN (dn_img, max=imax) ; Find min/max pixel intensity range. print, 'imin/imax: ', imin, imax ;--- Get keyword parameters from FITS header. xdim = fxpar (dn_hdu, "NAXIS1") ydim = fxpar (dn_hdu, "NAXIS2") bitpix = fxpar (dn_hdu, "BITPIX") observat = fxpar (dn_hdu, "OBSERVAT") date = fxpar (dn_hdu, "DATE-OBS") time = fxpar (dn_hdu, "TIME-OBS") detector = fxpar (dn_hdu, "DETECTOR") exptime = fxpar (dn_hdu, "EXPTIME") xsize = strtrim (string (xdim), 2) ; Convert to string w/o blanks. nbypx = bitpix / 8 IF (nbypx EQ 1) THEN pixtyp = "c" IF (nbypx EQ 2) THEN pixtyp = "s" IF (nbypx EQ 4) THEN pixtyp = "i" IF (nbypx EQ -4) THEN pixtyp = "f" IF (nbypx EQ -8) THEN pixtyp = "d" year = STRMID (date, 0, 4) month = STRMID (date, 5, 2) day = STRMID (date, 8, 2) date_dn_img = year + month + day date_obs = day + '/' + month + '/' + year fxaddpar, cal_hdu, 'DATE-OBS', date_obs, " DAY/MONTH/YEAR (UT)" hour = STRMID (time, 0, 2) minute = STRMID (time, 3, 2) second = STRMID (time, 6, 2) time_dn_img = hour + minute + second inst = STRLOWCASE (STRMID (detector, 0, 2)) ;--- Calibrate C3 image. cal_img = float (c3_calibrate (dn_img, dn_hdu)) print, 'size (cal_img): ', size (cal_img) ; Convert DN to Bsun units. ; x_bin = 1024 / xdim ; Binning (pixel sum) factor for X-axis. ; y_bin = 1024 / ydim ; Binning (pixel sum) factor for X-axis. ; dn_img = (dn_img * dn_to_bsun) / (x_bin * y_bin * exptime) fmin = MIN (cal_img, max=fmax) ; Find min/max pixel intensity range. print, 'fmin/fmax: ', fmin, fmax fxaddpar, cal_hdu, 'DATAMIN', fmin, ' BSUN UNITS fxaddpar, cal_hdu, 'DATAMAX', fmax, ' BSUN UNITS fxaddpar, cal_hdu, 'DISPMIN', fmin, ' BSUN UNITS fxaddpar, cal_hdu, 'DISPMAX', fmax, ' BSUN UNITS fxaddpar, cal_hdu, 'BUNIT', 'BSUN', ' BSUN=AVERAGE SOLAR DISK BRIGHTNESS' ; new_name = inst + '.' + year + month + day + '.' $ ; + hour + minute + second + '.' + pixtyp + xsize + '.fts' new_name = inst + '.' + year + month + day + '.' $ + hour + minute + second + '.bsun.fts' new_name = STRTRIM (new_name, 2) ; Eliminate any blanks. fxaddpar, cal_hdu, 'FILENAME', new_name PRINT, 'new_name: ', new_name ; -- Write FITS image to disk. writefits, new_name, cal_img, cal_hdu END CLOSE, 1 END