H_C $SSW/yohkoh/ucon/idl/hudson/h_c.pro
[Previous] [Next]
 NAME:
     H_C
 PURPOSE:
     Compute the Holt-Cline cross-section for bremsstrahlung
     The Holt-Cline cross-section incorporates the
       Elwert factor necessary to give correct results at hnu = E.
       Ref Holt, SS, and Cline, TL, Ap. J. 154, 1027, 1968
 CATEGORY:
     Theory
 CALLING SEQUENCE:
     h_c, hnu, energy
 INPUTS:
     small_e is the photon energy in keV;
     big_e is the electron energy in keV
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
     cross-section in cm^2
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     HSH, written 8-june-92


H_VS_TIME $SSW/yohkoh/ucon/idl/hudson/h_vs_time.pro
[Previous] [Next]
 NAME:
     H_VS_TIME
 PURPOSE:
     fit X location of brightest point in an image, e.g. for
       determining source height 
 CATEGORY:
     Yohkoh
 CALLING SEQUENCE:
     h_vs_time, ii, dd, height
 INPUTS:
     ii, dd: prepped PFI data
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
     height: the outputs, viz.
       0 = peak of Gaussian fit to images projected on X axis
       1 = peak of Gaussian fit to row containing peak brightness
       2 = X pixel ID of brightest pixel
       3 = X coordinate of image centroid from CENTROIDW
       4 = width corresponding to 0
       5 = width corresponding to 1
 CALLS: ***
	CENTROIDW [1], CENTROIDW [2], GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3]
	GAUSSFIT [4], GAUSSFIT [5]
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     HSH, written 3-Feb-94


halp halphaprep $SSW/yohkoh/gen/idl/gbo/halp.pro
[Previous] [Next]
	Name: halp (halpha-prep)
	Purpose: prepare h-alpha images for the movie.
	Calling:
		nimg = halp(img, histo_scale=histo_scale, deltar=deltar,
			imgsize=imgsize, rm_limbdarken=rm_limbdarken])
	RETURNS:
		a prepared h-alpha image.
       INPUT:
		img		input h-alpha image
		histo_scale	use histogram scaling for image.
				default is no scaling.
		imgsize 	user specified output image size, default
				is approx. 150 pixels for the diameter.
		interp		interpolation switch passed to congrid.
		deltar		pad added to the computed radius for clipping
				the image.  Default is 5 nibs.
		rm_limbdarken	remove limb darkening.
	
 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3], GBO_MASK, HALP, fit_limb, get_ciridx
	hist_scale, rm_darklimb
	History: written 15-Sep-94, GAL
		revamped  7-Oct-94, GAL
                         9-oct-94, SLF - subscript range protection
                        10-oct-94, SLF - same, opposite direction
			 10-Oct-94, GAL - added option for removeal of 
					  limb darkening.


halpha_prep $SSW/yohkoh/ucon/idl/linford/halpha_prep.pro
[Previous] [Next]
	Name: halpha_prep
	Purpose: prepare h-alpha images for the movie.
	Calling:
		nimg = Halpha_prep(img, histo_scale=histo_scale, 
			imgsize=imgsize])
	RETURNS:
		a prepared h-alpha image.
       INPUT:
		img		input h-alpha image
		histo_scale	use histogram scaling for image instead
				of default which is to average.
		imgsize 	user specified output image size, default
				is approx. 150 pixels for the diameter.
	OUTPUT:
		hdate	header date
		htime	header time
	
 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3], GBO_MASK, fit_limb, get_ciridx, hist_scale
	History: written 15-Sep-94, GAL
		revamped 21-Sep-94, GAL


hard_cen $SSW/yohkoh/ucon/idl/linford/hard_cen.pro
[Previous] [Next]
	NAME: hard_cen
	
	PURPOSE: Center image and load users color table for Kodak output.

	CALLING SEQUENCE:
		hard_cen, img, r, g, b, [file=file, landscape=landscape]
	
       INPUT: 
		img	image to center for kodak printer
		r,g,b	color vectors for kodak

	OPTIONAL INPUT:
		file	file name of output postscript file.
		landsc*	switch to use landscape print mode
	
	HISTORY:
		written Oct. 93, gal


hard_center $SSW/yohkoh/ucon/idl/lemen/hard_center.pro
[Previous] [Next]
 NAME:
   hard_center
 PURPOSE:
   Preprocessor for hardcopy
 CALLING SEQUENCE:
   hard_center,image
   hard_center,image,/land
   hard_center,image,/land,/color

   hard_center will call hard_copy

 INPUTS:
   image	= 2-d array
 OPTIONAL INPUT KEYWORDS:
   file	= Name of the output .ps file
   /color	= To make a color plot
   /landscape	= To rotate the output to landscape
   xsize	= To specify X size (inch) 
 CALLS: ***
	hardcopy [1], hardcopy [2], input [1], input [2]
 MODIFICATION HISTORY:
   3-aug-93, JRL, Written
  24-feb-94, JRL, Added the file=file option
  14-may-94, JRL, Enabled xsize specification


hard_prep $SSW/yohkoh/ucon/idl/labonte/hard_prep.pro
[Previous] [Next]

 Displays an image with all the axes, color bar, titles, as
 preparation for making a hardcopy.


PRO hard_prep, image, x, y, lo=lo, hi=hi, title=title, xtitle=xtitle, $
		ytitle=ytitle, btitle=btitle, nobar=nobar


 INPUT PARAMETERS:
	image = 2 dimensional array to display.

 OPTIONAL INPUT PARAMETERS:
	x, y = vectors of x, y positions of pixels.  Use to get
		axes marked correctly

 OPTIONAL INPUT KEYWORDS:
	lo, hi = data values to use for scaling image.  Default is
		to use image minimum, maximum.
	title, xtitle, ytitle = plot and axes labels, string.
	btitle = color bar title, string.
	nobar = if set, do not make a color bar.  Default displays a bar.

 USAGE:
	Call this procedure to get a window that can be dumped to:
		Mitsubishi Color Printer with COLOR_COPY.
		Tektronix Color Printer with HARDCOPY.

 RESTRICTIONS: 
	This procedure will minify large images.  To get maximum
	resolution from the hardcopy device, print the image alone
	with a direct call to the hardcopy routine.
 	
 HISTORY:
	Written   March 7, 1994   Barry LaBonte


hdcopy [1] $SSW/yohkoh/ucon/idl/slater/hdcopy.pro
[Previous] [Next]
NAME:
       hdcopy 
PURPOSE:
       Print out active window of any size to either laser
       printer or Kodak with maximum possible size.
       You do not need to take care of size adjustment.
CALLING SEQUENCE:
       hdcopy		; Black and white, sent to laser printer
       hdcopy,/l	; Black and white
       hdcopy,/k	; Color, sent to Kodak
       hdcopy,/bw	; Black and white, sent to kodak
       hdcopy,/c	; Color, sent to kodak
       hdcopy,/k,/bw	; Black and white, sent to kodak
INPUT:
       A - image (optional - read from current graphics if not passed)
 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3]
 CALLED BY:
	get_pix
OPTIONAL KEYWORD INPUT:
	/l - Send to laser printer
	/k - Send to kodak
	/bw - Black and white
       /c - Color
	rcol - red col vec	- rcol,gcol,bcol read from current
	gcol - green col vec	  graphics if not passed
	bcol - blue col vec
OUTPUT:
       None
NOTE:
       idl.ps file is created in your current directory.
       It will not be erased automatically.
HISTORY:
       25-Sep-93 Saku Tsuneta
       27-Jul-94 GLS - added image input and color vector input options


hdcopy [2] $SSW/yohkoh/ucon/idl/slater/wangcopy.pro
[Previous] [Next]
NAME:
       hdcopy 
PURPOSE:
       Send an image to a printer (laser or color).
       Size and orientation are automatically selected to take
	maximum possible advantage of paper size.
CALLING SEQUENCE:
       hdcopy		; Black and white, sent to laser printer
       hdcopy,/c	; Color, sent to color printer
INPUT:
       image - image array (optional - read from current graphics
		if not passed)
 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3], WANGCOPY
 CALLED BY:
	get_pix
OPTIONAL KEYWORD INPUT:
	/c - Color print
	printer - Printer name (eg 'cp2', 'cp3', 'lw4', default is 'lw4'
		  unless /c is set, inwhich case 'cp2' is default')
	/laser - send to laser printer, even if /c is set (only necessary
		 when using color laser printer).
	rcol - red col vec	- rcol,gcol,bcol read from current
	gcol - green col vec	  graphics if not passed
	bcol - blue col vec
OUTPUT:
       None
NOTE:
       The ps file is created in your current directory (unless outfil
	keyword is used.  It will not be erased automatically.
HISTORY:
       25-Sep-93 Saku Tsuneta
       27-Jul-94 GLS - added image input and color vector input options


header_scan $SSW/yohkoh/ucon/idl/suga/header_scan.pro
[Previous] [Next]
NAME:
	header_scan.pro
PURPOSE:        
       File Header scan procedure for jump to top of the 'data'.
	This procedure scans till the top of line is ';---------'.  
CALLING SEQUENCE:
	After 'openr,XX,file_name ',
	       header_scan,Nr=Nr
INPUTS:
	Nr - 'openr' & 'readf' file Nr.(ex. 1,2,...,lun etc. ).
 CALLED BY:
	GRS_SPEFF, OUT_GRSPHL1, OUT_GRSPHL2, OUT_HXSPH, PLOT_GRSPHH, PLOT_GRSPHL, PLOT_HXSPH
	ph_eff_grs1, ph_eff_grs2
HISTORY:
	14-Jul-93  (K.Suga) First written.


HEL2CCD $SSW/yohkoh/ucon/idl/acton/hel2ccd.pro
[Previous] [Next]
 NAME:
 	HEL2CCD
 PURPOSE:
	computes CCD target coordinates (256x256) from heliographic input
 CALL:
 	hel2ccd, nn, ww, suncenter = suncenter, date = date
       hel2ccd, 'N30', 'E23'
 INPUT: 
	heliographic coordinates nn, ww in solar degrees
                (north and west are positive)
       suncenter the FR pixel coordinates of sun center (default [528, 581])
 OUTPUT:
       half-resolution SXT pixel coordinates of target location
	CCD quarter resoution SXTSPT target coordinates
 CALLS: ***
	HEL2PIX
 HISTORY:
	Written by HSH 4/8/92, with shameless plagiarism of Wuelser's
	   routine gbo_hel
       Updated October 1992 to match the conventions N, W positive
          and (N,W) order, for both input and output
	Made procedure, allow input of string heliographic coordinates,
	   and output CCD target coordinates.  LWA  10/19/92.
       Update to call HEL2PIX.   LWA 9-Dec-92
       Update SXT suncenter coordinates to [528,581].  LWA  9-Dec-92


HEL2PIX $SSW/yohkoh/gen/idl/to_be_deleted/hel2pix.pro
[Previous] [Next]
 NAME:
	HEL2PIX
 PURPOSE:
	computes pixel coordinates (full-resolution pixels) from heliographic 
	   coordinate inputs (inverse of PIX2HEL).
 CALLING SEQUENCE:
 	print, hel2pix(nn, ww) 
 	print, hel2pix(nn, ww, suncenter = sunxy0, date = dat, tilt = tilt)
	returns the pixel coordinates of the point (nn,ww) in 
	heliographic coordinates. 
 INPUTS: 
	nn	= NS coordinate (in degrees) -- can be a vector
	ww	= EW coordinate (in degrees) -- can be a vector
 KEYWORDS:
	suncenter = pixel location of sun center, default [520,560]
 	date = date, default from system time
	tilt = correction for CCD rotation, default one degree
 CONVENTIONS:
	The conventions for inputs and outputs in programs of this type
	   are the following: the order of coordinates is (NS, EW), and
	   the N and W directions are positive.
 WARNINGS:
       The suncenter correction must be made if you are interested in 
	   precision. It can be gotten from hxa_suncenter.
	Does not incorporate information on the spacecraft roll position.
 CALLS: ***
	conv_h2p [1], conv_h2p [2], dont_use_this [1], dont_use_this [2]
 CALLED BY:
	HEL2CCD
 HISTORY:
	Written by HSH 4/8/92, based upon Wuelser's routine gbo_hel.
	HSH 11/23/92, order of coordinates changed to match Yohkoh convention; 
	   tilt correction installed.
	JRL 23-nov-92: nn and ww can be vectors. Calls get_rb0p.
	MDM 28-Jan-93: Correction to the method used to recognize data type
	MDM  5-Feb-93: Reversed the sign of the tilt from -1 deg to +1 deg
		       and removed the tilt keyword option
	MDM 16-Oct-93: Removed the code
	MDM 19-Oct-93: Corrected replacement call to CONV_H2P


HELIO_FOOT $SSW/yohkoh/ucon/idl/hudson/helio_foot.pro
[Previous] [Next]
 NAME:
 	HELIO_FOOT	
 PURPOSE:
	Overplot the footpoint of a solar wind measurement onto an SXT image.
 	The program puts a U at the location of the sub-Ulysses point,
	  ie a direct radial projection appropriate for the solar wind flow;	
	  it also puts an F for the Archimedes spiral footpoint for 
	  800 km/s wind speed to Ulysses, and a B (Front and Back!) in
	  case it comes out on the invisible hemisphere
 CATEGORY:
	Yohkoh
 CALLING SEQUENCE:
 	helio_foot, sxt_item, u_dat = u_dat 
 INPUTS:
       sxt_item is the index entry for the current image on the screen
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
	u_dat=u_dat to avoid re-reading
 OUTPUTS:
 CALLS: ***
	GET_SUNCENTER [1], GET_SUNCENTER [2], SW_ELAPSED_TIME, ULYSSES_FEM, get_rb0p [1]
	get_rb0p [2], gt_pix_size, tim2dset [1], tim2dset [2]
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
	this is just development work for a driver program do generate
	  heliographic and/or SXT pixel coordinates for various extrapolation
	  methods
 MODIFICATION HISTORY:
	HSH, written 11-Feb-94
       HSH, 20-apr-94 removed limb_trace
       HSH, 12-jun-94 updated for IDL 2.1
       HSH, 10-Aug-94 patched up the U and F for the FIRST_LIGHT window
       20-feb-1997 - S.L.Freeland - use <get_rb0p> in place of "old" pb0r


HELIOCENTRIC $SSW/yohkoh/ucon/idl/metcalf/heliocentric.pro
[Previous] [Next]
NAME:
     HELIOCENTRIC
PURPOSE:
     Computes the heliocentric angle given solar latitude and longitude
CATEGORY:
CALLING SEQUENCE:
     result = heliocentric(lonlat,date)
INPUTS:
     lonlat = longitude,latitude in degrees, W and N are positive.
              fltarr(2,N):  lonlat(0,*) = longitude
                            lonlat(1,*) = latitude
OPTIONAL INPUT PARAMETERS:
     date = date in any format.  Defaults to now if date is not
            specified.
KEYWORD PARAMETERS
     dir2center = direction from the heliographic coordinates to the center
                  of the solar disk as projected on the plane of the sky.  
                  Degrees CCW from solar north.
     /terrestrial = dir2center returns degrees CCW from terrestrial north.
OUTPUTS:
     result = heliographic angle in degrees: fltarr(N)
 CALLS: ***
	CONV_H2A [1], CONV_H2A [2], anytim2ints [1], anytim2ints [2], get_rb0p [1]
	get_rb0p [2]
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
     Calls pb0r to compute the solar b angle
MODIFICATION HISTORY:
     T. Metcalf  June 17, 1993
     20-feb-1997 - S.L.Freeland - use <get_rb0p> in place of "old" pb0r


HELIOEXALEPIDOPTERY $SSW/yohkoh/sxt/idl/atest/helioexalepidoptery.pro
[Previous] [Next]
 NAME:
     HELIOEXALEPIDOPTERY
 PURPOSE:
     Make a giant stackplot of Yohkoh daily images
 ETYMOLOGY
     "lepidoptery" from butterflies, "exa" from 10^18 Hz
 CALLING SEQUENCE:
     Main program, best to run in batch. This program
       is not optimized for speed.
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
     Writes a .genx file and .gif image to the current directory
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
     Requires the SFM data base (daily composite images) 
 MODIFICATION HISTORY:
     ~1999, written and named by HSH
     25-Jul-00, documented (HSH) 


HELP_BSC $SSW/yohkoh/bcs/idl/bsc/help_bsc.pro
[Previous] [Next]
 NAME:
       HELP_BSC
 PURPOSE:
       print BSC help file
 CALLING SEQUENCE:
       HELP_BSC
 INPUTS:
       none
 OPTIONAL OUTPUTS:
       help - text of help file
 HISTORY:
       Written Mar'93 by D. Zarro (ARC)
       May'94, Zarro, added DAT2BSC


help_coal $SSW/yohkoh/gen/idl/gbo/help_coal.pro
[Previous] [Next]
NAME:
	help_coal
PURPOSE:
	To show the COAL_IMAGE figure to help understand
 CALLS: ***
	WDEF [1], WDEF [2]
OPTIONAL KEYWORD INPUT:
	hc	- If set, make a hardcopy of the plot
RESTRICTIONS:
	It must be run to either X window or PS device
HISTORY:
	Written 11-Jan-94 by M.Morrison


help_offsets $SSW/yohkoh/sxt/idl/util/help_offsets.pro
[Previous] [Next]
NAME:
	help_offsets
PURPOSE:
	To display the SXT xray/NB/WB offsets
 CALLS: ***
	WDEF [1], WDEF [2]
OPTIONAL KEYWORD INPUT:
	hc	- If set, make a hardcopy of the plot
RESTRICTIONS:
	It must be run to either X window or PS device
HISTORY:
	Written 6-Jan-94 by M.Morrison


help_prefix $SSW/yohkoh/gen/idl/reformat/help_prefix.pro
[Previous] [Next]
NAME:
	help_prefix
PURPOSE:
	To display information on the different YOHKOH prefixes available
SAMPLE CALLING SEQUENCE:
	help_prefix
	help_prefix, 's*'
	help_prefix, 'obs', /full
	help_prefix, proc_info='ref_daily'
	help_prefix, file_type='sda'
	help_prefix, /help
OPTIONAL INPUT:
	descr	- A string or wildcard for which prefixes to list
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], DPRINT, RD_PREFIX_DOC
	concat_dir [4], prstr [1], prstr [2], wc_where [1], wc_where [2]
 CALLED BY:
	get_gol_site, get_gol_type
OPTIONAL KEYWORD INPUT:
	long	- If set, print out the full long description.
	full	- If set, print out the full long description plus the
		  line describing the processing and tape information
	hc	- If set, write to an output file and print it out
	outfil	- If defined, write the output to that file
	force_rd- If set, force a new read of the file that contains
		  the descriptions of the prefixes.
	file_type- If set, then search for "descr" occurrence in the file_type
		  string
	proc_info- If set, then search for "descr" occurrence in the processed
		   info string
	help	- If set, then just print the help information.
HISTORY:
	Written 6-Apr-93 by M.Morrison


help_roll $SSW/yohkoh/sxt/idl/util/help_roll.pro
[Previous] [Next]
NAME:
	help_roll
PURPOSE:
	To display the SXT roll convention
 CALLS: ***
	ARROW, PAUSE [1], WDEF [1], WDEF [2], pause [2]
OPTIONAL KEYWORD INPUT:
	hc	- If set, make a hardcopy of the plot
RESTRICTIONS:
	It must be run to either X window or PS device
HISTORY:
	Written 17-Sep-93 by M.Morrison
	 9-Dec-93 (MDM) - Added /EPS and FILE options
			- Changed the figures around


help_vignette $SSW/yohkoh/sxt/idl/util/help_vignette.pro
[Previous] [Next]
 NAME:
   help_vignette
 PURPOSE:
   To display the SXT Vignette function
 CALLING SEQUENCE:
   help_vignette
   help_vignette,/hc
   help_vignette,/hc,file=file
 CALLS: ***
	GT_SXT_AXIS, gt_pix_size, pprint [1], pprint [2], sxt_vignette
 OPTIONAL KEYWORD INPUT:
   hc	   = If set, make a hardcopy of the plot
   file   = To specify output PostScript file name
   eps	   = If set, make an encapsulated PostScript file
 RESTRICTIONS:
 MODIFICATION HISTORY:
 13-jan-93, J. R. Lemen LPARL, Written (calls sxt_vignette)


hexform $SSW/yohkoh/ucon/idl/freeland/hexform.pro
[Previous] [Next]
    Name: hexform

    Purpose: convert data to hex string/string arrary


HH_DELETE $SSW/yohkoh/ucon/idl/hudson/hh_delete.pro
[Previous] [Next]
 NAME:
     HH_DELETE
 PURPOSE:
     print a warning message for withdrawn UCON software
 CATEGORY:
     Yohkoh
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
 CALLED BY:
	WHICH_FILT, X_LUM, ZOOM_CONT, ZOOM_CONT2, ZS_CONTOUR
	wl_averagerdata_inavg_imgmask_img
 COMMON BLOCKS:
 SIDE EFFECTS:
     prints to screen
 RESTRICTIONS:
 MODIFICATION HISTORY:
     14-Apr-98, written (HSH)


his_index $SSW/yohkoh/sxt/idl/util/his_index.pro
[Previous] [Next]
NAME:
	his_index
PURPOSE:
	To update a tag in the index history record
SAMPLE CALLING SEQUENCE:
	his_index, index, 5, 'q_dark_sub', progverno
	his_index, index, ii, 'time_dark', time
	his_index, index
	his_index, /enable
	his_index, /disable
INPUT:
	index	- The index structure to be updated
OPTIONAL INPUT:
	i	- The indicy or indicies to update.  If it is set to -1, 
		  then update all index records.
	tag_name- The .HIS tag name to update
	value	- The value to write to the HIS tag
 CALLS: ***
	HIS_EXIST, SXT_STRUCT, gt_corner, gt_expdur [1], gt_expdur [2], gt_res
	str_merge [1], str_merge [2]
 CALLED BY:
	IMGSCL2, RD_XDA [1], RD_XDA [2], RESTORE_LOW8 [1], RESTORE_LOW8 [3], align1img [1]
	align1img [2], align_cube, change_res, coal_image, coal_rot, dark_sub [1]
	dark_sub [2], dark_sub [3], deka_norm [1], deka_norm [2], exp_norm [1]
	exp_norm [2], ext_subimg2, ext_subimg3, ext_subset [2], ffi_prep, get_dc_image [2]
	get_dc_image [3], get_leak_image [1], get_leak_image [2], get_leak_image [3]
	his_suncen, hxt_images2ps, leak_sub [1], leak_sub [2], leak_sub [3]
	match_index [1], match_index [2], mk_sdm, mk_sfd [1], mk_sfd [2], mk_sfd [3]
	mk_sfd [4], mk_ssc [1], mk_ssc [2], mk_syn_sfc [1], mk_syn_sfc [2], mod_res
	rest_low8_cube [1], rest_low8_cube [2], rest_low8_ffi, str_concat [1]
	str_concat [2], sxt_composite [1], sxt_composite [2], sxt_composite [3]
	sxt_mksdc_history, sxt_off_axis, sxt_prep [1], sxt_prep [2], sxt_prep [3]
	sxt_sff_composite [1], sxt_sff_composite [2], wl_process
OPTIONAL KEYWORD INPUT:
	enable	- Enable history records (Default is not to enable them)
	disable	- Disable history records
	init	- If set, then the .HIS structure already exists, but 
		  they are empty and need to be initialized.  Used by
		  RD_XDA when reading some files with .HIS and others
		  without.
METHOD:
	If the .HIS record does not already exist for the index, then it
	is appended to the input.  If only the index is passed, then the
	.HIS structure is appended but no tags are updated.
HISTORY:
	Written 6-Jun-93 by M.Morrison
	17-Jun-93 (MDM) - Set up the initialization of some of the index
			  history values.
	23-Jun-93 (MDM) - Added /ENABLE and /DISABLE
	 4-Jan-94 (MDM) - Added /INIT option


his_suncen $SSW/yohkoh/sxt/idl/util/his_suncen.pro
[Previous] [Next]
   Name: his_suncen

   Purpose: update history records of input files to include sun_center
            (from sxt_cen)

   Input Parameters:
      files - file or file array to update
  
   Output Parameters:
      oindex - final (updated) index records (for verification purposes)
                         (only for last file in list if multi-file call)

   Keyword Parameters:
      outfile - if set, name of output file (default is input file)
      rerun   - if set, force recall of sxt_cen (even if his already updated)
      cmd     - if set, use commanded pointing passed to sxt_cen 

   Callling Sequence:
      his_suncen, filelist   ; upate specified files.
      
   Calling Example:
      his_suncen, file_list('$DIR_SXT_SFT','sfc*')	; update all SFT files
   
 CALLS: ***
	DELVARX [1], DELVARX [2], DELVARX [3], DELVARX [4], RD_SDA [1], RD_SDA [2]
	RD_SDA [3], delvarx [5], his_index, sav_sda [1], sav_sda [2], sav_sda [3]
	sxt_cen [1], sxt_cen [2]
 CALLED BY:
	mk_sft [1], mk_sft [2]
   History:
      10-dec-1994 (SLF) 
      16-dec-1994 (SLF) - add /use_index_size to sav_sda call


hist_scale $SSW/yohkoh/sxt/idl/register/hist_scale.pro
[Previous] [Next]
  NAME:
    hist_scale
  PURPOSE:
    Find the max value of an array which has an obvious peak, 
    but throw out spurious high values.
  INPUTS:
    img = Array containing an image
  OPTIONAL INPUT KEYWORDS:
    qtest = 1: Print status messages
          = 2: Print messages and plot histogram to current window
    bright_limit = Fraction of the histogram to cut (from the top).
		    Default value = 0.5
  RETURNED:
    The maximum value which meets the selection criteria
  METHOD:
    Takes a histogram of the image.  Then it takes only those bins
    which are >1, then >2, etc.  Then find the number between the max
    and bright_limit * max.  Iterate until this number does not change
    by a more than hist_min (see definition in code).

    This routine should work properly on images that contain negative values.

    The routine is designed to work on data sets which have an obvious
    maximum, such as an optical solar image.
    The results may not be reliable for essentially flat images.

 CALLED BY:
	go_lasdisk golaserdisk, go_lasdisk2 golaserdisk, go_nvs5, halp halphaprep
	halpha_prep
  MODIFICATION HISTORY:
    Written,  1-sep-92, JRL


histscale [2] $SSW/yohkoh/gen/idl/util/histscale.pro
[Previous] [Next]
   Name: histscale

   Purpose: use histogram to auto-scale (different from histogram equaliz...)

   Input Parameters:
      image - image to scale

   Output 
      function returns scaled image (byte)

   Keyword Parameters:
      lowcut - if set, ignore pixels < lowcut in histogram determination
      hicut  - if set, ignore pixels > hicut  in histogram determination

   Calling Sequence:
      scaled_image=histscale(image [,lowcut=lowcut, hicut=hicut]


 CALLS: ***
	TOTVEC, WDEF [1], WDEF [2], deriv_arr [1], deriv_arr [2]
 CALLED BY:
	fl_suntoday [1], fl_suntoday [2], fl_suntoday [3], sun_today [1], sun_today [2]
	sun_today [3]
   History:
      25-sep-1995 (S.L.Freeland) - 


HMS2DD $SSW/yohkoh/ucon/idl/mcallister/hms2dd.pro
[Previous] [Next]
 NAME: HMS2DD

 PURPOSE: Convert a time in hours, minutes, and seconds to 
	   decimal days.

 CALLING SEQUENCE: DD=hms2dd(hrs,min,sec)

 PARAMETERS: 
		hrs 	input hours
		min	input minutes
		sec	input seconds
		DD	output decimal days

 RETURN TYPE: FLOAT                                            

 HISTORY: Drafted by A. McAllister Feb. 1993


HMSTIME [1] $SSW/yohkoh/ucon/idl/nitta/ffidl_nn.pro
[Previous] [Next]
 NAME:
       HMSTIME
 PURPOSE:
       Convert the TIME(unit of sec.) into the TIME(unit of HHMMSS.).
 CATEGORY:
       Programming
 CALLING SEQUENCE:
       HMSTIME, time
 INPUTS:
       time = time in the unit of sec.  
              Long Integer type data.
 OUTPUTS:
       time = time in the unit of HHMMSS. HHMMSS means HH:MM:SS.
              String type data having 6 data length.
   NOTE:
       notice that the type of inserted TIME (long integer) is also
     converted into another type (string*6) in the outputted TIME.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       The time in the unit of sec. is converted into the time in     
     unit of HHMMSS(HH:MM:SS).
 PROGRAMER:
       Toshifumi Shimizu
           Department of Astronomy, University of Tokyo, JAPAN
 HISTORY:
       Ver 1.0   7-JAN-1991  made


HMSTIME [2] $SSW/yohkoh/ucon/idl/nitta/pfidl_nn.pro
[Previous] [Next]
 NAME:
       HMSTIME
 PURPOSE:
       Convert the TIME(unit of sec.) into the TIME(unit of HHMMSS.).
 CATEGORY:
       Programming
 CALLING SEQUENCE:
       HMSTIME, time
 INPUTS:
       time = time in the unit of sec.  
              Long Integer type data.
 OUTPUTS:
       time = time in the unit of HHMMSS. HHMMSS means HH:MM:SS.
              String type data having 6 data length.
   NOTE:
       notice that the type of inserted TIME (long integer) is also
     converted into another type (string*6) in the outputted TIME.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       The time in the unit of sec. is converted into the time in     
     unit of HHMMSS(HH:MM:SS).
 PROGRAMER:
       Toshifumi Shimizu
           Department of Astronomy, University of Tokyo, JAPAN
 HISTORY:
       Ver 1.0   7-JAN-1991  made


HMSTIME [3] $SSW/yohkoh/ucon/idl/shimizu/ffidl.pro
[Previous] [Next]
 NAME:
       HMSTIME
 PURPOSE:
       Convert the TIME(unit of sec.) into the TIME(unit of HHMMSS.).
 CATEGORY:
       Programming
 CALLING SEQUENCE:
       HMSTIME, time
 INPUTS:
       time = time in the unit of sec.  
              Long Integer type data.
 OUTPUTS:
       time = time in the unit of HHMMSS. HHMMSS means HH:MM:SS.
              String type data having 6 data length.
   NOTE:
       notice that the type of inserted TIME (long integer) is also
     converted into another type (string*6) in the outputted TIME.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       The time in the unit of sec. is converted into the time in     
     unit of HHMMSS(HH:MM:SS).
 PROGRAMER:
       Toshifumi Shimizu
           Department of Astronomy, University of Tokyo, JAPAN
 HISTORY:
       Ver 1.0   7-JAN-1991  made


HMSTIME [4] $SSW/yohkoh/ucon/idl/shimizu/pfidl.pro
[Previous] [Next]
 NAME:
       HMSTIME
 PURPOSE:
       Convert the TIME(unit of sec.) into the TIME(unit of HHMMSS.).
 CATEGORY:
       Programming
 CALLING SEQUENCE:
       HMSTIME, time
 INPUTS:
       time = time in the unit of sec.  
              Long Integer type data.
 OUTPUTS:
       time = time in the unit of HHMMSS. HHMMSS means HH:MM:SS.
              String type data having 6 data length.
   NOTE:
       notice that the type of inserted TIME (long integer) is also
     converted into another type (string*6) in the outputted TIME.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       None.
 PROCEDURE:
       The time in the unit of sec. is converted into the time in     
     unit of HHMMSS(HH:MM:SS).
 PROGRAMER:
       Toshifumi Shimizu
           Department of Astronomy, University of Tokyo, JAPAN
 HISTORY:
       Ver 1.0   7-JAN-1991  made


HORI_VAR $SSW/yohkoh/ucon/idl/hudson/hori_var.pro
[Previous] [Next]
 NAME:
	HORI_VAR
 PURPOSE:
 CATEGORY:
 CALLING SEQUENCE:
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
 CALLED BY:
	feature_label
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:

 for all this useful info, please see below


 adapted from bigc.pro, but named after JHUAPL 'hori.pro', this
 interactively draws a horizontal line segment which can be used
 for positioning text.  input is the length of the intended
 character string, in characters.
 prints x,y in data coordinates  when a button is pressed.
 NB  - line segment is offset from cursor, use line-segment
   for positioning, offset is taken care of in x,y output...
  sets graphics device to 6  = if for some reason doesn't reset, 
	default (not xor) is 3 (see 3-8 in Ref. Guide)
 returns c=fltarr(2), c(0) = x, c(1) = y coord of point clicked
 AUTHOR:	KDL, after bigc.pro 931002


HOTPIX_FUDGE $SSW/yohkoh/ucon/idl/hudson/hotpix_fudge.pro
[Previous] [Next]
 NAME:
     HOTPIX_FUDGE
 PURPOSE:
     Fix hot pixels and their streaks cosmetically. It is hard-wired
       to fix the hot pixel at (182,66) HR automatically, or one
       can enter an address with the pix keyword (this has not been
       tested well).
 CATEGORY:
     Yohkoh
 CALLING SEQUENCE:
     data = hotpix_fudge(index,data)
 INPUTS:
     index and data
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     pix, address of hot pixel
     hotness, hot pixel DN count
     status, returns 1 if it did something, 0 if it didn't
     qdebug stops for debugging
 OUTPUTS:
     returns the input image, cleaned up by (a) replacing the hot pixel
       and its neighbor immediately above with the mean of the 23
       pixels surrounding it, if its value exceeds 5 sigma of this
       mean. Also replaces the column above with the mean of the two
       adjacent columns.
     in case the image is not square or has gaps, no fudging is 
       done.
 CALLS: ***
	KILL_INDEX [1], KILL_INDEX [2], STDEV, gt_percentd, gt_res
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
     only works on HR and QR full-frame data, but does any type (eg,
       bytes). Does not work on gapped or non-square images. 
 MODIFICATION HISTORY:
     29-Jan-98, written (HSH)


hswab procedure $SSW/yohkoh/ucon/idl/naoj_nkr/hswab.pro
[Previous] [Next]

 NAME       : hswab (procedure)
 PURPOSE :
	convert integer of nkrhead h  PC98 <-> SUN
 CATEGORY :
	idl/lib/nkr
 CALLING SEQUENCE :
	hswab,h
 INPUTS :
	h    : norikura type header structure
 OPTIONAL INPUT PARAMETERS : 
	none
 KEYWORD PARAMETERS :
 OUTPUTS :
	none
 CALLS: ***
	HSWAB
 COMMON BLOCKS : 	none
 SIDE EFFECTS : 	none
 RESTRICTIONS :	none
 PROCEDURE :
 MODIFICATION HISTORY :
	K.I. '91/07/17


ht_reform $SSW/yohkoh/sxt/idl/register/ht_reform.pro
[Previous] [Next]
   Name: ht_reform

   Purpose: reformat sxt high time data

   Input Parameters: 
      cube - data cube of raw data containing multiple
	      exposures in each image
      exp_per (optional) - number of exps/image 
			    2->1second, 4->halfsecond 
   Optional Keyword Parameters
	half = half - keyword set->halfsecond->4 exp/image
	sec  = sec  - keyword set->second    ->2 exp/image
 
   History: SLF, October 12, 1991


html_form_addtime [3] $SSW/yohkoh/gen/idl/http/html_formtime.pro
[Previous] [Next]
   Name: html_form_addtime

   Purpose: add times to an html form (template)

   Input Parameters:
      template - input text (html excluding time menus)
      start_sel - default start time to use
      stop_sel  - default stop time to use
   
   Keyword Parameters:
      timerange - time range for menus
      outfile   - if set, output .html document (default is <template>.html
      replace   - string to replace with time menus (in template)
                  default is <!** time_range **>

   Calling Sequence:
      html_form_addtime, template, start_sel [,stop_sel], timerange=timerange
 CALLS:


hunt $SSW/yohkoh/ucon/idl/mctiernan/hunt.pro
[Previous] [Next]
 NAME:
	hunt
 CALLING SEQUENCE:
	Hunt,xx,n,x,jlo
 PURPOSE:
	Given an array xx, of dimension n, this will return jlo, the index
 	just below the value x,
 INPUT:
	xx= and array, monotonically increasing
	n= n_elements(xx)
	x= the value you're looking for
 OUTPUT:
	jlo= index of element of xx just below value x
 HISTORY:
	Writtrn Spring '92 by JMCT


HX_COMP $SSW/yohkoh/ucon/idl/mctiernan/hx_comp.pro
[Previous] [Next]
 NAME:
	HX_COMP
 PURPOSE:
 	Compress data from 12 bits to 8 bits using the HXT algorithm
	(also used in WBS)
 CALLED BY:
	hxt_chsums
 HISTORY:
	Written by Hugh Hudson, 19-Dec-1991
       Corrected by J.McTiernan to accurately deal with DN<16 30-Jan-1992


HX_DECOMP $SSW/yohkoh/ucon/idl/mctiernan/hx_decomp.pro
[Previous] [Next]
 NAME:
	HX_DECOMP
 PURPOSE:
 	Restore HXT and WBS data from the 8-bit telemetry format to 
	the full 12 bits
 CALLED BY:
	AVE_CTS2 [1], AVE_CTS2 [2], AVE_CTS2 [3], grsl1_dead [2], grsl2_dead, hxs_dead
	hxt_chsums, hxt_mcaccum, hxtaccumulate
 HISTORY:
	Written by Jim McTiernan and Hugh Hudson, 19-Dec-1991
       Changed to do nothing if the data is not a byte array
       2-jan-1997, jmm.


HXA2HEL $SSW/yohkoh/ucon/idl/hudson/hxa2hel.pro
[Previous] [Next]
 NAME:
	HXA2HEL
 PURPOSE:
       Given the time of a PFI exposure, to calculate the heliographic
	coordinates of the FOV
 HISTORY
	Written by HSH, June, 1992
 CALLS:


HXA2HXAXY [1] $SSW/yohkoh/gen/idl/atest/hxa2hxaxy.pro
[Previous] [Next]
 NAME:
        HXA2HXAXY
 PURPOSE:
        Tries to reconstruct HXA limb positions hidden by fiducial marks
        and calculate the suncenter position (in HXA coordinates) from
        the HXA info in the PNT files.
 CATEGORY:
 CALLING SEQUENCE:
        sunc = hxa2hxaxy(hxa_i,hxa_d)
        sunc = hxa2hxaxy(atr,atr.hxa)
 INPUTS:
        hxa_i = pnt, atr, or ada_index structure.
        hxa_d = array(4,*). hxa data, e.g., atr.hxa or gt_hxa(ada_data)
 KEYWORDS (INPUT):
 OUTPUTS:
        sunc = array(2,*). suncenter coordinates in HXA coordinates.
               sunc(0,*) = hxa_x, sunc(1,*) = hxa_y
 KEYWORDS (OUTPUT):
        code = vector.  Indicates how each sun center position was obtained.
               0 : error, no result, 2 : result deduced from 2 limbs,
               3: result deduced from 3 limbs, 4 : all limbs used.
        zon = vector, the 4 LSB indicate which limbs were hidden.
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FORZONES [1], FORZONES [2]
	HXA_PARMS [1], HXA_PARMS [2], HXA_PARMS [3], INTERPOL, concat_dir [4]
	get_rb0p [1], get_rb0p [2], int2secarr [1], int2secarr [2], restgen [1]
	restgen [2]
 CALLED BY:
	IRUHXA2SXT, IRUHXASCAN2SXT [1], IRUHXASCAN2SXT [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
        Uses the solar radius to reconstruct hidden limbs.
 MODIFICATION HISTORY:
	19-Jul-93 (JPW) - part of hxa_suncenter
       16-Sep-96 (JPW) - modif. to allow for diff. solar r in x and y
                         (to correct for diff. sensitiv. of HXA x and y)
       25-Sep-98 (JPW) - allow larger error margin for degraded HXA data:
                         1. fx,fy dependant error margin, e.g.
                            err -> err + 33.3 * err * (1-fx)
                         2. adjust reconstructed limb if it moves outside
                            the fiducial mark.


HXA2HXAXY [2] $SSW/yohkoh/gen/idl/pointing/hxa2hxaxy.pro
[Previous] [Next]
 NAME:
        HXA2HXAXY
 PURPOSE:
        Tries to reconstruct HXA limb positions hidden by fiducial marks
        and calculate the suncenter position (in HXA coordinates) from
        the HXA info in the PNT files.
 CATEGORY:
 CALLING SEQUENCE:
        sunc = hxa2hxaxy(hxa_i,hxa_d)
        sunc = hxa2hxaxy(atr,atr.hxa)
 INPUTS:
        hxa_i = pnt, atr, or ada_index structure.
        hxa_d = array(4,*). hxa data, e.g., atr.hxa or gt_hxa(ada_data)
 KEYWORDS (INPUT):
 OUTPUTS:
        sunc = array(2,*). suncenter coordinates in HXA coordinates.
               sunc(0,*) = hxa_x, sunc(1,*) = hxa_y
 KEYWORDS (OUTPUT):
        code = vector.  Indicates how each sun center position was obtained.
               0 : error, no result, 2 : result deduced from 2 limbs,
               3: result deduced from 3 limbs, 4 : all limbs used.
        zon = vector, the 4 LSB indicate which limbs were hidden.
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FORZONES [1], FORZONES [2]
	HXA_PARMS [1], HXA_PARMS [2], HXA_PARMS [3], INTERPOL, concat_dir [4]
	get_rb0p [1], get_rb0p [2], int2secarr [1], int2secarr [2], restgen [1]
	restgen [2]
 CALLED BY:
	IRUHXA2SXT, IRUHXASCAN2SXT [1], IRUHXASCAN2SXT [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
        Uses the solar radius to reconstruct hidden limbs.
 MODIFICATION HISTORY:
	19-Jul-93 (JPW) - part of hxa_suncenter
       16-Sep-96 (JPW) - modif. to allow for diff. solar r in x and y
                         (to correct for diff. sensitiv. of HXA x and y)


hxa_lidark $SSW/yohkoh/ucon/idl/wuelser/hxa_lidark.pro
[Previous] [Next]
 NAME:
        hxa_lidark
 PURPOSE:
        Parametrized limb darkening model for hxa.
        To be called by curvefit.
 CATEGORY:
 CALLING SEQUENCE:
        hxa_lidark,x,a,f,pder
 INPUTS:
        x = independent variable
        a = fltarr(4), model parameters:
            [center,radius,center_intens,dark_level]
 KEYWORDS (INPUT):
 OUTPUTS:
        f = dependent variable.  Function values at x.
        pder = array(n_elements(x),4).  Partial derivatives of f.
               Calculated only if pder defined on input.
 KEYWORDS (OUTPUT):
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
        JPW, 29-sep-98


HXA_LIMBS $SSW/yohkoh/ucon/idl/hudson/hxa_limbs.pro
[Previous] [Next]
 NAME:
       HXA_LIMBS.PRO 
 PURPOSE:
	get HXA data for the ada data range specified in
       the calling sequence
		hxa_limbs,ada_data,x_hxa,y_hxa
	and return the mean HXA (unresolved for 45-degree tilt) values
 WRITTEN:
	Hugh Hudson, Nov. 1991
	HH Jan. 29, 1992, modified to call FORZONES and reject fiducial
	  hits (returns warning message if any fiducial mark is hit -
	  this may mean large errors!)
 CALLS:
 CALLED BY
	HXA_SUNC


HXA_LIMBS2 $SSW/yohkoh/ucon/idl/hudson/hxa_limbs2.pro
[Previous] [Next]
 NAME:
       HXA_LIMBS2.PRO 
 PURPOSE:
	get HXA data for the ada data range specified in
       the calling sequence
		hxa_limbs,ada_data,x_hxa,y_hxa
	and return the mean HXA (unresolved for 45-degree tilt) values
 WRITTEN:
	Hugh Hudson, Nov. 1991
	HH Jan. 29, 1992, modified to call FORZONES and reject fiducial
	  hits (returns warning message if any fiducial mark is hit -
	  this may mean large errors!)
       HH Mar. 23, 1992, renamed and modified to output 4 limb numbers.
	Put fiducial flag into output list.
	2-May-92 modified to return addresses even if on fiducial
 CALLS:
 CALLED BY
	HXA_SUNC2


HXA_PARMS [1] $SSW/yohkoh/gen/idl/atest/hxa_parms.pro
[Previous] [Next]
 NAME:
        HXA_PARMS
 PURPOSE:
        Returns numerical values of various parameters used in suncenter
        calculations, including HXA detector properties.

        This second version returns updated and corrected parameters.
 CALLED BY:
	HXA2HXAXY [1], HXA2HXAXY [2], HXASCAN2HXAXY, HXAXY2SXT, IRUHXA_FIT [1]
	IRUHXA_FIT [2], SXT2HXAXY, atr2hxa_dbase, mk_att [1], mk_att [2], show_hxafid
        Note: the use of cox, coy has slightly changed.  The polynomial
        is not in time since sunrise in minutes, but tofac*t/(t_lms-t_fms).
 CATEGORY:
 CALLING SEQUENCE:
        hxa_parms,...
 INPUTS:
 KEYWORDS (INPUT):
 OUTPUTS:
 KEYWORDS (OUTPUT):
        hpix = HXA pixel size (in arcseconds)
        h_xx, h_yy = HXA detector crossing point coordinates
        spix = SXT pixel size  (Note: in hxa_suncenter: spix = hpix/spix!)
        phi = angle between SXT (E->W) and HXA (SE->NW)
        sxt_off = SXT coordinates of HXA detector crossing point
        naban_o = offset between NaBan filter image and SXT X-ray image
        wdban_o = offset between WdBan filter image and SXT X-ray image
        cox, coy = coefficients for orbital phase correction
        tofac = multiplier for orbital phase
        clx, cly = coefficients for orbit duration correction
        tloff = time offset for orbit duration correction (in minutes)
        cmx, cmy = coefficients for mission time correction
        tmoff = time offset for mission time correction (in days)
        tmcut = last day for which mission time correction shall be applied
        gpix = gyro unit (in arcseconds)
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        correction coefficients cmx, cmy only work for first year of
        mission.  A zero correction is ok for 1993 and early 1994.
        This correction cannot be predicted for future times.
 PROCEDURE:
 MODIFICATION HISTORY:
	 19-Jul-93 (JPW) - Constants mostly from hxa-suncenter.
        20-Sep-94 (JPW) - Updated parameters, plus cutoff date for
                          mission time correction
        24-sep-94 (SLF) - added VERSION keyword (output), Set VERSION=1
         3-oct-96 (JPW) - set VERSION=2, to reflect modified hxa2hxaxy
        25-sep-98 (JPW) - set VERSION=3, to reflect another update of
                          hxa2hxaxy.


HXA_PARMS [2] $SSW/yohkoh/gen/idl/pointing/hxa_parms.pro
[Previous] [Next]
 NAME:
        HXA_PARMS
 PURPOSE:
        Returns numerical values of various parameters used in suncenter
        calculations, including HXA detector properties.

        This second version returns updated and corrected parameters.
 CALLED BY:
	HXA2HXAXY [1], HXA2HXAXY [2], HXASCAN2HXAXY, HXAXY2SXT, IRUHXA_FIT [1]
	IRUHXA_FIT [2], SXT2HXAXY, atr2hxa_dbase, mk_att [1], mk_att [2], show_hxafid
        Note: the use of cox, coy has slightly changed.  The polynomial
        is not in time since sunrise in minutes, but tofac*t/(t_lms-t_fms).
 CATEGORY:
 CALLING SEQUENCE:
        hxa_parms,...
 INPUTS:
 KEYWORDS (INPUT):
 OUTPUTS:
 KEYWORDS (OUTPUT):
        hpix = HXA pixel size (in arcseconds)
        h_xx, h_yy = HXA detector crossing point coordinates
        spix = SXT pixel size  (Note: in hxa_suncenter: spix = hpix/spix!)
        phi = angle between SXT (E->W) and HXA (SE->NW)
        sxt_off = SXT coordinates of HXA detector crossing point
        naban_o = offset between NaBan filter image and SXT X-ray image
        wdban_o = offset between WdBan filter image and SXT X-ray image
        cox, coy = coefficients for orbital phase correction
        tofac = multiplier for orbital phase
        clx, cly = coefficients for orbit duration correction
        tloff = time offset for orbit duration correction (in minutes)
        cmx, cmy = coefficients for mission time correction
        tmoff = time offset for mission time correction (in days)
        tmcut = last day for which mission time correction shall be applied
        gpix = gyro unit (in arcseconds)
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        correction coefficients cmx, cmy only work for first year of
        mission.  A zero correction is ok for 1993 and early 1994.
        This correction cannot be predicted for future times.
 PROCEDURE:
 MODIFICATION HISTORY:
	 19-Jul-93 (JPW) - Constants mostly from hxa-suncenter.
        20-Sep-94 (JPW) - Updated parameters, plus cutoff date for
                          mission time correction
        24-sep-94 (SLF) - added VERSION keyword (output), Set VERSION=1
         3-oct-96 (JPW) - set VERSION=2, to reflect modified hxa2hxaxy


HXA_PARMS [3] $SSW/yohkoh/ucon/idl/wuelser/hxa_parms_old.pro
[Previous] [Next]
 NAME:
        HXA_PARMS
 PURPOSE:
        Returns numerical values of various parameters used in suncenter
        calculations, including HXA detector properties.

        This second version returns updated and corrected parameters.
 CALLED BY:
	HXA2HXAXY [1], HXA2HXAXY [2], HXASCAN2HXAXY, HXAXY2SXT, IRUHXA_FIT [1]
	IRUHXA_FIT [2], SXT2HXAXY, atr2hxa_dbase, mk_att [1], mk_att [2], show_hxafid
        Note: the use of cox, coy has slightly changed.  The polynomial
        is not in time since sunrise in minutes, but tofac*t/(t_lms-t_fms).
 CATEGORY:
 CALLING SEQUENCE:
        hxa_parms,...
 INPUTS:
 KEYWORDS (INPUT):
 OUTPUTS:
 KEYWORDS (OUTPUT):
        hpix = HXA pixel size (in arcseconds)
        h_xx, h_yy = HXA detector crossing point coordinates
        spix = SXT pixel size  (Note: in hxa_suncenter: spix = hpix/spix!)
        phi = angle between SXT (E->W) and HXA (SE->NW)
        sxt_off = SXT coordinates of HXA detector crossing point
        naban_o = offset between NaBan filter image and SXT X-ray image
        wdban_o = offset between WdBan filter image and SXT X-ray image
        cox, coy = coefficients for orbital phase correction
        tofac = multiplier for orbital phase
        clx, cly = coefficients for orbit duration correction
        tloff = time offset for orbit duration correction (in minutes)
        cmx, cmy = coefficients for mission time correction
        tmoff = time offset for mission time correction (in days)
        tmcut = last day for which mission time correction shall be applied
        gpix = gyro unit (in arcseconds)
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        correction coefficients cmx, cmy only work for first year of
        mission.  A zero correction is ok for 1993 and early 1994.
        This correction cannot be predicted for future times.
 PROCEDURE:
 MODIFICATION HISTORY:
	 19-Jul-93 (JPW) - Constants mostly from hxa-suncenter.
        20-Sep-94 (JPW) - Updated parameters, plus cutoff date for
                          mission time correction
        24-sep-94 (SLF) - added VERSION keyword (output), Set VERSION=1


HXA_PARMS2 $SSW/yohkoh/ucon/idl/wuelser/hxa_parms2.pro
[Previous] [Next]
 NAME:
        HXA_PARMS2
 PURPOSE:
        Returns numerical values of various parameters used in suncenter
        calculations, including HXA detector properties.
        This second version returns updated and corrected parameters.
        Note: the use of cox, coy has slightly changed.  The polynomial
        is not in time since sunrise in minutes, but tofac*t/(t_lms-t_fms).
 CATEGORY:
 CALLING SEQUENCE:
        hxa_parms2,...
 INPUTS:
 KEYWORDS (INPUT):
 OUTPUTS:
 KEYWORDS (OUTPUT):
        hpix = HXA pixel size (in arcseconds)
        h_xx, h_yy = HXA detector crossing point coordinates
        spix = SXT pixel size  (Note: in hxa_suncenter: spix = hpix/spix!)
        phi = angle between SXT (E->W) and HXA (SE->NW)
        sxt_off = SXT coordinates of HXA detector crossing point
        naban_o = offset between NaBan filter image and SXT X-ray image
        wdban_o = offset between WdBan filter image and SXT X-ray image
        cox, coy = coefficients for orbital phase correction
        tofac = multiplier for orbital phase
        clx, cly = coefficients for orbit duration correction
        tloff = time offset for orbit duration correction (in minutes)
        cmx, cmy = coefficients for mission time correction
        tmoff = time offset for mission time correction (in days)
        tmcut = last day for which mission time correction shall be applied
        gpix = gyro unit (in arcseconds)
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        correction coefficients cmx, cmy only work for first year of
        mission.  A zero correction is ok for 1993 and early 1994.
        This correction cannot be predicted for future times.
 PROCEDURE:
 MODIFICATION HISTORY:
	 19-Jul-93 (JPW) - Constants mostly from hxa-suncenter.
        20-Sep-94 *JPW) - Updated parameters, plus cutoff date for
                          mission time correction


HXA_SHOW [1] $SSW/yohkoh/ucon/idl/hudson/hxa_show.pro
[Previous] [Next]
 NAME:
     HXA_SHOW 
 PURPOSE:
     show off some Yohkoh HXA image and limb address data
 CATEGORY:
 CALLING SEQUENCE:
     main program
 INPUTS:
     need infil path to Yohkoh ADA data
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
     has many hard-wired things, so you'll need to hack it to
       run it properly - ask the author please
 MODIFICATION HISTORY:
     18-Feb-98, written (HSH)
     19-Feb-98, fixed bug found by Wuelser (HSH)


HXA_SHOW [2] $SSW/yohkoh/ucon/idl/hudson/hxa_show2.pro
[Previous] [Next]
 NAME:
     HXA_SHOW 
 PURPOSE:
     show off some Yohkoh HXA image and limb address data
 CATEGORY:
 CALLING SEQUENCE:
     main program
 INPUTS:
     need infil path to Yohkoh ADA data
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
     has many hard-wired things, so you'll need to hack it to
       run it properly - ask the author please
 MODIFICATION HISTORY:
     18-Feb-98, written (HSH)
     19-Feb-98, fixed bug found by Wuelser (HSH)


HXA_SUNC $SSW/yohkoh/ucon/idl/hudson/hxa_sunc.pro
[Previous] [Next]
 NAME:
 	HXA_SUNC	
 PURPOSE:
	Uses HXA data to generate SXT offset coordinates.
 CALLING SEQUENCE:
	hxa_sunc,file_name,times,x,y(,smooth,hxa_scan), where file_name is 
         the name of the SDA file for which offset coordinates are needed,
	  and the program returns x and y (pixel units).
	       The structure hxa_scan, which contains the HXA images for
	  the associated ADA file, is an optional output, and the
	  parameter SMOOTH (default = 5 major frames).
 WARNINGS:
	Only does relative offsets, even though x,y are returned in 
	  approximately absolute values.
	Returns zeros and gives an error message for fiducial confusion.
	For DP mode high only.
 CALLS: ***
	HXA_LIMBS, RD_ADA, Rd_Roadmap [2], rd_roadmap [1], tim2dset [1], tim2dset [2]
 HISTORY:
	written by Hugh Hudson, Jan. 29, 1992
	HSH modified Feb. 13, 1992


HXA_SUNC2 $SSW/yohkoh/ucon/idl/hudson/hxa_sunc2.pro
[Previous] [Next]
 NAME:
 	HXA_SUNC2	
 PURPOSE:
	Uses HXA data to generate SXT offset coordinates.
 CALLING SEQUENCE:
	hxa_sunc2,file_name,times,x,y(,smooth,hxa_scan,fid_flag), where 
         file_name is the name of the SDA file for which offset coordinates 
	  are needed,and the program returns x and y (pixel units).
	       The structure hxa_scan, which contains the HXA images for
	  the associated ADA file, is an optional output, and the
	  parameter SMOOTH (default = 5 major frames).
 WARNINGS:
	Only does relative offsets, even though x,y are returned in 
	  approximately absolute values.
	Returns zeros and gives an error message for fiducial confusion.
	For DP mode high only.
	Has approximate calibrations hard-wired (error le 5 arc sec?) and
         ignores fiducial hits (error le 30 arc sec).
 CALLS: ***
	HXA_LIMBS2, RD_ADA, Rd_Roadmap [2], rd_roadmap [1], tim2dset [1], tim2dset [2]
 CALLED BY:
	HXA_SXT
 HISTORY:
	written by Hugh Hudson, Jan. 29, 1992
	HSH modified Feb. 13, 1992
	HSH renamed and modified Mar. 23 to handle four-limb output
       May 1, 1992 TRM Fixed bug which crashed the program when a fiducial 
                       mark was encounterd
         from HXA_LIMBS2


HXA_SUNCENTER $SSW/yohkoh/gen/idl/pointing/hxa_suncenter.pro
[Previous] [Next]
 NAME:
        HXA_SUNCENTER
 PURPOSE:
        Calculate the suncenter position (in SXT pixel coordinates) from
        the HXA info in the PNT files.  Tries to reconstruct hidden limbs.
 CATEGORY:
 CALLING SEQUENCE:
        sunc = hxa_suncenter(pnt)
        sunc = hxa_suncenter(index=index)
 INPUTS:
        pnt = pnt structure.  Optional if index keyword supplied.  In that
              case, the pnt file is read automatically.
 KEYWORDS (INPUT):
        index = sxt index structure.  If supplied, the suncenter position is
                calculated only for the times given in the index structure.
                In addition, the suncenter coordinates for the optical images
                are corrected for the appropriate filter offsets.
        /hxa = Output in hxa coordinates instead of SXT pixel coordinates
        /noorbit = do not correct for orbital variations of the offset
                   between HXT and SXT.  (fem file not read in this case.)
        /nosecular = do not correct for secular variation of the offset
                     between HXT and SXT.
        /nofilt = do not test and correct for offsets of optical filters.
                  Use if INDEX is not a SXT index or roadmap structure.
        fem = fem orbital data structure.  Optional, fem file read
              automatically if not supplied.
 OUTPUTS:
        sunc = suncenter coordinates in SXT full resolution pixels.
               sunc(0,*) = x, sunc(1,*) = y, sunc(2,*) = pnt.time,
               sunc(3,*) = pnt.day
 KEYWORDS (OUTPUT):
        code = vector.  Indicates how each sun center position was obtained.
               0 : error, no result, 1 : ADS used, 2 : result deduced from
               2 limbs, 3: result deduced from 3 limbs, 4 : all limbs used.
		-1: S/C commanded value used
 CALLS: ***
	FORZONES [1], FORZONES [2], get_rb0p [1], get_rb0p [2], gt_filta, rd_fem, rd_pnt
	sxt_cmd_pnt, tim2dset [1], tim2dset [2]
 CALLED BY:
	FOV_COORDS, GET_SUNCENTER [1], GET_SUNCENTER [2], GET_TRACUBE, PROTRACTOR, SPOTTER
	SXTASEQ, sxt_cen [1], sxt_cen [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        Use of ADS in case of failure is not implemented yet.
        The secular variation of the offset between HXT and SXT is
        well corrected for the first year of Yohkoh.  The correction
        needs to be updated as the project goes on.
 PROCEDURE:
 MODIFICATION HISTORY:
        JPW, Oct. 1992 added index keyword, added offset SXT - aspect tel.
        JPW, Oct. 1992 added corrections for orbital and secular variations
	  5-Jun-93 (MDM) - Added ZON keyword output option
			 - Added a print statment
			 - Added code(*) = -1 option to return S/C commanded
			   value instead of just returning zeros (replaced
			   code = 0)
	14-Jun-93 (MDM) - Did a range check on HXA data values (0 to 2047)
	18-Jul-93 (MDM) - Replaced SUN_R call with GET_RB0P
       30-sep-93 (JPW) - Changed coordinate system from halfres. OFR to FRE
                         (a 0.5 pixel difference)
       23-sep-94 (JPW) - Suppressing the secular variation correction for
                         dates after Jan-93.


HXA_SXT $SSW/yohkoh/ucon/idl/hudson/hxa_sxt.pro
[Previous] [Next]
 NAME:
	HXA_SXT	
 PURPOSE:
	Give coordinates for SXT field-of-view center, based upon HXA
 CALLING SEQUENCE:
	hxa_sxt,infil,index,ee,nn,tt
	  Input:  infil = file name (string)
                 index = reformatter index file
	  Output: ee is the location E of sun center, arc sec
	          nn is the location N of sun center, arc sec
		  tt is the time string
 METHOD:
	calls HXA_SUNC, HXA_LIMBS, FORZONES
 CALLS: ***
	HXA_SUNC2, fmt_tim [1], fmt_tim [2], gt_res
 HISTORY:
	H. Hudson, G. Slater, Feb. 17, 1992.
 WARNINGS:
   	Accuracy is maybe 2 arc sec rms. May bomb out if the HXA sensors
	are obscured by the fiducial marks ("FIDUCIAL HIT").


HXASCAN2HXAXY $SSW/yohkoh/ucon/idl/wuelser/hxascan2hxaxy.pro
[Previous] [Next]
 NAME:
        HXASCAN2HXAXY
 PURPOSE:
        Takes HXA scan (intensity) data and calculates the suncenter
        position (in HXA coordinates) by fitting a limb darkening
        function to the data.
        The fit results are screened for:
        (1) compatible with solar radius from ephemeris (large margin?)
        (2) suncenter not more than a solar radius from HXA crossing point
        (3) peak intensity between 2.0 and 63.0
        (4) sigma of center fit below some threshold (large margin?)
 CATEGORY:
 CALLING SEQUENCE:
        sunc = hxascan2hxaxy(hxa_scan,time_out)
 INPUTS:
        hxa_scan = hxa scan data structure, straight output from rd_hxa
 KEYWORDS (INPUT):
 OUTPUTS:
        sunc = float(2,*). suncenter coordinates in HXA coordinates.
               sunc(0,*) = hxa_x, sunc(1,*) = hxa_y
        time_out = time of each suncenter coordinate (internal time format).
                   (identical to anytim2ints(hxa_scan))
 KEYWORDS (OUTPUT):
        code = vector.  Flag tagging good data:
               0 : error, no/bad result, 1 : nominal result.
    The following parameters are for debugging purposes:
        par = float(4,2,*) fitting parameters
        sig = float(4,2,*) sigma of fit
        ini = float(4,2,*) initial guess for fitting parameters.
        npt = int(2,*) number of points used for fit.
        res = float(2,*) average residual for each fit.
        thi = int(2,*) lower threshold for intensity
 CALLS: ***
	FORZONES [1], FORZONES [2], HXA_PARMS [1], HXA_PARMS [2], HXA_PARMS [3]
	anytim2ints [1], anytim2ints [2], fit_1hxascan, get_rb0p [1], get_rb0p [2]
 CALLED BY:
	IRUHXASCAN2SXT [1], IRUHXASCAN2SXT [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
        Fits limb darkening function from Allen (Astrophysical Quantities)
        using curvefit.
 MODIFICATION HISTORY:
        22-Oct-98 (JPW) - written
        16-Mar-99 (JPW) - fixed bug (res calc. failed for wf=-1)
         9-Apr-99 (JPW) - fixed bug (undef. keyw. from fit_1hxascan)


HXAXY2SXT $SSW/yohkoh/gen/idl/pointing/hxaxy2sxt.pro
[Previous] [Next]
 NAME:
        HXAXY2SXT
 PURPOSE:
        Transform HXA suncenter coordinates into SXT coordinates and
        perform time dependent corrections.
        Time dependent corrections are: orbital phase correction,
        orbit duration correction, mission time correction (non-periodic).
 CATEGORY:
 CALLING SEQUENCE:
        s_sunc = hxa_suncenter(time_index,h_sunc)
 INPUTS:
        time_index = time vector, e.g., pnt, atr, or ada_index structure.
        h_sunc = array(2,*). suncenter coordinates in HXA coordinates.
                 sunc(0,*) = hxa_x, sunc(1,*) = hxa_y
 KEYWORDS (INPUT):
        /noorbit = do not correct for orbital variations of the offset
                   between HXT and SXT.
        /nomission = do not correct for mission time variation of the offset
                     between HXT and SXT.
 OUTPUTS:
        s_sunc = array(2,*). suncenter coordinates in SXT full resolution
                 pixels.  sunc(0,*) = sxt_x, sunc(1,*) = sxt_y
 KEYWORDS (OUTPUT):
 CALLS: ***
	HXA_PARMS [1], HXA_PARMS [2], HXA_PARMS [3], gt_day [1], gt_day [2], tim2orbit [1]
	tim2orbit [2]
 CALLED BY:
	IRUHXA2SXT, IRUHXASCAN2SXT [1], IRUHXASCAN2SXT [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        The mission time variation of the offset between HXT and SXT is
        well corrected for the first year of Yohkoh.  The correction
        needs to be updated as the project goes on.
 PROCEDURE:
 MODIFICATION HISTORY:
	19-Jul-93 (JPW) - part of hxa_suncenter
       22-Sep-94 (JPW)   Changed to apply mission correction only to pre-1993
                         data.  Extrapolation beyond that caused large errors.
                         Slightly changed algorithm for orbital phase corr.


hxi_channels $SSW/yohkoh/ucon/idl/mctiernan/hxi_channels.pro
[Previous] [Next]
 NAME:
       hxi_channels
 PURPOSE:
       returns the subscripts of each channel for an hxi data set
 CALLING SEQUENCE:
       hxi_channels, index, s0, s1, s2, s3
 INPUT:
       index= the index structure from the HXI file
 OUTPUT:
       s0, s1, s2, s3 = subscripts of channel 0, 1, 2, 3 images
                        if it's -1, then there aren't any
 CALLS: ***
	dude
 HISTORY:
       5-26-95, jmm


hxi_interp $SSW/yohkoh/ucon/idl/mctiernan/hxi_interp.pro
[Previous] [Next]
 NAME:
   hxi_interp
 PURPOSE:
   Linearly interpolate HXT images in time.

   WARNING:  hxi_interp overwrites the input variables:

 CALLING SEQUENCE:
   hxi_interp,index,data,ntimes,unc_data,/start

 INPUT/OUTPUT PARAMETERS:
   index   = HXI index structure
   data    = HXI data cube (must be 3-d)
   unc_data(optional)= uncertainty in data

 INPUT PARAMETERS:
   ntimes  = Vector of new times (can be any Yohkoh format or an
	      index or roadmap structure). These will be
             interpreted as the center times of the individual
             images. The output time for index will be the start time
             for the images, different by ntimes by a factor of dt/2.0.
             Unless the /start keyword is set.

 KEYWORDS:
   start = ntimes refers to the start time, of the image interval

 If extrapolation is performed, any resulting negative values are set to 0.

 CALLS: ***
	Ex2Int [1], Ex2Int [2], anytim2ex [1], anytim2ex [2], anytim2ints [1]
	anytim2ints [2], fmt_tim [1], fmt_tim [2], int2secarr [1], int2secarr [2]
	interp_arr [1], interp_arr [2], interp_arr [3]
 CALLED BY:
	box_sxthxt_fsp, box_sxtth_hxt, hxtbox_fsp
 MODIFICATION HISTORY:
   8-mar-93, J. R. Lemen, LPARL
  16-mar-93, JRL, Fixed typo (fmt_tim); Fixed up round-off scheme
  13-may-93, JMM, converted to work on hxi images
  16-nov-94, jmm, really, these images should be interpolated to the center
                 times.
  27-sep-95, jmm, put unc_data output back in


hxi_normap $SSW/yohkoh/hxt/idl/atest/hxi_normap.pro
[Previous] [Next]
 NAME:
       hxi_normap
 PURPOSE:
       Normalizes b to a array of between 0 and 255. This does not
       set the minimum value of the output to zero.
 CATEGORY:
       Yohkoh HXT
 CALLING SEQUENCE:
       norb = hxi_normap(b, max=max, max_sub=max_sub)
 INPUT:
       b = array, can be a data cube
 OUTPUT:
       norb = normalized b, bytes between 0 and 255
 KEYWORDS:
       max= the max. value of b
       max_sub= the subscript of the max. point
 CALLED BY:
	hxt_multimg, hxt_sources
 HISTORY:
       1-aug-94, jmm


hxi_unnorm $SSW/yohkoh/hxt/idl/atest/hxi_unnorm.pro
[Previous] [Next]
 NAME:
      hxi_unnorm
 PURPOSE:
      Restores a byte-type cube of hxi images to floating pt.,
 CATEGORY:
      Yohkoh HXT
 CALLING SEQUENCE:
      d1 = hxi_unnorm(index, data, /dt_norm, /strip, /hxtpro)
 INPUT:
      index = index structure for hxi images
      data = data cube byte type
 OUTPUT:
      d1 = for each image d1=data*index.hxi.max_bright/255.0
 KEYWORDS:
      dt_norm = if set, will normalize by the accumulation time
      strip = if set, strip the images to the size given
              by index(0).hxi.shape_sav
      hxtpro = if set, data is hxtpro output, normalized by
               total counts instead of the max. brightness
 CALLED BY:
	align_hxi, box_sxthxt_fsp, box_sxtth_hxt, hxtbox_fsp
 HISTORY:
      10/13/94, jmm
      9/21/95, jmjm, does nothing if a non-byte array is passed in,
               unless the dt_norm keyword is set.
      27/09/2000, rdb, changed typ to dtyp to avoind naoe collision


HXR2PELEC $SSW/yohkoh/ucon/idl/wuelser/hxr2pelec.pro
[Previous] [Next]
 NAME:
        HXR2PELEC
 PURPOSE:
        Calculate the thick target electron energy deposition from a given
        HXR power law spectrum.
 CATEGORY:
 CALLING SEQUENCE:
        pelec = hxr2pelec(a,gamma [,e0])
 INPUTS:
        a ,
        gamma : parameters of photon spectrum according to
                i(E) = a * E^(-gamma)  [photons / cm2 / s / keV]  ; E in keV
        e0 = cutoff energy.  Optional.  Default = 25 keV
 KEYWORDS (INPUT):
 OUTPUTS:
        pelec = energy deposited by electrons as derived from HXR spectrum
                [erg/s].
 KEYWORDS (OUTPUT):
 CALLS: ***
	GAMMA
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
        Tandberg-Hanssen and Emslie (1988): "The Physics of Solar Flares"
        (Cambridge).
 MODIFICATION HISTORY:
        JPW, Nov. 1992


HXR_BREMS $SSW/yohkoh/ucon/idl/wuelser/hxr_brems.pro
[Previous] [Next]
 NAME:
        HXR_BREMS
 PURPOSE:
        Returns a HXR power law, or thermal Bremsstrahlung spectrum
 CATEGORY:
 CALLING SEQUENCE:
        intens = hxr_brems(a,gamma,e0)
        intens = hxr_brems(t,em,/thermal)     ; em = double precision number
 INPUTS:
        a ,
        gam = parameters of nonthermal photon power law spectrum
              i(E) = a * E^(-gam)   [photons / cm2 / s / keV] ; E in keV
        e0 = cutoff energy of electrons (in KeV).  Optional.  Default = 25.
        t = temperature of thermal plasma (K)
        em = emission measure of thermal plasma (cm-3).
             Needs to be a double precision number!! (e.g., 1.0d50)
 KEYWORDS (INPUT):
        /thermal = calculate thermal spectrum instead of power law.
        energy = energy values for intensities.
                  If not specified, 161 values from 0...160 keV are used
 OUTPUTS:
        intens = intensity distribution [photons cm-2 s-1 keV-1].
 KEYWORDS (OUTPUT):
        energy = energy values of intensity distribution
 CALLS: ***
	BETAI, GAMMA
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        uses procedure betai in statlib.
 PROCEDURE:
        Thermal model: Crannel et al. 1978
        Nonthermal: above e0 : straightforward,
                    below e0 : needs to be checked!
 MODIFICATION HISTORY:
        JPW, Nov. 1992


hxs_chsums $SSW/yohkoh/ucon/idl/mctiernan/hxs_chsums.pro
[Previous] [Next]
 NAME:
	hxs_chsums
 PURPOSE:
	Gets HXS data out of the data structure, maybe sums over minor frames.
       Reforms the data, And maybe returns count rates. 
 CALLING SEQUENCE:
	zz=hxs_chsums(index,data,one_sec=one_sec,
                     tim_arr=tim_arr, dt=dt, cps=cps, tim_sec=tim_sec)
 INPUT:
       index= index structure, 
	data=data structure from rd_wda
 OUTPUT:
       zz= decompressed data 
 KEYWORDS:
       one_sec= if set, don't sum over the minor frames
       tim_arr= a time array will be passed out, in ANYTIM2INTS structure
       dt= time intervals
       cps= if set, this will do counts/sec,
       tim_sec= time array in seconds, starting at zero
 CALLS: ***
	anytim2ints [1], anytim2ints [2], dprate2sec [1], dprate2sec [2], hxs_dead
	mk_timarr [1], mk_timarr [2]
 CALLED BY:
	hxs_fsp, hxsgrs_fsp
 HISTORY:
	10-May-93, JM
       Added reform, index and tim_arr keywords, for plotting convenience,
                     28-jul-94, jmm
       Changed some stuff, rewrote as hxs_chsums for HXS
       Added tim_sec, 6-26-95, jmm


hxs_dead $SSW/yohkoh/ucon/idl/mctiernan/hxs_dead.pro
[Previous] [Next]
 NAME:
	hxs_dead
 CALLING SEQUENCE:
	zz=hxs_dead(index,data)
 PURPOSE:
	Decompresses HXS data, and calculates 
	dead time correction for the appropriate interval
 INPUT:
	index= data info.
	data= hxs data structure
 OUTPUT:
	zz=decompressed and dead time corrected HXS counts
 HISTORY
	Dec '92 JMcT, new correction lifted from
       /ys/ucon/soft/ohki/hxs_sp1.pro, 2-feb-94, JMM
 CALLS:
 CALLED BY
	hxs_chsums


hxs_fsp $SSW/yohkoh/ucon/idl/mctiernan/hxs_fsp.pro
[Previous] [Next]
 NAME:
	hxs_fsp
 CALLING SEQUENCE:
	hxs_fsp,index,data,fit_pars,sc_par,ch_dta,outfile=outfile,$
		pfile=pfile,sdel=sdel,countfile=countfile,fix_pars=fix_pars,$
               st_times=st_times,int_times=int_times,tyspec=tyspec,$
               bck_time=bck_time,bck_dt=bck_dt,noplot=noplot, $
               dt_resolution=dt_resolution,auto_bck=auto_bck, $
               auto_tim=auto_tim,nbcks=nbcks,nbsigmas=nbsigmas, $
               channel=channel, alt_tsel=alt_tsel, nsigmas=nsigmas, $
               erange=erange, sys_err=sys_err, two_bck=two_bck, $
               auto_peak=auto_peak, init_a=init_a
 PURPOSE:
	Fits spectra for the HXS YOU choose the data interval
 INPUT:
	index= data info. structure from rd_wda
	data=data structure from rd_wda
 OUTPUT:
	fit_pars, a structure of type {fitinfo}, for each interval, with tags:
		tyspec= type of spectrum
		ma= no. of parameters fit
		alabels = labels for the fit parameters
		t= the interval START times, in the 7 element array
		dt= the interval lengths
		a= the fit parameters, a fltarr(6)
 			tyspec  =1 a(0)=K, a(1)=gamma
				=2 a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
				=3 a(0)=em/1.0e47, a(1)=T/1.0e6
				=4 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
				=5 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
				=6 a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
				=7 a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		                =8 a(0)=em/1.0e47, a(1)=T/1.0e6, 
			           a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		                =9 a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			           a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			           a(5)=eb2 (between gamma2 and gamma3)
                               =10 a(0)=em/1.0e47, a(1)=T/1.0e6
                               =11 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
 		                =12, a(0)=K, a(1)=gamma, a(2)=e0
 		                =13, a(0)=K, a(1)=gamma, a(2)=e0
		sa= uncertainties in the fit parameters
               ffx= 0 if the associated parameter is free, 1 if fixed at a
                    user defined value, 2 if fixed at the value initially
                    given by ainit.
		chi2= chi^2
		nch= the number of channels for each interval
		fluxc= flux correction if any
		nsig= # of sigmas above background for good channels.
		flags= saturated flag, incomplete flag, channel event 
			was found in, highest channel included in fit, 
			mro flag.
	sc_par, a structure containing data for each sc channel, tags:
		e10= channel low energy edges
		e20= channel high energy edges
		eb0= channel midpt energy
		bck= background count rates, for the two bck intervals, fltarr(2)
		sbck= Uncertainty in bck
		tb= the background START time for two background intervals, an array of(7, 2)
		dtb= the bck time interval, fltarr(2)
	ch_dta, a structure containing data for each channel for each interval
		y0= incident count rates
		sy0= Uncertainty in y0
		chok=channel flag, 0 for channels used in fit , 
				   1 for channel not used
               b0 = background count rate
               sb0 = uncertainty in b0
               f0 = photon flux in the channel, for most cases f0 is
                    the flux at the channel energy, for thermal  + line fits
                    f0 is the average photon flux in that channel.
                    Note that f0 = model flux * ((y0-b0)/c0)
               sf0 = uncertainty in f0.      
 KEYWORD INPUT:
	outfile= the output file, a keyword
	pfile= a file for spectral plots
       sdel= array of channels to delete
       countfile= a file name for the accumulated counts which can 
                  be used as input to fsp_proc.pro, no fit is done
                  if you set this keyword.
       fix_pars= if set, you choose parameters to be fixed
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. Must be an integer
                  number of seconds, if the value of int_times is less than
                  a minor frame value, e.g., when not in flare mode,
                  we'll try to adjust.
	tyspec=the spectral type, if not set, the program prompts you
	      = 1 for single p.l.
	      = 2 for double p.l.
	      = 3 for single thermal
	      = 4 for p.l. + thermal
	      = 5 for thermal + thermal
	      = 6 for p.l. + p.l.
	      = 7 thermal below Ebr, p.l. above Ebr
             = 8 for thermal plus double p.l.
             = 9 for triple p.l.
             = 10 thermal including line emission
	      = 11 for p.l. + thermal, includes SXR lines
	nsigmas= the number of sigmas above background for a "good" channel,
		=3.0 as a default
       bck_time= a background time, in any yohkoh format
       bck_dt= the background accumulation time, bck_time must be set,
               If bck_dt is not set dtb=120.0 seconds is used.
       noplot= if set, don't put up a screen plot
       dt_resolution= The number of datasets per fit interval,
                      In flare mode, it's the number of seconds
                      In QT mode, it's the number of 8 second intervals.
                      If set to -1, use the whole interval.
;;;;;;;;;;;;;;;;;;;;;;This will only operate if the time is selected by
;;;;;;;;;;;;;;;;;;;;;;the user, or the st_times keyword has only one element.
       auto_bck= if set, the background interval is obtained automatically
       auto_tim= if set, the flare interval is obtained automatically
       FOR AUTOMATIC TIME SELECTION:
       nbcks = if set, the number of background levels above the
               background that the data within trange must be, 
               i.e., data - bck > nbcks*bck, the default is 1.0, 
               if not set. If both nbcks and nbsigmas are set,
               nbcks gets used.
       nbsigmas = if set, the number of sigmas above the background
                 that the data within trange must be, no default, 
                 i.e., data - bck > nbsigmas*sigma(bck). Note here that
                 we assume that the background is Poisson distributed,
                 even if that is not true.
       channel=channel to use for choice of background and interval
               The default is to sum the counts over all channels.
       alt_tsel = uses ALT_TIM_SEL to obtain interval, rather than PLOT_LCUR
                  Useful if you don't have x-windows. 
       erange= an energy range to be used for the spectral fit, channels with
               middle energies between the two limits are included. Channels
               specified using sdel are still deleted, but the user is not
               prompted for channels to delete if erange is supplied.
       sys_err= a 'systematic error', pass in if you don't trust the
                errors you get from counting stats, or to arbitrarily
                push down chi^2 values, or in cases where different
                instruments cause counts mismatches. The default iz 0.0
                This makes the error in the rate = sqrt(cps/dt)+sys_err*cps.
       two_bck= choose two background intervals, the default is to choose one,
       auto_peak= if set, find the peak interval for the
                  appropriate channel and fit it, if set to -1 this will
                  prompt you for an ok for the spot. if not, no prompt...
       init_a= initial values for the fit parameters, can be an array
               of (number of fit parameters, ntimes)
 CALLS: ***
	OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], UTPLOT [1], UTPLOT [2], UTPLOT [3]
	UTPLOT [4], UTPLOT [5], UTPLOT [6], accum_counts [1], accum_counts [2]
	accum_counts [3], any_fsp, anyrts, anytim2ex [1], anytim2ex [2], anytim2ints [1]
	anytim2ints [2], bck_interval, choose_interval, fmt_tim [1], fmt_tim [2], fsc_init
	hxs_chsums, yesnox [1], yesnox [2]
 HISTORY:
	Written Summer '92 by JMcT
	Changed to strucutres Dec '92 (JM)
       Added 1 sec time resolution, and changed to use
       any_fsp.pro Sep-93 (JM)
       Added countfile option, to replace hxsrts.pro 21-oct-93 (JMM)
       adapted to use non-flare mode data 28-oct-93 (JMM)
       Added fixed parameters option, 5-JAN-94 (JMM)
       Added st_times, int_times bck_time, bck_dt keywords, 9-Mar-94 (JMM)
       Changed to used of sel_timrange for those keywords, 24-mar-94 (JMM)
       Added the dt_resolution, auto, and channel keywords, 29-jul-94, jmm
       Stripped out accumulation stuff, replaced it with calls to ACCUM_COUNTS,
       and CHOOSE_INTERVAL, 30-mar-95, jmm
       added erange keyword, 5-apr-95, jmm
       added sys_err keyword, 24-jun-95, jmm
       Different output structures, two background, intervals, 26-jul-95, jmm
       Added init_a, testing, 3-oct-95, jmm
       Replace background code to use BCK_INTERVAL, 22-apr-1996, jmm


hxsgrs_fsp $SSW/yohkoh/ucon/idl/mctiernan/hxsgrs_fsp.pro
[Previous] [Next]
 NAME:
	hxsgrs_fsp
 CALLING SEQUENCE:
	hxsgrs_fsp,index,data,fit_pars,sc_par,ch_dta,outfile=outfile,$
		pfile=pfile,sdel=sdel,countfile=countfile,fix_pars=fix_pars,$
               st_times=st_times,int_times=int_times,tyspec=tyspec,$
               bck_time=bck_time,bck_dt=bck_dt,noplot=noplot, $
               dt_resolution=dt_resolution,auto_bck=auto_bck, $
               auto_tim=auto_tim,nbcks=nbcks,nbsigmas=nbsigmas, $
               channel=channel, alt_tsel=alt_tsel, nsigmas=nsigmas, $
               erange=erange, sys_err=sys_err, zzb=zzb, two_bck=two_bck, $
               auto_peak=auto_peak, hxs_choose=hxs_choose, grs_choose=grs_choose, $
               init_a=init_a
 PURPOSE:
	Fits spectra for a combination of HXS and the first 32 channels
       of GRS1, YOU choose the data interval. Note that the lowest GRS
       channel is deleted in all of these fits...
 INPUT:
	index= data info. structure from rd_wda
	data=data structure from rd_wda
 OUTPUT:
	fit_pars, a structure of type {fitinfo}, for each interval, with tags:
		tyspec= type of spectrum
		ma= no. of parameters fit
		alabels = labels for the fit parameters
		t= the interval START times, in the 7 element array
		dt= the interval lengths
		a= the fit parameters, a fltarr(6)
                  NOTE ON UNITS: for Power laws, K is the differential flux
                                 at 1keV, in photons/(sec-cm^2-keV).
                                 Break energies (ebr) are in keV.
                                 For thermal fits, em is the Emission Measure
                                 in cm^(-3) but the output EM is normalized
                                 by 1.0e47. T is in Kelvin, but the output
                                 temperatures are in MK. (T/10^6)
 			tyspec  =1 a(0)=K, a(1)=gamma
				=2 a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
				=3 a(0)=em/1.0e47, a(1)=T/1.0e6
				=4 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
				=5 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
				=6 a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
				=7 a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		                =8 a(0)=em/1.0e47, a(1)=T/1.0e6, 
			           a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		                =9 a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			           a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			           a(5)=eb2 (between gamma2 and gamma3)
                               =10 a(0)=em/1.0e47, a(1)=T/1.0e6
                               =11 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
 		                =12, a(0)=K, a(1)=gamma, a(2)=e0
 		                =13, a(0)=K, a(1)=gamma, a(2)=e0
		sa= uncertainties in the fit parameters
               ffx= 0 if the associated parameter is free, 1 if fixed at a
                    user defined value, 2 if fixed at the value initially
                    given by ainit.
		chi2= chi^2
		nch= the number of channels for each interval
		fluxc= flux correction if any
		nsig= # of sigmas above background for good channels.
		flags= saturated flag, incomplete flag, channel event 
			was found in, highest channel included in fit, 
			mro flag.
	sc_par, a structure containing data for each sc channel, tags:
		e10= channel low energy edges
		e20= channel high energy edges
		eb0= channel midpt energy
		bck= background count rates, for the two bck intervals, fltarr(2)
		sbck= Uncertainty in bck
		tb= the background START time for two background intervals, an array of(7, 2)
		dtb= the bck time interval, fltarr(2)
	ch_dta, a structure containing data for each channel for each interval
		y0= incident count rates
		sy0= Uncertainty in y0
		chok=channel flag, 0 for channels used in fit , 
				   1 for channel not used
               b0 = background count rate
               sb0 = uncertainty in b0
               f0 = photon flux in the channel, for most cases f0 is
                    the flux at the channel energy, for thermal  + line fits
                    f0 is the average photon flux in that channel.
                    Note that f0 = model flux * ((y0-b0)/c0)
               sf0 = uncertainty in f0.      
               c0 = Model Excess count rates
 KEYWORD INPUT:
	outfile= the output file, a keyword
	pfile= a file for spectral plots
       sdel= array of channels to delete
       countfile= a file name for the accumulated counts which can 
                  be used as input to fsp_proc.pro, no fit is done
                  if you set this keyword.
       fix_pars= if set, you choose parameters to be fixed
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. Must be an integer
                  number of seconds, if the value of int_times is less than
                  a minor frame value, e.g., when not in flare mode,
                  we'll try to adjust.
	tyspec=the spectral type, if not set, the program prompts you
	      = 1 for single p.l.
	      = 2 for double p.l.
	      = 3 for single thermal
	      = 4 for p.l. + thermal
	      = 5 for thermal + thermal
	      = 6 for p.l. + p.l.
	      = 7 thermal below Ebr, p.l. above Ebr
             = 8 for thermal plus double p.l.
             = 9 for triple p.l.
             = 10 thermal including line emission
	      = 11 for p.l. + thermal, includes SXR lines
	nsigmas= the number of sigmas above background for a "good" channel,
		=3.0 as a default
       bck_time= a background time, in any yohkoh format
       bck_dt= the background accumulation time, bck_time must be set,
               If bck_dt is not set dtb=120.0 seconds is used.
       noplot= if set, don't put up a screen plot
       dt_resolution= The number of datasets per fit interval,
                      In flare mode, it's the number of 4 second GRS intervals
                      In QT mode, it's the number of 32 second intervals.
                      If set to -1, use the whole interval.
;;;;;;;;;;;;;;;;;;;;;;This will only operate if the time is selected by
;;;;;;;;;;;;;;;;;;;;;;the user, or the st_times keyword has only one element.
       auto_bck= if set, the background interval is obtained automatically
       auto_tim= if set, the flare interval is obtained automatically
       FOR AUTOMATIC TIME SELECTION:
       nbcks = if set, the number of background levels above the
               background that the data within trange must be, 
               i.e., data - bck > nbcks*bck, the default is 1.0, 
               if not set. If both nbcks and nbsigmas are set,
               nbcks gets used.
       nbsigmas = if set, the number of sigmas above the background
                 that the data within trange must be, no default, 
                 i.e., data - bck > nbsigmas*sigma(bck). Note here that
                 we assume that the background is Poisson distributed,
                 even if that is not true.
       channel=channel to use for choice of background and interval
               The default is to sum the counts over all channels.
               here channel refers to either HXS or GRS
       alt_tsel = uses ALT_TIM_SEL to obtain interval, rather than PLOT_LCUR
                  Useful if you don't have x-windows. 
       erange= an energy range to be used for the spectral fit, channels with
               middle energies between the two limits are included. Channels
               specified using sdel are still deleted, but the user is not
               prompted for channels to delete if erange is supplied.
       sys_err= a 'systematic error', pass in if you don't trust the
                errors you get from counting stats, or to arbitrarily
                push down chi^2 values, or in cases where different
                instruments cause counts mismatches. The default iz 0.0
                This makes the error in the rate = sqrt(cps/dt)+sys_err*cps.
       zzb = Don't use this... zero background
       two_bck= choose two background intervals, the default is to choose one
       auto_peak= if set, find the peak interval for the
                  appropriate channel and fit it, if set to -1 this will
                  prompt you for an ok for the spot. if not, no prompt...
       hxs_choose= use hxs to choose the intervals, this is the default
       grs_choose= use grs to choose the intervals
       init_a= initial values for the fit parameters, can be an array
               of (number of fit parameters, ntimes)
 CALLS: ***
	OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], UNIQ [1], UNIQ [2], UNIQ [3], UTPLOT [1]
	UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], accum_counts [1]
	accum_counts [2], accum_counts [3], any_fsp, anyrts, anytim2ex [1], anytim2ex [2]
	anytim2ints [1], anytim2ints [2], auto_bck_find, choose_interval, fmt_tim [1]
	fmt_tim [2], grsl1_dead [1], grsl1_dead [2], grsl2_dead, hxs_chsums, yesnox [1]
	yesnox [2]
 HISTORY:
	Written Summer '92 by JMcT
	Changed to strucutres Dec '92 (JM)
       Added 1 sec time resolution, and changed to use
       any_fsp.pro Sep-93 (JM)
       Added countfile option, to replace hxsrts.pro 21-oct-93 (JMM)
       adapted to use non-flare mode data 28-oct-93 (JMM)
       Added fixed parameters option, 5-JAN-94 (JMM)
       Added st_times, int_times bck_time, bck_dt keywords, 9-Mar-94 (JMM)
       Changed to used of sel_timrange for those keywords, 24-mar-94 (JMM)
       Added the dt_resolution, auto, and channel keywords, 29-jul-94, jmm
       Stripped out accumulation stuff, replaced it with calls to ACCUM_COUNTS,
       and CHOOSE_INTERVAL, 30-mar-95, jmm
       added erange keyword, 5-apr-95, jmm
       added sys_err keyword, 24-jun-95, jmm
       Different output structures, two background, intervals, 26-jul-95, jmm
       Rewrote HXS_FSP into HXSGRS_FSP, it's easier to deal with all of
       the changes, 28-jul-95, jmm
       added init_a, 23-oct-95, jmm


HXT2SXSPC $SSW/yohkoh/ucon/idl/takahash/hxt2sxspc.pro
[Previous] [Next]
NAME: 
        HXT2SXSPC
PURPOSE:
        Estimate SXS-PC counting rate with electron
        temperature and emission measure derived from
        HXT. After you do HXT_THERMAL and obtain the
        electron temperature and emission measure,
        this procedure should be done.
INPUT:
        te_em  -  Te and EM derived from HXT_THERMAL
OUTPUT:
        ** Structure HXT2SXSPC, 4 tags,
           PC11         DOUBLE    Array
           PC12         DOUBLE    Array 
           PC21         DOUBLE    Array
           PC22         DOUBLE    Array
 CALLS: ***
	gt_day [1], gt_day [2]
EXAMPLE:
           idl> pc_data=hxt2sxspc(te_em,index)
PLOT:
          Use UTPLOT in the following,
           idl> utplot,time,pc_data.pc11,index(0)
           idl> utplot,time,pc_data.pc11,index(0)
           where time is the array derived from MK_TIMARR
HISTORY:
          M.Tatakahashi (Tokai Univ.) 16-Aug-93


HXT_4CHPLOT $SSW/yohkoh/ucon/idl/sakao/hxt_4chplot.pro
[Previous] [Next]
 NAME:
	HXT_4CHPLOT
 PURPOSE:
	Plots a set of HXT 4 ch time profiles either on display or on lp 
	paper. See E-32 of the IDL manual for postscript fonts. 
 CALLING SEQUENCE:
	hxt_4chplot,index,data,/psout
	hxt_4chplot,index,data,timerange=10
 INPUT:
	index	- HXT index
	data	- HXT data
 CALLS: ***
	ANYTIM2MSV, AVE_CTS, CLOSE_PAPER, MSV2INTS, UTPLOT [1], UTPLOT [2], UTPLOT [3]
	UTPLOT [4], UTPLOT [5], UTPLOT [6], UT_VLINE, WDEF [1], WDEF [2], gt_day [1]
	gt_day [2], gt_time [1], gt_time [2]
 OPTIONAL KEYWORD INPUT:
	timerange	- If set, time interval of the X-axis is fixed to the 
			  specified value (in units of min.).
	psout		- If set, a PS file `idl.ps' is prepared.
	title		- If set, you can change titles for the plots
			  (default: e.g. `15 NOV 1991 FLARE')
	yrange		- If set, max. scale for each ch is specified.
				e.g. yrange = [100,-1,-1,-1]
	showsec		- If set, then the X-label time format will be 
			  HH:MM:SS instead of HH:MM (default). 
	movelabel	- If set, then then energy bands are shown at the 
			  top-left corner of each panel.
	vtrange		- Has a format of STRARR([stime,etime],4Ch) = (2,4).
			  If this option is set, then a set of two vertical 
			  lines are shown in each of the four panels so as to 
			  display data integration time intervals. 
	vlinestyle	- Specifies line style of vertical lines displayed by 
			  the vtrange option.
 OUTPUT:
	none
 OPTIONAL KEYWORD OUTPUT:
	pages		- Returns number of pages (or windows) of the plot.
 SIDE EFFECTS:
	A window is displayed on the screen.
 RESTRICTIONS:
	Option `timerange' is still not adequate for flares lasting more than 
	the value specified.
	This restriction was removed in ver.1.3.
 HISTORY:
	version 1.0	93.07.29 (Thu)	T.Sakao written.
	version 1.1	93.08.11 (Wed)
		Options xminor and yminor added.
  	version 1.2	94.02.15 (Tue)
		Option timerange added.	
	version 1.3	94.02.28 (Sat)
		Available for multiple-pages outputs.
	version 1.4	94.03.31 (Thu)
		A bug in QT-flare with no timerange option was fixed.
	version 1.5	94.09.19 (Mon)
		Option yrange added.
	version 1.6	94.10.03 (Mon)
		A bug associated with yrange was fixed.
	version 1.7	95.12.29 (Fri)
		Option showsec added.
	version 1.8	97.12.14 (Sun)
		Option movelabel added.
	version 1.9	98.05.07 (Thu)
		Options vtrange and vlinestyle added.


hxt_anycomp $SSW/yohkoh/ucon/idl/mctiernan/hxt_anycomp.pro
[Previous] [Next]
 NAME:
       hxt_anycomp
 PURPOSE:
       Calculates the expected HXT response for a spectral fit
 CALLING SEQUENCE:
       cps = hxt_anycomp(tyspec, a)
 INPUT:
       tyspec= spectral type, 
       a = fit parameters, an array of (ma, ntimes)
         tyspec=1, single p.l., a(0)=K, a(1)=gamma
		=2, double p.l., a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
			(ebr is the break energy in keV)
		=3, Thermal, a(0)=em/1.0e47, a(1)=T/1.0e6
		=4, Thermal + p.l., a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, 
			a(3)=gamma
 	        =5, Double Thermal, a(0)=em1/1.0e47, a(1)=T1/1.0e6, 
			a(2)=em2/1.0e47, a(3)=T2/1.0e6
		=6, p.l.+p.l., a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
		=7, Thermal below Ebr, p.l. above Ebr, 
			a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		=8 Thermal + double p.l., a(0)=em/1.0e47, a(1)=T/1.0e6, 
			a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		=9 Triple P.L.,  a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			a(5)=eb2 (between gamma2 and gamma3)
		=10, Thermal, a(0)=em/1.0e47, a(1)=T/1.0e6, includes
                    SXR lines
		=11, Thermal + p.l., a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, 
			a(3)=gamma, includes  SXR lines
 		=12, single p.l. flattens below e0, a(0)=K, a(1)=gamma, a(2)=e0
 		=13, single p.l. cuts off below e0, a(0)=K, a(1)=gamma, a(2)=e0
 	        =14, Double Thermal, a(0)=em1/1.0e47, a(1)=T1/1.0e6, 
			a(2)=em2/1.0e47, a(3)=T2/1.0e6, includes lines
               =95, Double PL, Tcutoff at 30 MK, Tb = 5MK
                    a(0) = EM at 1MK, a(1) = low pl. index OF T,
                    a(2) = high pl. index of T
               =96, Double Power Law in temperature, variable T cutoff, Tb=5MK
                    a(0) = EM at 1MK, a(1) = low pl. index OF T,
                    a(2) = high pl. index of T, a(3) = cutoff T
               =97, Gaussian in temperature
                    a(0) = EM at peak, a(1) = peak T, a(2) = width in T
               =98, Power Law in temperature, variable T cutoff,
                    a(0) = EM at 1MK, a(1) = pl. index OF T, a(2) = Max. T
               =99, Power Law in temperature, constantT cutoff,
                    a(0) = EM at 1MK, a(1) = pl. index OF T
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], Countrate, Multresponses
	concat_dir [4], fdf10_init, ma_labels
 CALLED BY:
	hxt_fsp1
 HISTORY:
      2-Apr-1996, jmm


HXT_AUTOIMG $SSW/yohkoh/hxt/idl/atest/hxt_autoimg.pro
[Previous] [Next]

function hxt_autoimg,files, iindex_out, idata_out, $
                     counts_per_interval = cpi, $
                     accum_chan = accum_chan, $
                     channels = channels, $
                     n_pix = n_pix, $
                     expfac = expfac, $
                     xy=xy, $
                     hxi_directory = hxi_directory, $
                     psout=psout, $
                     error=ierror_out, $
                     pixons=pixons, $
                     sensitivity=sensitivity, $
                     resolution=resolution, $
                     pixon_sizes=pixon_sizes, $
                     pixon_map=ipmap_out, $
                     flare_list=flare_list, $
                     trange=trange, $
                     btrange=btrange, $
                     ss=ss, $
                     lambda_max=lambda_max, $
                     nolook=nolook, notty=notty,_extra=_extra

NAME:
     HXT_AUTOIMG
PURPOSE:
     Generate HXT images automatically
CATEGORY:
CALLING SEQUENCE:
     hxi_files = hxt_autoimg(files, index_out, data_out)
INPUTS:
     files = string array of hda file names to process.  Should include
             the full path to the file.
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS:
    hxi_directory = path where the HXI files should be saved
    counts_per_interval = attempt to get this many counts per time interval
                          in channle accum_chan.  Default = 1000.
    accum_chan = channel to do the accumulation in (default = LO channel)
                 (LO=0, M1=1, M2=2, HI=3)
    channels = vector of channel numbers to image.  Default = [0,1] 
    n_pix = size of image.  Default = 64
    expfac = image scale expansion factor.  Default = 1.0 (SXT size pixels)
    error = returns with error estimate on the images.
    /psout =  write a .ps file summarizing the image selections.  The
            summary is output to the current device by default.
    /pixons = Use pixon reconstruction.  Very slow!
    flare_list = list of flares to analyze.  This is only relevant if there
                 are multiple flares in a file.  To analyze just the first
                 flare in the file use flare_list=[0], the second [1], the
                 first and the second, [0,1], etc.
    trange = time range to analyze.  This keyword overrides the automatic
             selection.  There should be an even number of elements.  Each
             pair gives one time range.
    btrange = the time of the background suptraction.  overides the default.
              must be a 2 element array giving the start and end time.
    ss = index array which selects a subset of the data elements in the 
         specified file.  Only works for a single file.
    nolook = do not display intermediate images.  Also see /notty for pixons.
    *** PIXON ONLY KEYWORDS:
    pixon_map = returns with the pixon_maps for the images
    pixon_sizes = list of pixon sizes to use
    resolution = size of smallest pixon
    sensitivity = sensitivity of pixon map to weak sources (0.0 = most
                  sensitve, 3.0 is rather insensitive to weak sources)
    /notty = do not display images
    *** MEM ONLY KEYWORDS
    lambda_max = max value of lambda allowed
OUTPUTS:
     hxi_files = string array of hxi file names written
     index_out = HXI index for the output images
     data_out = reconstructed images
 CALLS: ***
	DATA_PATHS, OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], RD_XDA [1], RD_XDA [2], RSTRPOS
	SPLITSTR, SQUEEZE, TIME2FILE, UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4]
	UTPLOT [5], UTPLOT [6], auto_bck_find, data_paths2 [1], data_paths2 [2]
	file_list [1], file_list [2], fmt_tim [1], fmt_tim [2], get_hxt_pos, gt_center
	gt_dp_mode [1], gt_dp_mode [2], hxt_multimg, int2secarr [1], int2secarr [2]
	tim2orbit [1], tim2orbit [2]
 CALLED BY:
	multi_hda2hxi
COMMON BLOCKS:
SIDE EFFECTS:
     Writes hxi files.
RESTRICTIONS:
     The background interval is always calculated from the LO lightcurve.
PROCEDURE:
     Uses MEM image reconstruction and outputs HXI files with the
     reconstructed images.

     The result is written to an hxi file and a summary of the image times
     is written to a postscript file.
MODIFICATION HISTORY:
     T. Metcalf 1997-06-18
     T. Metcalf 1997-06-19  Added ps output.
     T. Metcalf 1997-06-20  Compute background from LO rather than M1.
                            Added night, fms, and saa checks
     T. Metcalf 1997-12-19  Added a work around for a background which is 
                            at the start or end of flare mode.  Added a few
                            more pixon keywords.
     T. Metcalf 1999-Feb-22 Added trange keyword.
     T. Metcalf 1999-Jun-07 Added ss keyword
     T. Metcalf 1999-Jun-28 Protected the output index and data to avoid
                            structure conflicts.  Also catch errors when
                            using file_list to look for a matching spr file.
     T. Metcalf 1999-Jul-01 The previous fix did not work with files w/o
                            flare mode.  Fixed this bug.
     T. Metcalf 1999-Oct-27 Added the btrange keyword to override the default
                            background times.
     T. Metcalf 2001-Aug-28 Added nolook and notty keywords.
     T. Metcalf 2003-Jan-23 Added lambda_max and _extra keywords.
                            Fixed a couple of small bugs which
                            cropped up for (1) a very short flare
                            interval and (2) multiple files indexing
                            bug.  Both caused the code to crash but
                            did not produce erroneous results.
     T. Metcalf 2003-Jan-24 /notty now turns off all graphics.


HXT_BACK $SSW/yohkoh/ucon/idl/hudson/hxt_back.pro
[Previous] [Next]
 NAME:
	HXT_BACK
 PURPOSE:
	HXT background rates estimator for HXT_SPECTRA
 CALLING SEQUENCE:
	hxt_back,channels,backs,plot=plot
 EXPLANATION:
	this is called by HXT_SPECTRA. It finds the background in HI
	  by determining the peak of the histogram. Other channels
	  are scaled to this (set at 0, in fact, in the first version).
       to see how well the background is working, run this separately
         with the /plot option.
 KEYWORDS:
 	/plot shows the background level against the HI time series 
 INPUTS: 
	channels (from HXT_SUMMER)
 OUTPUTS: 
	backs = fltarr(4) are the background estimates
 CALLS: ***
	GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3], GAUSSFIT [4], GAUSSFIT [5], OUTPLOT [1]
	OUTPLOT [2], OUTPLOT [3], STDEV, UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4]
	UTPLOT [5], UTPLOT [6]
 CALLED BY:
	HXT_SPECTRA
 HISTORY:
	written by HSH, August 12, 1992


hxt_back_sub $SSW/yohkoh/ucon/idl/metcalf/hxt_back_sub.pro
[Previous] [Next]
NAME:
	hxt_back_sub
PURPOSE:
	Subtracts the background from the image count rate, and rearranges
	the order of the data so that the correct count rates are matched to 
	the correct Sub Collimators.
CALLING SEQUENCE:
	hxt_back_sub,hxi_index,counts,bcounts,fobs,sig
INPUT:	
	hxi_index= Structure with info pertaining to image
	tags:
	hxi_index.actim= Flare accumulation time
	hxi_index.bkg_actim= Background accumulation time
	hxi_index.chan= channel number
	counts= Flare total counts, all SC's, all channels
	bcounts= Background counts
	sig= Uncertainty in counts
OUTPUT:
	fobs= Counts - Background
	sig= Uncertainty in fobs
 CALLS: ***
	SETGRA
 CALLED BY:
	HXTPIXON
MODIFICATION HISTORY:
	Adapted from Fortran routine HXTSBT of T. Sakao, by J McTiernan, July '92
       T. Metcalf 1994-09-08  Modified McTiernan's hxtsbt.pro to do the errors
          assuming that sig is defined on input.
       Jmm, 1-12-94, took out truncation of excess counts.


HXT_BACKGROUND $SSW/yohkoh/ucon/idl/hudson/hxt_background.pro
[Previous] [Next]
 NAME:
	HXT_BACKGROUND
 PURPOSE:
	estimate HXT background rates
 INPUTS:
 OUTPUTS:
	summed background counting rates, per cm^2 sec
 CALLING SEQUENCE:
	hxt_background,backs
 KEYWORDS
 OUTPUTS:
	fltarr(4)
 WARNING:
	at present this just reports mean values for ten arbitrary
	  flares. In an ideal world, somebody would do a parametric
	  study of the background variations with geomagnetic
	  parameters, time, orbital position, etc. - meanwhile,
	  the values reported here may be off by 10-20% or ??
 CALLED BY:
	HXT_SUMMER, HXT_TEEM, HXT_TEMPS, hxt_impulsivness, hxt_survey
 HISTORY:
	written by HSH, November 21, 1992


HXT_BTOT $SSW/yohkoh/ucon/idl/metcalf/hxt_btot.pro
[Previous] [Next]

function hxt_btot,data,patt,weights=ci,guess=guess, $
                  maxval=maxval, minval=minval, maxerr=maxerr, minerr=minerr
NAME:
     HXT_BTOT
PURPOSE:
     Computes the total expected number of counts in an HXT image
     using a weighted sum of the subcollimator data.  The weights
     are determined from the modulation patterns.
CATEGORY:
CALLING SEQUENCE:
     btot = hxt_btot(data,patterns)
INPUTS:
     data = vector of subcollimator data.  fltarr(nd,nchan,nimages)
            or fltarr(nd,nchan) for a single image.
     patterns = modulation patterns.  fltarr(nx,ny,nd,nchan) or
                fltarr(nx,ny,nd) for a single channel.
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS
     weights = on output, contains the weights.  fltarr(nd,nchan)
     guess = input, an initial guess for the weights.  fltarr(nd,nchan)
     minval = output, the minimum value of the sum array, fltarr(nchan)
              (should be close to 1.0)
     maxval = output, the maximum value of the sum array, fltarr(nchan)
              (should be close to 1.0)
     minerr = output, the minimum possible error in btot, fltarr(nchan)
              The minimum error would occur for a very extended source.
     maxval = output, the maximum possible error in btot, fltarr(nchan)
              The maximum error would occur for a point source at the
              worst possible place.
OUTPUTS:
     btot = total expected counts in any image reconstructed from
            data.  fltarr(nchan,nimages)
 CALLS: ***
	HXT_BTOT_FUNC, HXT_BTOT_GRAD
 CALLED BY:
	hxt_multimg
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
     The calculation of the weights is very time consuming.  However,
     once the weights are computed, the calculation of the total
     counts is fast.  So, if you are computing the total counts 
     at a number of time steps, do all the time steps in a single
     call to hxt_btot so that the weights do not have to be recomputed
     for every time step.

     If the min or max value of the sum array is not 1.0, the 
     estimate of the total count rate will have reduced accuracy.

     The transpose function and the ## operator require IDL version
     4 or above.
PROCEDURE:
     If a set of weights for the mod patterns can be found such
     that the sum of the weighted mod patterns is identically 1, 
     the the total counts in the image is equal to the sum of the 
     sumcollimator data using the same weights.
MODIFICATION HISTORY:
     T. Metcalf  1997-01-17
                 1997-Jul-08 Fixed max error print statement (TRM)
                 1998-Jul-02 Changed warning to 10% error


hxt_cal_repair $SSW/yohkoh/ucon/idl/sato/hxt_cal_repair.pro
[Previous] [Next]
NAME: 
hxt_cal_repair
PURPOSE
 correction of saturated decompressed data in HXT
CALLING SEQUENCE:

 This procedure should be used in reform_hxtcal2
 hdata=hxt_cal_repair(hres(ch      ,sc,    datnum),1)
   hres=reformed cal data 1-64 ele.,1-64 ele., 
INPUTS:
 hxt decompressed data should be inputted as hres
OPTIONAL INPUT 
 If ref_phase is 0, we assume that FIRST of data is not saturated.
 If ref_phase is 1, we assume that END of data is not saturated.
 default is 0
 CALLED BY:
	reform_hxtcal2
RESTRICTIONS:
 Inputted hxt decompressed data near the end 
   must be no saturated data in case of default.
NOTE:
1. This data correction does NOT CONSIDER dead time correction and 
   RAPID INCREASE/DECREASE > 128 cts/SC during 8 sec.
MODIFICATION HISTORY:
 Jun Sato 4-dec-97


hxt_chsums $SSW/yohkoh/hxt/idl/atest/hxt_chsums.pro
[Previous] [Next]
 NAME:
	hxt_chsums
 PURPOSE:
	sums the HXT channel data over all the SC's and maybe minor frames,
       If full resolution, the data is reformed.
CATEGORY:
       Yohkoh HXT
 CALLING SEQUENCE:
	zz=hxt_chsums(index,data,half_sec=half_sec,tim_sec=tim_sec,$
                     tim_arr=tim_arr, dt=dt, cps=cps, index_out=index_out,$
                     data_out=data_out)
 INPUT:
	data=data structure from rd_hda, do not decompress before using
 OUTPUT:
       zz= decompressed data summed over subcollimators and maybe minor frames
 KEYWORDS:
       half_sec= if set, don't sum over the minor frames
       tim_arr= time array in ANYTIM2INTS structure, corrected fot the
                HXT time lag, At the START of the accumulation interval
       tim_sec= time array in seconds starting at zero
       dt= time intervals, if index is passed in.
       cps= if set, this will do counts/sec,
       index_out= index to be passed out, if there is Calibration mode
                  data this will be different from the index passed in
       data_out= data to be passed out, if there is Calibration mode
                  data this will be different from the data passed in
 CALLS: ***
	DELVARX [1], DELVARX [2], DELVARX [3], DELVARX [4], HX_COMP, HX_DECOMP
	anytim2ints [1], anytim2ints [2], delvarx [5], dprate2sec [1], dprate2sec [2]
	fix_hxtindex, gt_dp_mode [1], gt_dp_mode [2], int2secarr [1], int2secarr [2]
	mk_timarr [1], mk_timarr [2], reform_hxtcal
 CALLED BY:
	hxt_fsp, hxt_fsp1, hxt_mcaccum, hxt_utplot, hxtimg_accum, sxthxt_fsp, sxtth_hxt
 HISTORY:
	10-May-93, JM
       Added reform, index and tim_arr keywords, for plotting convenience,
                     28-jul-94, jmm
       Dropped the reform keyword, and index is now a parameter, 1-aug-94.
       Added correction to deal with the 4.0 second time lag in the hda files,
                     9/21/94, jmm
       Added the ability to do non-flare mode data, 2/12/95, jmm
       Fixed bug which occurs when there is no flare mode data,
                     and data = 0, 3-feb-96, jmm
       Puts 64 channel cal mode data into 4 channels, 20-aug-1997, jmm
       changed, /overwrite option, to pass out index_out and data_out,
       for cal mode., 6-apr-1999, jmm


HXT_COMP $SSW/yohkoh/hxt/idl/util/hxt_comp.pro
[Previous] [Next]
 NAME:
	HXT_COMP
 PURPOSE:
 	Compress data from 12 bits to 8 bits using the HXT algorithm
	(also used in WBS)
 HISTORY:
	Written by Hugh Hudson, 19-Dec-1991


hxt_count $SSW/yohkoh/ucon/idl/nitta/hxt_count.pro
[Previous] [Next]
 Input Parameters
     spec: 0 for thermal, 1 for power-law
     te6: temperature (MK) or power-law index
     em45: emission measure (10^45) or normalization factor (20 keV)
 Output Parameters
     
 CALLS:
 CALLED BY
	dem_tr_er, dem_tr_er0


HXT_COUNTLIST $SSW/yohkoh/ucon/idl/sakao/hxt_countlist.pro
[Previous] [Next]
 NAME:
	HXT_COUNTLIST
 PURPOSE:
	To make a HXT count list for fractal dimension analyses of solar 
	flares.
 CALLING SEQUENCE:
	HXT_COUNTLIST, data, ch, filename
 INPUT:
	data		- HXT data BEFORE BIT DECOMPRESSION. 
	ch		- Energy channel of HXT. 
	filename	- Output filename. 
 OUTPUT:
	none
 SIDE EFFECT:
	An output file is created. 
 CATEGORY:
	Research with Maxima-ken. 
 CALLS: ***
	HXT_DECOMP
 HISTORY:
	version 1.0	T.Sakao written on 96/09/23 (Mon), Shu-bun no hi. 
		1.1	96.12.21 (Sat)
			'data' modified from a decompressed one to a 
			pre-decompressed one to avoide possible confusion. 


hxt_cutoff $SSW/yohkoh/ucon/idl/mctiernan/hxt_cutoff.pro
[Previous] [Next]
 NAME:
       hxt_cutoff
 PURPOSE:
       Given a power law fit, calculates the expected HXT response in
       the LO channel, for given values of the low-energy cutoff e_cut,
       then interpolates on the LO vs. e_cut curve to obtain e_cut. 
 CALLING SEQUENCE:
       e_cut = hxt_cutoff(K,m,lo_cps,flat=flat)
 INPUT:
       K = Emission at 1 keV, from p.l. fit
       m = p.l. spectral index
       lo_cps = count rate in HXT LO channel
 KEYWORDS;
       flat = spectrum flattens below e_cut, if set
       exp = spectrum has an exponential cut-off if set
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], INTERPU_1D, Multresponses, Respint
	concat_dir [4], fx_1pl_cut, fx_1pl_ecut, fx_1pl_flat
 HISTORY:
       11-Apr-94 by JMM


HXT_DECOMP $SSW/yohkoh/hxt/idl/util/hxt_decomp.pro
[Previous] [Next]
 NAME:
	HXT_DECOMP
 PURPOSE:
 	Restore HXT and WBS data from the 8-bit telemetry format to 
	the full 12 bits
 CALLED BY:
	HXT_COUNTLIST, HXT_FANS, HXT_HI_SUM, HXT_LOW_SUM, HXT_MED1_SUM, HXT_MED2_SUM
	HXT_SUMMER, MK_GRSPCH, MK_GRSPCL, MK_GRSPHH1, MK_GRSPHH2, MK_GRSPHL1, MK_GRSPHL2
	MK_HXSPC, MK_HXSPH, OUT_GRSPHL1, OUT_GRSPHL2, OUT_HXSPH, WBS_DB, WBS_DB2, cnvt [2]
	grs_plot, lcobs, lcwda, rd_sxs_pha [1], rd_sxs_pha [2], rd_wbs_pha [1]
	rd_wbs_pha [2]
 HISTORY:
	Written by Jim McTiernan and Hugh Hudson, 19-Dec-1991


HXT_DUMP $SSW/yohkoh/ucon/idl/sakao/hxt_dump.pro
[Previous] [Next]
 NAME:
	HXT_DUMP
 PURPOSE:
	Display date,time dp_mode, bit_rate and X-ray counts in 4 energy bands
	in every SF.
	This program is the same as MF HXTDMP.
 CALLING SEQUENCE:
	dump = HXT_DUMP(index, data, ssss, /list)
	dump = HXT_DUMP(index, data, ssss, /hs)
 INPUT:
	index	- HXT index obtained from hda files
	data	- HXT data	"
	ssss	- HXT ssss	"
 CALLS: ***
	AVE_CTS, gt_day [1], gt_day [2], gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1]
	gt_dp_rate [2], gt_sum_h [1], gt_sum_h [2], gt_sum_l [1], gt_sum_l [2]
	gt_sum_m1 [1], gt_sum_m1 [2], gt_sum_m2 [1], gt_sum_m2 [2], gt_time [1]
	gt_time [2]
 OPTIONAL KEYWORD INPUT:
	hs	- If set, then returns a count dump in every 1/4 MF.
	list	- Option for line alignment in the dump. 
 OUTPUT:
	dump	- HXT count dump data in the form of an array of strings. 
 NOTE:
	Time tag at the beginning of every line in the dump is the RAW 
	telemetry time. Pre-storage of HXT count data is NOT taken into 
	account.

	HXT count values in the dump are in units of CTS/SEC/SC, which could 
	lead you to some confusion in selecting a certain time interval (for 
	image synthesis) based on the dump. 
 HISTORY:
	version 1.0       92.09.21 (Mon)	T.Sakao written.

	version 1.1       92.12.09 (Wed)
	Program is changed from pro to function. hxt_dump now returns an array 
	of string that contains information for each SF. 
	A new argument 'ssss' is included. This time, SF0 is the very 
	beginning of selected reformat-file.
	At this moment 'data' is not necessary, but will be necessary if we 
	make an 0.5sec interval hxt_dump.

	version 1.2       92.12.15 (Tue)
	Count dump for each 15 FR is available using option 'hs'.
	This version uses hxt_halfsec2 and gt_hs_sum2.

	version 1.3       93.03.25 (Thu)
	Option list was added. Use this option when you display HXT dump in a 
	window (not a WMENU window) or print it to papers.

	version 1.4       93.05.03 (Mon)
	Output for /hs option was modified. Now the unit is cts/sec/16FR.
	Also a bug in time tag (in /hs mode) was fixed.

	version 1.5       93.06.19 (Sat)
	Output for /hs option was again modifed. Now the unit is cts/sec for 
	each 0.5 sec.

	version 1.6	96.01.13 (Sat)
	Documentation prepared. (Too late ? I'm so sorry...) 


HXT_EFF $SSW/yohkoh/ucon/idl/hudson/hxt_eff.pro
[Previous] [Next]
 NAME:
	HXT_EFF
 PURPOSE:
	read calibration file for HXT spectral response 
 CALLING SEQUENCE:
	hxt_eff,energy,prob
	hxt_eff,energy,prob,/two
 OUTPUTS:
	energy = energy of calculation
	prob(4,*) = probabilities for LO, M1, M2, HI (there are 121 
         points for energy = 0, 120, 1 keV). See the HXT Databook for
	  much more information.
 KEYWORDS
	/two reads the old data, now superseded (2-Apr-93) by possi3.dat
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], RDFILE [1], RDFILE [2]
	concat_dir [4], tbeep [1], tbeep [2], tbeep [3]
 HISTORY:
	written by HSH to read Mika Inda's calibration data, Oct. 1992
	HSH, updated to read possi3.dat. This file can be read directly
	  for its documentation information as supplied by M. Inda.


HXT_EFF_AREA $SSW/yohkoh/ucon/idl/sakao/hxt_eff_area.pro
[Previous] [Next]
 NAME:
	HXT_EFF_AREA
 PURPOSE:
	Returns effective area of HXT (= 57.4 cm2; fixed value). 
	This value appears in p.11 of Yohkoh Instrument Guide section of 
	the `Yohkoh Analysis Guide'. 
 INPUT:
	none
 OUTPUT:
	Effective area of HXT.
 CALLED BY:
	HXT_THERMAL
 HISTORY:
	ver. 1.0	T.Sakao written 95/10/09 (Mon)


HXT_ERROR $SSW/yohkoh/ucon/idl/metcalf/hxt_error.pro
[Previous] [Next]

function hxt_error, hxiindex, data, inpatterns, image0, sigma, pixonmap=pixonmap

NAME:
     HXT_ERROR
PURPOSE:
     Computes the one sigma error bars for an HXT image
CATEGORY:
CALLING SEQUENCE:
     err = hxt_error(hxiindex,data,patterns,image,sigma,pixonmap=pixonmap)
INPUTS:
     hxiindex = 1D array of index structures with nimages elements
     data = data used to reconstruct the image.  This is not the same as the 
            data variable that goes into hxt_multimg!!!  This is the 
            data actually used to compute image. fltarr(ndata,nimages).
     patterns = fltarr(nx,ny,ndata,nchannel).  See restrictions, below.
     image = the reconstructied image.  fltarr(nx,ny). 
             See restrictions, below.
OPTIONAL INPUT PARAMETERS:
     sigma = one sigma HXT data error, fltarr(ndata,nimages).
             sqrt(data) is the default if you don't have anything better.
KEYWORD PARAMETERS
     pixonmap = pixon map.  Use only if the pixon code was used to 
                compute the HXT images.  fltarr(nx,ny,nimages)
OUTPUTS:
     error = the one sigma error, fltarr(nx,ny,nimages) 
 CALLS: ***
	LOCAL_SMOOTH, SQUEEZE, tag_index [1], tag_index [2]
 CALLED BY:
	HXTFPB_FUZZY, hxt_multimg
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
     The image and the patterns are assumed to be rotated relative to one
     another.  I.e., the image is assued to have solar north up and east
     to the left, but the patterns are assumed to have the original 
     orientation.  This means that output from hxt_multimg can be sent to
     hxt_error, as is.

     If the image is of byte type, it is assumed to be a byte scaled image
     from hxt_multimg.
PROCEDURE:
MODIFICATION HISTORY:
     T. Metcalf 1996-08-09
     T. Metcalf 1996-10-01 Fixed a few problems.  First version on-line.
     T. Metcalf 1996-10-02 Added IDL version check since the transpose
                           function changed between version 3 and 4.
     T. Metcalf 1996-10-14 Added a kludge to get around the transpose version
                           problem.


HXT_FANS $SSW/yohkoh/ucon/idl/hudson/hxt_fans.pro
[Previous] [Next]
 NAME:
       HXT_FANS
 PURPOSE:
       extract fan-beam elements from HXT and display
 OUTPUTS:
       fan_data = channel rates
       fan_index = index
 CALLING SEQUENCE:
       hxt_fans,index,data,fan_index,fan_data,plot=plot (from HDA read)
 KEYWORDS
       /plot makes plots
	/nonorm extracts raw rates (counts/subcollimator/sec)
       channel
       photons
       sums give (4,4,n) where the 2nd variable represents position
         angle, the sums of all phases (divided by 4). 
 OUTPUTS:
       fan_data(4,16,n) where n is the flare mode high-rate data array;
         order among the 16 entries is phase, then PA 
       fan_index
 CALLS: ***
	BAIL, CLEAR_UTPLOT [1], CLEAR_UTPLOT [2], HXT_DECOMP, UTPLOT [1], UTPLOT [2]
	UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], clearplot [1], clearplot [2]
	gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
 HISTORY:
       25 Sep. 1992, written by HSH
       24 Oct, nonorm 
       23 May 1996, added channel for plot ID and re-ordered arguments
       27 May 1996, replaced /nonorm with /photons, ie standardized
              on cts/sc/sec; added sums = sums to get four summed 
              outputs (for each position angle)
       30 apr 2001, debugged SUMS (HSH)


hxt_fit_powl $SSW/yohkoh/ucon/idl/hudson/fit_inda.pro
[Previous] [Next]
 NAME:
	hxt_fit_powl
 PURPOSE:
	generate coefficients for HXT powerlaw response
 CATEGORY:
 CALLING SEQUENCE:
	main program
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
	Oct-1992 written by HSH and then deleted accidentally
	19-Jan-92 replaced


HXT_FLARE_POS $SSW/yohkoh/hxt/idl/util/hxt_flare_pos.pro
[Previous] [Next]
NAME:
	HXT_FLARE_POS
PURPOSE:
	To read a text file which contains dates and HXT addresses for
	flare positions
SAMPLE CALLING SEQUENCE:
	hxt_pos = hxt_flare_pos()
OPTIONAL INPUTS:
	infil	- If not defined, it will use $DIR_HXT_CAL/hxt_flare_pos.txt
OUTPUT:
	hxt_pos	- A structure with 
			.TIME, .DAY	- the date of the event (no time)
			.GOES 		- the GOES event classification
			.X0, .Y0	- the HXT address of the event
			.COMMENTS	- any comments for that event
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], anytim2ints [1], anytim2ints [2]
	concat_dir [4], rd_tfile [1], rd_tfile [2]
 CALLED BY:
	get_hxt_pos
HISTORY:
	Written 20-Dec-93 by M.Morrison
	21-Dec-93 (MDM) - Modified to read the new file format which
			  has flare times


hxt_fsp $SSW/yohkoh/ucon/idl/mctiernan/hxt_fsp.pro
[Previous] [Next]
 NAME:
	hxt_fsp
 CALLING SEQUENCE:
	hxt_fsp,index,data,fit_pars,sc_par,ch_dta,outfile=outfile,$
		pfile=pfile,sdel=sdel,countfile=countfile,fix_pars=fix_pars,$
               st_times=st_times,int_times=int_times,tyspec=tyspec,$
               bck_time=bck_time,bck_dt=bck_dt,noplot=noplot, $
               dt_resolution=dt_resolution,auto_bck=auto_bck, $
               auto_tim=auto_tim,nbcks=nbcks,nbsigmas=nbsigmas, $
               channel=channel,alt_tsel=alt_tsel,nsigmas=nsigmas, $
               erange=erange, sys_err=sys_err, zzb=zzb, $
               auto_peak=auto_peak,init_a=init_a
 PURPOSE:
	Fits spectra for the HXT, YOU choose the data interval
 INPUT:
	index= data info. structure
	data=data structure
 OUTPUT:
	fit_pars, a structure of type {fitinfo}, for each interval, with tags:
		tyspec= type of spectrum
		ma= no. of parameters fit
		alabels = labels for the fit parameters
		t= the interval START times, in the 7 element array
		dt= the interval lengths
		a= the fit parameters, a fltarr(6)
 			tyspec  =1 a(0)=K, a(1)=gamma
				=2 a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
				=3 a(0)=em/1.0e47, a(1)=T/1.0e6
				=4 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
				=5 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
				=6 a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
				=7 a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		                =8 a(0)=em/1.0e47, a(1)=T/1.0e6, 
			           a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		                =9 a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			           a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			           a(5)=eb2 (between gamma2 and gamma3)
                               =10 a(0)=em/1.0e47, a(1)=T/1.0e6
                               =11 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
 		                =12, a(0)=K, a(1)=gamma, a(2)=e0
 		                =13, a(0)=K, a(1)=gamma, a(2)=e0
		sa= uncertainties in the fit parameters
               ffx= 0 if the associated parameter is free, 1 if fixed at a
                    user defined value, 2 if fixed at the value initially
                    given by ainit.
		chi2= chi^2
		nch= the number of channels for each interval
		fluxc= flux correction if any
		nsig= # of sigmas above background for good channels.
		flags= saturated flag, incomplete flag, channel event 
			was found in, highest channel included in fit, 
			mro flag.
	sc_par, a structure containing data for each sc channel, tags:
		e10= channel low energy edges
		e20= channel high energy edges
		eb0= channel midpt energy
		bck= background count rates, for the two bck intervals, fltarr(2)
		sbck= Uncertainty in bck
		tb= the background START time for two background intervals, an array of(7, 2)
		dtb= the bck time interval, fltarr(2)
	ch_dta, a structure containing data for each channel for each interval
		y0= incident count rates
		sy0= Uncertainty in y0
		chok=channel flag, 0 for channels used in fit , 
				   1 for channel not used
               b0 = background count rate
               sb0 = uncertainty in b0
               f0 = photon flux in the channel, for most cases f0 is
                    the flux at the channel energy, for thermal  + line fits
                    f0 is the average photon flux in that channel.
                    Note that f0 = model flux * ((y0-b0)/c0)
               sf0 = uncertainty in f0.      
               c0 = Model Excess count rates
 KEYWORD INPUT:
	outfile= the output file, a keyword
	pfile= a file for spectral plots
       sdel=channels to delete
       sdel= array of channels to delete
       countfile= a file name for the accumulated counts which can 
                  be used as input to fsp_proc.pro, no fit is done
                  if you set this keyword.
       fix_pars= if set enables you to fix parameters
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. Must be an integer
                  number of seconds, if the value of int_times is less than
                  a minor frame value, e.g., when not in flare mode,
                  we'll try to adjust.
	tyspec=the spectral type, if not set, the program prompts you
	      = 1 for single p.l.
	      = 2 for double p.l.
	      = 3 for single thermal
	      = 4 for p.l. + thermal
	      = 5 for thermal + thermal
	      = 6 for p.l. + p.l.
	      = 7 thermal below Ebr, p.l. above Ebr
             = 8 for thermal plus double p.l.
             = 9 for triple p.l.
             = 10 thermal including line emission
	      = 11 for p.l. + thermal, includes SXR lines
	nsigmas= the number of sigmas above background for a "good" channel,
		=3.0 as a default
       bck_time= a background time, in any yohkoh format
       bck_dt= the background accumulation time, bck_time must be set,
               If bck_dt is not set dtb=120.0 seconds is used.
       noplot= if set, no screen plot
       dt_resolution= The number of datasets per fit interval,
                      In flare mode, it's the number of half-seconds
                      In QT mode, it's the number of 4 second intervals.
                      If set to -1, use the whole interval.
;;;;;;;;;;;;;;;;;;;;;;This will only operate if the time is selected by
;;;;;;;;;;;;;;;;;;;;;;the user, or the st_times keyword has only one element.
       auto_bck= if set, the background interval is obtained automatically
       auto_tim= if set, the flare interval is obtained automatically
       FOR AUTOMATIC TIME SELECTION:
       nbcks = if set, the number of background levels above the
               background that the data within trange must be, 
               i.e., data - bck > nbcks*bck, the default is 1.0, 
               if not set. If both nbcks and nbsigmas are set,
               nbcks gets used.
       nbsigmas = if set, the number of sigmas above the background
                 that the data within trange must be, no default, 
                 i.e., data - bck > nbsigmas*sigma(bck). Note here that
                 we assume that the background is Poisson distributed,
                 even if that is not true.
       channel=channel to use for choice of background and interval
                   for automatic choices, default is zero, for interactive
                   choices, the default is to prompt the user
       alt_tsel = uses ALT_TIM_SEL to obtain interval, rather than PLOT_LCUR
                  Useful if you don't have x-windows. 
       erange= an energy range to be used for the spectral fit, channels with
               middle energies between the two limits are included. Channels
               specified using sdel are still deleted, but the user is not
               prompted for channels to delete if erange is supplied.
       sys_err= a 'systematic error', pass in if you don't trust the
                errors you get from counting stats, or to arbitrarily
                push down chi^2 values, The default iz 0.0.
                This makes the error in the rate = sqrt(cps/dt)+sys_err*cps.
       zzb = Don't use this.. zero background.
       auto_peak= if set, find the peak interval for the
                  appropriate channel and fit it, if set to -1 this will
                  prompt you for an ok for the spot. if not, no prompt...
       init_a= initial values for the fit parameters, , can be an array
               of (number of fit parameters, ntimes)
 CALLS: ***
	OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], UTPLOT [1], UTPLOT [2], UTPLOT [3]
	UTPLOT [4], UTPLOT [5], UTPLOT [6], accum_counts [1], accum_counts [2]
	accum_counts [3], any_fsp, anyrts, anytim2ex [1], anytim2ex [2], anytim2ints [1]
	anytim2ints [2], bck_interval, choose_interval, fmt_tim [1], fmt_tim [2], fsc_init
	hxt_chsums, yesnox [1], yesnox [2]
 HISTORY:
	Written Summer '92 by JMcT
	Changed to strucutres Dec '92 (JM)
       Added 1/2 sec time resolution, changed to use any_fsp.pro and
       Added countfile option, to replace hxtrts.pro 22-oct-93 (JMM)
       Added the ability to handle non-flare mode data, 29-oct-93 (JMM)
       Added st_times, int_times bck_time, bck_dt keywords, 24-Mar-94 (JMM)
       Added the dt_resolution, auto, and channel keywords, 29-jul-94, jmm
       The 4 second delay in the times tags is dealt with, 21-sep-93, jmm
       Stripped out accumulation stuff, replaced it with calls to ACCUM_COUNTS,
       and CHOOSE_INTERVAL, and added erange keyword, 5-apr-95, jmm
       Added sys_err keyword, 24-jun-95, jmm
       Added init_a keyword, 23-oct-95, jmm
       Replaced background code with BCK_INTERVAL, 22-apr-96, jmm


hxt_fsp1 $SSW/yohkoh/ucon/idl/mctiernan/hxt_fsp1.pro
[Previous] [Next]
 NAME:
	hxt_fsp1
 CALLING SEQUENCE:
	hxt_fsp1,index,data,fitp,scp,chd,t_2ndc,dt_2ndc,tysp_2ndc,$
               a_2ndc,fitp_2ndc=fitp_2ndc,tyspec=tyspec, $
               outfile=outfile, pfile=pfile,sdel=sdel,$
               countfile=countfile,fix_pars=fix_pars, $
               bck_time=bck_time,bck_dt=bck_dt,noplot=noplot, $
               auto_bck=auto_bck,channel=channel,alt_tsel=alt_tsel,$
               nsigmas=nsigmas,erange=erange,sys_err=sys_err,zzb=zzb, $
               init_a=init_a
 PURPOSE:
	Fits spectra for the HXT, after subtracting out a known second
       component, the data intervals are passed int
 INPUT:
	index= data info. structure
	data=data structure
       t_2ndc=start time of the 2nd component fit intervals, all of
              the *_2ndc variables must be passed in, unless the fitp_2ndc
              keyword is set
       dt_2ndc= interval time of the fit intervals, can be a scalar
       tysp_sndc= spectral typ of the 2nd component fits, a scalar
       a_2ndc= the fit parameters of the 2nd component, see below
 OUTPUT:
	fit_pars, a structure of type {fitinfo}, for each interval, with tags:
		tyspec= type of spectrum
		ma= no. of parameters fit
		alabels = labels for the fit parameters
		t= the interval START times, in the 7 element array
		dt= the interval lengths
		a= the fit parameters, a fltarr(6)
                  NOTE ON UNITS: for Power laws, K is the differential flux
                                 at 1keV, in photons/(sec-cm^2-keV).
                                 Break energies (ebr) are in keV.
                                 For thermal fits, em is the Emission Measure
                                 in cm^(-3) but the output EM is normalized
                                 by 1.0e47. T is in Kelvin, but the output
                                 temperatures are in MK. (T/10^6)
 			tyspec  =1 a(0)=K, a(1)=gamma
				=2 a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
				=3 a(0)=em/1.0e47, a(1)=T/1.0e6
				=4 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
				=5 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
				=6 a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
				=7 a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		                =8 a(0)=em/1.0e47, a(1)=T/1.0e6, 
			           a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		                =9 a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			           a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			           a(5)=eb2 (between gamma2 and gamma3)
                               =10 a(0)=em/1.0e47, a(1)=T/1.0e6
                               =11 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
 		                =12 a(0)=K, a(1)=gamma, a(2)=e0
 		                =13 a(0)=K, a(1)=gamma, a(2)=e0
				=14 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
		sa= uncertainties in the fit parameters
               ffx= 0 if the associated parameter is free, 1 if fixed at a
                    user defined value, 2 if fixed at the value initially
                    given by ainit.
		chi2= chi^2
		nch= the number of channels for each interval
		fluxc= flux correction if any
		nsig= # of sigmas above background for good channels.
		flags= saturated flag, incomplete flag, channel event 
			was found in, highest channel included in fit, 
			mro flag.
	sc_par, a structure containing data for each sc channel, tags:
		e10= channel low energy edges
		e20= channel high energy edges
		eb0= channel midpt energy
		bck= background count rates, for the two bck intervals, fltarr(2)
		sbck= Uncertainty in bck
		tb= the background START time for two background intervals, an array of(7, 2)
		dtb= the bck time interval, fltarr(2)
	ch_dta, a structure containing data for each channel for each interval
		y0= incident count rates
		sy0= Uncertainty in y0
		chok=channel flag, 0 for channels used in fit , 
				   1 for channel not used
               b0 = background count rate
               sb0 = uncertainty in b0
               f0 = photon flux in the channel, for most cases f0 is
                    the flux at the channel energy, for thermal  + line fits
                    f0 is the average photon flux in that channel.
                    Note that f0 = model flux * ((y0-b0)/c0)
               sf0 = uncertainty in f0.      
               c0 = Model Excess count rates
 KEYWORD INPUT:
       fitp_2ndc = fit parameters for the second component,
                   pass in instead of the individual variables...
	outfile= the output file, a keyword
	pfile= a file for spectral plots
       sdel= array of channels to delete
       countfile= a file name for the accumulated counts which can 
                  be used as input to fsp_proc.pro, no fit is done
                  if you set this keyword.
       fix_pars= if set enables you to fix parameters
	tyspec=the spectral type, if not set, the program prompts you
	      = 1 for single p.l.
	      = 2 for double p.l.
	      = 3 for single thermal
	      = 4 for p.l. + thermal
	      = 5 for thermal + thermal
	      = 6 for p.l. + p.l.
	      = 7 thermal below Ebr, p.l. above Ebr
             = 8 for thermal plus double p.l.
             = 9 for triple p.l.
             = 10 thermal including line emission
	      = 11 for p.l. + thermal, includes SXR lines
             = 12 single p.l. flattens below e0
             = 13 single p.l. cuts off below e0
             = 14 Double Thermal, includes SXR lines
	nsigmas= the number of sigmas above background for a "good" channel,
		=3.0 as a default
       bck_time= a background time, in any yohkoh format
       bck_dt= the background accumulation time, bck_time must be set,
               If bck_dt is not set dtb=120.0 seconds is used.
       noplot= if set, no screen plot
       auto_bck= if set, the background interval is obtained automatically
       channel=channel to use for choice of background and interval
                   for automatic choices, default is zero, for interactive
                   choices, the default is to prompt the user
       alt_tsel = uses ALT_TIM_SEL to obtain interval, rather than PLOT_LCUR
                  Useful if you don't have x-windows. 
       erange= an energy range to be used for the spectral fit, channels with
               middle energies between the two limits are included. Channels
               specified using sdel are still deleted, but the user is not
               prompted for channels to delete if erange is supplied.
       sys_err= a 'systematic error', pass in if you don't trust the
                errors you get from counting stats, or to arbitrarily
                push down chi^2 values, The default iz 0.0.
                This makes the error in the rate = sqrt(cps/dt)+sys_err*cps.
       zzb = Don't use this.. zero background.
       init_a= initial values for the fit parameters, , can be an array
               of (number of fit parameters, ntimes)
 CALLS: ***
	accum_counts [1], accum_counts [2], accum_counts [3], any_fsp, anyrts
	anytim2ex [1], anytim2ex [2], anytim2ints [1], anytim2ints [2], auto_bck_find
	choose_interval, fmt_tim [1], fmt_tim [2], hxt_anycomp, hxt_chsums
 HISTORY:
       From HXT_FSP, 5-apr-1996, jmm


hxt_gentrn $SSW/yohkoh/hxt/idl/atest/hxt_gentrn.pro
[Previous] [Next]
NAME:
	hxt_gentrn
PURPOSE:
	Generates trn, the 2-d array containing the modulation patterns
	for the SubCollimators.
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	hxt_gentrn,hxi_index,sc_paras,trn
INPUT:	hxi_index the structure with the image information, tags used:
	hxi_index.iway=0 for triangular shaped patterns
	hxi_index.alpha= amplitude of phase correction = -1.0
	hxi_index.area= 2.3*2.3-0.25*0.25*2.0
	sc_paras, the structure with the SC infomration, tags:
	sc_paras.dc= dc offset of pattern
	sc_paras.amp= amplitude of pattern, peak=amp+dc
	sc_paras.phase= phase of SC
	sc_paras.phase_corr= phase correction factor, in units of 1.0e-4 rad
OUTPUT:
	trn= modulation pattern, fltarr(ngrids, npts, nchannels)
KEYWORDS:
       npts = the number of points for trn for each SC, the default is 512
 CALLED BY:
	hxt_pattern_maker
MODIFICATION HISTORY:
	Adapted from Fortran Subroutine GENTRN of T.Sakao, July '92 J.McTiernan
       Multiple channels, and add HI channel corrections 20-jul-94
       Added new mod. pattern calculations, 14-jan-1997, jmm, js, trm
       Final new mod. pattern calculations, 13-may-1998, jmm
       Rewritten, from routines MKPAT and GENTRN in the Fortran program NMOVIE
 CALLS: ***
	MKPAT
NOTE:
       This is as an exact copy of the fortran routine as we can get.
       The results agree to within 0.6% (using the HI channel as a test)
       The probable sources of difference are the error function calls
       in MKPAT


Hxt_getflt_arr $SSW/yohkoh/hxt/idl/atest/hxt_getflt_arr.pro
[Previous] [Next]
 NAME:
      Hxt_getflt_arr
 CALLING SEQUENCE:
      y = hxt_getflt_arr(x)
 CATEGORY:
      Yohkoh HXT
 PURPOSE:
      Calculates the fraction between x and the next lowest integer.
 INPUT:
      x = some array of real numbers
 OUTPUT:
      x = x - fix(x), x>0
        = x-fix(x)+1, x<0
        = 0, x>1
 CALLED BY:
	hxt_modpat
 HISTORY:
      Adapted from Tsakao, GETFLT.f, July, 92, Jmm
      New name, 24-jun-1998, jmm


HXT_HI_SUM $SSW/yohkoh/ucon/idl/shimizu/hxt_hi_sum.pro
[Previous] [Next]
NAME:
        HXT_HI_SUM
POURPOSE:
        Get the total counts(summation of all the sensors) in HXT high
      energy channel(52.7-92.8keV).
CATEGORY:
        Yohkoh/HXT analysis
CALLING SEQUENCE:
        hi_sum = HXT_HI_SUM(data, index, [fint= fint])
INPUT:
        data    - HXT pc data (bytarr(4, 64, 4, *))
        index   - HXT index structure from reformatted data
OPTIONAL INPUT:
        fint    - data integration in flare mode. Default = 4. 
                In flare mode pulse count data comes 4 times per SF.
                   = 4(default): Sum 4 data in SF and output value
                       every SF(time resolution 1SF in flare md). 
                   = 2: time resolution 1/2 SF in flare md.
                   = 1: time resolution 1/4 SF in flare md.
OUTPUT:
        hi_sum - the total counts per sec (floating point data type)
                 Data structure  fint = 4: fltarr(*)   
                                      = 2: fltarr(2, *)
                                      = 1: fltarr(4, *)  
 CALLED BY:
	HXT_TEEM, plott_hi_sum
PROCEDURE:
        Quiet mode: No data = 0 
        Flare mode: Get data from pc_data (data)
 CALLS: ***
	HXT_DECOMP, gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
RESTRICTIONS:
        (1) This data comes only in flare mode.
MODIFICATION HISTORY:
        May 27, 1992  written by Toshifumi Shimizu
                                        (Univ. of Tokyo) 


hxt_hk_temp $SSW/yohkoh/ucon/idl/hudson/hxt_hk_temp.pro
[Previous] [Next]
NAME:
	hxt_hk_temp
PURPOSE:
	To extract and convert the HXT temperatures to degrees C.
CALLING SEQUENCE:
	t = hxt_hk_temp( index, 0 )
	t = hxt_hk_temp( index, 0, title=title )
       t = hxt_hk_temp( index, /help)
Input:
	item	- Index structure or the array of temperatures.
		  The roadmap is not acceptible as input
	itemp	- The index of the temperature to return (0-15)
 CALLS: ***
	AHK_CONV, gt_conv2str [1], gt_conv2str [2]
 CALLED BY:
	go_hxt_hk_temps
OPTIONAL KEYWORD INPUT:
       string  - If present, return the string mnemonic (long notation)
       short   - If present, return the short string mnemonic
       spaces  - If present, place that many spaces before the output
                 string.
       help    - Prints the HXT temperature sensor locations (and
                 does not compute)
OUTPUT:
       returns - The house keeping temperature, a floating point value or 
		  a string value depending on the switches used.  It is a vector
                 if the input is a vector
OPTIONAL KEYWORD OUTPUT:
	title	- A description of the temperature selected.
WARNINGS
       The downstream author here does not understand some of the
         upstream stuff in this code.
History:
	Written 24-Apr-92 by M.Morrison (GT_TEMP_HK)
       HSH, plated from gt_temp_hk 18-Feb-97; help from Sawa on details


hxt_hs_bgd $SSW/yohkoh/ucon/idl/sakao/hxt_hs_data.pro
[Previous] [Next]
 FUNCTION: hxt_hs_bgd
  Extracts HXT BGD/DATA data from a file or a reformatted data displayed on
    screen.
  Retrurns a structure 'hxt' that contains HXT count data and associated 
    information.

  version 1.0          92.11.25 (Wed)

  version 1.1          92.11.26 (Thu)
    Program was modified according to the replace of mk_hxt_sum.pro.
  version 1.2          93.06.21 (Mon)
    Option display was added.
  version 1.3          93.06.23 (Wed)
    Option channel was added.
  version 1.4		98.03.07 (Sat) @ GSFC
    Option hs (halfsec) added.
 CALLS:


hxt_hs_task $SSW/yohkoh/ucon/idl/sakao/hxt_hs_task.pro
[Previous] [Next]
 FUNCTION: hxt_hs_task
   Display a window for HXT proc.

 version 1.0         92.11.25 (Wed)

 version 1.1         92.11.25 (Wed)
   A new procedure 'hxt_hs_data' was installed for the case s = 2 and 3.

 version 1.2         92.11.26 (Thu)
   Hardness Ratio - proc. was modified to implement BGD subtraction.
   New fuctions: hd_bgd_proc and hardness_proc was prepared.

 version 1.3         93.06.21 (Mon)
   Option display was added.

 version 1.4         93.06.23 (Wed)
   Option channel was added. 
 version 1.5		98.03.07 (Sat) @ GSFC
	Option hs (halfsec) added.
 CALLS:


HXT_IMAGE_TIME $SSW/yohkoh/ucon/idl/sakao/hxt_image_time.pro
[Previous] [Next]
 NAME:
	HXT_IMAGE_TIME
 PURPOSE:
	Returns central, as well as start and end, times for intervals of 
	HXT image data accumulation. 
 CALLING SEQUENCE:
	center = HXT_IMAGE_TIME(inf, start_time=s_ints, end_time=e_ints)
 INPUT:
	inf	- Either HXT `inf' data (structure variable) or the `hxt' 
		  structure variable. This data is to be read in the following 
		  manner:
		    RD_HXTIMG, img, hdr, inf, 'hxtimg_filename', or
		    RD_HXTDAT, hxt, 'hxt_data.disc'.
		  Make sure that these files are used for HXTPRO(_NMP) and 
		  are different from HXI files. 
 CALLS: ***
	GET_TIME_LAPSE, INTS4NEXT_DAY, anytim2ints [1], anytim2ints [2]
 OPTIONAL KEYWORD INPUT:
	ints	- If set, then the output is an INTS variable. 
 OUTPUT:
	center	- Central times of a series of HXT image time intervals 
		  (in the INTS format), together with the intervals in seconds.
 OPTIONAL KEYWORD OUTPUT:
	s_ints	- Start times of a series of HXT image time intervals, in the 
		  INTS format.
	e_ints	- End times of ...
 SIDE EFFECTS:
	none
 CATEGORY:
	Yohkoh HXT data analysis.
 HISTORY:
	version 1.0	98.08.27 (Thu)	T.Sakao written.
		1.1	98.10.17 (Sat)	Tag .acctim added to the outputs. 
					The program also accepts `hxt' 
					structure variables. 


hxt_images2ps $SSW/yohkoh/ucon/idl/nitta/hxt_images2ps.pro
[Previous] [Next]
 Name: hxt_images2ps
 PURPOSE: Make a postscript file of HXT time sequence images in countours.
 CALLING SEQUENCE: hxt_images2ps, index, data, 4, 6
                      HXT images are shown in a format of 4 (X) x 6 (Y).
                   hxt_images2ps, index, data, 2, 6, /grid
                      HXT images are shown in a format of 2 (X) x 6 (Y) with
                      fiducial grids (10x10).
 INPUTs:  index, data  -  data should be normalized beforehand.
          nx, ny - how many frames to be displayed in X and Y directions.
 OUTPUTs: None
 Optional Input Keywords:
      sub:   subset of data to be displayed (such as 4+indgen(15)).
      a4:    for an A4 output (instead of letter).
      outfile:  Name of the output postscript file (default: ~/hxt_images.ps).
      landscape: Makes the output in landscape orientation.
      normalize: when set, the contour levels are level*normalize.
      reduce:  Makes a smaller file (the maximum is 18 cm in X and 24 cm in Y).
      encapsulate: Makes an encapsulated file.
      grid: Number of grids per image (setting it simply as /grid creates 10x10).
      sxt_index: Scalar. If passed draw limb.  The HXT images have to be 
               coaligned with the SXT image corresponding to sxt_index.  
      quiet:  Omit printing in-house information.
      sx0, sy0: BLC of subimage (default=0)
      sx1, sy1: TRC of subimage (default=63)
 SIDE EFFECT: A postscript file is created.
 CALLS: ***
	ADDTIME [1], ADDTIME [2], ARR2STR [1], Arr2Str [2], OCONTOUR2, SXT_GRID [1]
	SXT_GRID [2], SXT_GRID [3], clearplot [1], clearplot [2], draw_box_nn [1]
	draw_box_nn [2], get_rb0p [1], get_rb0p [2], gt_center, gt_corner, gt_day [1]
	gt_day [2], gt_shape, gt_time [1], gt_time [2], his_index
 HISTORY:  18-Feb-96, NN, written, from ps_hxt_image.pro
           31-AUG-97, NN, fixed some bugs.
           28-JUN-98, NN, added keywords for subimage to plot the limb correctly.


hxt_img $SSW/yohkoh/ucon/idl/mctiernan/hxt_img.pro
[Previous] [Next]
NAME:
	hxt_img
 OFF-LINE!!!, use HXT_MULTIMG instead!


hxt_img0 $SSW/yohkoh/ucon/idl/metcalf/hxt_img0.pro
[Previous] [Next]
NAME:
	hxt_img0
PURPOSE:
	To make an hxt image for a given energy band, designed to access data 
       from the reformatted data base.  Calls makimg0 to make the image.
       The makimg0 procedure is particularly useful for quick look images.

       See the hxt_qlook program if you want to make multiple quick look 
       iamges.
CALLING SEQUENCE:
	.run hxt_img0
INPUT:
	index=HXT data info from test_rd
	data=counts in each subcollimator for each channel
OUTPUT:
	The structure hxi_index, with tags
	(DATA SELECTION)
	hxi_index.chan= channel used
		=0 L0 (15-24.4keV)
		=1 M1 (24.4-35.2 keV)
		=2 M2 (35.2 - 56.8 keV)
		=3 HI (56.8 - 100.0 keV)
	cnts_p_cm2= counts per cm^2 for the selected channel (not per sec) for the
		16 fan beam collimators
	hxi_index.actim= image accumulation time in millisec (not less than 500 ms)
	hxi_index.interval= end time minus start time =actim if there's no data missing
	hxi_index.bkg_time= start time for background accumulation (millisec of day)
	hxi_index.bkg_day= day of start of background accumulation (days since 1-Jan-79)
	hxi_index.bkg_actim= image accumulation time in millisec (not less than 500 ms)
	hxi_index.bkg_interval= end time minus start time =actim if there's no data missing

	(INPUT PARAMETERS TO THE SYNTHESIS ROUTINE)
	hxi_index.grause(8)=Each element is either 0b or 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	hxi_index.x0, hxi_index.y0= X and Y corrdinates in HXT Coordinate system,  
		these are not inmcluded in Ref. data base, and must be input 
		by hand.
	hxi_index.alpha= amplitude of phase correction factor
	hxi_index.iway=0 for triangular patterns, =1 for sine wave patterns
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.syserr= systematic error term to be added to Poisson Uncertainty
	(RESULTS OF SYNTHESIS ROUTINE)
	hxi_index.chi2= chi^2, reduced = total((fobs(b(i))-fobs)^2/var)/usenum
		where usenum is the number of SC's used
	hxi_index.max_bright= maximum brightness of image
	hxi_index.x_max= Column of max. brightness
	hxi_index.y_max= row of max. brightness
	sc_paras - The subcollimator parameters in a QS structure
	sc_paras, a structure of  HXI_QS_SCPara_Rec, with tags:
	sc_paras.sensor= id number of SC's
	sc_paras.spat_freq= spatial frequency of SC's
	sc_paras.pos_angle= position angle of SC's
	sc_paras.id='1'-'4' for fan-beam, 'S' for sin elements, 'C' for cos elements
	sc_paras.dc= dc offset for mod. pattern
	sc_paras.amp= amplitude of mod. pattern
	sc_paras.phase= phase of mod. pattern
	sc_paras.phase_corr= phase correction factor
	(OTHER STUFF NOT IN STRUCTURES)
	ictrl=1 if we want to see intermediate images
	p= 2-d modulation pattern used for image synthesis
	fobs= the observed counts in the SC's
	var= the uncertainty in fobs squared, or the variance
	data_out= the image, brightness in counts/pix^2 cm^2
	index_out= all of the structures mushed together...
DESCRIPTION:
	First data must be input using the program test_rd, which fills the
	structure INDEX, and the array DATA. The program prompts to see 
	if the image synthesis and modulation collimator parameters have
	been dealt with. Next it calls the routine get_hxtfobs, in which 
	the user selects time intervals, and the channel to be imaged. 
	And then the image.

       The output matches the MEM image quite well, although the MEM image
       will generally be flatter.
MODIFICATION HISTORY:
	Adapted from program movie7 of T. Sakao, by J.McTiernan, June '92

       June 21, 1993 TRM Modified hxt_img to hxt_img0.  The only substantive 
                         change is to call makimg0 instead of makimg.


hxt_impulsivness $SSW/yohkoh/hxt/idl/atest/hxt_impulsiveness.pro
[Previous] [Next]
   Name: hxt_impulsivness

   Input Parameters:
      index, data  - hxt 'index,data' pair 

   Output Parameters:
      (index,data) - if INFILE or EVENT_TIME specified, these are updated
      duration 
      net_duration
      impulsiveness

   Keyword Parameters:
      infile - optional hda file name (in lieu of index,data)
      event_time - optional event time to check  
                   (assumes all hda data online via cdrom/mag_disk) 
      deltat - deltaT (minutes) between event time and index(0)
               (only defined for EVENT_TIME input)

 CALLS: ***
	AVE_CTS, BOX_MESSAGE, FILE_EXIST [2], HXT_BACKGROUND, HXT_IMPULSIVENESS
	RD_XDA [1], RD_XDA [2], cdrom_files [1], cdrom_files [2], data_chk [1]
	data_chk [2], file_exist [1], file_exist [3], gt_day [1], gt_day [2]
	int2secarr [1], int2secarr [2], sel_filetimes [1], sel_filetimes [2], ssw_deltat
	time_window
   History:
      20-Jan-2000 - Hugh Hudson - wrote hx_duration
       9-Feb-2001 - S.L.Freeland - convert hx_duration to routine


HXT_LCURVE $SSW/yohkoh/ucon/idl/metcalf/hxt_lcurve.pro
[Previous] [Next]

pro hxt_lcurve, index0, data0, error0, lcur=lcur, marks=marks, $
                xsize=xsize, ysize=ysize, nodel_win_p=nodel_win_p, $
                noscale=noscale, polygon_mark=polygon_mark, plot6=plot6, $
                title=title, overplot=overplot, lerr=err, $
                stime=stime, mtime=mtime, etime=etime,noplot=noplot, $
                psym=psym,yrange=yrange,linestyle=linestyle, $
                xtitle=xtitle,errskip=errskip

NAME:
     HXT_LCURVE
PURPOSE:
     Interactively draw light curves for HXT image cubes
CATEGORY:
CALLING SEQUENCE:
     hxt_lcurve,index,data
INPUTS:
     index = HXI index
     data = image data cube
OPTIONAL INPUT PARAMETERS:
     error = error array for the data cube
KEYWORD PARAMETERS
     lcur = output of the light curves (nimages x ncurves)
     lerr = output of the errors on the light curves (nimages x ncurves)
     marks = the subscripts within the image that were selected.  The
             output array is NxM where N is the largest number of subscripts
             that were selected in a region, and M is the number of
             different regions selected.  When padding is necessary, the
             value is set to -1, so that value needs to be avoided.
             If marks is set on input, it will be used to make the plot
             and you will not interactively select the regions.
     stime,mtime,etime = start, middle, and end times of the time integration.
     title = string with title for the final plot.  Can be a string array
             so that different light curves have different titles.  A string
             array only makes sense if you have set up !p.multi to plot each
             curve separately.
     xtitle = string with title for the final plot.  Can be a string array
             so that different light curves have different titles.  A string
             array only makes sense if you have set up !p.multi to plot each
             curve separately.
     psym = symbol to use to mark data points.  Default is no symbol.
            If psym is a vector, each element coresponds to the different
            lightcurves.
     errskip = Plot only every errskip error bars (def = 1)
     linestyle = line style to use in plotting, def = 0.
                 If linestyle is a vector, each element coresponds to the 
                 different lightcurves.
     yrange = y range on plot
     /overplot = overplot the light curves on whatever is currently in the
                 plot window.
     /noplot = do not draw the final plot of all light curves.

     The following are passed to lcur_image and have no effect if  the marks 
     keyword is defined on input.

     xsize = x size of image
     ysize = y size of image
     /nodel_win_p = Passed to lcur_image.  Don't delete plot window.  This has
                    no effect if marks is set.
     /noscale = do not scale the image in stepper.
     /polygon_mark = use polygon method of selecting a region.
     /plot6 = plot in 6 panels.  Not recommended: I prefer to just set
              !p.multi myself.
OUTPUTS:
 CALLS: ***
	CLEAR_UTPLOT [1], CLEAR_UTPLOT [2], OUTPLOT [1], OUTPLOT [2], OUTPLOT [3]
	UTERRPLOT [1], UTERRPLOT [2], UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4]
	UTPLOT [5], UTPLOT [6], anytim2ints [1], anytim2ints [2], int2secarr [1]
	int2secarr [2], lcur_image, tag_index [1], tag_index [2]
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
     lcur_image is called with the /nonorm and /total_cnts keywords set.
PROCEDURE:
     Converts to "real" units counts/pixel/sec and then calls
     lcur_image.pro which sums the data into counts/sec.

     If the image is of byte type, it is assumed to be bytescaled data from
     hxt_multimg and is converted to float using index.hxi.max_bright.

     All the lightcurves are plotted one on top of the other unless !p.multi
     is set up to do multiple plots per page, in which case the lightcurves
     are plotted separately.
MODIFICATION HISTORY:
     T. Metcalf  1995-11-29
     T. Metcalf  1996-08-02 -Added /nodel_win_p in call to lcur_image.
     T. Metcalf  1996-08-15 -Added error bars.
                            -Added check for byte type data
     T. Metcalf  1996-11-05 -The final plot now uses the middle of the
                             integration time and plots a horizontal error
                             bar to indicate the integration time.
                            -Fixed minor bug which caused a crash when 
                             the error input array was not set.
     T. Metcalf  1996-11-08 -Added !p.multi check
                            -Changed the marks keyword so that if it is set
                             there is no interactive region selection.
                            -Added keywords nodel_win_p, noscale,
                             polygon_mark, and plot6 which are all passed to
                             lcur_image.
                            -Added keywords title and overplot.


HXT_LOW_SUM $SSW/yohkoh/ucon/idl/shimizu/hxt_low_sum.pro
[Previous] [Next]
NAME:
        HXT_LOW_SUM
POURPOSE:
        Get the total counts(summation of all the sensors) in HXT low 
      energy channel(13.9-22.7keV).
CATEGORY:
        Yohkoh/HXT analysis
CALLING SEQUENCE:
        low_sum = HXT_LOW_SUM(data, index, [fint= fint])
        low_sum = HXT_LOW_SUM(index)
INPUT:
        data    - HXT pc data (bytarr(4, 64, 4, *))
        index   - HXT index structure from reformatted data
OPTIONAL INPUT:
        fint    - data integration in flare mode. Default = 4. 
                In flare mode pulse count data comes 4 times per SF.
                   = 4(default): Sum 4 data in SF and output value
                       every SF(time resolution 1SF in flare md). 
                   = 2: time resolution 1/2 SF in flare md.
                   = 1: time resolution 1/4 SF in flare md.  
OUTPUT:
        low_sum - the total counts per sec (floating point data type)
                 Data structure  fint = 4: fltarr(*)   
                                      = 2: fltarr(2, *)
                                      = 1: fltarr(4, *)  
 CALLED BY:
	HXT_TEEM, plott_low_sum
PROCEDURE:
        (1) HXT_LOW_SUM(data, index)
              Quiet mode: Get data from HXT_DHK in index
              Flare mode: Get data from pc_data (data)
        (2) HXT_LOW_SUM(index)
              Get data from HXT_DHK in index every time. 
 CALLS: ***
	HXT_DECOMP, SUMROW [1], SUMROW [2], SUMROW [3], gt_dp_mode [1], gt_dp_mode [2]
	gt_dp_rate [1], gt_dp_rate [2]
RESTRICTIONS:
        (1) HXT_LOW_SUM(index)
              Index has the only integrated data of 4 pc data in 1 SF 
            even in Flare mode. (Restriction of reformatted data) 
MODIFICATION HISTORY:
        May 27, 1992  written by Toshifumi Shimizu
                                        (Univ. of Tokyo) 


hxt_mcaccum $SSW/yohkoh/ucon/idl/mctiernan/hxt_mcaccum.pro
[Previous] [Next]
NAME:
	hxt_mcaccum
PURPOSE:
 	plots hxt data, prompts for start and end times for data 
	accumulation and background, and returns an array with the
       accumulated counts, for each interval and channel. Then
       this will generate N sets of observations and sigmas
       using poisson statistics. Restricted to 1 time interval.
       Totals intervals before choosing samples, the old hxt_mcaccum
       samples before totaling. 
CALLING SEQUENCE:
       Hxt_mcaccum, index, data, index1, hxi_index, counts, sigma, bcounts, $
                     bsigma, trials=trials, img_trange=img_trange, $
                     bck_trange=bck_trange, channel=channel, $
                     accum_cnts=accum_cnts, ch_accum=ch_accum, $
                     serr_only=serr_only, norm_error=norm_error, $
                     no_serr=no_serr, st_times = st_times, $
                     int_times = int_times
INPUT:	
	index=data info from hda file
	data=counts in each subcollimator for each channel
KEYWORDS:
       trials = no. of MC trials for this interval. Default is 100
       img_trange = a time range for the images, any yohkoh format
       bck_range = a time_range for the background accumulation
       channel= a channel number for the plots, default is to prompt the user
       serr_only = if set, only use the systematic error term to
                   obtain samples, the default is to add poisson
                   variation and the systematic error term. The
                   default systematic error is 0.03, and can be
                   set using the sys_err keyword in HXT_MCIMG.
       norm_error = if set, vary the SC counts using a normal distribution,
                    with a standard deviation equal to norm_error*counts
       no_serr = if set, do not add systematic error to the variation
       So: counts = poidev(counts0)+sys_err*counts0*(2*(randomu(64,4)-0.5))
           is the default variation. If norm_error is set,
           then counts = counts0(1.0+norm_error(0)*randomn(64,4)+
                         sys_err*counts0*(2*(randomu(64,4)-0.5)
           If /serr_only is set, then
           counts = sys_err*counts0*(2*(randomu(64, 4)-0.5)
       And if the /no_serr keyword is set, the sys_err term is not included.
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. This must be an integer
                  number of the appropriate resolution in seconds, if the
                  value of int_times is less than a frame value.
OUTPUT:
       index1= index structure for the first frame of each image interval
	hxi_index.chan= channel used
		=0 L0 (15-24.4keV)
		=1 M1 (24.4-35.2 keV)
		=2 M2 (35.2 - 56.8 keV)
		=3 HI (56.8 - 100.0 keV)
	hxi_index.actim= image accumulation time in 10ths of secs
	hxi_index.interval= actim
	hxi_index.bkg_time= start time for background accumulation
                           (millisec OF day)
	hxi_index.bkg_day= day of start of background accumulation
                          (days since 1-Jan-79)
	hxi_index.bkg_actim= background accumulation time in 10ths of secs
	hxi_index.bkg_interval= actim 
       counts= the counts accumulated over the chosen intervals
       sigma= sqrt(counts)
       bcounts= the counts accumulated over the background interval
       bsigma= sqrt(bcounts)
DESCRIPTION:
	Uses the function plot_lcur to select the data to be imaged,
	and the background.
 CALLS: ***
	HX_DECOMP, POIDEV, SETGRA, choose_interval, gt_day [1], gt_day [2], gt_dp_mode [1]
	gt_dp_mode [2], hxt_chsums
MODIFICATION HISTORY:
	Written Oct-93 by JMM,
       Changed to give full resolution, 19-jul-94, JMM
       9/21/94, account for 4.0 second time lag in hda files, jmm
       1/9/95, changed calculation of sigma to be the same as
               in Tom Metcalf's hxtaccumulate.pro, to be consistent
               in pixon calculations.
       1/13/95, added MC code here, as old hxt_mcimg is not valid
       4/20/95, made consistent with new versions of hxtimg_accum, hxtsbt_mult,
                And added channel and trange keywords, to enable batch runs
       6/9/95, subtract background from counts before choosing intervals
       4/15/96, Added serr_only, norm_error,
       4/23/96, Added no_serr
       1/6/97, Added st_times, int_times, noback


hxt_mcimg $SSW/yohkoh/ucon/idl/mctiernan/hxt_mcimg.pro
[Previous] [Next]
NAME:
	hxt_mcimg
PURPOSE:
	To make HXT images, for a monte carlo sample of data sets,
       obtained for 1 time interval...
CALLING SEQUENCE:
        Hxt_mcimg, index, data, index_out, data_out, patterns, $
 GENERAL KEYWORDS:
            outfile = outfile, /append_outfile, channels = channels, $
            /Nolook, /nonorm, /bsmooth, Sys_err = sys_err, $
            /prompt_outfile, /calc_btot, $
 ACCUMULATION KEYWORDS:
            img_trange = img_trange, bck_trange = bck_trange, /alt_tsel, $
            dt_resolution = dt_resolution, accum_cnts = accum_cnts, $
            ch_accum = ch_accum, /noback, $, st_times = st_times, $
            int_times = int_times $
 MODULATION PATTERN KEYWORDS:
            /new_mod_patterns, xy = xy, expfac = expfac, $
            n_pix = n_pix, patt_shape = patt_shape, ph_correct = ph_correct, $
            patt_file = patt_file, grause_file = grause_file, $
            /sato_patterns
 MEM KEYWORDS:
            gamma0 = gamma0, chilim = chilim, Lambda_limit = lambda_limit, $
            lambda_max=lambda_max, delta_max=delta_max, iter_max=iter_max, $
 QLOOK KEYWORDS:
            /qlook, bin = bin, smooth = smooth, $
 PIXON KEYWORDS:
            /pixons, /snr, guess = guess, /quiet, $
            /verbose, /continued, /partan, $
            resolution = resolution, pixon_sizes = pixon_sizes, $
            /notty, /lo2hi_guess, /poisson, /chisqr, sensitivity, $
            pixonmap=pixonmap, $
 MONTE CARLO KEYWORDS:
            mc_trials = mc_trials, norm_error=norm_error, /serr_only,
            /no_serr
INPUT:
	index = HXT data info from hda file
	data = counts in each subcollimator for each channel
       patterns = the modulation patterns, (optional), if not passed in,
                 or if any of the mod patterns keywords
                 have been set, then new patterns will be calculated.
KEYWORD INPUT:
 GENERAL KEYWORDS:
       outfile = an output filename, NOTE: this will be made lower case.
                 Unlike previous versions, HXT_MCIMG no longer
                 prompts for an output file, this must be set if you
                 want to output into a file.
       /append_outfile = if set, and the output file already exists,
                        append the output file
       /prompt_outfile = if set, the routine prompts you for an output
                         filename after the images have been generated,
                         THIS IS IGNORED IF YOU'VE SET THE OUTFILE KEYWORD...
       channels = if set, will only image the channels in channels,
                  otherwise all channels are imaged.
       /nolook = do not plot the intermediate images,
       /nonorm = do not normalize images, the default is to normalize
                the images to byte arrays of 0 to 255, using the routine
                HXI_NORMAP. 
       /bsmooth= if set, smooth the image over 3 pixels, passed into
                 MAKIMG, AND MAKIMG_L. This is here to avoid the
                 overresolution common in  MEM images, but you may use this
                 for the pixon case too.
       calc_btot = if set, uses HXT_BTOT to calculate the total counts in the
                   image, 
 ACCUMULATION KEYWORDS:
       img_trange = a time range for the images, any Yohkoh time format...
       bck_range = a time_range for the background accumulation
       /alt_tsel = if set, use alt_tim_sel to get interval, instead of
                  plot_lcur, this is good if you have no xwindows.
       dt_resolution = number of 1/2 second (flare mode) or 4 second
                      (quiet mode) frames per image, default is to
                      use the whole time range. NOTE THAT THIS KEYWORD IS
                      IGNORED IF MULTIPLE INTERVALS HAVE BEEN SELECTED
                      EITHER IN PLOT_LCUR, OR IF THEY HAVE BEEN PASSED IN.
       accum_cnts = if set, the value of average counts/SC in a given
                    that you want for each set of images, the routine
                    will accumulate counts until the number of counts
                    in the given channel are greater than or equal to
                    this value. If set with a slash, ie. the value=1
                    then the default is 200 (a good value).
                    As of 9-jun-95, this refers to EXCESS counts, as
                    opposed to total counts. This keyword will also
                    not work if multiple intervals are selected while
                    in PLOT_LCUR, or are passed in.
       ch_accum = the channel you want to use for the accum_cnts (future
                  versions will allow you to accum different numbers of
                  counts for different channels).
       /noback = if set, the background will be set to zero, this is
                not recommended for MEM images.
	sys_err= systematic error term to be added to Poisson Uncertainty,
                default is 0.03.
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. This must be an integer
                  number of the appropriate resolution in seconds, if the
                  value of int_times is less than a frame value.
 MODULATION PATTERN KEYWORDS:
       /new_mod_patterns = If set, Force a new computation of the
                         modulation patterns, even if they exist already, 
                         even if the patterns parameter is set.  Normally, if
                         patterns is set, the modulation patterns are not
                         computed.  You must recompute the modulation 
                         patterns whenever you use a different pointing.
                         If any of the mod. pattern keywords are set,
                         the mod. patterns are recomputed.
       xy= an array containing the 2 HXA aspect coordinates, if not
           set, and the patterns are to be calculated, the program will prompt
           you.
       expfac= expansion factor, the default is 1.0, gives 2.47 arcsec pixels.
               The routine will no longer prompt you.
       n_pix= number of pixels in image, default is 64, the default n_pix and
              expfac give the same size as a Full res. flare mode PFI from SXT.
       patt_shape= pattern shape, 0 for triangular patterns, 1 for sine waves,
                   2 triangular with HI channel correction, 
                   3 for sine wave with HI channel correction.
                   2 is the default, as of 1-may-95
       ph_correct= amplitude of phase correction factor, default is -1.0,
                   Pay no attention to this unless you know what you're doing.
       patt_file = a filename for the mod. pattern parameters, the default
                      is $DIR_HXT_CAL/para3.dat
       grause_file = a filename for the grid use file, the default is
                     $DIR_HXT_CAL/grause, or an array of 64 1's or 0's
                     if set to 0, that subcollimator is not used
       sato_patterns = new in-flight calibrated mod. patterns,
                       for LO, M1 channels, courtesy of Jun Sato..
 MEM METHOD KEYWORDS:
       gamma0= initial value of iteration gain, default is 0.10
	chilim= minimum value of chi^2 needed in MEM iteration, default is 2.0
       lambda_limit = if set, makimg will iterate to the given value
                      of lambda, if set to 1, this will be calculated by the
                      highest channel image for each interval
       lambda_max = max value of lambda allowed, default is 50, note that
                    this is different than lambda_limit, use of lambda_limit
                    turns off the Chi^2 criterion, use of lambda_max keeps
                    the Chi^2 criterion.
       iter_max = max no. of iterations for a given lambda, default is 150
       delta_max = max value of delta for a switch to a new lambda, default is 0.03
 PIXON KEYWORDS:
       /pixons= if set uses Tom Metcalf;s HXTPIX to get the images, in pixons.
       guess = initial guess for reconstructed image (def = compute with
              hxt_qlook).  If guess is not n_pix by n_pix or if all elements
              of guess are LE 0, then the guess is not used.  If you pass
              a standard image (i.e. north up east left) the image should
              be flipped before passing as a guess: guess = rotate(guess,7).
              Guess can be a vector of images provided that the dimensions
              of guess are the same as the dimensions of data_out.  HOWEVER,
              this will only work if you analyze a single energy channel, i.e.
              you must pass something like chan=[0].
       /lo2hi_guess = bootstrap the initial guesses, i.e use the LO image as 
              a guess for the M1 image, the M1 as a guess for the M2, and
              the M2 as a guess for the HI.  To make
              this work, be sure to specify channels from LO up to whatever
              channel you are interested in, e.g. chan=[0,1,2],/lo2hi_guess.
       /snr = Weight the residuals by the signal-to-noise ratio.
       resolution = smallest allowed pixon size (pixels), default = 1
       pixon_sizes = an integer list of pixon sizes (resolutions) to use.
       /partan = Uses "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails.
       /continued = Uses faster "continued parallel tangent"
                  iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent
       /notty = Not running on a tty.  Set this for background jobs.
       /quiet = Don't print any diagnostics
       /verbose = print lots of diagnostics
       /poisson, /chisqr = If /pixons is set, the /poisson and /chisqr
                 keywords have the following effects: 
                  -----------------------
                 poisson = 0, chisqr = 0:
                 If neither /poisson nor /chisqr are set, the error
                 is set to sqrt(total(counts)), as in MEM. This is the
                 default behavior which should be appropriate for most cases. 
                 ------------------------
                 chisqr = 1:
                 If /chisqr is set, regardless of whether /poisson is set,
                 the error is set to a weighted average of sqrt(total(counts))
                 and total(sqrt(counts)).  This is useful when the count
                 rate is low or when the integration time is long.  
                 -----------------------
                 poisson = 1, chisqr = 1:
                 If /poisson is set and /chisqr is not set, the error
                 computed by hxtimg_accum is ignored in the pixon code which
                 uses Poisson statistics based on the counts above
                 background. This behavior may not be what you expect.
       pixonmap = returns with the pixon maps
       sensitivity = controls the sensitivity of the pixon map.  0.0 is
                          most sensitive.  Def = sqrt(2.).
MONTE CARLO KEYWORDS:
       mc_trials = number of Monte Carlo trials, default is 100
       serr_only = if set, only use the systematic error term to
                   obtain samples, the default is to add poisson
                   or normal variation and the systematic error tern
       norm_error = if set, vary the SC counts using a normal distribution,
                    with a standard deviation equal to norm_error*counts
       no_serr = if set, do not include the sys_err in the variation
OUTPUT:
       index_out = index for images, this contains the HDA index for
                   the start of each image accumulation time,
                   The tag index_out.hxi contains the structure hxi_index,
                   with tags:
	(DATA SELECTION)
	hxi_index.chan= channel used
		=0 L0 (13.7-22.7 keV)
		=1 M1 (22.7-32.7 keV)
		=2 M2 (32.7-52.7 keV)
		=3 HI (52.7-92.8 keV)
	cnts_p_cm2= counts per cm^2 for the selected channel (not per sec)
                   for the 16 fan beam collimators*some normalization factor
	hxi_index.actim= image accumulation time in tenths of seconds.
	hxi_index.interval= end time minus start time =actim if there's
                           no data missing.
	hxi_index.bkg_time= start time for background accumulation
                           (millisec of day)
	hxi_index.bkg_day= day of start of background accumulation
                          (days since 1-Jan-79)
	hxi_index.bkg_actim= background accumulation time in millisec 
	hxi_index.bkg_interval= end time minus start time
	(INPUT PARAMETERS TO THE SYNTHESIS ROUTINES)
	hxi_index.grause(8)=Each element is either 0b or 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	hxi_index.x0, hxi_index.y0= X and Y corrdinates in HXT Coordinate
               system,  can be obtained frm SXT data using
               conv_p2hxt(gt_center(sxt_index)), may be input interactively.
	hxi_index.alpha= amplitude of phase correction factor
	hxi_index.iway=0 for triangular patterns, =1 for sine wave patterns
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.syserr= systematic error term to be added to Poisson
                         Uncertainty
	hxi_index.gamma0= initial value of iteration gain (NOT USED FOR PIXONS)
	hxi_index.laminc= initial value for lambda increment (NOT USED FOR PIXONS)
	hxi_index.chilim= minimum value of chi^2 needed (NOT USED FOR PIXONS)
	(RESULTS OF SYNTHESIS ROUTINES)
	hxi_index.lambda= final value of lambda, which controls the 
                         iteration step size. (NOT USED FOR PIXONS)
	hxi_index.delta= total((b(i)-b(i-1))^2)/Total(b(i)^2) for each
                        iteration, lambda is changed when delta is reduced
                        to 0.030 or less.  (NOT USED FOR PIXONS)
	hxi_index.iteration= the number of iterations, for the final value of
                            lambda.
	hxi_index.chi2= chi^2, reduced = total((fobs(b(i))-fobs)^2/var)/usenum
		where usenum is the number of SC's used
	hxi_index.max_bright= maximum brightness of image
	hxi_index.x_max= Column of max. brightness
	hxi_index.y_max= row of max. brightness
 And the answer:
       data_out = data for images, in counts/cm^2/SC,  not per second,
                  normalized from 0 to 255, unless the /nonorm keyword is set,
                  normalized data can be unnormalized using the routine HXI_UNNORM.
DESCRIPTION:
       Index and Data come from an HDA file, The position in HXA coordinates
       Can be obtained in various ways, using GET_HXT_POS, or from SXT images
       using xy = gt_center(sxt_index, /hxt). You choose the time ranges,
       as a default. Once counts are accumulated, the images are synthesized
       using the Max Entropy method (default), the Pixon method (if you've
       set the /pixons keyword), or zeroth order regularization (/qlook).
       The image is normalized before being passed out of the routine.
MODIFICATION HISTORY:
	Adapted from program movie7 of T. Sakao, by J.McTiernan, June '92
       Lots o' revisions, 18-jul-94, jmm
       different mod patterns for different channels, 20-jul-94, jmm
       account for 4 second time lag, 21-sep-94, jmm
       Added xxx keyword, 14-feb-95, jmm
       redefined accum_cnts keyword to excess counts, not total counts,
              9-jun-95, jmm
       Got sick of all of these keywords, got rid of pixon and qlook options,
              stick with MEM, chnaged defaults for output file, 13-jun-95, jmm
       Oops, Pixons are back, reorganized keyword list,
              Hopefully things are understandable, added modifications
              of Tom Metcalf for pixon code, and batch running, 22-Jun-95, jmm
       Put the prompt for output files back in, as a keyword, jmm 11-jul-95
       Added lambda_max, delta_max, iter_max keywords, 1-aug-95, jmm
       Wrote from hxt-multimg, 1-aug-95, jmm
       Put back in restriction of fobs>0.0, which was removed when GETVAR
       was retired, 22-sep-95, jmm
       Changed  default sigmas back to poisson statistics, added /poisson
       and /chisqr keywords, 6-mar-96, jmm
       added perr-only, and serr_only  keywords and changed the default
       MC calculation to include both types of variations, 15-apr-1996, jmm
       Added calc_btot, and sato_patterns keywords, 17-jun-1997, jmm


HXT_MED1_SUM $SSW/yohkoh/ucon/idl/shimizu/hxt_med1_sum.pro
[Previous] [Next]
NAME:
        HXT_MED1_SUM
POURPOSE:
        Get the total counts(summation of all the sensors) in HXT med1 
      energy channel(22.7-32.7keV).
CATEGORY:
        Yohkoh/HXT analysis
CALLING SEQUENCE:
        med1_sum = HXT_MED1_SUM(data, index, [fint= fint])
INPUT:
        data    - HXT pc data (bytarr(4, 64, 4, *))
        index   - HXT index structure from reformatted data
OPTIONAL INPUT:
        fint    - data integration in flare mode. Default = 4. 
                In flare mode pulse count data comes 4 times per SF.
                   = 4(default): Sum 4 data in SF and output value
                       every SF(time resolution 1SF in flare md). 
                   = 2: time resolution 1/2 SF in flare md.
                   = 1: time resolution 1/4 SF in flare md.  
OUTPUT:
        med1_sum - the total counts per sec (floating point data type)
                 Data structure  fint = 4: fltarr(*)   
                                      = 2: fltarr(2, *)
                                      = 1: fltarr(4, *)  
 CALLED BY:
	HXT_TEEM, plott_med1_sum
PROCEDURE:
        Quiet mode: No data = 0 
        Flare mode: Get data from pc_data (data)
 CALLS: ***
	HXT_DECOMP, gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
RESTRICTIONS:
        (1) This data comes only in flare mode.
MODIFICATION HISTORY:
        May 27, 1992  written by Toshifumi Shimizu
                                        (Univ. of Tokyo) 


HXT_MED2_SUM $SSW/yohkoh/ucon/idl/shimizu/hxt_med2_sum.pro
[Previous] [Next]
NAME:
        HXT_MED2_SUM
POURPOSE:
        Get the total counts(summation of all the sensors) in HXT med2
      energy channel(32.7-52.7keV).
CATEGORY:
        Yohkoh/HXT analysis
CALLING SEQUENCE:
        med2_sum = HXT_MED2_SUM(data, index, [fint= fint])
INPUT:
        data    - HXT pc data (bytarr(4, 64, 4, *))
        index   - HXT index structure from reformatted data
OPTIONAL INPUT:
        fint    - data integration in flare mode. Default = 4. 
                In flare mode pulse count data comes 4 times per SF.
                   = 4(default): Sum 4 data in SF and output value
                       every SF(time resolution 1SF in flare md). 
                   = 2: time resolution 1/2 SF in flare md.
                   = 1: time resolution 1/4 SF in flare md.  
OUTPUT:
        med2_sum - the total counts per sec (floating point data type)
                 Data structure  fint = 4: fltarr(*)   
                                      = 2: fltarr(2, *)
                                      = 1: fltarr(4, *)  
 CALLED BY:
	HXT_TEEM, plott_med2_sum
PROCEDURE:
        Quiet mode: No data = 0 
        Flare mode: Get data from pc_data (data)
 CALLS: ***
	HXT_DECOMP, gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
RESTRICTIONS:
        (1) This data comes only in flare mode.
MODIFICATION HISTORY:
        May 23, 1992  written by Toshifumi Shimizu
                                        (Univ. of Tokyo) 


hxt_memimg $SSW/yohkoh/hxt/idl/atest/hxt_memimg.pro
[Previous] [Next]
NAME:
	hxt_memimg
PURPOSE:
	The image synthesis subroutine, now in IDL, hxt_memimg performs the 
	image deconvolution for HXT using the maximum entropy method.
CALLING SEQUENCE:
	hxt_memimg, ictrl, hxi_index, index1, fobs, sig, p, index_out, $
                   data_out, bsmooth = bsmooth
INPUT:
	ictrl=1 enables us to look at intermediate data, or it 
		will, when implemented.
	hxi_index= a structure containing everything we need to know about
                  the hxt image
	Tags used:
	hxi_index.grause(8)=Each element is either 0b or 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.gamma0= initial value of iteration gain
	hxi_index.laminc= initial value for lambda increment
	hxi_index.chilim= minimum value of chi^2 needed
	index1=index structure of the first data set in accumulation
	fobs= the observed counts in the SC's
	sig= the uncertainty in fobs = sqrt(fobs) kind of
	p= the 2-d modulation pattern, reformed and transposed from a 3d
          array of (pxln, pxln, nfobs) to (nfobs, pxln^2), 
          fobs = p#b, where b is the brightness, this should be done
          before, but if not, it will be done here in hxt_memimg
OUTPUT:
	More tags for the structure hxi_index:
	hxi_index.lambda= final value of lambda, which controls the 
		          iteration step size
	hxi_index.iteration= the number of iterations, for a given value of
                            lambda
	hxi_index.delta= total((b(i)-b(i-1))^2)/Total(b(i)^2) for each
                        iteration, lambda is changed when delta is reduced
                        to 0.030 or less
	hxi_index.chi2= chi^2, reduced = total((fobs(b(i))-fobs)^2/var)/usenum
		where usenum is the number of SC's used
	hxi_index.max_bright= maximum brightness of image
	hxi_index.x_max= Column of max. brightness
	hxi_index.y_max= row of max. brightness

	index_out= Hxi gen hxt and hxi structure,...
	data_out= the brightness, a n_pixXn_pix array of
                 counts/cm^2/pixel^2, THE ANSWER. n_pix is obtained from
                 the mod pattern (18-jul-94, jmm)
KEYWORDS:
       chi_limit = limiting chi^2, the default is 1.0
       bsmooth = if set, smooth the data over 3 pixels
       lambda_max = max value of lambda allowed, default is 50
       lambda_limit = if set, memimg will only iterate to a given value
                      of lambda, ignoring chi^2 limit, the default is 50.
       iter_max = max no. of iterations for a given lambda, default is 150
       delta_max = max value of delta for a switch to a new lambda,
                  default is 0.03
       btot_in = An estimate of the total # of counts in the image
                 The default is a weighted sum of the counts in the SC's
DESCRIPTION:
	hxt_memimg uses the maximum entropy method to make an HXT image, given the
	SC modulation patterns, p, and the counts and variances in the 64
	sub-collimators, fobs and var. It's a two step procedure, the entropy
	(b*log(b)) is maximized subject to the constraint that chi^2 is a of order 1.
	This constraint is included as a lagrange multipliers, lambda. Starting 
	with a gray map initially, the image is improved for a given value of
	lambda until delta<0.03, i.e., the change between images is very small.
	Then lambda is varied, until we reach a chi^2 value less than or equal to 2.
 CALLS: ***
	hxt_unpack_grause, str_merge [1], str_merge [2], te_scale
 CALLED BY:
	hxt_multimg
MODIFICATION HISTORY:
	Translated from FORTRAN routine MAKIMG, of T. Sakao, by J. McTiernan, July '92
	30-Sep-92 (JM) - changed chilim form an absolute of 2.0 to 
			 0.40*Sqrt(total(var))/64, found semi-empirically
        8-Jun-93 (JM) - changed chilim back to 2.0
       26-oct-93 (JMM) - added chi_limit keyword
       29-dec-94 (JMM) - restored use of hgain in calculation of btot
       13-Jun-95 (jmm) - added bsmooth keyword
       1-Aug-95  (jmm) - removed call to GETVAR, since the systematic error
                         is now in HXTIMG_ACCUM, Also added lambda_max,
                         iter_max, and delta_max keywords
       27-jan-1997 (jmm) - added btot_in keyword
       5-jun-1998 (jmm) - New method, based on J.Sato's thesis work
                          Btot is now a variable, the modulation
                          pattern matrix is a 2d matrix, the algorithm
                          here is pulled from HESSI_MEMIMG


hxt_modpat $SSW/yohkoh/hxt/idl/atest/hxt_modpat.pro
[Previous] [Next]
NAME:
	hxt_modpat
PURPOSE:
	Generates the 2-d modulation patterns, for each SC grid,
	to be used in image synthesis, a 3d array, one for each channel.
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	hxt_modpat,hxi_index,sc_paras,trn,p,expfac=expfac,n_pix=n_pix
INPUT:	tags of image structure hxi_index,
	hxi_index.x0,hxi_index.y0= x and y coordinates given in HXT coordinate system
	hxi_index.area= scintillator effective area
	tags of SC parameter structure
	sc_paras.spat_freq= spatial frequency of the SC's
	sc_paras.pos_angle= position angle of the SC's
	trn= modulation patterns of the SC's
OUTPUT:
	p= fltarr(n_pix,n_pix,64) the 2-d modulation pattern of each SC,
		such that the observed count rate in the nth SC is
		given by fobs(n)=total(p(*,*,n)*b(*,*)), where 
		b(i,j) is the brightness of the (i,j)th pixel
KEYWORDS:
       expfac= the expansion factor for the field of view, default is
               1.0, giving 64x64 pixels and a synthesis aperture of 2.2 arcmin
       n_pix= number of pixels in image, default is 64.
 CALLS: ***
	Hxt_getflt_arr
 CALLED BY:
	hxt_pattern_maker
HISTORY:
       Written July '92 by J.McTiernan
       Added EXPFAC keyword 29-oct-93 (JMM)
       Added n_pix keyword 18-jul-94 (jmm)
       Channel variant mod patterns, 20-jul-94 (jmm)
       New name, 24-Jun-1998, jmm


hxt_multimg $SSW/yohkoh/hxt/idl/atest/hxt_multimg.pro
[Previous] [Next]
 NAME:
	 hxt_multimg
 PURPOSE:
	 To make HXT images.
 CATEGORY:
        Yohkoh HXT
 CALLING SEQUENCE:
        Hxt_multimg, index, data, index_out, data_out, patterns, $
 GENERAL KEYWORDS:
            outfile = outfile, /append_outfile, channels = channels, $
            /Nolook, /nonorm, /bsmooth, Sys_err = sys_err, /prompt_outfile, $
            error=error, /calc_btot, amp_err = amp_err, $
            phase_err = phase_err, $
 ACCUMULATION KEYWORDS:
            img_trange = img_trange, bck_trange = bck_trange, /alt_tsel, $
            dt_resolution = dt_resolution, accum_cnts = accum_cnts, $
            ch_accum = ch_accum, /noback, st_times = st_times, $
            int_times = int_times $
 MODULATION PATTERN KEYWORDS:
            /new_mod_patterns, xy = xy, expfac = expfac, ntrn = ntrn, $
            n_pix = n_pix, patt_file = patt_file, grause_file = grause_file, $
 MEM KEYWORDS:
            gamma0 = gamma0, chilim = chilim, Lambda_limit = lambda_limit, $
            lambda_max=lambda_max, delta_max=delta_max, iter_max=iter_max, $
 QLOOK KEYWORDS:
            /qlook, bin = bin, smooth = smooth, $
 PIXON KEYWORDS:
            /pixons, /snr, guess = guess, /quiet, $
            /verbose, /continued, /partan, $
            resolution = resolution, pixon_sizes = pixon_sizes, $
            /notty, /lo2hi_guess, /poisson, /chisqr, sensitivity, $
            pixonmap=pixonmap
INPUT:
	index = HXT data info from hda file
	data = counts in each subcollimator for each channel
       patterns = the modulation patterns, (optional), if not passed in,
                 or if any of the mod patterns keywords
                 have been set, then new patterns will be calculated.
KEYWORD INPUT:
 GENERAL KEYWORDS:
       outfile = an output filename, NOTE: this will be made lower case.
                 Unlike previous versions, HXT_MULTIMG no longer
                 prompts for an output file, this must be set if you
                 want to output into a file.
       /append_outfile = if set, and the output file already exists,
                        append the output file
       /prompt_outfile = if set, the routine prompts you for an output
                         filename after the images have been generated,
                         THIS IS IGNORED IF YOU'VE SET THE OUTFILE KEYWORD...
       channels = if set, will only image the channels in channels,
                  otherwise all channels are imaged.
       /nolook = do not plot the intermediate images,
       /nonorm = do not normalize images, the default is to normalize
                the images to byte arrays of 0 to 255, using the routine
                HXI_NORMAP. 
       /bsmooth= if set, smooth the image over 3 pixels, passed into
                 MAKIMG, AND MAKIMG_L. This is here to avoid the
                 overresolution COMMON in  MEM images, but you may use this
                 for the pixon case too.
       /chisqr= if set, sigma(counts) is a weighted sum of total(sqrt(counts))
                 and sqrt(total(counts)), where the total is taken over the
                 accumulation intervals, This was the default, but is not
                 any longer, 6-mar-96, jmm
       error = returns with an error estimate for the HXT images.  Suitable
               for use with hxt_lcurve.  CAUTION: These are statistical 
               errors only.  There is no account for reconstruction errors.
               Returned with MEM and Pixon reconstructions only.
       calc_btot = if set, uses HXT_BTOT to calculate the total counts in the
                   image, 
 ACCUMULATION KEYWORDS:
       img_trange = a time range for the images, any Yohkoh time format...
       bck_range = a time_range for the background accumulation
       /alt_tsel = if set, use alt_tim_sel to get interval, instead of
                  plot_lcur, this is good if you have no xwindows.
       dt_resolution = number of 1/2 second (flare mode) or 4 second
                      (quiet mode) frames per image, default is to
                      use the whole time range. NOTE THAT THIS KEYWORD IS
                      IGNORED IF MULTIPLE INTERVALS HAVE BEEN SELECTED
                      EITHER IN PLOT_LCUR, OR IF THEY HAVE BEEN PASSED IN.
       accum_cnts = if set, the value of average counts/SC in a given
                    that you want for each set of images, the routine
                    will accumulate counts until the number of counts
                    in the given channel are greater than or equal to
                    this value. If set with a slash, ie. the value=1
                    then the default is 200 (a good value).
                    As of 9-jun-95, this refers to EXCESS counts, as
                    opposed to total counts. This keyword will also
                    not work if multiple intervals are selected while
                    in PLOT_LCUR, or are passed in.
       ch_accum = the channel you want to use for the accum_cnts (future
                  versions will allow you to accum different numbers of
                  counts for different channels).
       /noback = if set, the background will be set to zero, this is
                not recommended for MEM images.
	sys_err= systematic error term to be added to Poisson Uncertainty,
                default is 0.01, as of jan-1997
                As of june-1998, sys_err is only used for PIXON images
       amp_err = systematic amplitude error term, either a scalar, or
                 an array of nchannels, one value for each channel
                 used, or an array of four, corresponding to all four
                 channels (the program will pick out the appropriate
                 value for each channel).
                 the default is [0.01, 0.015, 0.02, 0.03]
                 for the four channels
	phase_err= systematic phase error term, the default is 0.315
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. This must be an integer
                  number of the appropriate resolution in seconds, if the
                  value of int_times is less than a frame value.
 MODULATION PATTERN KEYWORDS:
       /new_mod_patterns = If set, Force a new computation of the
                         modulation patterns, even if they exist already, 
                         even if the patterns parameter is set.  Normally, if
                         patterns is set, the modulation patterns are not
                         computed.  You must recompute the modulation 
                         patterns whenever you use a different pointing.
                         If any of the mod. pattern keywords are set,
                         the mod. patterns are recomputed.
       xy= an array containing the 2 HXA aspect coordinates, if not
           set, and the patterns are to be calculated, the program will prompt
           you. This now (as of 18-oct-1996) allows you
           to pass in an sxt_index as the corrdinates, or a string
           representation of the position, e.g. 'n16w13'
       expfac= expansion factor, the default is 1.0, gives 2.47 arcsec pixels.
               The routine will no longer prompt you.
       n_pix= number of pixels in image, default is 64, the default n_pix and
              expfac give the same size as a Full res. flare mode PFI from SXT.
       patt_file = a filename for the mod. pattern parameters, the default
                      is $DIR_HXT_CAL/npara.dat, as of 13-may-1998
       grause_file = a filename for the grid use file, the default is
                     $DIR_HXT_CAL/grause, or an array of 64 1's or 0's
                     if set to 0, that subcollimator is not used
       ntrn = the number of points in the 1-d mod patterns for each SC
              the default is 512
 MEM METHOD KEYWORDS:
       gamma0= initial value of iteration gain, default is 0.08
	chilim= minimum value of chi^2 needed in MEM iteration, default is 2.0
       lambda_limit = if set, makimg will iterate to the given value
                      of lambda.
       lambda_max = max value of lambda allowed, default is 50, note that
                    this is different than lambda_limit, use of lambda_limit
                    turns off the Chi^2 criterion, use of lambda_max keeps
                    the Chi^2 criterion.
       iter_max = max no. of iterations for a given lambda, default is 150
       delta_max = max value of delta for a switch to a new lambda, default is 0.03
 PIXON KEYWORDS:
       /pixons= if set uses Tom Metcalf;s HXTPIX to get the images, in pixons.
       guess = initial guess for reconstructed image (def = compute with
              hxt_qlook).  If guess is not n_pix by n_pix or if all elements
              of guess are LE 0, then the guess is not used.  If you pass
              a standard image (i.e. north up east left) the image should
              be flipped before passing as a guess: guess = rotate(guess,7).
              Guess can be a vector of images provided that the dimensions
              of guess are the same as the dimensions of data_out.  HOWEVER,
              this will only work if you analyze a single energy channel, i.e.
              you must pass something like chan=[0].
       /lo2hi_guess = bootstrap the initial guesses, i.e use the LO image as 
              a guess for the M1 image, the M1 as a guess for the M2, and
              the M2 as a guess for the HI.  To make
              this work, be sure to specify channels from LO up to whatever
              channel you are interested in, e.g. chan=[0,1,2],/lo2hi_guess.
       /snr = Weight the residuals by the signal-to-noise ratio.
       resolution = smallest allowed pixon size (pixels), default = 1
       pixon_sizes = an integer list of pixon sizes (resolutions) to use.
       /partan = Uses "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails.
       /continued = Uses faster "continued parallel tangent"
                  iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent
       /notty = Not running on a tty.  Set this for background jobs.
       /quiet = Don't print any diagnostics
       /verbose = print lots of diagnostics
       /poisson, /chisqr = If /pixons is set, the /poisson and /chisqr
                 keywords have the following effects: 
                  -----------------------
                 poisson = 0, chisqr = 0:
                 If neither /poisson nor /chisqr are set, the error
                 is set to sqrt(total(counts)), as in MEM. This is the
                 default behavior which should be appropriate for most cases. 
                 ------------------------
                 chisqr = 1:
                 If /chisqr is set, regardless of whether /poisson is set,
                 the error is set to a weighted average of sqrt(total(counts))
                 and total(sqrt(counts)).  This is useful when the count
                 rate is low or when the integration time is long.  
                 -----------------------
                 poisson = 1, chisqr = 1:
                 If /poisson is set and /chisqr is not set, the error
                 computed by hxtimg_accum is ignored in the pixon code which
                 uses Poisson statistics based on the counts above
                 background. This behavior may not be what you expect.
       pixonmap = returns with the pixon maps
       sensitivity = controls the sensitivity of the pixon map.  0.0 is
                          most sensitive.  Def = sqrt(2.).
OUTPUT:
       index_out = index for images, this contains the HDA index for
                   the start of each image accumulation time,
                   The tag index_out.hxi contains the structure hxi_index,
                   with tags:
	(DATA SELECTION)
	hxi_index.chan= channel used
		=0 L0 (13.7-22.7 keV)
		=1 M1 (22.7-32.7 keV)
		=2 M2 (32.7-52.7 keV)
		=3 HI (52.7-92.8 keV)
	cnts_p_cm2= counts per cm^2 for the selected channel (not per sec)
                   for the 16 fan beam collimators*some normalization factor
	hxi_index.actim= image accumulation time in tenths of seconds.
	hxi_index.interval= end time minus start time =actim if there's
                           no data missing.
	hxi_index.bkg_time= start time for background accumulation
                           (millisec of day)
	hxi_index.bkg_day= day of start of background accumulation
                          (days since 1-Jan-79)
	hxi_index.bkg_actim= background accumulation time in millisec 
	hxi_index.bkg_interval= end time minus start time
	(INPUT PARAMETERS TO THE SYNTHESIS ROUTINES)
	hxi_index.grause(8)=Each element is from 0b to 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	hxi_index.x0, hxi_index.y0= X and Y corrdinates in HXT Coordinate
               system,  can be obtained frm SXT data using
               conv_p2hxt(gt_center(sxt_index)), may be input interactively.
	hxi_index.alpha= amplitude of phase correction factor = -1.0
	hxi_index.iway=0 for triangular patterns, =1 for sine wave patterns
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.syserr= systematic error term to be added to Poisson
                         Uncertainty
	hxi_index.gamma0= initial value of iteration gain (NOT USED FOR PIXONS)
	hxi_index.laminc= initial value for lambda increment (NOT USED FOR PIXONS)
	hxi_index.chilim= minimum value of chi^2 needed (NOT USED FOR PIXONS)
       hxi_index.perr = phase error term
       hxi_index.aerr = amplitude error term
	(RESULTS OF SYNTHESIS ROUTINES)
	hxi_index.lambda= final value of lambda, which controls the 
                         iteration step size. (NOT USED FOR PIXONS)
	hxi_index.delta= total((b(i)-b(i-1))^2)/Total(b(i)^2) for each
                        iteration, lambda is changed when delta is reduced
                        to 0.030 or less.  (NOT USED FOR PIXONS)
	hxi_index.iteration= the number of iterations, for the final value of
                            lambda.
	hxi_index.chi2= chi^2, reduced = total((fobs(b(i))-fobs)^2/var)/usenum
		where usenum is the number of SC's used
	hxi_index.max_bright= maximum brightness of image
	hxi_index.x_max= Column of max. brightness
	hxi_index.y_max= row of max. brightness
 And the answer:
       data_out = data for images, in counts/cm^2/SC,  not per second,
                  normalized from 0 to 255, unless the /nonorm keyword is set,
                  normalized data can be unnormalized using the routine HXI_UNNORM.
DESCRIPTION:
       Index and Data come from an HDA file, The position in HXA coordinates
       Can be obtained in various ways, using GET_HXT_POS, or from SXT images
       using xy = gt_center(sxt_index, /hxt). You choose the time ranges,
       as a default. Once counts are accumulated, the images are synthesized
       using the Max Entropy method (default), the Pixon method (if you've
       set the /pixons keyword), or zeroth order regularization (/qlook).
       The image is normalized before being passed out of the routine.
 CALLS: ***
	FILE_EXIST [2], HXT_BTOT, HXT_ERROR, HXT_STRUCT [1], HXT_STRUCT [2], STR_LOAD
	file_exist [1], file_exist [3], fmt_tim [1], fmt_tim [2], hxi_normap, hxt_memimg
	hxt_pattern_maker, hxtimg_accum, hxtpix, hxtsbt_mult, input [1], input [2], makimg0
	sav_hxi, str_merge [1], str_merge [2], time_2_fileid
 CALLED BY:
	HXT_AUTOIMG
MODIFICATION HISTORY:
	Adapted from program movie7 of T. Sakao, by J.McTiernan, June '92
       Lots o' revisions, 18-jul-94, jmm
       different mod patterns for different channels, 20-jul-94, jmm
       account for 4 second time lag, 21-sep-94, jmm
       Added xxx keyword, 14-feb-95, jmm
       redefined accum_cnts keyword to excess counts, not total counts,
              9-jun-95, jmm
       Got sick of all of these keywords, got rid of pixon and qlook options,
              stick with MEM, changed defaults for output file, 13-jun-95, jmm
       Oops, Pixons are back, reorganized keyword list,
              Hopefully things are understandable, added modifications
              of Tom Metcalf for pixon code, and batch running, 22-Jun-95, jmm
       Put the prompt for output files back in, as a keyword, jmm 11-jul-95
       Added lambda_max, delta_max, iter_max keywords, 1-aug-95, jmm
       Put back in restriction of fobs>0.0, which was removed when GETVAR
       was retired, 22-sep-95, jmm
       Changed  default sigmas back to poisson statistics, added /poisson
       and /chisqr keywords, 6-mar-96, jmm
       T. Metcalf 1996-10-01 Added calls to hxt_error.  Added pixon keywords
                  sensitivity, pixonmap.  Added error, imagedata, imagesig
                  keywords.
       T. Metcalf 1996-10-10 Fixed a bug in the pixon error analysis which
                  did not return the error estimate properly when multiple
                  channels were analyzed.
       Added the option to pass in an SXT index, or string for the flare
       position, jmm, 18-oct-1996.
       Added patt_file and grause_file keywords, jmm, 26-nov-96
       Fixed bug in which the chilim keyword was not being passed into
       MAKIMG, jmm, 3-jan-97
       Added st_times, int_times keywords, jmm, 3-jan-97
       sato_patterns, added, 14-jan-1997
       added call to HXT_BTOT, by Tom Metcalf, for the MEM images
       27-jan-1997, jmm, this can be turned on by setting /calc_btot
       new mod. patterns, jmm, 4-jun-1998, sato_patterns is no longer
       a valid keyword, Original sys_err is only retained for
       Pixon images, 29-jun-1998, jmm


hxt_pattern_maker $SSW/yohkoh/hxt/idl/atest/hxt_pattern_maker.pro
[Previous] [Next]
NAME:
	hxt_pattern_maker
PURPOSE:
	To input the image synthesis control parameters, and generate the 
	modulation pattern, and control the iteration. 
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	hxt_pattern_maker,hxi_index,p,sc_paras,trn,xy=xy,expfac=expfac,$
                     n_pix=n_pix, patt_file = patt_file, $
                     grause_file = grause_file, ntrn = ntrn
INPUT:
       trn= 1-d mod patterns of each SC, if passed in, you need not generate it
	hxi_index= a structure containing everything we need to know
                  about the hxt image. 
	Tags for the structure hxi_index:
	hxi_index.alpha= amplitude of phase correction factor
	hxi_index.iway=0 for triangular patterns
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.syserr= systematic error term to be added to Poisson Uncertainty
	hxi_index.gamma0= initial value of iteration gain
	hxi_index.laminc= initial value for lambda increment
	hxi_index.chilim= minimum value of chi^2 needed
OUTPUT:
	hxi_index.x0, hxi_index.y0= X and Y corrdinates in HXT Coordinate
               system, these are not included in Ref. data base, and must
               be input by hand, or obtained from other sources, try
               xy = conv_p2hxt(gt_center(sxt_index)) given SXT data
       hxi_index.grause(8)=Each element is either 0b to 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	p= 2-d modulation pattern, for the given coordinates
	sc_paras - The subcollimator parameters in a QS structure
       trn= 1-d mod patterns of each SC, if passed in, you need not generate it
KEYWORDS:
       xy= an array containing the 2 HXA aspect coordinates, if not
           set, the program will prompt you. This now allows you
           to pass in an sxt_index as the corrdinates, or a string
           representation of the position, e.g. 'n16w13'
       expfac= expansion factor, 1.0 gives 2.47 arcsec pixels
       n_pix= number of pixels in images, default is 64
       interactive= if set, you choose the files for the SC parameters
       patt_file = a filename for the mod. pattern parameters, the default
                      is $DIR_HXT_CAL/para3.dat
       grause_file = a filename for the grid use file, the default is
                     $DIR_HXT_CAL/grause, or an array of 64 1's or 0's
                     if set to 0, that subcollimator is not used
       ntrn = the number of grid points for each 1-d modulation pattern
              the default is 512
DESCRIPTION:
	hxt_pattern_maker, creates the 2-d modulation
       pattern used for the synthesis.
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], CONV_H2HXT [1], CONV_H2HXT [2]
	CONV_HS2H [1], CONV_HS2H [2], concat_dir [4], gt_center, hxt_gentrn, hxt_modpat
	hxt_rdpara, hxt_usegrd
 CALLED BY:
	hxt_multimg
MODIFICATION HISTORY:
	Written July '92 by J. McTiernan
	24-Aug-92 (MDM) - Changed default GRAUSE file from "grause_k7"
			  to "grause"
	22-Jun-93 (MDM) - Changed to use "para3.dat" instead of "para_3"
			  data files.
       29-oct-93 (JMM) - Added expfac keyword, for larger fields of view
       18-jul-94 (JMM) - Added n_pix keyword, for any number of pixels in
                         The image
       Pulled out the img_default routine, which is now called directly,
       and changed the name from hxt_img_prep, to pattern_maker.pro
       20-jul-94, jmm
       Added trn as a parameter, and absorbed MAKPAT.pro, 21-jul-94
       Got rid of prompt for expansion factor, now it defaults to 1.0
       Added option to pass in sxt_index as the xy keyword, and
       also the string heliocentric coordinates, and the date keyword
       18-oct-96, jmm
       Added patt_file and grause_file keywords, jmm, 26-nov-96
       New mod. patterns, 13-May-1998, jmm
       New name, Hxt_pattern_maker, 24-jun-1998, jmm
       Added ntrn keyword, 24-jun-1998, jmm


hxt_plcomp $SSW/yohkoh/ucon/idl/mctiernan/hxt_plcomp.pro
[Previous] [Next]
 NAME:
       hxt_plcomp
 PURPOSE:
       Calculates the expected HXT response for a power law
       component, of spectral index m and emission at 1keV k
 CALLING SEQUENCE:
       cps = hxt_plcomp(k ,m , rate=rate)
 INPUT:
       k = 1 keV emission, may be an array
       m = spectral index, may be an array
 KEYWORDS:
       rate = if set, hxt_plcomp will return a fraction of the
              rate, so this must be an array, of (4) or (4,n_t6)
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], Countrate, Multresponses
	concat_dir [4]
 HISTORY:
       1-17-94, jmm


HXT_POSSI4 $SSW/yohkoh/ucon/idl/hudson/hxt_possi4.pro
[Previous] [Next]
 NAME:
	HXT_POSSI4
 PURPOSE:
	read Inda-Koide_san's "possi4.dat" file with 0.1 keV calculations
	  of HXT spectral response. Read the header of this file
	  for background info provided by Mika-san.
 CALLING SEQUENCE:
	hxt_possi4,energy,prob
 OUTPUTS:
	energy = energy of calculation
	prob(6,*) = probabilities for detection, LO, M1, M2, HI,
	  misses. This is in the format of the HXT Databook. 
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], RDFILE [1], RDFILE [2]
	concat_dir [4]
 HISTORY:
	HSH, written 11-Sep-93	


HXT_POWERLAW $SSW/yohkoh/ucon/idl/sakao/hxt_powerlaw.pro
[Previous] [Next]
 NAME:
 	HXT_POWERLAW
 PURPOSE:
	To derive power-law photon index and flux at a certain energy using a 
	pair of count rate data from two adjacent energy bands of HXT. 
 CALLING SEQUENCE:
	p = hxt_powerlaw(index,data,1,bgd)      ;  if you want to use BGD 
                                               ;  subtracted data.
 	p = hxt_powerlaw(index,data,1,bgd,/sf)  ;  get parameters every 1SF.
	p = hxt_powerlaw(index,data,1,bgd,time=time)

 INPUTS:
	index	- HXT index.
	data    - HXT data.
	low_ch	- The lower band of a pair of adjacent energy bands of HXT.
		  low_ch is either 0 (M1/L), 1 (M2/M1), or 2(H/M2).

 OPTIONAL INPUT PARAMETERS:
	bgd	- Background data (structure) which is obtained by MK_HXTDATA.
		  If set, then the parameters are calculated from the 
		  background-subtracted data.
	time	- An array which contains information on time tag with 
		  pre-storage of HXT data in DP taken into account. 
		  Usage: IDL> utplot,time,p(0,*),index(0)
	sf	- If set, then power-law parameters for each major frame are 
		  obtained.
	energy  - If set, then p(1,*) will be flux at `energy' keV.

 OUTPUTS:
	p	- Power-law parameters. For an incident power-law photon 
		  spectrum: I(E) = A(E/20 keV)^G (photons/s/cm2/keV), 
		  p(0,*): photon index A
		  p(1,*): flux at 20 keV (default)

 CALLS: ***
	AVE_CTS, HARDNESS, RAT2POWL
 HISTORY:
 	written by T.Sakao
	version 1.0		93.03.27 (Sat)
	version 1.1		93.09.29 (Wed)
		A bug was fixed. 
	version 1.2		93.12.27 (Mon)
		Option `energy' added. 


HXT_POWL $SSW/yohkoh/ucon/idl/hudson/hxt_powl.pro
[Previous] [Next]
 NAME:
	HXT_POWL
 PURPOSE:
	read calibration files for HXT channel ratios against power-law spectra
 CALLING SEQUENCE:
	hxt_powl,fits
 OUTPUTS:
	fits.gammas = power-law photon index, dJ/dE = E^-GAMMA
	fits.ratios = ratios M1/LO, M2/M1, HI/M2
       fits.norms = counts at A20, according to Inda-san's notes:
       "I assumed power-law incident spectrum in the form of
       n(e) = A20 * (e/20) ^ -Gamma  [photons/s/keV/cm^2]
               where e in keV,
                     A20 is the normalization factor at 20 keV
       and calculated the flux [counts/s/cm^2] in each energy band of HXT.
       In the table, A20 = 100 is assumed and the flux for various Gamma
       from 2 to 6 is presented."
	(note: norms only defined for gammas > 2. right now) 
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], RDFILE [1], RDFILE [2]
	concat_dir [4]
 CALLED BY:
	RAT2POWL2
 HISTORY:
	written by HSH to read Mika Inda's calibration data, Oct. 1992
	HSH added count-rate normalizations provided by Inda-san 5 Jan. 1993
	HSH made the output into a structure 1 Feb 93


HXT_PRESTORE [5] $SSW/yohkoh/hxt/idl/util/hxt_prestore.pro
[Previous] [Next]
 NAME:
	HXT_PRESTORE
 PURPOSE:
	Obtain time tags at the midpoint of HXT data accumulation intervals. 
       See p.71 of SOLAR-A Jikken-Keikaku-Syo for a reference.
 CALLING SEQUENCE:
       pre = hxt_prestore(index)
       pre = hxt_prestore(index,/ser)
		pre has the form of pre = fltarr(4,[No. of Major Frames])
 INPUT:
       index   - HXT index
 CALLS: ***
	FRAME2SERIAL, gt_dp_mode [1], gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
 CALLED BY:
	AVE_CTS, AVE_CTS2 [1], AVE_CTS2 [2], AVE_CTS2 [3], HXT_TVEC, fix_hxtindex
 OPTIONAL KEYWORD INPUT:
       hxa     - If set, end time for HXA data accumulation is returned. 
	ser	- If set, the output will be 
		  pre = fltarr(4*[No. of Major Frames])
	endtime - If set, end time of data accumulation is given. 
 OUTPUT:
	Mid-time of HXT data accumulation, in units of second.
	Note that data corresponds to the first quarter of index(0) was 
	obtained pre(0,0) sec prior to the time shown by 
	gt_time(index(0),/str). 
 RESTRICTIONS:
       Not yet prepared for HXT CAL data.
 HISTORY:
       Written by T.Sakao on 30 June 1993
	version 1.1		93.12.29 (Wed)
	  Time tag was changed so that it corresponds to the midpoint of data 
	  accumulation interval.
      8-Jan-1997 - S.L.Freeland - renamed to hxt_prestore (avoid SSW conflict and generic name)


HXT_PROB $SSW/yohkoh/ucon/idl/hudson/hxt_prob.pro
[Previous] [Next]
 NAME:
	HXT_PROB
 PURPOSE:
	read calibration file for HXT spectral response 
 CALLING SEQUENCE:
	hxt_prob,energy,prob
 OUTPUTS:
	energy = energy of calculation
	prob(6,*) = probabilities for LO, M1, M2, HI, out of band, not detected
	(there are 121 points for energy = 0, 120, 1 keV)
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], RDFILE [1], RDFILE [2]
	concat_dir [4]
 HISTORY:
	written by HSH to read Mika Inda's calibration data, Oct. 1992


HXT_QLOOK $SSW/yohkoh/ucon/idl/metcalf/hxt_qlook.pro
[Previous] [Next]
NAME:
     HXT_QLOOK
PURPOSE:
     Makes a series of HXT quick-look images (i.e. a quick-look movie).
CATEGORY:
CALLING SEQUENCE:
     hxt_qlook, index, data, movie, hxi_index [,patterns] 
INPUTS:
     index = HXT index from an HDA file
     data = HXT data from an HDA file
OPTIONAL INPUT PARAMETERS:
     patterns = the sub-collimator modulation patterns.  Computed if not
                supplied.  The computation is slow, so if you plan to make
                a series of movies, use patterns to receive the computed 
                patterns the first time you call hxt_qlook and then use
                patterns to pass the modulation patterns back to the routine
                on subsequent calls to hxt_qlook.  You must recompute the 
                modulation patterns whenever you use a different pointing.
OUTPUTS:
     movie = a data cube of the HXT images
     hxi_index = an index describing various parameters of the images.  The
                 time in the index is the start of the accumulation period.
KEYWORD PARAMETERS
     /new_mod_patterns = Force a new computation of the modulation patterns,
                         even if the patterns parameter is set.  Normally, if
                         patterns is set, the modulation patterns are not
                         computed.  You must recompute the modulation 
                         patterns whenever you use a different pointing.
     /show_images = show each image as it is computed
     /quiet = don't print any diagnostics
     /verbose = print lots of diagnostics
     smooth = smoothing parameter which determines how much the inverse 
              computation of the image is smoothed.  Default = 0.1.
 CALLS: ***
	FILE_EXIST [2], GET_HXTTIME, HXTSBT, HXT_ACCUM, HXT_IMG_PREP, add2str [1]
	add2str [2], anytim2ex [1], anytim2ex [2], anytim2ints [1], anytim2ints [2]
	dprate2sec [1], dprate2sec [2], ex2fid [1], ex2fid [2], file_exist [1]
	file_exist [3], fmt_tim [1], fmt_tim [2], input [1], input [2], makimg0, sav_hxi
	tag_index [1], tag_index [2], tim2dset [1], tim2dset [2], yesnox [1], yesnox [2]
SIDE EFFECTS:
     if set on input, hxi_index and movie are modified.
RESTRICTIONS:
     When the modulation patterns are passed to hxt_qlook in the patterns 
     parameter, hxi_index must also be set from the output from a previous 
     call to hxt_qlook or hxt_img_prep.

     The minimum time for which counts are accumulated is 1 major frame
     in hxt_accum.  Setting the accumulation to something less than this
     implies overlapping data are used in the computed images.  Further,
     the acutal data accumulation is only done in integral numbers of
     major frames.

     Several tags in the hxi_index which have information on the MEM
     analysis are set to 0 here since they have no meaning with the
     zeroth order regularization.  Also, the tag BIN has been added to 
     store the value used for the binning (float).
PROCEDURE:
     Calls makimg0 to compute the images.  hxt_qlook is just a front end
     for makimg0.  The modulation patterns are computed with hxt_img_prep.

     The user specifies the start and end times of the movie on a light curve
     plot.  The data are split into seperate images based on the length of
     the accumulation time.  For, example if the movie runs from 01:45:31
     through 01:45:37 and the accumulation time is 2 seconds, there will be
     three frames in the movie.  But, if the accumulation time is 6 seconds,
     there will only be one frame in the movie (i.e., a single image).

     The hxi_index structure is defined in
     /ys/gen/soft/rel/ref_access/hxt_struct.inc
MODIFICATION HISTORY:
     Written 25-June-93 by T. Metcalf


hxt_ratio $SSW/yohkoh/ucon/idl/nitta/hxt_ratio.pro
[Previous] [Next]
 Input Parameters
     comb: Which ratio to be used (0: M1/L, 1:M2/M1, 2: H/M2)
     cts1: Count rate of the lower channel
     cts2: Count rate of the higher channel
 Output Parameters
     
 CALLS:
 CALLED BY
	dem_tr_er, dem_tr_er0


hxt_rdpara $SSW/yohkoh/hxt/idl/atest/hxt_rdpara.pro
[Previous] [Next]
NAME:
	hxt_rdpara
PURPOSE:
	Reads in the Subcollimator parameters
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	Hxt_rdpara,parafile,sc_paras
INPUT:	
	parafile= name of file contatining the parameters,
                 Note that this file has a specific format,
                 see $DIR_HXT_CAL/npara.dat
OUTPUT:
	sc_paras, a structure of  HXI_QS_SCPara_Rec, with tags:
	sc_paras.sensor= id number of SC's
	sc_paras.spat_freq= spatial frequency of SC's
	sc_paras.pos_angle= position angle of SC's
	sc_paras.id='1'-'4' for fan-beam, 'S' for sin elements, 'C' for cos elements
	sc_paras.dc= dc offset for mod. pattern
	sc_paras.amp= amplitude of mod. pattern
	sc_paras.phase= phase of mod. pattern
	sc_paras.phase_corr= phase correction factor
 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], HXT_STRUCT [1], HXT_STRUCT [2]
	STR2ARR [1], STR2ARR [2], break_file [4], rd_tfile [1], rd_tfile [2]
 CALLED BY:
	hxt_pattern_maker
HISTORY:
	Written by J.McTiernan
	24-Aug-92 (MDM) - Corrected typo which was causing "sc_paras.sensor" 
			  not to be written to
	22-Jun-93 (MDM) - Changed reading routine to read slightly different
			  format file.
			- Used GET_LUN instead of fixed unit 10
       13-may-1998, jmm, new modulation patterns, a function of energy
                         different tags...


hxt_sat_repair $SSW/yohkoh/ucon/idl/sato/hxt_sat_repair.pro
[Previous] [Next]
NAME: 
hxt_sat_repair
PURPOSE
 correction of saturated decompressed data in HXT
CALLING SEQUENCE:
 a=hxt_sat_repair(hxt_decompressed_data)
INPUTS:
 hxt decompressed data should be inputted
OPTIONAL INPUT 
 If ref_phase is 0, we assume that first of data is no saturated.
 If ref_phase is 1, we assume that end of data is no saturated.
 default is 0
RESTRICTIONS:
 Inputted hxt decompressed data near the end 
   must be no saturated data.
NOTE:
1. This data correction does not consider dead time correction and 
   rapid increase/decrease > 2048 cts/SC in 0.5 sec.
MODIFICATION HISTORY:
 Jun Sato 4-dec-97


hxt_setgra $SSW/yohkoh/hxt/idl/atest/hxt_setgra.pro
[Previous] [Next]
NAME:
 hxt_setgra
PURPOSE:
 For some reason, the data as we get it, is not in the same order 
 as the SC info is input using the parameter file. This routine 
 sets up the array to put the data in the same order as the modulation 
 patterns, so that the data for a given SC corresponds to the mod. pattern
 for that SC.
CATEGORY:
 Yohkoh HXT
CALLING SEQUENCE:
 hxt_setgra,sn2gra,grasn2
INPUT:
 none
OUTPUT:
 sn2gra = subscripts for switch from order of SC's in modulation array
          to order in data array
 gra2sn = subscripts for switch from order in data array to the order
          in the modpat array.
 CALLED BY:
	hxtimg_accum
HISTORY:
 1992, jmm
 Changed name, 24-jun-1998, jmm


hxt_sources $SSW/yohkoh/ucon/idl/mctiernan/hxt_sources.pro
[Previous] [Next]
NAME:
	hxt_sources
PURPOSE:
	To make HXT images.
CALLING SEQUENCE:
       Hxt_sources, index, data, index_out, data_out, [patterns], $
 GENERAL KEYWORDS:
            outfile = outfile, /append_outfile, channels = channels, $
            /Nolook, /nonorm, /bsmooth, /xxx, Sys_err = sys_err, $
            /prompt_outfile, $
 ACCUMULATION KEYWORDS:
            img_trange = img_trange, bck_trange = bck_trange, /alt_tsel, $
            dt_resolution = dt_resolution, accum_cnts = accum_cnts, $
            ch_accum = ch_accum, /noback, $
 MODULATION PATTERN KEYWORDS:
            /new_mod_patterns, xy = xy, expfac = expfac, $
            n_pix = n_pix, patt_shape = patt_shape, ph_correct = ph_correct, $
            patt_file = patt_file, grause_file = grause_file, $
 MEM KEYWORDS:
            gamma0 = gamma0, chilim = chilim, Lambda_limit = lambda_limit, $
 SOURCES KEYWORDS:
            source_pars = source_pars, n_sources = n_sources, /moff, $
            /Cyl, s_ftol=s_ftol, s_alpha=s_alpha, s_beta=s_beta, $
            s_gamma=s_gamma, s_itmax=s_itmax, s_restart=s_restart, $
            /fixed_pos, /fixed_rad, /yyy, $
INPUT:
	index = HXT data info from hda file
	data = counts in each subcollimator for each channel
       patterns = the modulation patterns, (optional), if not passed in,
                 or if any of the mod patterns keywords
                 have been set, then new patterns will be calculated.
KEYWORD INPUT:
 GENERAL KEYWORDS:
       outfile = an output filename, NOTE: this will be made lower case.
                 Unlike previous versions, HXT_MULTIMG no longer
                 prompts for an output file, this must be set if you
                 want to output into a file.
       /append_outfile = if set, and the output file already exists,
                        append the output fil.e
       /prompt_outfile = if set, the routine prompts you for an output
                         filename after the images have been generated,
                         THIS IS IGNORED IF YOU'VE SET THE OUTFILE KEYWORD...
       channels = if set, will only image the channels in channels,
                  otherwise all channels are imaged.
       /nolook = do not plot the intermediate images,
       /nonorm = do not normalize images, the default is to normalize
                the images to byte arrays of 0 to 255, using the routine
                HXI_NORMAP. 
       /bsmooth= if set, smooth the image over n pixels where n = 5.0/resolution
                or the next number above, passed into MAKIMG, and MAKIMG_L.
                This is here to avoid the overresolution common im MEM
                images, but you may use this for the pixon case too.
       /xxx = if set, use sigma(counts)=sqrt(sounts), for comparison to
             HXTPRO results, nobody is allowed to use this keyword except
             for me (JMM).
 ACCUMULATION KEYWORDS:
       img_trange = a time range for the images, any Yohkoh time format...
       bck_range = a time_range for the background accumulation
       /alt_tsel = if set, use alt_tim_sel to get interval, instead of
                  plot_lcur, this is good if you have no xwindows.
       dt_resolution = number of 1/2 second (flare mode) or 4 second
                      (quiet mode) frames per image, default is to
                      use the whole time range. NOTE THAT THIS KEYWORD IS
                      IGNORED IF MULTIPLE INTERVALS HAVE BEEN SELECTED
                      EITHER IN PLOT_LCUR, OR IF THEY HAVE BEEN PASSED IN.
       accum_cnts = if set, the value of average counts/SC in a given
                    that you want for each set of images, the routine
                    will accumulate counts until the number of counts
                    in the given channel are greater than or equal to
                    this value. If set with a slash, ie. the value=1
                    then the default is 200 (a good value).
                    As of 9-jun-95, this refers to EXCESS counts, as
                    opposed to total counts. This keyword will also
                    not work if multiple intervals are selected while
                    in PLOT_LCUR, or are passed in.
       ch_accum = the channel you want to use for the accum_cnts (future
                  versions will allow you to accum different numbers of
                  counts for different channels).
       /noback = if set, the background will be set to zero, this is
                not recommended for MEM images.
	sys_err= systematic error term to be added to Poisson Uncertainty,
                default is 0.03.
 MODULATION PATTERN KEYWORDS:
       /new_mod_patterns = If set, Force a new computation of the
                         modulation patterns, even if they exist already, 
                         even if the patterns parameter is set.  Normally, if
                         patterns is set, the modulation patterns are not
                         computed.  You must recompute the modulation 
                         patterns whenever you use a different pointing.
                         If any of the mod. pattern keywords are set,
                         the mod. patterns are recomputed.
       xy= an array containing the 2 HXA aspect coordinates, if not
           set, and the patterns are to be calculated, the program will prompt
           you.
       expfac= expansion factor, the default is 1.0, gives 2.47 arcsec pixels.
               The routine will no longer prompt you.
       n_pix= number of pixels in image, default is 64, the default n_pix and
              expfac give the same size as a Full res. flare mode PFI from SXT.
       patt_shape= pattern shape, 0 for triangular patterns, 1 for sine waves,
                   2 triangular with HI channel correction, 
                   3 for sine wave with HI channel correction.
                   2 is the default, as of 1-may-95
       ph_correct= amplitude of phase correction factor, default is -1.0,
                   Pay no attention to this unless you know what you're doing.
       patt_file = a filename for the mod. pattern parameters, the default
                      is $DIR_HXT_CAL/para3.dat
       grause_file = a filename for the grid use file, the default is
                     $DIR_HXT_CAL/grause
 MEM METHOD KEYWORDS: (Refer to the initial guess)
       gamma0= initial value of iteration gain, default is 0.10
	chilim= minimum value of chi^2 needed in MEM iteration, default is 2.0
       lambda_limit = if set, makimg will only iterate to a given value
                      of lambda, if set to 1, this will be calculated by the
                      highest channel image for each interval
 SOURCES KEYWORDS:
       n_sources= number of sources in the image, max is 3, THIS HAS TO BE SET
       source_pars= output source parameters, brightness, rdaius, and position,
       moff = if set, use cylindrical moffat fns, f=c/(1+r^2/r0^2)^moff(0)
       amoeba_x keywords, for downhill simplex minimization
       s_ftol = fractional tolerance that we'll iterate to, default is 1.0e-5
       s_alpha, s_beta, s_gamma= iteration parameters, i don't know what yet
                          defaults are 1.0, 0.5, 2.0, respectively.
       s_itmax= max number of iterations, default is 500
       s_restart= max number of restarts of the AMoeba_HXI algorithm, default is 8
       /fixed_pos= if set, keep the position of the sources fixed at their
                  starting points
       /fixed_rad= if set, keep the radii of the sources fixed
       /yyy= use makimg_g1, which fits sources + background, i just can't think
            of names anymore
OUTPUT:
	data_out= the image, brightness in counts/pix^2 cm^2
	index_out= all of the structures mushed together...
	The structure hxi_index, with tags (index_out.hxi)
	(DATA SELECTION)
	hxi_index.chan= channel used
		=0 L0 (13.7-22.7 keV)
		=1 M1 (22.7-32.7 keV)
		=2 M2 (32.7-52.7 keV)
		=3 HI (52.7-92.8 keV)
	cnts_p_cm2= counts per cm^2 for the selected channel (not per sec)
                   for the 16 fan beam collimators
	hxi_index.actim= image accumulation time in tenths of seconds.
	hxi_index.interval= end time minus start time =actim if there's
                           no data missing.
	hxi_index.bkg_time= start time for background accumulation
                           (millisec of day)
	hxi_index.bkg_day= day of start of background accumulation
                          (days since 1-Jan-79)
	hxi_index.bkg_actim= background accumulation time in millisec 
	hxi_index.bkg_interval= end time minus start time

	(INPUT PARAMETERS TO THE SYNTHESIS ROUTINE)
	hxi_index.grause(8)=Each element is either 0b to 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	hxi_index.x0, hxi_index.y0= X and Y corrdinates in HXT Coordinate
               system,  can be obtained frm SXT data using
               conv_p2hxt(gt_center(sxt_index)), may be input interactively.
	hxi_index.alpha= amplitude of phase correction factor
	hxi_index.iway=0 for triangular patterns, =1 for sine wave patterns
	hxi_index.area= total area in cm^2 of scintillators
	hxi_index.syserr= systematic error term to be added to Poisson
                         Uncertainty
	hxi_index.gamma0= initial value of iteration gain
	hxi_index.laminc= initial value for lambda increment
	hxi_index.chilim= minimum value of chi^2 needed
	(RESULTS OF SYNTHESIS ROUTINE)
	hxi_index.lambda= final value of lambda, which controls the 
                         iteration step size
	hxi_index.iteration= the number of iterations, for the final value of
                            lambda
	hxi_index.delta= total((b(i)-b(i-1))^2)/Total(b(i)^2) for each
                        iteration, lambda is changed when delta is reduced
                        to 0.030 or less
	hxi_index.chi2= chi^2, reduced = total((fobs(b(i))-fobs)^2/var)/usenum
		where usenum is the number of SC's used
	hxi_index.max_bright= maximum brightness of image
	hxi_index.x_max= Column of max. brightness
	hxi_index.y_max= row of max. brightness
DESCRIPTION:
       Uses MEM to find an initial guess, the finds discrete sources,
       and minimizes chi^2
 CALLS: ***
	FILE_EXIST [2], IMG_DEFAULT, MAKIMG, MAKIMG_L, PATTERN_MAKER, PATT_DEFAULT, STR_LOAD
	anytim2ex [1], anytim2ex [2], file_exist [1], file_exist [3], fmt_tim [1]
	fmt_tim [2], hxi_normap, hxtimg_accum, hxtsbt_mult, input [1], input [2], makimg_g0
	makimg_g1, sav_hxi, str_merge [1], str_merge [2]
MODIFICATION HISTORY:
	Adapted from program movie7 of T. Sakao, by J.McTiernan, June '92
       Lots o' revisions, 18-jul-94, jmm
       different mod patterns for different channels, 20-jul-94, jmm
       account for 4 second time lag, 9/21/94, jmm
       Added xxx keyword, 2/14/95, jmm
       Added sources option, 3/14/95, jmm
       redefined accum_cnts keyword to excess counts, not total counts,
              9-jun-95, jmm
       Cut out pixon, qlook , mem options, and renamed, 13-jun-95, jmm


HXT_SPEC_DRIVER $SSW/yohkoh/ucon/idl/hudson/hxt_spec_driver.pro
[Previous] [Next]
 NAME:
       HXT_SPEC_DRIVER	
 PURPOSE:
	get HXT temperatures. The background is an average value
	  from a set of 9 flares but can be entered by hand also
 CALLING SEQUENCE:
 INPUT PARAMETERS:
 OUTPUT:
 WARNING:
 CALLS: ***
	RAT2THERM
 HISTORY:
	written by HSH, Nov. 21, 1992


HXT_SPECTRA $SSW/yohkoh/ucon/idl/hudson/hxt_spectra.pro
[Previous] [Next]
 NAME:
	HXT_SPECTRA
 PURPOSE:
	fit HXT channel rates to spectral models: for lower 3 channels, 
                f_hv = fits(0) * (hv/25)^(-fits(1))
       where fits(2) is the sigma returned by poly_fit;
       for LO and M1, fits(3,4) are the exponential function, with 
       fits(4) returned in T6 units.
	fits(5,6) a power-law fit to M2/HI, only where the flux ratio > 2
 CALLING SEQUENCE:
	hxt_spectra,data,index,fits,plot=plot,back=back
 KEYWORDS:
 	/plot puts out a plot
       /back subtracts background by finding the peak of the HI histogram
           and then scaling the other channels from it.
 INPUTS: 
	channels (from HXT_SUMMER), index, centers (from HXT_SUMMER)
 OUTPUTS: 
	fits as follows:
		0 3-channel power law multiplier, normalized to 25 keV
		1 3-channel slope
		2 3-channel sigma
		3 2-channel exponential mutliplier
		4 2-channel "temperature", T6 (million K) units
		5 M2/HI power law multiplier, normalized to 42.7 keV
		6 M2/HI slope 
 WARNING:
	does not handle time delays inherent in the HXT telemetry.
	the whole thing is awfully crude right now, USER BEWARE
 CALLS: ***
	HXT_BACK, POLY_FIT, UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5]
	UTPLOT [6]
 HISTORY:
	written by HSH, August 9, 1992
       HSH, LO/M1 kT and M2/HI power-law fits added Aug. 10
	HSH, background subtraction added Aug. 12


HXT_STRUCT [1] $SSW/yohkoh/gen/idl/atest/hxt_struct.pro
[Previous] [Next]
       NAME:
               HXT_STRUCT
       PURPOSE:
               Define the following HXT specific database structures
                       * HXT_QS_Instr_Rec         
                       * HXT_QS_Conv_Rec          
                       * HXT_Index_Rec            
                       * HXT_PC_Data_Rec          
                       * HXT_PH_Data_Rec          
                       * HXT_RoadMap_Rec          

       CALLING SEQUENCE:
               HXT_STRUCT
 CALLED BY:
	fort2hxi [1], fort2hxi [2], hxt_multimg, hxt_rdpara, rd_roadmap [1]
       HISTORY:
               written by Mons Morrison, Fall 90.
                1-Sep-94 (MDM) - Clarified the "dataRecTypes" definition
                9-jun-1998, jmm, added New HXI index HXI_4022_Index_rec,
                                 made it the default


HXT_STRUCT [2] $SSW/yohkoh/gen/idl/ref_access/hxt_struct.pro
[Previous] [Next]
       NAME:
               HXT_STRUCT
       PURPOSE:
               Define the following HXT specific database structures
                       * HXT_QS_Instr_Rec         
                       * HXT_QS_Conv_Rec          
                       * HXT_Index_Rec            
                       * HXT_PC_Data_Rec          
                       * HXT_PH_Data_Rec          
                       * HXT_RoadMap_Rec          

       CALLING SEQUENCE:
               HXT_STRUCT
 CALLED BY:
	fort2hxi [1], fort2hxi [2], hxt_multimg, hxt_rdpara, rd_roadmap [1]
       HISTORY:
               written by Mons Morrison, Fall 90.
                1-Sep-94 (MDM) - Clarified the "dataRecTypes" definition


HXT_SUMMER $SSW/yohkoh/ucon/idl/hudson/hxt_summer.pro
[Previous] [Next]
 NAME:
	HXT_SUMMER
 PURPOSE:
	add up the HXT channels and smooth over one major frame and
	  over all subcollimators willy-nilly
 INPUTS:
	data and index from rd_hda or equivalent
 OUTPUTS:
	channels are the channel sums, in units of counts/cm^2 sec (have
	  hard-wired a total effective area of 55 cm^2 for the time being)
 CALLING SEQUENCE:
 	hxt_summer,data,index_in,channels,index_out,plot=plot
 KEYWORDS
	/plot makes four plots of the channel rates
 OUTPUTS:
 	channels(4,n) where n is the number of data in FL HI mode.
       index_out the n-element index array that results
 WARNING:
	plots to the current window if /plot is set
 CALLS: ***
	HXT_BACKGROUND, HXT_DECOMP, OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], UTPLOT [1]
	UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], gt_dp_mode [1]
	gt_dp_mode [2], gt_dp_rate [1], gt_dp_rate [2]
 CALLED BY:
	hxt_survey
 HISTORY:
	HSH, written July 17, 1992
	HSH added units, July 26
	HSH added /nonorm, October, 1992 
	HSH 21-Nov-92 deleted dimensioned rates, added background lines  
	HSH 30-Nov-92 give output in counts/cm^2 sec, hardwired @ 55 cm^2 


hxt_survey $SSW/yohkoh/ucon/idl/hudson/hxt_survey.pro
[Previous] [Next]
 NAME:
	hxt_survey
 PURPOSE:
	survey HXT channel ratios for spectral information
 CALLING SEQUENCE:
	hxt_survey,infil,data,index,temps,ems,[powl,index_out,channels]
 INPUTS:
	data and index from hda file, file spec "infil"
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 OUTPUTS:
	temperatures, emission measures, output index from fits
	powl(2,*,3) contains number spectrum (gamma, normalization)
         for each * point, for 3 pairwise channel ratios 
	channels = fltarr(4,*) the channel rates, counts/cm^2sec
 CALLS: ***
	HXT_BACKGROUND, HXT_SUMMER, HXT_TEMPS, RAT2POWL, UTPLOT [1], UTPLOT [2], UTPLOT [3]
	UTPLOT [4], UTPLOT [5], UTPLOT [6], tbeep [1], tbeep [2], tbeep [3], yesnox [1]
	yesnox [2]
 MODIFICATION HISTORY:
	HSH, written 29-Jan-1993. 


hxt_t6_resp0 $SSW/yohkoh/ucon/idl/mctiernan/hxt_t6_resp0.pro
[Previous] [Next]
 NAME:
      hxt_t6_resp0
 PURPOSE:
      Calculates an SXT-style temperature response for the four HXT channels
 CALLING SEQUENCE:
      hxt_t6_resp0, t6, t6_resp, t6_range = t6_range, no_t6 =no_t6, /nonorm
 INPUT:
      none
 OUTPUT:
      t6 = array of temperatures
      t6_resp = the HXT response at t6, fltarr(2, no_t6)
 KEYWORDS:
      t6_range=A temperature range in MK, the default is [2.0, 100.0], No zeros please...
      no_t6=the number of temperature grid points, the default is 101
 CALLS: ***
	hxt_thcomp
 CALLED BY:
	hxt_thfsp_resp
 HISTORY:
      12-jan-96, jmm


HXT_TEEM $SSW/yohkoh/ucon/idl/hudson/hxt_teem.pro
[Previous] [Next]
 NAME:
	HXT_TEEM
 PURPOSE:
	generate temperature and emission-measure fits to HXT data
 CATEGORY:
	Yohkoh stuff
 CALLING SEQUENCE:
	hxt_teem,index,data,teem,rates,back=back,/get_back, /noverbose
 INPUTS:
	data and index files from HDA data
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
	get_back: if set, enter interactive mode for background rate selection
	  (cursor input on log plot of LOW rate - not necessarily the best
	  way to do it, please be careful)
	back: enter background rates directly (units counts/sec/channel,
	  fltarr(4))
	  NB: default background: [108.000, 176.000, 146.000, 574.002]
	noverbose: stops telling you what the background rates are
       btimes = strarr(2) returns start and stop times for backgrounds
 OUTPUTS:
	teem (N_DATA,3,2): data record, adjacent channel pair, (te,em)
	  with te in MK and em in units of 10^44 cm^-3
	  for example, T from the M1 to LOW ratio is teem(*,0,0)
	rates (N_DATA, 4): the four channel rates, counts/sec/subcollimator
         (to get total counts/sec, multiply by 64)
       back returns the actual background rates used
 CALLS: ***
	DOC_LIBRARY, HXT_BACKGROUND, HXT_HI_SUM, HXT_LOW_SUM, HXT_MED1_SUM, HXT_MED2_SUM
	RAT2THERM2, fmt_tim [1], fmt_tim [2], plot_lcur [1], plot_lcur [2]
 RESTRICTIONS:
	only gives results for flare mode data; returns zeros for
	  channel ratios outside specified ranges
	only gives results for major-frame averages (2 sec intervals)
 WARNING:
	this software does not compensate for the HXT time delays of
	  up to four sec
 MODIFICATION HISTORY:
	HSH, written 10-oct-93
	HSH, output rates changed to counts/sec/subcollimator 
	HSH, changed background units and hard-wired the default background
         for the LOW channel. get_back selects on MED1 now.
       HSH, added btimes output


HXT_TEMPS $SSW/yohkoh/ucon/idl/hudson/hxt_temps.pro
[Previous] [Next]
 NAME:
       HXT_TEMPS
 PURPOSE:
	Get HXT temperatures. The background is an average value
	  from a set of 9 flares but can be entered by hand also.
 CALLING SEQUENCE:
 	hxt_spec_driver, data, index, temps, ems, back = back
         (need to have HDA data and index available)
 INPUT PARAMETERS:
 OUTPUT:
 WARNING:
 CALLS: ***
	HXT_BACKGROUND, RAT2THERM
 CALLED BY:
	hxt_survey
 HISTORY:
	written by HSH, Nov. 21, 1992


hxt_thcomp $SSW/yohkoh/ucon/idl/mctiernan/hxt_thcomp.pro
[Previous] [Next]
 NAME:
       hxt_thcomp
 PURPOSE:
       Calculates the expected HXT response for a thermal
       component, of temperature t6 and emission measure e47.
       You may include line emission or not...
 CALLING SEQUENCE:
       cps = hxt_thcomp(t6,e47,lines=lines,rate=rate)
 INPUT:
       t6 = T/10^6 K, may be an array
       e47 = EM/10^47, may be an array
 KEYWORDS:
       lines = if set, includes line emission as calculated by
               mewe_spec.pro
       rate = if set, hxt_thcomp will return a fraction of the
              rate, so this must be an array, of (4) or (4,n_t6)
 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], Countrate, Multresponses
	concat_dir [4], fdf10_init
 CALLED BY:
	box_sxtth_hxt, hxt_t6_resp0, sxtth_hxt
 HISTORY:
       25-oct-93 by JMM


HXT_THERMAL $SSW/yohkoh/ucon/idl/sakao/hxt_thermal.pro
[Previous] [Next]
 NAME:
	HXT_THERMAL
 PURPOSE:
	To obtain temperature and emission measure from a pair of two adjacent 
	energy bands of HXT. An incident photon spectrum of 
	a single-temperature free-free emission is assumed.
 CALLING SEQUENCE:
	t = hxt_thermal(index,data,low_ch,bgd)       ; if you want to use BGD 
                                                    ; subtracted data.
	t = hxt_thermal(index,data,low_ch,bgd,/sf)   ; get params every 1 MF.
	t = hxt_thermal(index,data,low_ch,bgd,time=time)

 INPUTS:
	index	- HXT index.
	data	- HXT data.
	low_ch	-  The lower band of a pair of adjacent energy bands of HXT.
                 low_ch is either 0 (M1/L), 1 (M2/M1), or 2(H/M2).

 OPTIONAL INPUT PARAMETERS:
       bgd     - Background data (structure) which is obtained by MK_HXTDATA.
                 If set, then the parameters are calculated from the 
                 background-subtracted data.
       time    - An array which contains information on time tag with 
                 pre-storage of HXT data in DP taken into account. 
                 Usage: IDL> utplot,time,p(0,*),index(0)
       sf      - If set, then power-law parameters for each major frame are 
                 obtained.
 OUTPUTS:
	t	- Temperature and emission measure.
		  t(0,*): temperature (K)
		  t(1,*): emission measure (10^48 /cm3)

 CALLS: ***
	AVE_CTS, HARDNESS, HXT_EFF_AREA, RAT2THERM2
 HISTORY:
	written by T.Sakao
	version 1.0	93.03.27 (Sat)
	version 1.1	93.09.29 (Wed)
		A possible bug was fixed. 
	version 1.2	93.12.27 (Mon)
		rat2therm2 instead of rat2therm.
	version 1.3	95.10.09 (Mon)
		Fixed a bug in calling rat2therm2. Corrected for a 
		difference between HXT effective area used in rat2therm2 and 
		the `official' effective area. 
		(c.f. p.11 of Yohkoh Instrument Guide)


hxt_thfsp_resp $SSW/yohkoh/ucon/idl/mctiernan/hxt_thfsp_resp.pro
[Previous] [Next]
 NAME:
	hxt_thfsp_resp
 PURPOSE:
       Obtains the HXT thermal response and outputs it into a file
       which can be used by fsp_*.pro, for the multi thermal fits,
       tyspec=98 or 99
 CALLING SEQUENCE:
       hxt_thfsp_resp
 INPUT:
       reads the latest hxt response file 
 OUTPUT:
       outputs the response file /ys/ucon/soft/mctiernan/hxt_thfsp_resp.dta
 KEYWORDS:
     t6_range = the range of temperatures, the default is 1.0 to 100.0
     no_t6 = number of temperature points, the default is 121
 CALLS: ***
	hxt_t6_resp0
 HISTORY:
       12-jan-95, jmm


HXT_TIME2FRAME $SSW/yohkoh/ucon/idl/sakao/hxt_time2frame.pro
[Previous] [Next]
 NAME:
	HXT_TIME2FRAME
 PURPOSE:
	To return INDEX and FR (frame: 0-3) IDs that correspond to 
	given time string. Default is to get INDEX/FR IDs for the intergration 
	START time. 
	The INDEX and FR values are returned in the following way:

	o For specifying integration START time:

			      EXCLUDE EXCLUDE INCLUDE INCLUDE INCLUDE ...
	  Frame boundaries ---|-------|-------|-------|-------|--- ...
						  |
						  |
					START time set here

	o For specifying integration END time:

			      INCLUDE INCLUDE INCLUDE EXCLUDE EXCLUDE ...
	  Frame boundaries ---|-------|-------|-------|-------|--- ...
						  |
						  |
					END time set here
 CALLING SEQUENCE:
	id = HXT_TIME2FRAME(index, target_time)
	id = HXT_TIME2FRAME(index, target_time, /endfr, xx=xx)
 INPUT:
	index		- HXT index.
	target_time	- In any time format that can be fed into ANYTIM2INTS.
 CALLS: ***
	GET_FRAME_TIME, GET_TIME_LAPSE, anytim2ints [1], anytim2ints [2], gt_dp_mode [1]
	gt_dp_mode [2]
 OPTIONAL KEYWORD INPUT:
	endfr		- If set, then returns INDEX/FR IDs for a given 
			  integration END time.
 OUTPUT:
	id		- An array variable with a format of [INDEX, FR]. 
			  A set of values, INDEX+SSSS(0) and FR, are to be 
			  used when making a source data file for the FORTRAN 
			  version of HXT image synthesis program. 
 OPTIONAL KEYWORD OUTPUT:
	xx		- Internal output of get_frame_time(index). This is 
			  for debugging purpose.
 CATEGORY:
	Yohkoh HXT data analysis.
 HISTORY:
	version 1.0	98.06.26 (Fri)	T.Sakao written.


HXT_TVEC $SSW/yohkoh/ucon/idl/bentley/hxt_tvec.pro
[Previous] [Next]
 NAME:
	HXT_TVEC
 PURPOSE:
       Creates corrected vector of HXT times
 CALLING SEQUENCE:
       times = hxt_tvec(index)
 INPUTS:
       index   stabdard yohkoh index record
 OPTIONAL INPUTS:

 OUTPUTS:

 OPTIONAL OUTPUTS:

 CALLS: ***
	ANYTIM2MSV, HXT_PRESTORE [1], HXT_PRESTORE [2], HXT_PRESTORE [3]
	HXT_PRESTORE [4], HXT_PRESTORE [5], MSV2INTS
 CALLED BY:
	OBS_PLOT
 RESTRICTIONS:

 PROCEDURE:
	Subtracts time derived from HXT_PRESTORE
 MODIFICATION HISTORY:
	RDB	   May-94  Written
       SLF        Jan-97  Change 'prestore' call to 'hxt_prestore' (ssw conflict)


hxt_unpack_grause $SSW/yohkoh/hxt/idl/atest/hxt_unpack_grause.pro
[Previous] [Next]
NAME:
 hxt_unpack_grause
PURPOSE:
 unpacks hxi_index.grause, the grid use array
CATEGORY:
 Yohkoh HXT
CALLING SEQUENCE:
 iuse = hxt_unpack_grause(hxi_index)
INPUT:
 hxi_index = the index structure for an HXI image, or an 8-element
             byte array
OUTPUT:
 iuse = a 64 element intarr, set to zero if that mod. collimator
        was not used in the fit, set to 1 if it was.
 CALLS: ***
	bits [1], bits [2]
 CALLED BY:
	hxt_memimg
HISTORY:
 26-nov-1996, jmm
 New name, 24-jun-1998


hxt_usegrd $SSW/yohkoh/hxt/idl/atest/hxt_usegrd.pro
[Previous] [Next]
NAME:
	hxt_usegrd
PURPOSE:
	Reads in the flag for SC use
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	hxt_usegrd,grausfile,grause
INPUT:	
	grausfile= grid use filename, or an array of 64 1's or 0's
                  if set to 0, that subcollimator is not used
OUTPUT:
	grause(8)=Each element is either 0b or 255b, 
		If grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
               changed, 26-nov-96
 CALLED BY:
	hxt_pattern_maker
MODIFICATION HISTORY:
	Written June '92 by J.McTiernan
       Rewritten, 26-nov-1996, jmm, to allow individual
       collimators to be dropped out.
       2-dec-1996, allow an array of 64 1's and 0's to be passed in.
       New name, 24-jun-1998, jmm


hxt_utplot $SSW/yohkoh/ucon/idl/mctiernan/hxt_utplot.pro
[Previous] [Next]
	Pro hxt_utplot,index,data
 Given HXT data in the structure, this will plot out the pulse 
 counts/sec for each HXT channel for each index, this will be 
 decompressed. versus UT, using UTPLOT
 CALLS:


hxtaccumulate $SSW/yohkoh/ucon/idl/metcalf/hxtaccumulate.pro
[Previous] [Next]
NAME:
	hxtaccumulate
PURPOSE:
	Given the start time and interval time to accumulate counts 
	return the data and estimated error on the accumulation
CALLING SEQUENCE:
	hxtaccumulate,index,data,st_time,int_tim,counts,sigma,syserr=syserr
INPUTS: 
	index=data info from test_rd,
	data=counts in subcollimator for each channel
	st_time=Start time of data accumulation, a string
	int_tim=Data accumulation interval
       syserr = systematic error (fraction of counts)
OUTPUT:
	counts= counts in 64 SC's, 4 channels
	sigma= uncertainty
	index1=index of the first data set in accumulation
 CALLS: ***
	HX_DECOMP, STDEV, anytim2ints [1], anytim2ints [2], dprate2sec [1], dprate2sec [2]
	fix_hxtindex, tim2dset [1], tim2dset [2]
 CALLED BY:
	HXTPIXON
HISTORY:
       T. Metcalf 1994-Sep-8
          Modification of McTiernan's hxt_accum.pro.
          McTiernan used sigma = sqrt(total(counts))
             --> Assumes image identical at each time.
          This routine uses sigma = total(sqrt(counts))
             --> Assumes image different at each time.
          Reality is probably somewhere in between.
       Added, fix to hxt time, using fix_hxtindex


hxtbox_fsp $SSW/yohkoh/ucon/idl/mctiernan/hxtbox_fsp.pro
[Previous] [Next]
 NAME:
	hxtbox_fsp
 PURPOSE:
	To fit spectra for HXT, for a box chosen using lcur_image
 CALLING SEQUENCE:
	hxtbox_fsp,index,data,fit_pars,sc_par,ch_dta,sdel=sdel,tyspec=tyspec,$
                  outfile=outfile,pfile=pfile,same_bx=same_bx,boxq=boxq,$
                  countfile=countfile, fix_pars=fix_pars, $
                  average=average, all=all, channel=channel, $
                  no_interp=no_interp, sys_err=sys_err, udata=udata
 INPUT:
	index= info. structure for HXT data from test_rd
       data= compressed data
 OUTPUT:
	fit_pars, a structure of type {fitinfo}, for each interval, with tags:
		tyspec= type of spectrum
		ma= no. of parameters fit
		alabels = labels for the fit parameters
		t= the interval START times, in the 7 element array
		dt= the interval lengths
		a= the fit parameters, a fltarr(6)
                  NOTE ON UNITS: for Power laws, K is the differential flux
                                 at 1keV, in photons/(sec-cm^2-keV).
                                 Break energies (ebr) are in keV.
                                 For thermal fits, em is the Emission Measure
                                 in cm^(-3) but the output EM is normalized
                                 by 1.0e47. T is in Kelvin, but the output
                                 temperatures are in MK. (T/10^6)
 			tyspec  =1 a(0)=K, a(1)=gamma
				=2 a(0)=K1, a(1)=gamma1, a(2)=gamma2, a(3)=ebr
				=3 a(0)=em/1.0e47, a(1)=T/1.0e6
				=4 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
				=5 a(0)=em1/1.0e47, a(1)=T1/1.0e6, a(2)=em2/1.0e47, a(3)=T2/1.0e6
				=6 a(0)=K1, a(1)=gamma1, a(2)=K2, a(3)=gamma2
				=7 a(0)=K, a(1)=gamma, a(2)=T/1.0e6, a(3)=Ebr
		                =8 a(0)=em/1.0e47, a(1)=T/1.0e6, 
			           a(2)=K1, a(3)=gamma1, a(4)=gamma2, a(5)=Ebr
		                =9 a(0)=K1, a(1)=gamma1, a(2)=gamma2, 
			           a(3)=gamma3, a(4)=eb1 (between gamma1 & gamma2), 
			           a(5)=eb2 (between gamma2 and gamma3)
                               =10 a(0)=em/1.0e47, a(1)=T/1.0e6
                               =11 a(0)=em/1.0e47, a(1)=T/1.0e6, a(2)=K, a(3)=gamma
 		                =12, a(0)=K, a(1)=gamma, a(2)=e0
 		                =13, a(0)=K, a(1)=gamma, a(2)=e0
		sa= uncertainties in the fit parameters
               ffx= 0 if the associated parameter is free, 1 if fixed at a
                    user defined value, 2 if fixed at the value initially
                    given by ainit.
		chi2= chi^2
		nch= the number of channels for each interval
		fluxc= flux correction if any
		nsig= # of sigmas above background for good channels.
		flags= saturated flag, incomplete flag, channel event 
			was found in, highest channel included in fit, 
			mro flag.
	sc_par, a structure containing data for each sc channel, tags:
		e10= channel low energy edges
		e20= channel high energy edges
		eb0= channel midpt energy
		bck= background count rates, for the two bck intervals, fltarr(2)
		sbck= Uncertainty in bck
		tb= the background START time for two background intervals, an array of(7, 2)
		dtb= the bck time interval, fltarr(2)
	ch_dta, a structure containing data for each channel for each interval
		y0= incident count rates
		sy0= Uncertainty in y0
		chok=channel flag, 0 for channels used in fit , 
				   1 for channel not used
               b0 = background count rate
               sb0 = uncertainty in b0
               f0 = photon flux in the channel, for most cases f0 is
                    the flux at the channel energy, for thermal  + line fits
                    f0 is the average photon flux in that channel.
                    Note that f0 = model flux * ((y0-b0)/c0)
               sf0 = uncertainty in f0.      
               c0 = Model Excess count rates
 KEYWORD INPUT:
       sdel= the channels to delete, default is to prompt the user, -1 none
       tyspec= spectral type, default is to prompt the user
	outfile= the output file, a keyword
	pfile= a file for spectral plots
       same_bx= if set, use the values of the box coordinates in same_bx or
                boxq if set
       boxq= the output box coordinates
       countfile= a file name for the accumulated counts which can 
                  be used as input to fsp_proc.pro, no fit is done
                  if you set this keyword.
       fix_pars= if set, enables you to fix fit parameters
       /average keyword lets you average all of the images over the chosen
                time interval, really, you should do the averaging when
                doing the image deconvolution.
       all = if set fit all of the intervals
       channel= channel number for interval selection, default is to
                prompt the user
       no_interp= if set, do not call hxi_interp, be careful if this is
                  set, and you don't have all channels for each time
                  interval, things will be messed up.
       sys_err= a 'systematic error', pass in if you don't trust the
                errors you get from counting stats, or to arbitrarily
                push down chi^2 values, The default iz 0.0.
                This makes the error in the rate = sqrt(cps/dt)+sys_err*cps.
       udata= Uncertainty in the images, this must be a cube of the
             same size as data, or the routine crashes
 CALLS: ***
	UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], any_fsp
	anyrts, fmt_tim [1], fmt_tim [2], hxi_interp, hxi_unnorm, lcur_image, plot_lcur [1]
	plot_lcur [2], yesnox [1], yesnox [2]
 HISTORY:
	Written Mar, '93 by J.McTiernan
       Changed use of box_lc to lcur_image, boxq is different, corresponding
       to the lcur_image keyword marks,
       11-nov-93 multiple intervals and boxes (JMM)
       Fixed byte array bug, 10/11/94, jmm
       Added sys_err keyword, 24-jun-95, jmm
       New output formats, jmm, 28-jul-95
       Added udata keyword, jmm, 27-sep-1995


hxtcrude $SSW/yohkoh/ucon/idl/metcalf/hxtcrude.pro
[Previous] [Next]

Function hxtcrude,fobs,p,alphain,bin=binin,quiet=quiet,verbose=verbose, $
                  initialize=init,n_pix=n_pix,negative=negative,channel=channel
NAME:
	hxtcrude
PURPOSE:
	The image synthesis subroutine performs the image deconvolution 
       for HXT using the zeroth order regularization method.  
CALLING SEQUENCE:
	data_out = hxtcrude(fobs,p)
INPUT:
	fobs = the observed counts in the SC's: fltarr(nSC,nimages)
	p = the 2-d modulation pattern, fobs(j)=total(b*p(*,*,j)), 
		where b is the brightness and j is the grid number
               p = p(nx,ny,nd,nchan)
OPTIONAL INPUT:
       alpha = smoothing parameter (default = 0.1).  Larger smoothing gives
               a flatter imagem but it can become oversmoothed.
KEYWORD PARAMETERS:
       channel = channel to image, default = 0
       n_pix = size of each dimension in the image
       /initialize = compute P matrix.  If hxtcrude is called many
                     times there is no need to recompute the square
                     matrix every time.
       bin = binning factor (default = 2.0). Any float number GE 1.  
             Bigger = faster.
       /negative = allow the image to be negative
       /quiet = Don't print any diagnostics
       /verbose = print lots of diagnostics
OUTPUT:
	data_out= the brightness, a 64X64 array of counts/cm^2/pixel^2, 
                 THE ANSWER.  fltarr(64,64,nimages)
DESCRIPTION:
	makimg uses the zeroth order regularization to compute the iamge
       from the SC modulation patterns, p, and the counts and variances in 
       the 64 sub-collimators, fobs and var.  Zeroth order regularization is
       similar to MEM, but it avoids the iteration.

       The output matches the MEM image quite well, although the MEM image
       will generally be flatter.
 CALLED BY:
	HXTFPB, HXTFPB_FUZZY, hxtpix
MODIFICATION HISTORY:
	Translated from FORTRAN routine MAKIMG, of T. Sakao, by 
       J. McTiernan, July '92
	24-Aug-92 (MDM) - Added hxi_index.resolution = 1.97*1000
	30-Sep-92 (JM) - changed chilim form an absolute of 2.0 to 
			 0.40*Sqrt(total(var))/64, found semi-empirically
        9-Jun-93 (JM) -changed chilim back to 2.0
       22-Jun-93 (TRM) - Stripped JM's makimg.  Eliminated the MEM stuff
                         and added zeroth order regularization.
       25-Jun-93 (TRM) - Added code to handle multiple images efficiently
       19-Jun-95 (trm) - fixed a bug: the matrix was not recomputed 
                         when the channel changed.
       12-dec-96 (jmm) - changed grdnum=64 to grdnum=n_elements(p(0,0,*,0))
                         to avoid crashing when all of the SC's are not used.


HXTFPB $SSW/yohkoh/ucon/idl/metcalf/hxtfpb.pro
[Previous] [Next]

function hxtfpb,data,p,hxi_index,sigmai,residual,rgof,iterate=iteration,partan=partan, $
                initpatt=initpatt,quiet=quiet,continued=continued, $
                resolution=minresin,snr=dosnr,guess=guessin, $
                n_pix=n_pix,pixon_sizes=inpixon_sizes,notty=notty, $
                outresolution=outresolution

NAME:
   HXTFPB
PURPOSE:
     HXT Image reconstruction using the fractal pixon basis of Pina and Puetter.
CATEGORY:
CALLING SEQUENCE:
     image = hxtfpb(data,p,hxi_index[,residual,gof])
INPUTS:
     data = observed counts in the sub-collimators
     p = modulation patterns
     sigma = error on the data in "data", same size as data.
             This is a very important parameter since it
             is used to find the resolution of the image ...
             get the best estimate you can!
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS
     guess = initial guess for reconstructed image (def = compute with 
             hxt_qlook).  If guess is not n_pix by n_pix or if all elements
             of guess are LE 0, then the guess is not used.
     resolution = Minimum resolution in pixels (def = 1).
     pixon_sizes = an integer list of pixon sizes (resolutions) to use.
                   default = all possible.
     n_pix = size of each dimension in the image (def = 64).
     /snr = Weight the residuals by the signal-to-noise ratio.
     /initpatt = The modulation patterns have changed from the last call
                 to hxtfpb and should be re-initialized.
     /partan = Use "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails
     /continued = Uses faster "continued parallel tangent" iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent.
     iterate = returns with the number of iterations used at the final 
               resolution.
     outresolution = returns with the final resolution, i.e. the minimum
                     pixon size.
     /notty = Not running on a tty.  Set this for background jobs.
     /quiet = Work quietly.
OUTPUTS:
     image = reconstructed image
     residual = data residuals
     gof = goodness of fit 
 CALLS: ***
	HXT_GOF_FUNC, LOCAL_SMOOTH, PIXON_MAP, conj_grad2, hxtcrude, minF_partan
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
MODIFICATION HISTORY:
     T. Metcalf June 8, 1994
     T. Metcalf 1994 October 26, Major revision, everything changed!
     T. Metcalf 1995 May 26, Added check to see if routine went one
                             resolution step too far.
     T. Metcalf 1995-06-16,  Added a guard ring around the reconstructed
                             image.  This removes the restriction that
                             only the central part of the image is valid.
                             This makes the routine somewhat slower.  The
                             guard ring is necessary since the CONVOL routine
                             used for the local smoothing wipes out the edges
                             of the image.

                             Modified unstable criterion to allow the first
                             iteration to be unstable.
     T. Metcalf 1995-06-20,  Force the iteration to proceed untill at
                             least 3 resolutions are completed.


HXTFPB_FUZZY $SSW/yohkoh/ucon/idl/metcalf/hxtfpb_fuzzy.pro
[Previous] [Next]

function hxtfpb_fuzzy,data,p,hxi_index,sigmai,residual,rgof,error, $
                iterate=iteration,partan=partan, $
                initpatt=initpatt,quiet=quiet,continued=continued, $
                resolution=minresin,snr=dosnr,guess=guessin, $
                n_pix=n_pix,pixon_sizes=inpixon_sizes,notty=notty, $
                outresolution=outresolution,poisson=poisson,chisqr=chisqr, $
                sensitivity=sensitivity,pixonmap=pixonmap,btot_in=btot_in

NAME:
   HXTFPB_FUZZY
PURPOSE:
     HXT Image reconstruction using the fractal pixon basis of Pina and Puetter.
CATEGORY:
CALLING SEQUENCE:
     image = hxtfpb_fuzzy(data,p,hxi_index,sigma[,residual,gof,error])
INPUTS:
     data = observed counts in the sub-collimators
     p = modulation patterns
     hxi_index = hxi index for images with info on the HXT dataset.
     sigma = error on the data in "data", same size as data.
             This is a very important parameter since it
             is used to find the resolution of the image ...
             get the best estimate you can!
             Otherwise use /poisson.
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS
     sensitivity = sensitivity in creating the pixon map.  
                   default = 1./sqrt(2),
                   0.0 is most sensitive, >3.0 is very insensitive.  The
                   default was arrived at after much testing and simulation.
                   Don't mess with it unless you know what you are doing.
                   If sensitivity is set too small, you may get spurious
                   sources; too large and you may miss real sources.
     guess = initial guess for reconstructed image (def = compute with 
             hxt_qlook).  If guess is not n_pix by n_pix or if all elements
             of guess are LE 0, then the guess is not used.
     resolution = Minimum resolution in pixels (def = 1).
     pixon_sizes = an integer list of pixon sizes (resolutions) to use.
                   default = powers of sqrt(2.0).  Slower, but more robust,
                   would be something like pixon_sizes=indgen(17).
     n_pix = size of each dimension in the image (def = 64).
     /snr = Weight the residuals by the signal-to-noise ratio.
     /initpatt = The modulation patterns have changed from the last call
                 to hxtfpb_fuzzy and should be re-initialized.
     /partan = Use "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails.  Use of this keyword is deprecated,
               but it remains for compatibility with older code.
     /continued = Uses faster "continued parallel tangent" iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent.  Use of this keyword is deprecated,
                  but it remains for compatibility with older code.
     /chisqr = Use chi square statistics rather that poisson statistics.
               sigma will be used if set.  If sigma is not set,
               the Poisson statistics ala /poisson are used.
     /poisson = Use Poisson statistics rather than chi^2.  If this keyword 
                is set, sigma is not used.  THIS IS THE DEFAULT.
     iterate = returns with the number of iterations used at the final 
               resolution.
     outresolution = returns with the final resolution, i.e. the minimum
                     pixon size.
     /notty = Not running on a tty.  Set this for background jobs.
     /quiet = Work quietly.
     btot_in = An estimate of the total # of counts in the image
                 The default is a weighted sum of the counts in the SC's
OUTPUTS:
     image = reconstructed image
OPTIONAL OUTPUTS:
     residual = data residuals
     gof = goodness of fit 
     error = Outputs the estimated error on the reconstructed image
 CALLS: ***
	HXT_ERROR, HXT_GOF_FUNC, HXT_PIXON_MAP, LOCAL_SMOOTH, MINF_CONJ_GRAD, hxtcrude
	minF_partan
 CALLED BY:
	hxtpix
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
     Convolutions are done with FFT so the procedure is considerably
     faster when the image size is a power of 2.

     The FFT also wraps the edges, so emission at the edges is not
     treated properly.  This could be corrected by taking the /fft out
     of all the calls to local_smooth, but that is much slower.  It could
     also be fixed by setting guard_width>0.
PROCEDURE:
MODIFICATION HISTORY:
     T. Metcalf June 8, 1994
     T. Metcalf 1994 October 26  Major revision, everything changed!
     T. Metcalf 1995 May 26  -Added check to see if routine went one
                              resolution step too far.
     T. Metcalf 1995-06-16   -Added a guard ring around the reconstructed
                              image.  This removes the restriction that
                              only the central part of the image is valid.
                              This makes the routine somewhat slower.  The
                              guard ring is necessary since the CONVOL routine
                              used for the local smoothing wipes out the edges
                              of the image.

                             -Modified unstable criterion to allow the first
                              iteration to be unstable.
     T. Metcalf 1995-06-20   -Force the iteration to proceed until at
                              least 3 resolutions are completed.
     T. Metcalf 1995-06-05   -Changed hxtfpb.pro to hxtfpb_fuzzy.pro
                1995-08-14   -Added a new pixon calculator, hxt_pixon_map
                1995-09-01   -Modified the ME prior in hxt_gof_func to use
                              the DOF map.
     T. Metcalf 1996-03-06   -Added the /chisqr and the /poisson keywords.
     T. Metcalf 1996-06-12   -Changes search_step divisor from 2 to 4.
                              Modified the default pixon map calculation
                              to completely recompute at every scale.
                              Changed convergence criteria to include the 0.0 
                              case.
                             -There was a very subtle bug in hxt_gof_func.  
                              The common block had a bizarre interaction 
                              with minf_parabol_d when gof was included in 
                              the first common block.  The conjugate gradient
                              minimization is MUCH more robust now.
     T. Metcalf 1996-06-13   -Made pixon calculator faster by ignoring
                              background pixels after 5 passes.  
                             -Set sigma
                              to 0.707 (from 1.414) in pixon calculator.
     T. Metcalf 1996-06-14   -Removed unstable test.
                             -Repeat minimum resolution
                             -Use minf_conj_grad rather than conj_grad2.
                             -Added error calculation.
     T. Metcalf 1996-06-20   -Set guard_width to 0 since CONVOL now has a
                              /edge_truncate keyword to handle this more
                              efficiently.
                             -Use logarithmically spaced pixon sizes as the 
                              default.  This required a change to 
                              local_smooth.pro (binup factor).
                             -Use FFT in local_smooth call.  It's Fast now 
                              with
                              guard_width set to zero since the standrd image
                              size is a power of 2.
                             -Add a very large pixon for the background.  This
                              greatly reduces the number of pixons used in the
                              reconstruction and makes the iteration very 
                              stable.
     T. Metcalf 1996-06-21   -Keep track of pixon changes as the pixon map is
                              calculated in hxt_pixon_map (dr2s stuff).
     T. Metcalf 1996-07-01   -Set sigma in hxt_pixon_map to 0.  Add size
                              0 pixon.
     T. Metcalf 1996-07-05   -Added median filter to calculation of the
                              pixon map.  
                             -Recalculate pixon map from scratch
                              at every iteration, but leave background
                              pixons as is.
     T. Metcalf 1996-07-08   -Took out median filter.  It wasn't necessary 
                              with the recompute at every step. Set sigma in 
                              hxt_pixon_map to 1./sqrt(2.0).
     T. Metcalf 1996-07-26   -Alternate between logarithmic and linear 
                              solution.  This is a very significant change!
                             -sigma set to sqrt(2)in hxt_pixon_map.
                             -order of x,y and i loops reversed in 
                              hxt_pixon_map.
                             -Pixon resolution is frozen if gof goes below nd
                             -Convergence required to be zero to end conj_grad
                             -tolerance set to 1.e-4 from 1.e-2.
                             -edgefill set to 1.0 since /fft is in calls to
                              local_smooth.
                             -iteration limit for the final resolution 
                              reduced from 50 to 40.  Others up'ed to 30.
                             -Return last image not lowest gof image.  Lowest
                              gof is not always best!
     T. Metcalf 1996-08-02   -Added the sensitivity keyword.
     T. Metcalf 1996-08-08   -Added a check for max(image) LE 0.0 which
                              can happen when not in flare mode and the data
                              are 0.
     T. Metcalf 1996-10-14   -Fixed the orientation of the error estimate.
     T. Metcalf 1996-11-11   -Changed default sensitivity to 0.707
     T. Metcalf 1997-01-22   -New GOF term to make the residuals unbiased.
                             -New correction factor for DC term after each
                              resolution is completed.
                             -Removed pixon size 0
                             -Use total intensity estimate in the inital guess
                             -Set default sensitivity to 0.0
                             -Modified sigma for negative data
      17-jun-1997 (jmm, TRM) - added btot_in keyword


HXTIMG2INTS $SSW/yohkoh/ucon/idl/wuelser/hxtimg2ints.pro
[Previous] [Next]
 NAME:
        HXTIMG2INTS
 PURPOSE:
        Converts a HXT_INFO structure (as produced by rd_hxtimg)
        into a standard time structure with tags .time and .day
 CATEGORY:
 CALLING SEQUENCE:
        time_struct = hxtimg2ints(hxt_info,'dd-mmm-yy')
 INPUTS:
        hxt_info = info structure as defined by rd_hxtimg
 KEYWORDS (INPUT):
 OUTPUTS:
        time_struct = standard time structure with tags .time (milliseconds
                      of day) and .day (days since 1979).
                      This time is the middle of the HXT integration.
 KEYWORDS (OUTPUT):
        stim = time structure of start times
        etim   = time structure of end times
        integ = integration time in seconds
 CALLS: ***
	anytim2ints [1], anytim2ints [2], int2secarr [1], int2secarr [2]
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
        time vectors that go across midnight must be in ascending order.
 PROCEDURE:
 MODIFICATION HISTORY:
        JPW, Nov. 92
        JPW, Dec. 93   changed to use format from rd_hxtimg


hxtimg_accum $SSW/yohkoh/hxt/idl/atest/hxtimg_accum.pro
[Previous] [Next]
NAME:
	hxtimg_accum
PURPOSE:
 	plots hxt data, prompts for start and end times for data 
	accumulation and background, and returns an array with the
       accumulated counts, for each interval and channel.
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
       Hxtimg_accum, index, data, index1, hxi_index, counts, sigma, bcounts, $
                     bsigma, img_trange = img_trange, bck_trange=bck_trange, $
                     dt_resolution=dt_resolution, alt_tsel=alt_tsel, $
                     accum_cnts=accum_cnts, ch_accum=ch_accum, cnts_str=cnts_str,$
                     bkgd_str=bkgd_str, hdafile=hdafile, channel=channel, $
                     noback=noback, chisqr=chisqr, st_times = st_times, $
                     int_times = int_times
INPUT:	
	index=data info from hda file
	data=counts in each subcollimator for each channel
KEYWORDS: (INPUT)
       img_trange = a time range for the images
       bck_range = a time_range for the background accumulation
       dt_resolution = number of 1/2 second (flare mode) or 4 second
                      (quiet mode) frames per image, default is to
                      prompt the user. If set to -1, then the whole chosen
                      interval is used. NOTE THAT THIS KEYWORD IS IGNORED
                      IF MULTIPLE INTERVALS HAVE BEEN SELECTED EITHER
                      IN PLOT_LCUR, OR IF THEY HAVE BEEN PASSED IN.
       alt_tsel = use alt_tim_sel to obtain interval, rather than plot_lcur
                  Useful if you don't have x-windows
       accum_cnts = if set, the value of average counts/SC in a given
                    that you want for each set of images, the routine
                    will accumulate counts until the number of counts
                    in the given channel are greater than or equal to
                    this value. If set with a slash, ie. the value=1
                    then the default is 200 (a good value).
       accum_cnts_ch = the channel you want to use for the accum_cnts
       structures = if set, the data will be passed out in structures,
                    duplicating the use of MK_HXT_SUM for use in HXTPRO.
                    The structure hxi_index need not be passed in if
                    the structures keyword is set. THIS IS IMPORTANT:
                    DO NOT USE ANY OF THE OPUTPUT VARIABLES IF YOU SET
                    THIS KEYWORD, I.E. THE CALLING SEQUENCE ONLY INCLUDES
                    INDEX AND DATA AS PARAMETERS, THE REST MUST BE KEYWORDS,
                    LIKE THIS: Hxtimg_accum, index, data, /struct, cnts_str=cnts_str, $
                                  bkgd_str=bkgd_str, other keywords....
       hdafile= the name of the hda file used, the structures want this
                i have no clue why, if not set we make one up.
       channel= a channel number for the plots, default is to prompt the user
       noback= if set, the background is set to zero. Requested by HSH 21-jun-95
       /chisqr= if set, sigma(counts) is a weighted sum of total(sqrt(counts))
                 and sqrt(total(counts)), where the total is taken over the
                 accumulation intervals. This may be more useful for cases
                 with low signal-to-noise. This used to be the default,
                 but not anymore, 6-mar-96, the default is to use sqrt(total(counts))
       st_times= an array of accumulation start times, in any yohkoh format
       int_times= interval times corresponding to st_times, may be a scalar,
                  if this is not set, and st_times is set, the routine will
                  use the differences between st_times. This must be an integer
                  number of the appropriate resolution in seconds, if the
                  value of int_times is less than a frame value.
KEYWORDS: (OUTPUT)
       cnts_str = the counts in a structure, the structures keyword must
                  be set for this to be calculated, for use by HXTPRO
       bkgd_str = the background in a structure, the structures keyword must
                  be set for this to be calculated.
OUTPUT:
       index1= index structure for the first frame of each image interval
	hxi_index.chan= channel used
		=0 L0 (13-23 keV)
		=1 M1 (23-33 keV)
		=2 M2 (33-53 keV)
		=3 HI (53-93 keV)
	hxi_index.actim= image accumulation time in 10ths of secs
	hxi_index.interval= actim
	hxi_index.bkg_time= start time for background accumulation
                           (millisec OF day)
	hxi_index.bkg_day= day of start of background accumulation
                          (days since 1-Jan-79)
	hxi_index.bkg_actim= background accumulation time in 10ths of secs
	hxi_index.bkg_interval= actim 
       counts= the counts accumulated over the chosen intervals
       sigma= sqrt(counts)
       bcounts= the counts accumulated over the background interval
       bsigma= sqrt(bcounts)
DESCRIPTION:
	Uses the function plot_lcur to select the data to be imaged,
	and the background.
 CALLS: ***
	SET_HXT_STRUCT, anytim2ex [1], anytim2ex [2], anytim2ints [1], anytim2ints [2]
	avsig_1 [1], avsig_1 [2], avsig_1 [3], avsig_1 [4], avsig_1 [5], avsig_1 [6]
	avsig_1 [7], choose_interval, ex2fid [1], ex2fid [2], gt_day [1], gt_day [2]
	gt_dp_mode [1], gt_dp_mode [2], hxt_chsums, hxt_setgra
 CALLED BY:
	hxt_multimg, hxt_sources
MODIFICATION HISTORY:
	Written Oct-93 by JMM,
       Changed to give full resolution, 19-jul-94, JMM
       9/21/94, account for 4.0 second time lag in hda files, jmm
       1/9/95, changed calculation of sigma to be the same as
               in Tom Metcalf's hxtaccumulate.pro, to be consistent
               in pixon calculations.
       Added the ability to do non-flare mode data, 2/12/95, jmm
       Speed things up using new-style TOTAL commands, 2/13/95, jmm
       13-mar-95 JPW : img_trange can now be an array of ranges (2,n)
       16-mar-95 JPW : can now use multiset option in plot_lcur
       Stripped out accumulation stuff, replaced it with calls to
       CHOOSE_INTERVAL, 5-apr-95, jmm
       added cnts_str, bkgd_str keyword outputs, 6-apr-95, jmm
       Added the call to setgra, which gives the subscripts for
       the subcollimator switch, from HXTSBT_MULT, 6-apr-95, jmm.
       This accomodates the structures...
       I don't think anyone will notice.
       Subtract bcakground before choosing the imaging intervals,
       You can see where it's less than zero, and ACCUM_CNTS now
       refers to Excess counts, 9-jun-95
       Added /noback option, 22-jun-95
       Fixed bug in calculation of SC uncertainties for single
       interval accumulations, 1-Aug-95, Jmm
       Changed  default sigmas back to poisson statistics, added 
       /chisqr keyword, 6-mar-96, jmm
       Added st_times, and int_times keywords, 3-jan-1997, jmm
       Call to hxt_chsums is changed, 6-apr-1999, jmm


hxtpix $SSW/yohkoh/ucon/idl/metcalf/hxtpix.pro
[Previous] [Next]
NAME:
	hxtpix
PURPOSE:
	The image synthesis subroutine performs the image deconvolution 
       for HXT using the pixon method of Pina and Puetter.
CALLING SEQUENCE:
	hxtpix, ictrl, hxi_index, index1, fobs, sig, p, index_out, data_out $
INPUT:
      /snr = Weight the residuals by the signal-to-noise ratio.
      /ictrl = enables display of final image
      hxi_index = a structure containing everything we need to know about 
                   the hxt image.  nimages elements.
	Tags used:
	   hxi_index.grause(8)=Each element is either 0b or 255b, 
		If hxi_index.grause(j)=0b, then the Subcollimators with 
		spatial wave number j+1 aren't used in the calculation
	index1 = index structure of the first data set in each accumulation
	fobs = the observed counts in the SC's: fltarr(nSC,nimages)
	sig = the uncertainty in fobs = sqrt(fobs) kind of
	p = the 2-d modulation pattern, fobs(j)=total(b*p(*,*,j)), 
		where b is the brightness and j is the grid number
OPTIONAL INPUT:
KEYWORD PARAMETERS:
     sensitivity = sensitivity in creating the pixon map.  default = sqrt(2),
                   0.0 is most sensitive, >3.0 is very insensitive.  The
                   default was arrived at after much testing and simulation.
                   Don't mess with it unless you know what you are doing.
                   If sensitivity is set too small, you may get spurious
                   sources; too large and you may miss real sources.
       guess = initial guess for reconstructed image (def = compute with
              hxt_qlook).  If guess is not n_pix by n_pix or if all elements
              of guess are LE 0, then the guess is not used.  guess can
              be a vector of images if the number of guess images equals
              the number of output images.
       resolution = resolution of final image in pixels (def = 1)
       pixon_sizes = an integer list of pixon sizes (resolutions) to use.
                     default = all possible.
       n_pix = number of pixels in each dimension of the image (def = 64)
       /initpatt = The modulation patterns have changed since the last call
                   to hxtpix and they should be re-initialized.
       /partan = Uses "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails
       /continued = Uses faster "continued parallel tangent" iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent
       /notty = Not running on a tty.  Set this for background jobs.
       /quiet = Don't print any diagnostics
       /verbose = print lots of diagnostics
     btot_in = An estimate of the total # of counts in the image
                 The default is a weighted sum of the counts in the SC's
OUTPUT:
	index_out= Hxi gen htx and hxi structure.  nimages elements
	data_out= the brightness, a n_pixXn_pix array of counts/cm^2/pixel^2, 
                 THE ANSWER.  fltarr(n_pix,n_pix,nimages)
DESCRIPTION:
	makimg uses the pixon method to compute the iamge
       from the SC modulation patterns, p, and the counts and variances in 
       the 64 sub-collimators, fobs and var.
 CALLS: ***
	HXTFPB_FUZZY, SQUEEZE, STR_LOAD, hxtcrude, str_merge [1], str_merge [2]
	tag_index [1], tag_index [2], unpack_grause
 CALLED BY:
	HXTPIXON, hxt_multimg
RESTRICTIONS:
MODIFICATION HISTORY:
	Translated from FORTRAN routine MAKIMG, of T. Sakao, by 
       J. McTiernan, July '92
	24-Aug-92 (MDM) - Added hxi_index.resolution = 1.97*1000
	30-Sep-92 (JM) - changed chilim form an absolute of 2.0 to 
			 0.40*Sqrt(total(var))/64, found semi-empirically
        9-Jun-93 (JM) -changed chilim back to 2.0
       Zeroth Order Regularization -- T. Metcalf
       22-Jun-93 (TRM) - Stripped JM's makimg.  Eliminated the MEM stuff
                         and added zeroth order regularization.
       25-Jun-93 (TRM) - Added code to handle multiple images efficiently
       Pixons -- T. Metcalf
       14-Jun-94 (TRM) - Modified makimg0.pro to hxtpix.pro
       1994-10-26 (TRM) - Changes to hxtfpb call
       1995-07-05 (TRM) - Changed hxtfpb to hxtfpb_fuzzy
       1996-01-16 (TRM) - The minimum pixon size is now returned in
                          hxi_index.delta instead of hxi_index.resolution.
       1996-03-04 (TRM) - added /chisqr and /poisson to pass to hxtfpb_fuzzy
       1996-10-01 (TRM) - Added keywords sensitivity, pixonmap, pixonerror.
       1996-11-26 (JMM) - Added call to UNPACK_GRAUSE, which allows for
                          individual SC's to be left out of the fit
       1997-01-24 (TRM) - Compute initial guess in hxtpix rather than hxtfpb_fuzzy
                          if a guess is not supplied.  The computed guess
                          is now passed back to the calling routine.
      17-jun-1997 (jmm, TRM) - added btot_in keyword


HXTPIXON $SSW/yohkoh/ucon/idl/metcalf/hxtpixon.pro
[Previous] [Next]
NAME:
     HXTPIXON
PURPOSE:
     Makes a series of HXT images
CATEGORY:
CALLING SEQUENCE:
     hxtpixon, index, data, movie, hxi_index [,patterns] 
INPUTS:
     index = HXT index from an HDA file
     data = HXT data from an HDA file
OPTIONAL INPUT PARAMETERS:
     patterns = the sub-collimator modulation patterns.  Computed if not
                supplied.  The computation is slow, so if you plan to make
                a series of movies, use patterns to receive the computed 
                patterns the first time you call hxtpixon and then use
                patterns to pass the modulation patterns back to the routine
                on subsequent calls to hxtpixon.  You must recompute the 
                modulation patterns whenever you use a different pointing
                (see /new_mod_patterns).
OUTPUTS:
     movie = a data cube of the HXT images
     hxi_index = an index describing various parameters of the images.  The
                 time in the index is the start of the accumulation period.
KEYWORD PARAMETERS
     guess = initial guess for the reconstructed image (def = compute with
             hxt_qlook)
     resolution = resolution of final image in pixels (def = 1).
     pixon_sizes = an integer list of pixon sizes (resolutions) to use.
                   default = all possible.
     n_pix = number of pixels in the image (def = 64).
     /snr = Weight the residuals by the signal-to-noise ratio.
     /new_mod_patterns = Force a new computation of the modulation patterns,
                         even if the patterns parameter is set.  Normally, if
                         patterns is set, the modulation patterns are not
                         computed.  You must recompute the modulation 
                         patterns whenever you use a different pointing.
     patt_shape = type of modulation pattern (0=triangular, 1=sinusoidal, ...)
     expfactor = expansion factor (1.0 = 2.47" pixels)
     xy = HXT [x,y] position of flare
     sys_err = systematic error, def = 0.02
     /partan = Uses "parallel tangent" iteration.  Slower than the default
               conjugate gradient, but almost always converges even when
               conjugate gradient fails
     /continued = Uses faster "continued parallel tangent" iteration scheme.
                  It is slower than conjugate gradient, but faster than
                  plain parallel tangent
     /quiet = don't print any diagnostics
     /verbose = print lots of diagnostics
 CALLS: ***
	FILE_EXIST [2], GET_HXTTIME, IMG_DEFAULT, MAKPAT, anytim2ex [1], anytim2ex [2]
	anytim2ints [1], anytim2ints [2], dprate2sec [1], dprate2sec [2], ex2fid [1]
	ex2fid [2], file_exist [1], file_exist [3], fmt_tim [1], fmt_tim [2], hxt_back_sub
	hxtaccumulate, hxtpix, input [1], input [2], sav_hxi, tag_index [1], tag_index [2]
	tim2dset [1], tim2dset [2], yesnox [1], yesnox [2]
SIDE EFFECTS:
     if set on input, hxi_index and movie are modified.
RESTRICTIONS:
     When the modulation patterns are passed to hxtpixon in the patterns 
     parameter, hxi_index must also be set from the output from a previous 
     call to hxtpixon, hxt_qlook or hxt_img_prep.

     The minimum time for which counts are accumulated is 1 major frame
     in hxt_accum.  Setting the accumulation to something less than this
     implies overlapping data are used in the computed images.  Further,
     the acutal data accumulation is only done in integral numbers of
     major frames.

     Several tags in the hxi_index which have information on the MEM
     analysis are set to 0 here since they have no meaning with the
     pixon reconstruction.

PROCEDURE:
     Calls hxtpix to compute the images.  hxtpixon is just a front end
     for hxtpix.  The modulation patterns are computed with hxt_img_prep.

     The user specifies the start and end times of the movie on a light curve
     plot.  The data are split into seperate images based on the length of
     the accumulation time.  For, example if the movie runs from 01:45:31
     through 01:45:37 and the accumulation time is 2 seconds, there will be
     three frames in the movie.  But, if the accumulation time is 6 seconds,
     there will only be one frame in the movie (i.e., a single image).

     The hxi_index structure is defined in
     /ys/gen/soft/rel/ref_access/hxt_struct.inc
MODIFICATION HISTORY:
     Written 25-June-93 by T. Metcalf
     T. Metcalf 14-Jun-94 Converted hxt_qlook into hxtpixon
     T. Metcalf 26-Oct-94 Updated to match the new hxtfpb.pro.
                          Now calls hxt_bacj_sub and hxt_accumulate.


HXTPRO [1] $SSW/yohkoh/ucon/idl/bentley/hxtpro.pro
[Previous] [Next]
 NAME:
	HXTPRO
 PURPOSE:
	Runs the HXT F77 Programme MOVIE
 CALLING SEQUENCE:  
	.run HXTPRO
 INPUTS:
	channel		Channel for analysis
	flare_coords	Coordinates of flare (HXT units), FOV Exp.,Fac.
	comment		Comment (up to 80 chars)
 OUTPUTS:
	Creates the jcl file for MOVIE on current directory
 OPTIONAL OUTPUTS:

 RESTRICTIONS:

 PROCEDURE:
	Asks few questions, allows selection of data. Creates input 
	files for image synthesis. Creates a jcl file for image synthesis
	using the supplied HXT coordinates, channel and comment. 
	Rename o/p files??
 MODIFICATION HISTORY:
	RDB  21-Jun-93	Written
	RDB  22-Jun-93	Added few bits; changed name of wrt_hxtmovie_jcl
			to wrt_hxtmve_jcl  (compile problem).
	RDB  23-Jun-93	Only ask channel once; wset command
			Added converting output file to hxi.
			Changed default name of jcl file
	20-nov-93 JRL	Fixed the hxi section to not clobber input data
			Added code to optionally call rd_hxtimg and disp_hxtimg
	22-nov-93 JRL   Fixed a bug concerning channel input


HXTPRO [2] $SSW/yohkoh/ucon/idl/mctiernan/hxtpro2.pro
[Previous] [Next]
 NAME:
	HXTPRO
 PURPOSE:
	Runs the HXT F77 Programme MOVIE
 CALLING SEQUENCE:  
	.run HXTPRO
 INPUTS:
	channel		Channel for analysis
	flare_coords	Coordinates of flare (HXT units), FOV Exp.,Fac.
	comment		Comment (up to 80 chars)
 OUTPUTS:
	Creates the jcl file for MOVIE on current directory
 OPTIONAL OUTPUTS:

 RESTRICTIONS:

 PROCEDURE:
	Asks few questions, allows selection of data. Creates input 
	files for image synthesis. Creates a jcl file for image synthesis
	using the supplied HXT coordinates, channel and comment. 
	Rename o/p files??
 MODIFICATION HISTORY:
	RDB  21-Jun-93	Written
	RDB  22-Jun-93	Added few bits; changed name of wrt_hxtmovie_jcl
			to wrt_hxtmve_jcl  (compile problem).
	RDB  23-Jun-93	Only ask channel once; wset command
			Added converting output file to hxi.
			Changed default name of jcl file
	20-nov-93 JRL	Fixed the hxi section to not clobber input data
			Added code to optionally call rd_hxtimg and disp_hxtimg
	22-nov-93 JRL   Fixed a bug concerning channel input
       6-apr-95  JMM   Fixed bug when the array SSSS doesn't exist
       6-apr-95  JMM   stripped out alot of stuff,
                       replaced with a call to HXTIMG_ACCUM


HXTPRO_NMP $SSW/yohkoh/ucon/idl/sakao/hxtpro_nmp.pro
[Previous] [Next]
 NAME:
	HXTPRO_NMP
 PURPOSE:
	Runs the HXT F77 Programme MOVIE
 CALLING SEQUENCE:  
	.run HXTPRO_NMP
 INPUTS:
	channel		Channel for analysis
	flare_coords	Coordinates of flare (HXT units), FOV Exp.,Fac.
	comment		Comment (up to 80 chars)
 OUTPUTS:
	Creates the jcl file for MOVIE on current directory
 OPTIONAL OUTPUTS:

 RESTRICTIONS:

 PROCEDURE:
	Asks few questions, allows selection of data. Creates input 
	files for image synthesis. Creates a jcl file for image synthesis
	using the supplied HXT coordinates, channel and comment. 
	Rename o/p files??
 MODIFICATION HISTORY:
   === FOR HXTPRO ===
	RDB  21-Jun-93	Written
	RDB  22-Jun-93	Added few bits; changed name of wrt_hxtmovie_jcl
			to wrt_hxtmve_jcl  (compile problem).
	RDB  23-Jun-93	Only ask channel once; wset command
			Added converting output file to hxi.
			Changed default name of jcl file
	20-nov-93 JRL	Fixed the hxi section to not clobber input data
			Added code to optionally call rd_hxtimg and disp_hxtimg
	22-nov-93 JRL   Fixed a bug concerning channel input
  === FOR HXTPRO_NMP ===
	version 1.0	98.03.07 (Sat) @ GSFC
		T.Sakao written.
       version 1.1     98.05.03
		J.Sato modefied.


hxtsbt_mult $SSW/yohkoh/hxt/idl/atest/hxtsbt_mult.pro
[Previous] [Next]
NAME:
	hxtsbt_mult
PURPOSE:
	Subtracts the background from the image count rate, and rearranges
	the order of the data so that the correct count rates are matched to 
	the correct Sub Collimators.
CATEGORY:
       Yohkoh HXT
CALLING SEQUENCE:
	hxtsbt_mult,hxi_index,counts,bcounts,fobs,sig
INPUT:	
	hxi_index= Structure with info pertaining to image
	tags:
	hxi_index.actim= Flare accumulation time
	hxi_index.bkg_actim= Background accumulation time
	counts= Flare total counts, all SC's, all channels
	bcounts= Background counts
OUTPUT:
	fobs= Counts - Background
	sig= Uncertainty in fobs
KEYWORDS;
       b_zero= if set do not subtract the background, for the alternative
               background option
 CALLED BY:
	hxt_multimg, hxt_sources
MODIFICATION HISTORY:
	Adapted from Fortran routine HXTSBT of T. Sakao, by J McTiernan, July '92
       Made useful for multiple channels and intervals 29-oct-93 (JMM)
       Added the csigma and bsigma keywords, for improved uncertainty
       calculation, ala Tom M's hxt_back_sub.pro, 1-10-95, jmm.
       Removed the call to setgra, which gives the subscripts for
       the subcollimator switch, and added into HXTIMG_ACCUM, 6-apr-95, jmm.
       I don't think anyone will notice.


HYDRO_ CORONA $SSW/yohkoh/ucon/idl/hudson/hydro_corona.pro
[Previous] [Next]
 NAME:
       HYDRO_ CORONA
 PURPOSE:
       integrate isothermal hydrostatic coronal models
 CALLING SEQUENCE
       flux = hydro_int(temp, distance, dens = dens, int_step = int_step)
 INPUTS
       temp = isothermal temperature, K
       distance from disk center, solar radii (assume 1 A.U.)
 OUTPUT:
       flux = fltarr(2) the thin Al and Dag fluxes, DN/sec/full res pix (?)
 KEYWORDS:
       dens = density at base, default 1e9
       int_step the number of steps in the integrals, default = 500
 CATEGORY:
       Yohkoh stuff
 ROUTINES USED:
       SXT_FLUX, GT_PIX_SIZE
 CALLS: ***
	HYDRO_CORONA, gt_pix_size, sxt_flux [1], sxt_flux [2], sxt_flux [3]
 HISTORY: 
       HSH Apr. 25 1994 written
       HSH, JLC 3 June 1994, fixed bug