; This IDL procedur contains a routine for listing a summary of some of the ; key parameters for a scan in the /home/gbtdata directory. The required ; parameters for this routine are the project ID, scan number, and the back-end ; device used for taking the data. The default device is the spectral ; processor. Information for all of the files with the same scan number will ; be printed to the screen. Antenna position data are retrieved from the ; Antenna FITS file and frequency information from the LO1A file for the same ; scan. ; This code illustrates the use of cfitsio keyword access functions. It ; assumes knowledge of the contents of the FITS files, which may be obtained ; with a FITS viewer, like 'fv', a text listing utility, like 'more', or the ; 'show_fits' function in the get_fits module. ; We assume that all files of the same scan for the different devices have ; the same file name. This is not guaranteed to be the case, but it generally ; is, except for the spectrometer, which uses an A, B, C, or D suffix to name ; files from different banks. This code presently only looks at antenna, LO ; and spectral processor files. ; To run from the IDL prompt: ; IDL> scan_info, 'AGBT02A_069_01', 162 ; This routine retrieves and prints selected keyword values from the antenna ; FITS file, , in the /home/gbtdata//Antenna/ directory. function show_antenna_info, project, file_name ; assemble the file name path and check to see that the file exists fpn = '/home/gbtdata/' + project + '/Antenna/' + file_name GET_LUN, fd OPENR, fd, fpn stat = FSTAT(fd) if (stat.OPEN NE 0) then begin CLOSE, fd ; open the file main header to the fitsio access mhdr = HEADFITS(fpn, EXTEN=0) ; retrieve the outside air temperature, pressure, and humidity ; from the main header keywords temp = fxpar(mhdr, 'AMBTEMP') pres = fxpar(mhdr, 'AMBPRESS') humid = fxpar(mhdr, 'AMBHUMID') ; retrieve the antenna's position at the beginning of the scan in ; two coordinate systems from the third header data unit's (HDU) ; binary table columns. fxbopen,t1, fpn, 2, ehdr fxbread, t1, az, 'MNT_AZ' fxbread, t1, el, 'MNT_EL' fxbread, t1, ra, 'RAJ2000' fxbread, t1, dec, 'DECJ2000' fxbclose, t1 print, 'Antenna:' print, ' Temperature: ', STRTRIM(STRING(temp), 2), ' Deg. C' print, ' Pressure: ', STRTRIM(STRING(pres), 2), ' millibars' print, ' Humidity: ', STRTRIM(STRING(humid), 2) print, ' Azimuth: ', STRTRIM(STRING(az(0)), 2), $ ' Deg. Elevation: ', STRTRIM(STRING(el(0)), 2), ' Deg.' print, ' RA2000: ', STRTRIM(STRING(ra(0) / 15.0), 2), $ ' Hrs. Dec2000: ', STRTRIM(STRING(dec(0)), 2), ' Deg.' endif else begin print, 'Cannot find Antenna FITS file:', file_name endelse return, 0 end ; This routine retrieves and prints selected keyword values from the LO ; FITS file, , in the /home/gbtdata//LO1A/ directory. function show_lo_info, project, file_name ; assemble the file name path and check to see that the file exists fpn = '/home/gbtdata/' + project + '/LO1A/' + file_name GET_LUN, fd OPENR, fd, fpn stat = FSTAT(fd) if (stat.OPEN NE 0) then begin CLOSE, fd ; open the file main header to the fitsio access mhdr = HEADFITS(fpn, EXTEN=0) ; retrieve the line rest frequency, first IF center frequency, ; LO power level sent to the receiver, and the sideband of the ; first mixer conversion from the main header keywords rest_freq = fxpar(mhdr, 'RESTFRQ') if_freq = fxpar(mhdr, 'IFFREQ') pwr_lvl = fxpar(mhdr, 'POWERLVL') sideband = fxpar(mhdr, 'SIDEBAND') ; retrieve the object's velocity with respect to the selected ; reference frame, the LO frequency, the observer's velocity with ; respect to the selected reference frame, and the velocity of the ; object with respect to the observer at the beginning of the scan ; from the third and fourth HDU binary table columns. fxbopen,t1, fpn, 2, ehdr fxbread, t1, vel, 'VELOCITY' fxbclose, t1 fxbopen,t1, fpn, 3, ehdr fxbread, t1, lo_freq, 'LO1FREQ' fxbread, t1, vframe, 'VFRAME' fxbread, t1, rvsys, 'RVSYS' fxbclose, t1 print, 'LO1A:' print, ' Rest Frequency: ', $ STRTRIM(STRING(rest_freq * 1e-6), 2), ' MHz' print, ' First IF Frequency: ', $ STRTRIM(STRING(if_freq * 1e-6), 2), ' MHz' print, ' Power Level: ', $ STRTRIM(STRING(pwr_lvl), 2), ' dBm Sideband: ', sideband print, ' Velocity: ', $ STRTRIM(STRING(vel * 1e-3), 2), ' km/s' print, ' LO Frequency: ', $ STRTRIM(STRING(lo_freq * 1e-6), 2), ' MHz' print, ' Frame Velocity: ', $ STRTRIM(STRING(vframe * 1e-3), 2), ' km/s' print, ' RVsys: ', $ STRTRIM(STRING(rvsys * 1e-3), 2), ' km/s' endif else begin print, 'Cannot find LO1A FITS file:', file_name endelse return, 0 end ; This routine retrieves and prints a few selected keyword values from the ; spectral processor FITS file, , in the ; /home/gbtdata//SpectralProcessor/ directory. function show_spectral_processor_info, project, file_name ; assemble the file name path and check to see that the file exists fpn = '/home/gbtdata/' + project + '/SpectralProcessor/' + file_name GET_LUN, fd OPENR, fd, fpn stat = FSTAT(fd) if (stat.OPEN NE 0) then begin CLOSE, fd ; retrieve the input center frequency, bandwidth, and spectral ; processor input sideband from the second HDU binary table columns. fxbopen,t1, fpn, 1, ehdr fxbread, t1, iff, 'IFF' fxbread, t1, bw, 'BANDWD' fxbread, t1, sideband, 'IFSIDE' fxbclose, t1 ; get the number of data records (integrations), number of switch ; states, e.g., cal on and cal off, number of IF inputs, and number ; of spectral channels from the data array dimensions in the fourth ; HDU. fxbopen,t1, fpn, 3, ehdr fxbread, t1, spec, 'DATA' fxbclose, t1 sizes = SIZE(spec) num_chan = sizes(1) num_states = sizes(2) num_rcvrs = sizes(3) num_records = sizes(4) ; print the results print, 'Spectral Processor:' print, ' Receivers: ', STRTRIM(STRING(num_rcvrs), 2), $ ' Records: ', STRTRIM(STRING(num_records), 2) print, ' Bandwidth: ', STRTRIM(STRING(bw(0) * 1e-6), 2), ' MHz' print, ' IF Center Frequency: ', STRTRIM(STRING(iff(0) * 1e-6), 2), $ ' MHz IF Sideband: ', sideband(0) print, ' Switch States: ', STRTRIM(STRING(num_states), 2), $ ' Spectral Channels: ', STRTRIM(STRING(num_chan), 2) endif else begin print, 'Cannot find SpectralProcessor FITS file:', file_name endelse return, 0 end pro scan_info, project, scan_number, device if N_params() LT 3 then begin device = 'SpectralProcessor' endif if N_params() LT 2 then begin print, 'Usage: scan_info, project, scan_number[, device] return endif ; assemble the directory path name and get a list of file names path = '/home/gbtdata/' + project + '/' + device SPAWN, 'ls ' + path, ls sz = SIZE(ls) if sz(1) LE 1 then begin return endif file_num = 0 ; step through every file in the list for fn = 0, sz(1) - 1, 1 do begin ; if it's not a FITS file, skip it if (STRPOS(ls(fn), 'fits') GT 0) then begin file_num = file_num + 1 fpn = path + '/' + ls(fn) ; open the file main header to the fitsio access mhdr = HEADFITS(fpn, EXTEN=0) ; retrieve the SCAN keyword value in the main header scan = fxpar(mhdr, 'SCAN') ; check the scan number to see if it is the one requested ; if so, gather a few object, date, and time keyword values from ; the main header and print them. if (scan EQ scan_number) then begin object = fxpar(mhdr, 'OBJECT') date_time = fxpar(mhdr, 'DATE-OBS') mjd = fxpar(mhdr, 'UTDATE') ut_start = fxpar(mhdr, 'UTCSTART') ut_stop = fxpar(mhdr, 'UTCSTOP') tpos = STRPOS(date_time, 'T') date = STRMID(date_time, 0, tpos) time = STRMID(date_time, tpos + 1, 100) ; check for a midnight crossing during the scan if (ut_start GT ut_stop) then ut_stop = ut_stop + 86400.0 scan_length = round(ut_stop - ut_start) print, '' print, 'Scan: ' + STRTRIM(STRING(scan), 2), ' of Object: ' + $ STRTRIM(object, 2) print, ' Date: ' + date, ' UTC: ' + time + $ ' MJD: ' + STRTRIM(STRING(mjd), 2) print, ' Scan length: ' + STRTRIM(STRING(scan_length), 2) + $ ' seconds' ; get and print keyword values from the corresponding antenna ; and LO files and more detailed information from the spectral ; processor FITS file. x = show_antenna_info(project, ls(fn)) x = show_lo_info(project, ls(fn)) x = show_spectral_processor_info(project, ls(fn)) endif endif ; move on to the next file endfor end