================================================================================ 3-Helium GBT Single Dish Data Reduction System in IDL ================================================================================ T.M. Bania v1.3 26 Feb 2004 v1.4 12 Mar 2004 v2.0 30 Apr 2004 v2.1 15 May 2004 v3.0 15 June 2004 v3.1 10 July 2004 v3.2 21 July 2004 ================================================================================ The following procedures are defined in this system. N.B. Other procedures are also invoked and defined, but they should be transparent to the user. Below is a summary of procdures that a user needs in order to analyze GBT data. ================================================================================ ACCUM ADD ADDEM ATTACH AVE AVGSTK AZXX B BB BBB BIAS BMARK BSEARCH BOXCAR CAT CCC CHAN CLEARSET CLRSTK COMMENT CLOSE_DATAFILE CONDAR CONTINFO CONT COPY CUROFF CURON CGBT_WIN CGG DATE DEF_AXIS DCSUB DCOFF DCON DECX DISP DIV DISPLAY ELXX FETCH FIND_FILE FILES FLAG FLAGOFF FLAGON FLG_ID FREEX FREEXY FREEY FREQ G GAUSS GBTRESTORE GBTSAVE GBT_WIN GET GETNS GETOFF GETON GETONLINE GETOFFLINE GET_SCAN GG GGG H115 H91 H92 HDR HE3 HLINE IDCHAN INFO INIT_DATA INIT_NSAVE KILLWIN KONDAR KSR KURSOR LASTX LASTY LASTXY LINE LIST LOOK LOOKAV MAKE_DATA MAKE_NSAVE MAKE_CDATA MAKE_ONLINE MULT MASK MGAUSS MINUS MK MRDFITS MRSET NROFF NRON NRSET NSOFF NSON NSLOG NRFI ONLINE OFFLINE ORTHOFIT PLTG PLTHDR PLUS PRINTOFF PRINTON PROCS PS PLTCHDR PSOFF PSON PSPLOT PUTNS QAV QLOOK QLOOK4 QQQ RADIOM RAXX REC_INFO RESHOW RMS RXIDREC RFI SCALE SD_HDR SD_TO_GBT SD2CGBT SELECT SET SETID SETCOLORS SETPLOT SETRANGE SETREC SETSCAN SETSRC SETTYPE SETPOL SETXY SETX SETY SHOW SMO SMOOTH SRCVL SRCVLON SRCVLOFF SUB SYMS START_GBT SETPRINTER TAGID TAGTYPE TAGPOL TELLSTK TH_RMS UNMK UPDATE VELO WRESET XROLL XX ZLINE ZLOFF ZLON ================================================================================ The following commands are part of the 3-Helium data reduction package (they are NOT described here but in ../v3.1/DOCS/3_HELIUM): AVGNS AVLOG BAM CATNS CMARKER DAZE EDITNS PUTAVNS SELECTNS START_SRC START_DAY START_EPOCH The following spectra flag routines are also defined: HE3 A91 B115 A92 HEPP G131 G132 ================================================================================ N.B. (0) V2.0 eliminates the !gbt[] structure for data storage. In V2.0, data are stored in an external file defined by the user. This ONLINE data file stores GBT data in the {gbt_data} structure format. This provides great power: many different data files can be ATTACHed to the ONLINE data file. There is also an OFFLINE data file as in UNIPOPS. The ONLINE data file is made using MAKE_ONLINE and can be appended to using UPDATE. A {gbt_data} structure format file can be made from an input SDFITS file vis MAKE_DATA. To see what files you are using issue FILES and to change files use ATTACH. (1) The record number of the spectrum in the ONLINE data file is the basic data reference used in this package. This is how CLASS does it as well. (2) Procedures use globally defined system variables, !sys_var_name, to pass important parameters and to toggle Boolean switches. You can access the instantaneous values of these variables easily with the IDLDE GUI. (3) ALL procedures operate on the header and data currently residing in buffer 0 (i.e. !b[0]) (4) Many, but not all, of the analysis tools now work on spectra with the x-axis in an choice of units (channels, frequency, or velocity). Baseline routinues still need to be fitted using channels or velocity for the x-axis. When in doubt, do your analysis in channels. (5) V3.0 enables DCR continuum data analysis. Switch between LINE and CONTinuum with these commands. Package uses two graphics screens, on for each mode. One must chose the x-axis units: channels, azimuth, elevation, R.A., or Dec. (CHAN AZIXX ELXX RAXX DECX). One must know the number of data points in the continuum record (!c_pts). (6) Continuum data are written in {gbt_data} format which must be defined. Position information is packed into {gbt_data}.data array, after the data themselves. (7) V3.0 defines 16 !b[] data buffers for added power. (8) V3.1 successfully demonstrated use of UPDATE command to access GBT data real-time with SDFITS-TEST running continuously and appending new data as they come in. ================================================================================ Alphabetical Listing of Procedures ================================================================================ ; ; accum Accumulate weighted record data from buffer 0 in buffer 3 ; ----- as in Unipops. header of first call to ACCUM is stored in buffer 3 ; weight is tintg/(Tsys)**2 ; !aaccum counts number of scans in current ACCUM ; ; add,rec Add a single record number to the STACK ; ------- !acount counts the number of records in STACK ; !astack is an array of the record numbers currently in STACK ; ; addem,rec_array Add several record numbers to the STACK ; --------------- Useage: addem,[rec#1,rec#2, ... ,rec#last] ; MUST be delimited by [...] ; ; attach,filetype attach file to IDL system ; --------------- file must already exist or procedure returns an error ; if no input filetype, a menu is printed: ; ; menu: ; print,'Select file type to attach: ' ; print,'(0) SDFITS data file' ; print,'(1) ONLINE data file' ; print,'(2) OFFLINE data file' ; print,'(3) NSAVE data file' ; print,'(4) PLOT file' ; print,'(5) JOURNAL file' ; print,'(6) SAVE_state file' ; print,'(7) SAVE_procs file ' ; print,'Syntax: attach,unit_num OR attach,"file_name"' ; ; attach,1 specify filetype by integer or string ; attach,'ONLINE' both these commands do the same thing: ; each prompts user for filename to attach ; ; attach,filetype,filename <= construction useful for batch mode ; ------------------------ ; attach,filetype,filenam,nsave_log_file name <= construction for NSAVE ; ; ave Compute the weighted average of accum buffer 3 ; --- store result in buffer 0 and buffer 4 ; zero accum buffer 3 and all relevant weights in the process ; ; avgstk ACCUM and AVE the records in the STACK ; ------ ; ; azxx sets system flag to display AZIMUTH on x-axis (continuum mode only) ; ---- ; ; b Fit polynomial baseline of order !nfit to data in NREGION zones ; - does the fit automatically, thus all relevant parameters must be set ; neither a baseline model nor the resulting baseline subtracted spectrum ; is shown ; stores result in buffer 0 ; prints RMS of NREGIONs zones ; ; bb,nfit Fit polynomial baseline of order nfit to data in NREGION zones ; ------- if nfit is not passed, !nfit is used, else !nfit=nfit ; NREGIONs must be set with NRSET before this procedure is invoked ; !nrset = #_nregions and !nregion[...] array of channel values ; original data copied to buffer 2 ; fitted baseline is overplotted on data with built in pause ; returns baseline subtracted spectrum in buffer 0 ; if (!zline) then zero intensity line is plotted ; if (!bmark) then NREGIONs plotted with Y-axis size +/- 3 sigma ; prints RMS of NREGIONs zones ; ; bbb,nfit Fit orthonormal basis vectors of order nfit to data in ; -------- NREGION zones. Acts just like bb. Written by J.G. Lyon ; This procedure is far more robust than either b or bb. ; Can work to nfit=100. (!!!) Invokes ORTHOFIT ; ; bias,y_offset Displace spectrum in !b[0].data by y_offset ; ------------- ; ; bmark Draw NREGION boxes +/- 1.5 sigma from spectrum's y-axis mean ; ----- for a 3 sigma high band. Used by SHOW procedure. Boolean toggle ; is !bmark which is set/unset by NRON and NROFF procedures ; ; bsearch,nfit Automatic search for the optimal nfit to use for a baseline ; ------------ if nfit is not passed, nfit=100. Procedure uses ORTHOFIT. ; Fits baselines through NREGION zones for orders=0 ; to nfit and plots RMS vs NFIT order. HLINE flags ; rms of original, unbaselined spectrum for comparison. ; After use, issue WDELETE command to erase window ; and return control to original graphics screen ; ; boxcar,nch Execute a boxcar smoothing function over nch cnannels. ; ---------- original buffer 0 data copied to buffer 8 ; overplots smoothed data and then pauses ; RESHOWs the smoothed data ; ; cat List contents of STACK CATalog ; --- uses format of REC_INFO procedure ; ; ccc,xpos,ypos Invoke a full plot screen cursor and return its position ; ------------- (xpos,ypos) in PLOT units ; (rdplot from Astrolib and is a full screen cursor) ; Boolean toggle is !flag which is set/unset by FLAGON/FLAGOFF ; !flag controls whether cursor position is printed to screen ; ; cgbt_win Create a CONTINUUM graphics window ; -------- ; ; cgg,ngauss multiple gaussian fit to !b[0].data MODIFIED FOR CONTINUUM ; ---------- ; ; chan Set system flag !chan to display channels on x-axis ; ---- this is the default works in LINE and CONTinuum mode ; VELO/FREQ set x-axis display to velocity/frequency ; in continuum mode AZXX/ELXX/RAXX/DECX set x-axis display to ; Azimuth, Elevation, Right Ascension, or Declination ; ; clearset Set all SELECT system variables to wild card values ; -------- SELECT variables allow one to search either the ONLINE ; or the OFFLINE data file for matches and store these ; record numbers in the STACK ; ; close_datafile close the ONLINE and OFFLINE data files ; -------------- useful when i/o error occurs during IDL session ; IDL doesn't care if you close a closed file so ; this closes them both ; ; clrstk Empty STACK (N.B. EMPTY is, alas, an IDL defined variable) ; ------ Think: CLeaRSTacK ; ; condar,file_name Start looking at continuum data: ; ---------------- ; ; comment,msg Write a string into !b[0].history for annotation ; ----------- 48 character maximum in {gbt_data} at present time ; (check definition in GBT_DATA which defines {gbt_data}) ; routine truncates input string to fit ; If msg is passed explicitly, then must be a string 'msg' ; else system prompts for a message and no ' ' is needed ; => Overwrites !b[0].history ; ; ; continfo,filename Scan SDFITS continuum data file and determine the number ; ----------------- of continuum data points per record. Prompts for filename ; if none is input. Uses changes in scan number, polarization, ; scan type, and sequence number to flag new data records. ; Note that different continuum observing procedures, e.g. ; PEAK, FOCUS, etc. will have different number of data points. ; ; cont Switch to CONTINUUM data reduction and CONTINUUM graphics window ; ---- ; ; copy,bin,bout Copy buffer bin into buffer bout ; ------------- returns error if bin, bout not provided ; ; curoff Turn the cursor OFF for various input: !cursor=-1 ; ------ ; ; curon Turn the cursor ON for various input !cursor=1 ; ----- ; ; date.pro prints information on date of observation ; -------- based on !b[0].date value ; ; def_xaxis define x-axis units using Boolean flags set via commands: ; --------- ; If !chan then x-axis is in channels CHAN ; !freq frequency FREQ ; !velo lsr velocity VELO ; !elxx elevation ELXX ; !azxx azimuth AZXX ; !raxx right ascension RAXX ; !decx declination DECX ; ; dcon Turn the DC subtraction ON: !dcsub=1 ; ---- ; ; dcoff Turn the DC subtraction OFF: !dcsub=0 ; ----- ; ; dcsub Subtract DC offset defined by mean of the inner 90% of the spectrum ; ----- Used by FETCH, PS, and LOOK ; ; decx sets system flag to display DECLINATION on x-axis ; ---- ; ; disp,n,m SHOW buffer n and RESHOW buffer m ; -------- buffer 0 ends up with contents of buffer n ; ; display,image=image,wid=wid Display an input IMAGE file on window WID ; --------------------------- this is not currenly in use in this package ; ; div,n,m !b[0].data = !b[n].data / !b[m].data ; ------- Divide buffer n by buffer m returns result to buffer 0 ; Default: !b[0].data = !b[1].data / !b[0].data ; ; elxx sets system flag to display ELEVAION on x-axis (continuum mode only) ; ---- ; ; fetch,recon Calculates the PS spectrum from TP ON/OFF records ; ----------- recon is the ON data record ; calculates the OFF rec# via !recs_per_scan which is ; set by MAKE_ONLINE. ; currently !recs_per_scan=8 for the 3He experiment ; ON=> buffer 5 OFF=> buffer 6 TP=> buffer 0 and buffer 7 ; currently hardwired so that recoff = recon-8 ; because SDFITS does not give recoff ; also, at present SDFITS gives bogus intensities. whoopee. ; ==> also create a TP pair via: PS,on_rec,off_rec ; ; find_file,fname Does this file_name exist? ; --------------- If not, prints an error and issues a 'retall' ; ; files Show what files are currently being used: ; ----- Data file, NSAVE file, NSAVE logfile, PLOT file, Journal file, ; SAVE_state and SAVE_procs files ; N.B. ALL these files and their LUNs are global system variables ; ; flag,ch Plot vertical flag at specified channel. LabelS with channel number. ; ------- Uses current x-axis definition. ; ; flagon Turn the flag ON for various control functions: !flag=1 ; ------ ; ; flagoff Turn the flag OFF for various control functions: !flag=0 ; ------- ; ; flg_id,ch,lab,clr Plot vertical flag at specified channel for line ID ; ----------------- ch=x-axis value for flag ; lab=string for flag label ; clr=sys_colour_variable_name: e.g. !red,!blue,!green ; ; freex Reset x-axis to autoscaling ; ----- ; ; freey Reset y-axis to autoscaling ; ----- ; ; freexy Reset x + y-axis to autoscaling ; ------ ; ; freq.pro SET system flag to display frequency on x-axis ; -------- VELO/CHAN set x-axis display to velocity/channels. ; ; g Multiple gaussian fit to !b[0].data i.e. buffer 0 ; - ; routine hardwired to fit gaussians with all initial values PRESET ; presumably this is done via 'GG,#gaussians_to_fit' ; gaussian h,c,w values for each component are in !a_gauss ; fitting region is delimited by !bgauss and !egauss ; ; buffer 2 contains copy of original data from buffer 0 ; buffer 1 contains the GMODEL, i.e. the fitted gaussians ; buffer 8 contains the data-model difference spectrum ; ; FLAGON/FLAGOFF toggles more complete output: ; annotate line parameters; overplot of fit ; ; gauss Fit multiple Gaussians: interactive walk-through-each-step ; ----- for best results subtract a baseline first ; modified by t.m.bania from astrolib? code ; ===> READ the prompts carefully and follow orders....! (ja?) ; ; gbtrestore Restore all system + local variables and ; ---------- user defined procedures + functions from ; !save_idl_state + !save_idl_procs files, respectively ; => N.B. RESTORE is an IDL reserved word ; ; gbtsave Save all system + local variables and user ; ------- defined procedures and functions in ; !save_idl_state + !save_idl_procs files, respectively ; => N.B. SAVE is an IDL reserved word ; ; gbt_win Create a plot window tailored to the GBT data reduction system ; ------- ; ; get,rec Copy rec# into buffer 0 => !b[0] ; ------- also sets !tsys and !time from header of rec# ; !ONLINE is boolean flag toggle for ONLINE or OFFLINE data search ; ; getns,ns Fill buffer 0 with NSAVE region specified by ns ; --------- if ns not supplied, !nsave is used, else !nsave=ns ; uses !nsavefile and !nslogfile which contains !nsave_log[] ; if (!nsave_log(!nsave) eq 0) then there is no data here ; ; getoff,rec Copy OFF rec# into buffers 0 and 6: !b[0] and !b[6] ; ---------- also sets !tsys and !time from header of rec# ; ; geton,rec Copy ON rec# into buffers 0 and 5: !b[0] and !b[5] ; --------- also sets !tsys and !time from header of rec# ; ; getonline,rec fills buffer 0 with data record from ONLINE data file ; ------------- must input the record number ; ; getoffline,rec fills buffer 0 with data record from OFFLINE data file ; -------------- must input the record number ; ; get_scan,idx For a specific scan find and plot both polarizations for ; ------------ a receiver specified by idx. ; ; gg,ngauss Fit multiple gaussians to buffer 0: !b[0].data ; --------- overplots the fit ; if !flag=1 then overplot the residual=data-fit ; ; ngauss = # gaussian components to fit ; ; => this works exactly like our UNIPOPS gg function ; from LEFT to RIGHT Click: bgauss #_gauss(center,hw_right) egauss ; i.e. each Gaussian component specified by a center and half-width ; flagged to the right of the line center ; (bgauss,egauss) denote the range for the Gaussian fit ; ; assumes spectrum is in buffer 0 with x-axis in channels ; buffer 2 holds copy of buffer 0 ; buffer 1 holds the GMODEL (gfit) ; buffer 8 holds the data-model difference ; ; => N.B. in v2.0 gg works for any x-axis unit definition ; ; ggg G procedure with explicit i/o ; --- ; ; he3 Flag channels for the 3-He band ; --- recomb lines for Dec03 setup ; this is !rxid = 1 'rx1' or 'rx1.1' or 'rx1.2' ; ; h91 Flag channels for the H91alpha, He91alpha, and C91alpha ; --- recomb lines for Dec03 setup ; this is !rxid = 2 'rx2' or 'rx2.1' or 'rx2.2' ; ; h115 Flag channels for H115 beta recomb lines for Dec03 setup ; ---- this is !rxid = 3 'rx3' or 'rx3.1' or 'rx3.2' ; these flagging routines could also stores NREGIONs for fits ; ; h92 Flag channels for the H92alpha series ; --- recomb lines for Dec03 setup ; this is !rxid = 4 'rx4' or 'rx4.1' or 'rx4.2' ; ; hdr,rec Print header variables for a single GBT_DATA record ; ------- i.e. a single subcorrelator spectrum for a specific scan ; FLAGON/FLAGOFF toggles extra information via !flag ; if !flag=1 then print out a full header ; assumes that the data are in !b[0] ; ; hline,value Draws and labels a horizonal line at y-axis = value ; ----------- ; ; idchan,xval,xchan Take xaxis value and return channel number of !xx array ; ----------------- element whose value is closest. i.e. finds channel number ; associated with an x-axis value in one of the following ; co-ordinate systems: ; ==> If !chan then x-axis is in channels ; !freq frequency ; !velo lsr velocity ; !elxx elevation ; !azxx azimuth ; !raxx right ascension ; !decx declination ; ; info Print information for buffer 0 header (!b[0]) ; ---- FLAGON/FLAGOFF toggles annotation of column headings ; ; init_data,fname initializes values of all i/o files ; --------------- SDFITS data file is fname. if not supplied it is ; hardwired in the !datafile global ; searches SDD !datafile data and sets # !data_points ; in a spectrum. ; use FILES to see what files are being used ; ; init_NSAVE Invoked by START_GBT at startup to initialize NSAVE files. ; --------- Asks whether or not to use existing ~nsave.dat and ~nsave.log ; files or to make new ones with either the default, or new names. ; Invokes MAKE_NSAVE ; ; killwin Kills all existing graphics windows ; ------- ; ; kondar Batch file script executed via command: @kondar ; ------ Reads SDFITS DCR continuum file. Puts the first !data_points (value ; from {gbt_data}) which must be defined) data points into !b[0].data. ; Advances though SDFITS file and puts data in buffers 1 to 15. ; => View with combination of SHOW and COPY,buffer#,0 commands. ; This is the first thing to do when trying to figure out the structure ; of the SDFITS DCR continuum file. ; ; ksr Continuous version of KURSOR: Left-click mouse for cursor reads ; --- Left-click mouse ==> KURSOR executes ; Right-click mouse ==> EXIT and return to IDL command line ; ; kursor Invoke cursor and read its position once. Return these values in xpos,ypos. ; ----- Plot this position and its values on graphics screen via FLAG and HLINE. ; Invokes CCC so xpos,ypos in PLOT units. ; ==> CURSOR is an IDL command hence this name. ; ; lastx Restore x-axis range to previous value ; ----- ; ; lasty Restore y-axis range to previous value ; ----- ; ; lastxy Restore x and y-axis ranges to previous values ; ; line Switch to LINE data reduction and LINE graphics window ; ---- ; ; list,start,stop List contents of either ONLINE or OFFLINE data file ; -------------- for record index range start,stop ; if (start,stop) not given, lists entire file ; => invokes REC_INFO ; ; look Use STACK record locations to FETCH spectra and plot them ; ---- with a DC level subtracted. Assumes x,y-axes are set properly. ; FLAGON/FLAGOFF action: ; FLAGOFF -> !flag = 0 --> overplot these spectra ; FLAGON -> !flag = 1 --> show them individually ; ; In either case, system pauses after each plot. ; Issue to continue. ; ; lookav Select and average all receivers using QAV command ; ------ ; ; make_data,infile,outfile create spectral LINE data file using the {gbt_data} format ; ------------------------ ; If files not given, prompts for file names. ; INFILE data is from SDFITS filled data file ; !kon counts number of data records currently in file ; OUTFILE data is {gbt_data} format to specified file ; which must then be attached via ATTACH command ; Note: Error generated if #spectral channels in INPUT ; does not match current {gbt_data} format ; ; make_ONLINE create ONLINE data file with the {gbt_data} structure ; ----------- INPUT data is from SDFITS filled data file 'fname' ; where fname=!datafile is defined by INIT_DATA ; --------- ; new data can be appended to this file via UPDATE ; ------ ; --> !kon counts number of ONLINE data records currently in fname ; ; --> this procedure is normally run via STARTUP.IDL ; => N.B. size of spectral array automatically set by SDD data file size ; datafile => the name of the SDD data file ; !datafile value set in INIT_DATA is used ; ; => invokes SD_TO_GBT procedure to do translation for each record ; ; => N.B. once {gbt_data} is defined it cannot be modified during ; an IDL session. if you need to analyze spectra with ; different numbers of channels you will need to exit the ; session and start again. note, however, that this only ; refers to the channels per spectrum. if the number of ; channels is the same, then everything else, e.g. bandwidth ; can change... ; ; make_Cdata,infile,outfile create CONTINUUM data file using the {gbt_data} format ; ------------------------- ; INPUT data is from SDFITS filled data file ; !kon counts number of data records currently in file ; OUTPUT data is {gbt_data} format to specified file ; which must then be attached via ATTACH command ; => Invokes: SD2CGBT procedure ; ; make_NSAVE,gbt Create the NSAVE file using the input gbt data structure {gbt_data}. ; -------------- also create a log file flagging whether a slot has been ; written to or not. Flags are in !nsave_log(!nsave) ; => File names are '~/data/nsave.dat' and '~/data/nsave.log' ; Size of NSAVE file (number of save slots) is 256. ; Procedure invoked at startup by START_GBT. ; => N.B. this procedure should only be run sparingly. it *can* ; destroy previous versions of the same file name .... ; You can prevent this by renaming the files: ; $cp ~/data/nsave.dat ~/data/new_name.dat ; $cp ~/data/nsave.log ~/data/new_name.log ; You can always ATTACH these files later. ; ; mask,dsig,index Use NREGION information to extract x/y-axis values for ; --------------- values for fitting routines. ; returns: dsig => rms of masked regions ; index => NREGION locations ; index is used to parse the x/y-axis arrays for curve fits ; ; mgauss,x,a,f,pder Function required by curvefit for Gaussain fit ; ----------------- Used to fit the sum of a number of Gaussians ; x=size of x-array for fit ; a=array containing initial values for h,c,w ; f=array containing functional form of Gaussian ; pder=array containing function derivative ; => do NOT mess with this unless you know what you are doing ; ; minus,n,m !b[0].data = !b[n].data - !b[m].data ; --------- Subtract buffer m from buffer n ; Default: !b[0].data = !b[1].data - !b[0].data ; ; mk Convert y-axis in Kelvins to milliKelvin scale via !fact=1.0E+03 ; -- ; ; mrdfits Read a FITS file. Procedure from astrolib/pro ; ------- Read all standard FITS data types into arrays or structures. ; Further information on MRDFITS is available at ; http://idlastro.gsfc.nasa.gov/mrdfits.html ; => MAKE_GBT uses the command: ; sdd = mrdfits(lun, 1, hdr, status=status) ; makes data structure array of Single Dish Data (sdd) ; sdd is SDFITS data structure array ; ; mrset,n,nreg Sets NREGION mask in x-axis units. ; ------------ If !cursor=0 (CUROFF) then returns with error ; Sets beginning and ending of NREGIONs to display xmin,xmax ; n is the number of nregions to set ; nreg is array of x-axis value pairs of (begin,end) ; EXCEPT the first begin and last end are by ; default the displayed xmin,xmax ; ; => First click is END of first NREGxION <= ; => Last click is BEGINNING of last NREGION <= ; ; mult,n,m !b[0].data = !b[n].data * !b[m].data ; -------- Multiply buffer n by buffer m ; Default: !b[0].data = !b[1].data * !b[0].data ; ; nrfi,nfit Replaces spectral region contanimated with RFI with values gotten ; --------- from a baseline fit. Must define RFI zone via either NRSET or MRSET. ; MRSET is recommended. ; Spectral values are replaced for *all* regions *outside* the NREGIONs ; which are *inside* the plotted display. ; Prompts if nfit, the order of the baseline fit, not given. ; ; nron Turn flag ON for SHOWing NREGIONs: !bmark=1 ; ---- ; ; nroff Turn flag OFF for SHOWing NREGIONs: !bmark=0 ; ----- ; ; nrset,n,nreg Set NREGION mask in x-axis units (use channels for now) ; ------------ n is the number of NREGIONs to set ; nreg is array of (begin,end) x-axis pairs used to ; delimit n-NREGIONs: i.e. [b1,e1,b2,e2,b3,e3, ...] ; ; ===> Baseline fits are made to the data WITHIN the NREGION zones <=== ; ; CURON/CUROFF toggles whether cursor is used for input ; if !cursor=1 then set with the cursor: ; nrset,#_regions_to_set ; prompts for 2 x #_regions_to_set cursor points ; N.B. do this from left to right! ; else nrset,3,[1510,1790,1965,2090,2300,2475] ; |=#_regions_to_set ; N.B. this array must be delimited: [...] ; ; => flags NREGIONs specified on the plot ; ; nsoff Set NSAVE write protection flag OFF: !protectns=0 ; ----- Enable overwrites if data exist in !nsave ; CAVEAT EMPTOR ; ; nson Set NSAVE write protection flag ON: !protectns=1 ; ---- Disable overwrites if data exist in !nsave ; Returns error if you try to write to a filled NSAVE ; ; nslog Print information for NSAVE data records ; ----- Uses !nsave_log from !nslogfile to find slots with data ; Invokes: HDR ; ; online choose ONLINE data file for SELECT searches ; ------ toggles boolean !online ; use ATTACH to change ONLINE file ; ; offline choose OFFLINE data file for SELECT searches ; ------- toggles boolean !online ; use ATTACH to change OFFLINE file ; ; orthofit J.G. Lyon procedure to calculate orthonormal fits ; -------- for arbitrarily large values of nfit. ; Invoked by BBB. ; ; pltg annotate plot with gaussian fit values ; ---- assumes fits are in !a_gauss ; involked if FLAGON ; ; plthdr Annotate spectral line plot with header values ; ------ assumes data are in !b[0] ; ; pltchdr Annotate continuum plot with header values ; ------- assumes data are in !b[0] ; ; plus,n,m !b[0].data = !b[n].data + !b[m].data ; -------- Add buffer n and buffer m ; Default: !b[0].data = !b[0].data + !b[1].data ; ; printoff,prt Close the postscript plot file !plot_file ; ------------ ; if prt=1 then prints this file to a postscript device ; searches for ENV variable PSPRINTER, else uses ; PSprinter = 'lp0' <== change this for GB !! ; => invokes Gumley procedure: PSOFF which closes the .ps file ; and returns to previous DEVICE in original state ; ; printon,fname Open a PostScript printfile named FNAME ; ------------- if FNAME omitted, default is 'idl.ps' ; At GB this plot lives at: /tbania/idl/figs/idl.ps ; => invokes Gumley procedure: ; PSON,filename=psfilename,landscape=1 ; this opens the .ps file psfilename ; makes output that is WYSIWYG of the graphics screen ; ; procs Print the names of all currently compiled procedures ; ----- N.B. There are many compiled procs that are invoked which are not ; part of the analysis package in that they provide functionality ; that should be transparent to the normal user. ; ps,on_rec,off_rec Calculate the PS spectrum from TP ON/OFF records ; ----------------- on_rec = ON data record # => copied to buffer 5 ; off_rec = OFF data record # => copied to buffer 6 ; TP spectrum copied to buffer 7 ; DCON/DCOFF toggles automatic DC level subtraction ; => Also create a TP pair using: FETCH,on_rec ; (this assumes off_rec=on_rec-8) ; ; psoff, pson Procedures from Gumley. PSON/PSOFF are a complementary pair ; ----- ---- PSON creates PostScript output file for graphics that is ; WYSIWYG. PSOFF closes this file and returns to original ; DEVICE in its original state ; => invoked by PRINTON/PRINTOFF above. ; ; psplot,filename Print a postscript file ; --------------- searches for ENV variable PSPRINTER, else uses ; PSprinter = 'lp0' <== change this for GB !! ; if filename not input, 'idl' is assumed ; ; putns,ns Save buffer 0 to NSAVE region specified by 'ns' argument. ; -------- if ns not given then ns=!nsave, else !nsave=ns ; Save to !nsavefile and updates !nsave_log in !nslogfile ; !nsave_log[] array flags which slots already have data ; !nsave_log(!nsave)=1 if !nsave already has data ; if ((!protectns eq 1) and (!nsave_log(!nsave) eq 1)) ; then do NOT overwrite this saved data ; ==> NSON/NSOFF toggle write protection ; ==> FLAGON/FLAGOFF toggle extra output ; ==> N.B. Beware! SAVE is an IDL command! Do not use it! ; ; qav,rx_num From the existing selection criteria, fill the STACK with ; ---------- all matching records, both polarizations, average, and flag. ; If rx_num not given, prompts for input. ; qlook Take a quick look at all the subcorrelators with appropriate flags. ; ----- SELECTs records in STACK and executes the LOOK command. Can be ; used for a single scan via SETSCAN. ; ; qlook4,rx1,rx2,rx3,rx4 For STACK contents average and display all ; ---------------------- the correlator segments. ; Pop Up a new graphics window and plot four ; plots with two polarizations each. ; => rx1 rx2 rx3 rx4 integers can be in any ; order with 1 -> 'rx1' ; If not passed, defaults to 2x4 plots ; => Return window state via WRESET command ; ; qqq,scan_number Uses QLOOK4 to give a quick look at a single TP on/off pair ; --------------- for data taken in the 3He configuration: 8 x 2 correlators ; ; radiom,nfit For STACK contents fit nfit order baseline to ; ----------- previously defined NREGIONs and calculate the ; rms vs integration time. ; Pop Up a new graphics window and plot the ; radiometer equation, comparing these empirical ; => RUN THIS PROCEDURE WITH X-AXIS IN CHANNELS ; rms values with theoretical ones calculated via TH_RMS. ; => Return window state via WRESET command ; ; raxx sets system flag to display RIGHT ASCENSION on x-axis ; ---- (continuum mode only) ; ; rec_info,rec Print information on rec in either ONLINE or OFFLINE data file ; ------------ rec is the record number in the data file ; ONLINE/OFFLINE must be set ; ; reshow Overplot existing plot using identical plot parameters ; ------ ; If CHAN !chan then x-axis is in channels ; FREQ !freq frequence ; VELO !velo lsr velocity ; ; rfi Replaces spectral region contanimated with RFI with values gotten ; --- from a baseline fit. Prompts to define a *single* RFI zone via MRSET,2 ; Spectral values are replaced for *all* regions *outside* the NREGIONs ; which are *inside* the plotted display. By default nfit=9. ; ; rms,sigma,xmin,xmax Calculate rms between xmin and xmax ; ------------------- CURON/CUROFF toggles how this is set ; if !cursor=1 then set with the cursor, left to right ; else set via command line parameters xmin,xmax ; => returns: sigma = rms in current y-axis units ; ; rxidrec,line_id Identify the spectral transition of a subcorrelator band ; --------------- using the GBT sampler keyword. Sets value of 'line_id' in {gbt_data}. ; Does this on a record by record basis in MAKE_ONLINE and MAKE_DATA. ; --> 'line_id' is both input and output string and takes values such as: ; 'rx1.1','rx1.2','rx2.1','rx2.2', etc where .1/.2 are polarizations: ; .1=LCP and .2=RCP ; ; Currently hardwired to dec 03 run configuration: ; gbtsampler=['A9 ', 'A10', 'A13', 'A14', 'B17', 'B18', 'B21', 'B22', $ ; 'C25', 'C26', 'C29', 'C30', 'D33', 'D34', 'D37', 'D38'] ; lid=['rx1.1','rx2.1','rx1.2','rx2.2','rx3.1','rx4.1','rx3.2','rx4.2', $ ; 'rx5.1','rx6.1','rx5.2','rx6.2','rx7.1','rx8.1','rx7.2','rx8.2'] ; ; scale,fact Scale (multiply) buffer 0 (!b[0].data) by !fact ; ---------- ; ; sd_hdr,rec Print header variables for a single SDFITS record ; ---------- i.e. a single subcorrelator spectrum for a specific scan ; 'rec' is an explicit reference to this single *SDFITS record*; ; it is NOT the record number of a spectrum in a {gbt_data} data file. ; For this procedure to work, MRDFITS must be used to generate a ; sdd[] structure array from the SDFITS data file: ; ; ; Read the SDFITS data file in array sdd[] ; get_lun,lun ; openr,lun,!datafile ; sdd = mrdfits(lun, 1, hdr, status=status) ; makes SDFITS data structure array ; free_lun,lun ; ; Useage: rec=sdd[rec#] or sd_hdr,sdd[111] ; sd_hdr,rec ; ; sd_to_gbt,in,out Convert the SDFITS structure into the internal ; ---------------- GBT data structure {gbt_data} ; Does this on a record by record basis at present ; 'in' is SDFITS data structure input sdd[] ; 'out' is {gbt_data} data structure output ; => Invoked by MAKE_DATA and MAKE_ONLINE ; ; sd2Cgbt,in,out Convert the SD_FITS structure on a record basis into ; -------------- the GBT data structure {gbt_data} ; 'in' is SDFITS data structure input sdf[] ; 'out' is {gbt_data data} structure output ; 15 April 2004 version for SDFITS v1.1 release ; ; select Search either the ONLINE or OFFLINE data file and load STACK ; ------ with record numbers that match various selection criteria. ; ALL searches are made on strings. Matches input string exactly. ; ==> Currently the possible choices are: <== ; Source Name 'W3' !src ; Scan type 'ON' !typ ; Line ID 'rx2.2' !id ; Scan '1234' !scan ; Record Range !recmin,!recmax ; ; set Set parameter values for filtering of data type ; --- This procedure walks you through all the choices ; => LOOK CAREFULLY AT THE IDL PROMPT WHICH CHANGES ; => Input strings must NOT be delimited by quotes ; => '' or ' ' or '*' (NO QUOTES!) return sets wildcard for search ; ; setcolors,various_params Sets color table for this package ; ------------------------ see directory /idl/colors/ ; Sets up device independent line plot colors. Designed to ; work correctly on both X Window and PostScript devices. ; ; Invoked at startup to define system colors: ; setcolors,/system_variables which gives: ; !black !red !orange !green !forest !yellow ; !cyan !blue !magenta !purple !gray !white ; ; setid,id Sets line ID for a SELECT search of ONLINE/OFFLINE data. ; -------- if id value not passed, prompts for string ; Useage: setid,"rx1.2" <-- must pass a string "*" is wildcard ; ; setplot,device,THICK=thick NOT part of this package, but it is useful. ; -------------------------- ; Directs subsequent plot to the specified plotting device. ; Typing SETPLOT without any parameters will give a menu of ; available plotting devices. ; setplot ;Print menu of available graphics devices ; setplot,device_n_no ;Direct subsequent to device device_no ; setplot,device_name ;Set to device given by device_name ; THICK - controls thickness of lines and characters, by setting ; !P.CHARTHICK, !P.THICK, !X.THICK and !Y.THICK, default=1 ; For example, to make triple thickness lines on a QMS landscape plot: ; IDL>SETPLOT,'QMS',THICK=3 ; ; setprinter,dev select printer for hardcopy output ; -------------- via 'setenv PSPRINTER dev' ; ; ==> setprinter,dev if no device input a menu is printed ; Syntax: setprinter,unit_no OR setprinter,"device_name" ; setprinter,0 can specify device by integer or string ; setprinter,'lpr' both these commands do the same thing ; ; menu: ; (0) lp0 : Boston University department office: BW' ; (1) ops4050 : GBT Control Room: BW' ; (2) telops : GBT Control Room: color' ; (3) net : Jansky 234: BW' ; (4) lp : Reber 105: BW' ; (5) pslaser : Reber 105: color' ; (6) coltran : Reber 105: color transparency' ; (7) lpx : University of Virginia printer' ; ; setrange,scanmin,scanmax Set the scan range for a SELECT search. ; ------------------------ ; ; setrec,recmin,recmax Set the record range for a SELECT search of ; -------------------- ONLINE/OFFLINE data file. ; If no input, prompts for !recmin,!recmax ; ; setscan,scan Set the scan number for a SELECT search of ONLINE/OFFLINE ; ------------ data. If no input, prompts for scan #. ; Useage: setscan,'3242' <--must be string; '*' is wildcard ; ; setsrc,src Set the source name for a SELECT search of ONLINE/OFFLINE data. ; ---------- If no input, prompts for source name ; Useage: setsrc,'NGC3242' <--must be string; '*' is wildcard ; ; settype,typ Set scan type for for a SELECT search of ONLINE/OFFLINE data. ; ----------- If no input, prompts for scan type. ; Useage: setype,"ON" <--must be string; '*' is wildcard ; ; setpol,pol Sets polarization for a SELECT search of ONLINE/OFFLINE data. ; ---------- If pol value not passed, prompts for string ; Syntax:: setpol,"LCP" <-- must pass a string "*" is wildcard ; ; setx,xmin,xmax Set xmin and xmax for x-axis range on SHOW ; -------------- CURON/CUROFF toggles behavior: ; if !cursor=1 then set with the cursor ; else set via command line parameters: SETX,xmin,xmax ; ; sety,ymin,ymax Set ymin and ymax for y-axis range on SHOW ; -------------- CURON/CUROFF toggles behavior: ; if !cursor=1 then set with the cursor ; else set via command line parameters: SETY,ymin,ymax ; ; setxy Use a box cursor to set the x-axis and y-axis scaling simultaneously. ; ----- ; CURON --> setxy ; CUROFF --> setxy,xmin,xmax,ymin,ymax ; ; Click Left button to set box bottom right corner. ; Drag Left button to move box. ; Drag Middle button near a corner to resize box. ; Right button when done. ; ; show Plot the data. Plots data and header of contents of buffer 0 !b[0] ; ---- Stores a copy of data in buffer 9 ; CHAN/FREQ/VELO toggle controls x-axis: ; If !chan then x-axis is in channels CHAN line or continuum ; !freq frequency FREQ line only ; !velo lsr velocity VELO line only ; COMMANDS BELOW ARE FOR CONTINUUM DATA ONLY ; !azxx azimuth deg AZXX ; !elxx elevation deg ELXX ; !raxx R.A. deg RAXX ; !decx Dec. deg DECX ; ; Toggles: ; LINE/CONT: if (!plthdr) then plot header if set chooses line or continuum header via !LINE ; ZLON/ZLOFF: if (!zline) then plot zero intensity if set ; SRCVLON/SRCVLOFF: if (!srcvl) then flag source velocity if set ; NRON/NROFF: if (!bmark) then plot NREGION zones if set ; ; smo,n Smooth data with Gaussian weighting with fwhm=n in channels ; ----- If no input uses !smgwt[] => currently hardwired for 5 channel fwhm ; channels within fwhm at both spectrum ends are left intact ; FLAGON/FLAGOFF toggles extended information ; => Returns smoothed data to buffer 0: RESHOW to display atop original ; ; => This *should* be a normalized Gaussian smoothing function, but TMB ; isn't truly convinced.... ; ; smooth Smooth data with gaussian weighting: 5 channel fwhm gaussian ; ------ FLAGON/FLAGOFF toggles extended information ; uses !smgwt array !smgwt[0] = number of channels in smgwt ; channels within fwhm at both spectrum ends are left intact ; ; srcvl,ch Plot vertical flag at specified source velocity ; -------- ch= position of flag. must be in current x-axis units ; ; srcvloff Turn the source velocity flag line OFF: !srcvl=0 ; -------- ; ; srcvlon Turn the source velocity flag line ON: !srcvl=1 ; ------- ; ; start_gbt,SDFITS_file INITIALIZES THIS PACKAGE ; --------------------- Creates ONLINE data file from SDFITS_file ; Prompts for file if not supplied ; ; sub,rec subtract a record number from the STACK ; ------- ; ; syms,no,scale,ifl Not used at present ; ----------------- ; Creates a set of vectors which define basic symbols ; for use in scatter plots. See the discussion of the IDL USERSYM ; procedure, pg. B-122. These vectors set the shape of the symbols, ; then USERSYM is called prior to plotting. ; Written by Mike Fanelli; Modified by Ed Murphy ; ; no -- selects the desired symbol ; 1=circle 2=triangle 3=square 4=diamond ; 5=plus 6=x symbol 7=half circle ; scale -- selects the scale factor ; ifl -- selects the `filling 'factor' ; 1= filled 0= empty ; ; tagtype,msg Writes a byte(string) into !b[0].scan_type for annotation ; ----------- 32 character maximum in {gbt_data} ; Routine truncates input string to fit ; If msg is passed explicitly, then must be a string 'msg' ; else system prompts for a message and no ' ' is needed ; => Overwrites !b[0].scan_type ; ; tagid,msg Writes a byte(string) into !b[0].line_id for annotation ; --------- 32 character maximum in {gbt_data} ; Routine truncates input string to fit ; If msg is passed explicitly, then must be a string 'msg' ; else system prompts for a message and no ' ' is needed ; => Overwrites !b[0].line_id ; ; tagpol,msg Writes a byte(string) into !b[0].pol_id for annotation ; ---------- 4 character maximum in {gbt_data} ; Routine truncates input string to fit ; ; ; => Overwrites !b[0].pol_id ; ; tellstk Print contents of STACK as list of record numbers ; ------- TELLSTacK ; ; th_rms,tsys,df,npol,k1,k2,xmin,xmax,no_pts,time_x,rms_y ; ------------------------------------------------------- ; ; Calculate theoretical radiometer equation and return arrays ; time_x (min) and rms_y (mK) of specified length no_pts for ; specified tsys, df, k1, k2: ; ; rms := k1*tsys/sqrt(k2*teff*npol*df); ; ; where ; ; tsys - system temperature in milliKelvins ; k1 - backend sampling efficiency ; value 9 -> k1 = 1.032 for 9-level ; value 3 -> k1 = 1.235 for 3-level ; k2 - autocorrelator channel weighting function ; value 1 -> k2 = 1.21 for Uniform ; value 2 -> k2 = 2.00 for Hanning ; teff - ton*toff/(ton + toff) in seconds ; TP position switch ON/OFF here passes tintg => teff=0.25 tintg ; npol - number of polarizations (or independent signals) ; df - frequency resolution in Hz ; ; unmk Convert y-axis in milliKelvins to Kelvin scale via !fact=1.0e-03 ; ---- ; ; update update ONLINE data file by appending new data to existing ; ------ ONLINE data file. INPUT data is from SDFITS data file. ; Assumes SDFITS datafile is being updated. ; Translates and appends new data to ONLINE data file. ; SDFITS !datafile defined by INIT_DATA or MAKE_DATA ; --------- --------- ; !kon counts number of ONLINE data records currently in file ; ; velo Set system flag to display velocity on x-axis ; ---- CHAN/VELO/FREQ toggle x-axis display ; ; wreset Reset window from specialized window to either LINE or ; ------ CONTinuum graphics window. ; => Used to kill off PopUp windows from BSEARCH, RADIOM, QLOOK4 ; ; xroll sets x-axis range to inner 90% of spectral channels ; ----- this eliminates effects of correlator filter rolloff ; ; xx renaming of SHOW procedure ; -- ; ; zline Draw a line through zero intensity ; ----- ZLON/ZLOFF toggle ; ; zloff Turn the zero line OFF: !zline=0 ; ----- ; ; zlon Turn the zero line ON: !zline=1 ; ---- ;