c_annotationstringformate82ilev [1] $SSW/trace/idl/util/euv_image_cont.pro
[Previous] [Next]

 NAME:;        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)

	IMAGE_CONT
        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)

 PURPOSE:
	Overlay an image and a contour plot.

 CATEGORY:
	General graphics.

 CALLING SEQUENCE:
	IMAGE_CONT, A

 INPUTS:
	A:	The two-dimensional array to display.

 KEYWORD PARAMETERS:
 WINDOW_SCALE:	Set this keyword to scale the window size to the image size.
		Otherwise, the image size is scaled to the window size.
		This keyword is ignored when outputting to devices with 
		scalable pixels (e.g., PostScript).

	ASPECT:	Set this keyword to retain the image's aspect ratio.
		Square pixels are assumed.  If WINDOW_SCALE is set, the 
		aspect ratio is automatically retained.

	INTERP:	If this keyword is set, bilinear interpolation is used if 
		the image is resized.

 OUTPUTS:
	No explicit outputs.

 CALLS: ***
	EUV_IMAGE_CONT
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	The currently selected display is affected.

 RESTRICTIONS:
	None.

 PROCEDURE:
	If the device has scalable pixels, then the image is written over 
	the plot window.

 MODIFICATION HISTORY:
	DMS, May, 1988.


c_annotationstringformate82ilev [2] $SSW/trace/idl/util/image_cont2.pro
[Previous] [Next]

 NAME:;        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)

	IMAGE_CONT
        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)
        c_annotation=string(format='(e8.2)',ilev)

 PURPOSE:
	Overlay an image and a contour plot.

 CATEGORY:
	General graphics.

 CALLING SEQUENCE:
	IMAGE_CONT, A

 INPUTS:
	A:	The two-dimensional array to display.

 KEYWORD PARAMETERS:
 WINDOW_SCALE:	Set this keyword to scale the window size to the image size.
		Otherwise, the image size is scaled to the window size.
		This keyword is ignored when outputting to devices with 
		scalable pixels (e.g., PostScript).

	ASPECT:	Set this keyword to retain the image's aspect ratio.
		Square pixels are assumed.  If WINDOW_SCALE is set, the 
		aspect ratio is automatically retained.

	INTERP:	If this keyword is set, bilinear interpolation is used if 
		the image is resized.

 OUTPUTS:
	No explicit outputs.

 CALLS: ***
	IMAGE_CONT2
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	The currently selected display is affected.

 RESTRICTIONS:
	None.

 PROCEDURE:
	If the device has scalable pixels, then the image is written over 
	the plot window.

 MODIFICATION HISTORY:
	DMS, May, 1988.


check_ql_after_lz $SSW/trace/idl/ops/check_ql_after_lz.pro
[Previous] [Next]
NAME:
	check_ql_after_lz
PURPOSE:
	To check to see if an LZ file exists when an QL file comes
	in. If there is an LZ file, is there new data in the QL file.
INPUT:
	a single DPS file name
OUTPUT:
	output	- A string array summary
	status	>= 0 means run the reslotter, <0 means LZ is online
		=    0 if there is no LZ file yet
		=   -1 if there is an LZ file, but no new data
		=  -10 if there is an LZ file, but only a little new data
		= -100 if there is an LZ file and enough new data to warrent a new LZ file
		=    2 if there is no file online at all (no slot or LZ file)
		=    3 if it's APID 2 or 4 (can't be handled by RD_HK right now)
		=    4 if the input file does not exist
 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CONCAT_DIR [1], CONCAT_DIR [2]
	CONCAT_DIR [3], FILE_EXIST [2], break_file [4], concat_dir [4], deriv_arr [1]
	deriv_arr [2], dps_fname2time, file_exist [1], file_exist [3], file_list [1]
	file_list [2], prstr [1], prstr [2], rd_hk [1], rd_hk [2], where_arr [1]
	where_arr [2]
HISTORY:
	Written 10-Jun-98 by M.Morrison
	11-Jun-98 (MDM) - Added check for input file not existing
	11-Jun-98 (MDM) - Removed bypass for apid 2 and 4
_

common check_ql_after_lz_blk1, last_remake

if (n_elements(last_remake) eq 0) then last_remake = 'xx'

if (keyword_set(init_out)) then begin
    out = ['CHECK_LZ_AFTER_LZ  Ver 1.0  Program Run: ' + !stime,' ', $
	'           QL File                          #QL   #LZ  #New  #Min', $
	'                                           Pkts  Pkts  Pkts']
	;TRACE_G010_QL_1998-05-04T09-56-09Z_V03      404  3642     0  0.00
    prstr, out
end

if (n_elements(out) eq 0) then out = ''
break_file, infil, dsk_log, dir, filnam, ext


ss = where( (strpos(infil, 'G003') eq -1) and (strpos(infil, 'G073') eq -1) $
	and (strpos(infil, 'G014') eq -1) and (strpos(infil, 'G029') eq -1) )
if (ss(0) eq -1) then begin
    status = 3
    out0 = string(filnam, 'APID cannot be handled by CHECK_QL_AFTER_LZ right now', format='(a, 3x, a, 1x, a)')
    out = [out, out0]
    return
end

if (not file_exist(infil)) then begin
    status = 4
    out0 = string(filnam, 'Input file does not exist', format='(a, 3x, a, 1x, a)')
    out = [out, out0]
    return
end

;print, 'Now processing: ' + infil


tarr = dps_fname2time(infil, xx_outfilnam, fid, xx_dps, apid)
ext = ['.hk', '.sc'] + string(apid and 'ff'x, format='(z2.2)')
fid2 = strmid(fid, 2, 6)
ff = file_list('$GSE_GENTM_LOG_DIR', fid2+ext)
hkfil = ff(0)
if (hkfil eq '') then begin
    out0 = string(filnam, 'Could not find input file: ', fid2+ext, format='(a, 3x, a, 1x, a)')
    out = [out, out0]
    status = 2
    return
end
break_file, hkfil, dsk_log2, dir2, filnam2, ext2

qremake_lz = 0
mapfil = hkfil+'x'
if (file_exist(mapfil)) then begin
    status = -1
    lzmap = rd_hk(hkfil, /map)
    pkt_rate = min(deriv_arr(lzmap))
    tmpfil = concat_dir( getenv('HOME'), 'temp' + ext2)
    spawn, ['ln', '-s', infil, tmpfil], /noshell
    rec = rd_hk(tmpfil, 0, 9999999)
    spawn, ['rm', '-f', tmpfil], /noshell
    ;
    nlz = n_elements(lzmap)
    nql = n_elements(rec)
    ss = where_arr(lzmap, rec.time, nss)	;how many ql times are in lz file
    nnew = nql - nss
    nnew_min = nnew * pkt_rate/60.
    extra = ''
    if (nnew gt 0) then status = -10
    ;;if (nnew gt 1000) or (abs(pkt_rate) gt 10) then begin
    if (nnew/float(nlz) gt 0.10) or (abs(pkt_rate) gt 10) then begin
	status = -100
	if (fid2 ne last_remake) then begin
	    extra = ' Remake:' + fid2
	    last_remake = fid2
	end
    end
    out0 = string(filnam, nql, nlz, nnew, nnew_min, extra, $
				format='(a, 3x, 3i6, f6.1, a)')
end else begin
    out0 = string(filnam, 'No LZ file online for: ', fid2+ext, format='(a, 3x, a, 1x, a)')
    status = 0
end
out = [out, out0]
print, out0

end


CIV_SUBTRACT $SSW/trace/idl/util/civ_subtract.pro
[Previous] [Next]
 NAME:
    CIV_SUBTRACT.PRO

 PURPOSE:
    Given an arbitrary set of UV images from TRACE out of the 
    1550, 1600 and 1700 Images, generate a "Clean" C IV image, 
    per Handy et al. (1998) Solar Physics, in press.

    Note that unlike Handy et al., this routine also includes 
    a capability to extract CIV images from any arbitrary pair of
    UV images.  This has not yet been fully investigated, and the 
    uncertainty in these measurements is pretty suspect.

 CALLING SEQUENCE:
    civ_subtract, index, data, iout, civ_out, ctn_out, $
                  [,/dn][,err=err][,/debug]
 
 INPUTS:
    index, data -- data cube for the pair/triplet of images
          --> NOTE: -->
          The data is expected to meet the following minimum requirements:

          1.  Images are the same size
          2.  Pedestal and dark current subtracted
          3.  Images coaligned OR the /shift keyword set

          The images may come in any order, and any combination
          of two-three UV images will work (though some work 
          better than others).

          Don't normalize the image exposures.

 KEYWORD PARAMETERS:
    dn     -- Return answer in DN/sec/pixel.  Note that the ctn_out
              number will be pretty suspect in this case.
    shift  -- If set, CIV_SUBTRACT will coalign the image set 
              prior to doing the analysis routine, using 
              TR_GET_DISP.PRO.
    debug  -- Gives small, less-than-useful hints as to what's 
              going on.

 OUTPUTS:
    iout    -- Index structure of output CIV image.
    civ_out -- Computed CIV image, in units of 1e12 photons/s/cm^2/sr.
               If /dn is set, output is dn/s/cm^2/sr.
    ctn_out -- Computed UV continuum.  

 OPTIONAL OUTPUTS:
    err     -- The predicted error of the image  (tbd)

 CALLS: ***
	ADD_TAG [1], ADD_TAG [2], TR_GET_DISP [1], TR_GET_DISP [2], fmt_tim [1]
	fmt_tim [2]
 MODIFICATION HISTORY:
    19-Jul-98 (BNH) - Written
    24-Jul-98 (BNH) - Do the image normalization here.  That seems to
                      be the method of least surprise.  Also fix one
                      typo.
     3-Aug-98 (BNH) - Use 'index' everwhere to fix exposure normalization.
    30-Sep-98 (BNH) - Two changes, one BIG, one small:
                    - By popular demand, return IOUT in units of
                      10^12 Photons/Pixel/etc.
                    - Coefficients on everything for the 2-image sets
                      was just wrong.  Fixed.
                    - Expect data to be pre-normalized and cleaned via
                      TRACE_PREP or the equivalent.
     2-Oct-98 (BNH) - Added /shift keyword.
                    - Added a version number.
                    - Record version number and frames used in 
                      new index tag index.HIST_CIV.
    15-Oct-98 (BNH) - Keyword /DN now returns answer in DN/sec/pixel.
                    - Didn't properly convert DN to photons.  Missed
                      a factor of E_PER_DN here.
                    - Kick version to 2.0 because of above.
                    - make E_PER_DN dependent on index.amp, if present.
                      Fallback case is amplifier 'A'.
    18-Oct-98 (BNH) - Document the requirements on "data" better in the doc 
                      header.
                    - Turn on continuum image calculation.
                    - Recalibrate all the coefficients for the 2-image
                      cases by leapfrogging off of the answers from a
                      3-image case.  The results look promising.
    22-Oct-98 (BNH) - Protect the peace.  Normalize the images here.  

 $Id: civ_subtract.pro,v 1.10 1998/10/18 23:17:50 handy Exp $


ck_smooth $SSW/trace/idl/util/ck_smooth.pro
[Previous] [Next]
 NAME:
	ck_smooth
 PURPOSE:
	Perform quick smoothing, using successive boxcar averages to
	approximate a gaussian.
 CALLING SEQUENCE:
	result = ck_smooth(image, n)
 INPUTS:
	image = 2-dimensional image array
	n = number of iterations (effectively, this is proportional to the
		width of the smoothing kernel)
 CALLED BY:
	sxt_dstreek, trace_cleanjpg, trace_destreak, trace_rnoise, trace_unspike
 PROCEDURE:
	Just use smooth(image, 3) for n iterations.
 MODIFICATION HISTORY:
	Written by CCK 3/14/96


convert_hk [2] $SSW/trace/idl/egse/convert_hk.pro
[Previous] [Next]
NAME:
	convert_hk
PURPOSE:
	To extract a given value of a mnemonic from a HK packet,
	and convert it to the proper units (degrees/volts/...)
SAMPLE CALLING SEQUENCE:
	out = convert_hk(rec, mnem)
	out = convert_hk(rec, 'm-15ae', /raw)
INPUT:
	rec	- The HK record structure
	mnem	- The mnemonic to extract.  (single mnemonic input)
 CALLS: ***
	INTERPOL, bits [1], bits [2], rd_hist_dbase [1], rd_hist_dbase [2]
 CALLED BY:
	get1hk_info [1], get1hk_info [2], get_hk_info [1], get_hk_info [2]
	pr_hk_info [1], pr_hk_info [2], tr_decode_head [1], tr_decode_head [2]
OPTIONAL KEYWORD INPUT:
	raw_value - Do not convert to engineering units.  Simply grab
		    the right byte(s) and mask as necessary
	qstop	- If set, then stop inside the program
	read_dbase - If set, simply read the database file and return
	infil	- the input database file to read
	force_rd - Force the database file to be re-read
	nostring - If set, then do not make the output string type (ie:
		  do not use lookup table for "mnemonic" -- just send the
		  raw value).  This only applies to digital mnemonics.
HISTORY:
	Written Apr-94 by M.Morrison
	16-Jan-95 (MDM) - Modifications to allow SCHK1, SCHK2, SCHK4
			- Added /FORCE_RD
	 6-Feb-95 (MDM) - Added /NOSTRING option
	16-Nov-95 (MDM) - Changed the default READ_HIST file names (from
			  .DBS and .CCS to .INSIM and .EOF)
	 9-Oct-96 (MDM) - Modified to use new RTDB format file
			- Modified MAP2PACK values
			- Added polynomial conversion of analog values
	17-Oct-96 (MDM) - Modified to use GET_HIST_DBASE_FIL
	18-Nov-96 (MDM) - Corrected mismapping to structures
	27-Feb-97 (MDM) - Added check of 'itcmtmp'
	24-Aug-97 (MDM) - Added correction for when the string labels
			  are not in the database in increasing order