hao_hdr $SSW/packages/ztools/ground/hao_hdr.pro
[Previous] [Next]
 NAME:
	hao_hdr
	
 PURPOSE
	Produces a header for an HAO 512x512 image

 CALLS:


hastogram $SSW/packages/chianti/idl/low_level/hastogram.pro
[Previous] [Next]
FUNCTION:	hastogram
	returns a frequency histogram over a specified grid,
	calculated in a fast and clever way.  really.
	works in haste, without waste.

syntax
	f=hastogram(list,x,wts=wts)

parameters
	list	[INPUT; required] list of numbers to bin
	x	[I/O] the required binning scheme
		1: if not set, assumes a linear grid of size 100 from
		   min(LIST) to max(LIST)
		2: if scalar or 1-element vector, assumes this to be the
		   number of bins
		   * if -ve, log grid, else linear
		3: if vector with more than 1 element, assumes it to be
		   all the bin-beginning values and the final bin-ending
		   value.
		*  overwrites variable by adopted grid

keywords
	wts	[INPUT] if given, appropriately weights each element of LIST
		* default is unity
		* if size does not match size(LIST), will be appropriately
		  interpolated
	_extra	[JUNK] here only to prevent crashing the program

description
	the problem is the following: if the number of bins is large,
	accumulating a frequency histogram by linear search takes too
	long, esp. in IDL if one uses for-loops.
	so, first create a monster array containing both the list elements
	and the grid values.  then sort this array.  this results in an
	array where the list elements are all nicely placed within the
	correct bins.  now, if we've been keeping track of the positions
	of the list elements, it's an easy job to count up the number in
	each bin of the grid.  to do the latter, we first create a new
	array made up of -1s in positions of list elements and position
	indices for grid values and reorder according to the above sort.
	then, replace each -1 by the nearest non-(-1) from the left.  now
	each list element is assigned the correct bin number.  voila!

restrictions
	X must be sorted in increasing order.

subroutines


history
	vinay kashyap (Jan98)  PINT_of_ALE
	added kludge to speed up in case max(X) < max(LIST) (VK; Sep98)
	added quit in case X is not sorted in ascending order (VK; JanMMI)
 CALLS:
 CALLED BY
	MAKE_CHIANTI_SPEC


help_merge [1] $SSW/packages/spex/idl/original_spex/spex_source.pro
[Previous] [Next]

 NAME: help_merge


 PURPOSE: report the status of the arrays in the merge common 


 CATEGORY: spectral analysis


 CALLING SEQUENCE:  help_merge


 CALLED BY:    spex


 INPUTS:
       none explicit, only through commons;

 OUTPUTS:
       none explicit, only through commons;

 CALLS: ***
	ARR2STR [1], ATIME [1], ATIME [2], Arr2Str [2], CHECKVAR [1], DELVARX [1]
	DELVARX [2], DELVARX [3], DELVARX [4], FCHECK, F_DIV, GETUTBASE [1], GETUTBASE [2]
	checkvar [2], delvarx [5], edge_products, printx [1], printx [2], spex_current [1]
	spex_current [2], spex_delete [1], spex_delete [2], spex_hold [1], spex_hold [2]
	spex_merge [1], spex_merge [2], spex_source [1], spex_source [2]
 CALLED BY:
	spex_delete [1], spex_delete [2], spex_hold [1], spex_hold [2], spex_merge [1]
	spex_merge [2], spex_source [1], spex_source [2]
 COMMON BLOCKS:
	spex_hold_com
       spex_setup_com
       spex_proc_com

 MODIFICATION HISTORY:
	ras, 19-oct-94


help_merge [2] $SSW/packages/spex/pre2002/idl/spex_source.pro
[Previous] [Next]

 NAME: help_merge


 PURPOSE: report the status of the arrays in the merge common 


 CATEGORY: spectral analysis


 CALLING SEQUENCE:  help_merge


 CALLED BY:    spex


 INPUTS:
       none explicit, only through commons;

 OUTPUTS:
       none explicit, only through commons;

 CALLS: ***
	ARR2STR [1], ATIME [1], ATIME [2], Arr2Str [2], CHECKVAR [1], DELVARX [1]
	DELVARX [2], DELVARX [3], DELVARX [4], FCHECK, F_DIV, GETUTBASE [1], GETUTBASE [2]
	checkvar [2], delvarx [5], edge_products, printx [1], printx [2], spex_current [1]
	spex_current [2], spex_delete [1], spex_delete [2], spex_hold [1], spex_hold [2]
	spex_merge [1], spex_merge [2], spex_source [1], spex_source [2]
 CALLED BY:
	spex_delete [1], spex_delete [2], spex_hold [1], spex_hold [2], spex_merge [1]
	spex_merge [2], spex_source [1], spex_source [2]
 COMMON BLOCKS:
	spex_hold_com
       spex_setup_com
       spex_proc_com

 MODIFICATION HISTORY:
	ras, 19-oct-94


Help_spex [1] $SSW/packages/spex/idl/original_spex/help_spex.pro
[Previous] [Next]

 NAME:  Help_spex


 PURPOSE: Provide helpful information on commands, parameters and data arrays within SPEX


 CALLING SEQUENCE: help_spex, list=list, short=short, outcommand=outcommand


 INPUTS:
	list - string array of parameter and command substrings for inquiry
	short- only list the element names
 OUTPUTS:
	outcommand - used to pass back help requests to main program level
 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], PARSE_COMLINE, READ_SEQFILE
 CALLED BY:
	SPEX_COMMONS [2], SPEX_COMMONS [4], SPEX_PROC [1], SPEX_PROC [2]
 MODIFICATION HISTORY:
	ras, 15-feb-94
	ras, 19-aug-95, included idl help for variables
	Version 3,
	richard.schwartz@gsfc.nasa.gov, 14-nov-1997, place txt help files in
	ssw distribution and use path_dir to locate.
	1-oct-2001, ras, fix file finding.
       15-Jan-2002, Paul Bilodeau, use SPEX_DOC environment variable.


Help_spex [2] $SSW/packages/spex/pre2002/idl/help_spex.pro
[Previous] [Next]

 NAME:  Help_spex


 PURPOSE: Provide helpful information on commands, parameters and data arrays within SPEX


 CALLING SEQUENCE: help_spex, list=list, short=short, outcommand=outcommand


 INPUTS:
	list - string array of parameter and command substrings for inquiry
	short- only list the element names
 OUTPUTS:
	outcommand - used to pass back help requests to main program level
 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], PARSE_COMLINE, READ_SEQFILE
 CALLED BY:
	SPEX_COMMONS [2], SPEX_COMMONS [4], SPEX_PROC [1], SPEX_PROC [2]
 MODIFICATION HISTORY:
	ras, 15-feb-94
	ras, 19-aug-95, included idl help for variables
	Version 3,
	richard.schwartz@gsfc.nasa.gov, 14-nov-1997, place txt help files in
	ssw distribution and use path_dir to locate.
	1-oct-2001, ras, fix file finding.
       15-Jan-2002, Paul Bilodeau, use SPEX_DOC environment variable.


hessi_fits2drm [2] $SSW/packages/spex/idl/original_spex/hessi_fits2drm.pro
[Previous] [Next]

 NAME:
	hessi_fits2drm

 PURPOSE:
   Read a HESSI response matrix from a FITS file and return information of
 	interest to Spex.


 CATEGORY:
       SPECTRAL FITTING, SPEX - HESSI

 CALLING SEQUENCE:

 CALLS: ***
	FXPAR [1], FXPAR [2], fits2rm, st2num
 INPUTS:

 OUTPUTS:

 INPUT KEYWORDS:
 	FILE - name of FITS file to read.
 	SFILE - not used.  Included for Spex comptability.

 OUTPUT KEYWORDS:
 	EDGES_OUT - 2 x n_pha_bins array of detector channel energy bins
 	EDGES_IN - 2 x n_input_bins array of input energy bins
 	AREA - detector area
 	DRM - response matrix

 CALLED BY:
	rd_hessi_drm_4_spex [1], rd_hessi_drm_4_spex [2]
 PROCEDURE:

 Written 25-May-2001 Paul Bilodeau, RITSS/NASA-GSFC


hessi_fits2drm [3] $SSW/packages/spex/pre2002/idl/hessi_fits2drm.pro
[Previous] [Next]

 NAME:
	hessi_fits2drm

 PURPOSE:
   Read a HESSI response matrix from a FITS file and return information of
 	interest to Spex.


 CATEGORY:
       SPECTRAL FITTING, SPEX - HESSI

 CALLING SEQUENCE:

 CALLS: ***
	FXPAR [1], FXPAR [2], fits2rm, st2num
 INPUTS:

 OUTPUTS:

 INPUT KEYWORDS:
 	FILE - name of FITS file to read.
 	SFILE - not used.  Included for Spex comptability.

 OUTPUT KEYWORDS:
 	EDGES_OUT - 2 x n_pha_bins array of detector channel energy bins
 	EDGES_IN - 2 x n_input_bins array of input energy bins
 	AREA - detector area
 	DRM - response matrix

 CALLED BY:
	rd_hessi_drm_4_spex [1], rd_hessi_drm_4_spex [2]
 PROCEDURE:

 Written 25-May-2001 Paul Bilodeau, RITSS/NASA-GSFC


HESSI_SPEX [1] $SSW/packages/spex/idl/original_spex/hessi_spex.pro
[Previous] [Next]
Name: HESSI_SPEX

Purpose: Procedure provides an initialization of SPEX and a procedural
   interface customized to HESSI analysis.

Keyword:
   Input = String command for SPEX.  See Spex_proc.pro and SPEX documentation for syntax and
     allowed commands;
   CMODE = command_mode - set this to use SPEX in procedural mode.  Without this the
     SPEX command parser takes over and waits for input.
   COMMAND_FILE - full path to a command file with commands for the SPEX command parser;
     each line will be interpreted as a separate SPEX command. ';' specifies a comment field
     within the file.
 CALLS: ***
	FILE_EXIST [2], SPEX_PROC [1], SPEX_PROC [2], file_exist [1], file_exist [3]
	rd_tfile [1], rd_tfile [2], spex_current [1], spex_current [2]
History: Based on spex_proc, see more documentation there
   richard.schwartz@gsfc.nasa.gov, 10-nov-2003


HESSI_SPEX [2] $SSW/packages/spex/pre2002/idl/hessi_spex.pro
[Previous] [Next]
Name: HESSI_SPEX

Purpose: Procedure provides an initialization of SPEX and a procedural
   interface customized to HESSI analysis.

Keyword:
   Input = String command for SPEX.  See Spex_proc.pro and SPEX documentation for syntax and
     allowed commands;
   CMODE = command_mode - set this to use SPEX in procedural mode.  Without this the
     SPEX command parser takes over and waits for input.
   COMMAND_FILE - full path to a command file with commands for the SPEX command parser;
     each line will be interpreted as a separate SPEX command. ';' specifies a comment field
     within the file.
 CALLS: ***
	FILE_EXIST [2], SPEX_PROC [1], SPEX_PROC [2], file_exist [1], file_exist [3]
	rd_tfile [1], rd_tfile [2], spex_current [1], spex_current [2]
History: Based on spex_proc, see more documentation there
   richard.schwartz@gsfc.nasa.gov, 10-nov-2003


hist_count $SSW/packages/lparl/idl/ucon/morrison/hist_count.pro
[Previous] [Next]
NAME: 
	hist_count
PURPOSE: 
	To search the telemetry command history for certain strings and make
	a table of how often they are found for each month
SAMPLE CALLING SEQUENCE:
	hist_count
	hist_count, ['mdipict', 'mdiltc', 'mdifocus'] 
OPTIONAL INPUT: 
	list - An array holding the list of words to search for 
 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CONCAT_DIR [1], CONCAT_DIR [2]
	CONCAT_DIR [3], STR2ARR [1], STR2ARR [2], break_file [4], concat_dir [4]
	file_list [1], file_list [2], input [1], input [2]
OPTIONAL KEYWORD INPUT:
	default - If set, use a long list of routines something like:
HISTORY:
	Written Feb-94 by M.Morrison
V1.1	25-Apr-94 (MDM) - Made it a procedure


hist_summary $SSW/packages/lparl/idl/ucon/morrison/hist_summary.pro
[Previous] [Next]
NAME: 
	hist_summary
PURPOSE: 
	To search the telemetry command history for certain strings
SAMPLE CALLING SEQUENCE:
	hist_summary 
	hist_summary, ['mdipict', 'mdiltc', 'mdifocus'] 
	hist_summary,/eurlog,/default
OPTIONAL INPUT: 
	list - An array holding the list of words to search for 
 CALLS: ***
	ARR2STR [1], Arr2Str [2], STR2ARR [1], STR2ARR [2], file_list [1], file_list [2]
	input [1], input [2]
OPTIONAL KEYWORD INPUT:
	default - If set, use a long list of routines something like:
		'mdipict', 'mdiltc', 'mdifocus', 'mdiiss', 'mdidust', 'mdilaser', 
		'shutest', 'mdicom', 'lcmcom', 'ipcom', 'ipmemtst', 'iptbltst',
		'ipdmatst', 'ipdynmac', 'ipseqtst', 'lsqcom',  'mdidtune', 'bigtune',
		'supersun', 'vfdlscan', 'mtmtune', 'maplaser', 'mapgrad',  'mdiprot',
		'mdimrot', 'mdipdist'
	cal_log - If set, then use the CAL_LOG.TXT file instead of the CMD_HIST.*
		  files.
	eurlog	- If set, then use the EURLOG.TXT file instead of the CMD_HIST.*
		  files
HISTORY:
	Written Feb-94 by M.Morrison
V1.1	   Mar-94 (MDM)
V1.2	25-Apr-94 (MDM) - Made it a procedure
V2.0	 3-Jun-94 (MDM) - Added /CAL_LOG option
V3.0	 3-May-95 (MDM) - Added /EURLOG option


hsi_reg_ge_bethe $SSW/packages/xray/idl/regularization/hsi_reg_ge_bethe.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_bethe.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the Bethe-Heitler Bremsstrahlung cross section :

          Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].

       More accurate non-relativistic analytic form, often used in the literature.


 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_bethe,nph,nee,eps,ee,p,Z,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   None

 INPUTS:


   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   EPS
     - photon energy vector

    EE
     - electron energy vector

    P
     - rescaling parameter

    Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_bh_elwert $SSW/packages/xray/idl/regularization/hsi_reg_ge_bh_elwert.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_bh_elwert.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the Bethe-Heitler-Elwert Bremsstrahlung cross section (the Bethe-Heitler form
       with the Elwert collisional correction term applied).  The code takes into
       account of the limit value for the cross-section if the
       electron energy = photon energy (form 0/0)

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_bh_elwert,nph,nee,eps,ee,p,Z,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   - hsi_reg_ge_bethe_heitler_elwert

 INPUTS:


   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   EPS
     - photon energy vector

    EE
     - electron energy vector

    P
     - rescaling parameter

    Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	HSI_REG_GE_BETHE_HEITLER_ELWERT
 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_confidence $SSW/packages/xray/idl/regularization/hsi_reg_ge_confidence.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_confidence

 PURPOSE:
      determines a 'set' of solutions in order to estimate the uncertainty in the recovered
      solution.  Each realization is produced by randomly perturbing the data in the inputfile
      using the noise levels specified therein.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_confidence,nph,nee,ee,regsol,crosssection,viewingangle,spreadangle,lambda_multiplier,infofile,$
    err,gs,eps,wei,conf,u,w,opt,sf,p,Z,datastruct

 CALLED BY:

   - hsi_regularisation_genova.pro

 CALLS TO:

   - hsi_reg_ge_kramers.pro
   - hsi_reg_ge_bethe.pro
   - hsi_reg_ge_bh_elwert.pro
   - hsi_reg_ge_cs_haug.pro
   - hsi_reg_ge_cross3bn.pro
   - hsi_reg_ge_directivity.pro
   - hsi_reg_ge_regularization.pro
   - hsi_reg_ge_inverse_snr.pro


 INPUTS:

   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used;

   EE
     - electron energy vector

   REGSOL
     - The recovered F(E) array

   CROSSSECTION
     - A text string containing one of possible choices for the cross-section Q(eps,E):

      'Kramers' : Q ~ 1/eps E.  Simple analytic form of the electron-proton bremsstrahlung
          cross-section.  Not accurate, primarily for comparison with analytic results

      'Bethe-Heitler' ; Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].  More accurate
          non-relativistic analytic form, often used in the literature.

      'Bethe-Heitler-Elwert' : The Bethe-Heitler form with the Elwert collisional correction
          term applied.

      'Cross3BN' : Fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
          Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
          Used as default.

      'Haug' : A functional fit to the Cross3BN relativistic cross-section.  Includes the Elwert
          collisional correction term (Haug 1997, A & A, 326, 417-418)

      'Cross3BNee' : Cross3BN plus the term due to electron-electron bremsstrahlung

      'Anisotropy' : Fully angle-dependent electron-proton cross-section. (Gluckstern &
          Hull 1953, Phys. Rev., 90, 1030). If this cross-section is chosen, keywords
          viewingangle and spreadangle should also be specified.

      The default is 'Cross3BN'.

   VIEWINGANGLE
     - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
     - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

   LAMBDA_MULTIPLIER
     - Factor by which the user wishes to increase or decrease the value of the smoothing
       parameter used in the algorithm.  Must be non-negative and in the range [1.e-2,1.e2].
       The default value, which is STRONGLY recommended, is 1; values of lambda_multiplier
       outside the range [0.5,2] will yield a warning message.

   INFOFILE
     - A text file containing various technical pieces of information, all textually labeled.

   ERR
    -  1 sigma uncertainty in photon flux value

   GS
    -  X-ray flux (photons/cm^2/s/keV at detector)

   EPS
     - photon energy vector

   WEI
     - weight vector

   CONF
     - Number of solution realizations to be determined.  Each realization is produced by randomly
      perturbing the data in inputfile using the noise levels specified therein.  Used to
      construct a 'set' of solutions in order to estimate the uncertainty in the recovered
      solution.

   U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   W
     - singular values of the SVD of the Bremsstrahlung integral operator

   OPT
     - regularization parameter

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

   P
     - rescaling parameter

   Z
     - Value of the root-mean-square atomic number of the target.

 OPTIONAL INPUTS
   None

 KEYWORDS:

   None

 OUTPUTS

  DATASTRUCT
   -  Structure storing 3 arrays and 1 string

     - Tag 1 :     STRIP       DOUBLE    Array[NE, N+2]

       where NE = number of electron energy points
              N = number of solution realizations (defined by confidencestrip value)

       The array contains the electron energies and each realization of the solution F(E)
       in the following format:

       datastruct.strip[*,0]     =  a vector of NE elements containing the electron energies
       datastruct.strip[*,1]     =  a vector of NE elements containing the original (unperturbed) solution
                                    F(E) at the specified energies
       datastruct.strip[*,2:N+1] =  array containing N different electron fluxes F(E), at the
                                    specified energies, produced by randomly perturbing the data in inputfile


     - Tag 2 : RESIDUALS       DOUBLE    Array[NPH, 6]

       where NPH = number of photon energy points

       The array contains each realization of the original (unperturbed) solution F(E).
       The data is in six columns, with each row arranged as follows:

       datastruct.residuals[*,0] = Photon energy used (defined by photon energy array and
                                   optional photon_bin_position value)
       datastruct.residuals[*,1] = Photon flux value (from the input file)
       datastruct.residuals[*,2] = Uncertainty in photon flux value (from the input file)
       datastruct.residuals[*,3] = Photon flux corresponding to the recovered F(E) array
       datastruct.residuals[*,4] = Residual photon flux (actual - recovered, i.e., column 2 - column 4)
       datastruct.residuals[*,5] = Cumulative residual, defined as
                                   C_j = (1/j) sum_[i=1]^j res_i
 CALLED BY:
	hsi_regularisation_genova
                                   Note: this can be used as a measure of residual 'clustering'; for an
                                      acceptable fit to the data, abs(C_j) should be less than n/sqrt(j),
                                      where n is the number of allowed standard deviations (n=3 is used in
                                      the code to drive the solution to an 'acceptable' solution).

     - Tag 3 : RESOLUTION      DOUBLE    Array[M, 2]

       where M = number of resolution intervals

       The array contains two columns representing sample energy resolution values.  If two F(E)
       values are distant by more than the energy resolution, then they can be
       realistically treated as independent; if they fall within the energy resolution
       they should be treated as dependent to some degree.

       datastruct.resolution[*,0] = center of the resolution bar : sqrt(elow*ehigh)
       datastruct.resolution[*,1] = width of the resolution bar  : (ehigh-elow)

       The number of resolution intervals (M) is determined by the code (it cannot be specified by the user),
       and so the number of rows in this array (typically 20-30) is similarly determined internally.

     - Tag 4 : INFORMATION      STRING    'outputfile.info'

       The string is the pathname of a text file containing various technical pieces of
       information, all textually labeled.


 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	hsi_reg_ge_bethe, hsi_reg_ge_bh_elwert, hsi_reg_ge_cross3bn
	hsi_reg_ge_cs_haug, hsi_reg_ge_directivity, hsi_reg_ge_inverse_snr
	hsi_reg_ge_kramers, hsi_reg_ge_regularization
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   None

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_cross3bn $SSW/packages/xray/idl/regularization/hsi_reg_ge_cross3bn.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_cross3bn.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
       Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
       It optionally includes the term due to electron-electron bremsstrahlung

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_cross3bn,eebrem,nph,nee,eps,ee,p,Z,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   None

 INPUTS:

 EEBREM
      - A number (0 or 1) corresponding to:
        0 = only Cross3BN
        1 = Cross3BN plus the term due to electron-electron bremsstrahlung

    NPH
      - number of photon energy bins used

    NEE
      - number of electron energy bins used

    EPS
      - photon energy vector

     EE
      - electron energy vector

     P
      - rescaling parameter

     Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	HSI_REG_GE_BREMSS_CROSS
 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

      We caution the user that addition of the electron-electron bremsstrahlung term
      increases the computational time considerably.  Unless photon energies significantly
      above 100 keV are used, the results for 'cross3bn' and 'cross3bnee' are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_cross_section $SSW/packages/xray/idl/regularization/hsi_reg_ge_cross_section.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_cross_section.pro

 PURPOSE:
       calls the routine corresponding to the selected Bremsstrahlung cross section

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_cross_section,nph,nee,eps,gs,err,wei,ee,p,Z,crosssection,viewingangle,spreadangle,w,u,sf

 CALLED BY:

   - hsi_regularisation_genova.pro

 CALLS TO:

   - hsi_reg_ge_kramers.pro
   - hsi_reg_ge_bethe.pro
   - hsi_reg_ge_bh_elwert.pro
   - hsi_reg_ge_cs_haug.pro
   - hsi_reg_ge_cross3bn.pro
   - hsi_reg_ge_directivity.pro

 INPUTS:


   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   EPS
     - photon energy vector

    GS
     - X-ray flux (photons/cm^2/s/keV at detector)

   ERR
     - 1 sigma uncertainty in flux value

   WEI
     - weight vector

   EE
     - electron energy vector

    P
     - rescaling parameter

   Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

   CROSSSECTION
     - A text string containing one of possible choices for the cross-section Q(eps,E):

      'Kramers' : Q ~ 1/eps E.  Simple analytic form of the electron-proton bremsstrahlung
          cross-section.  Not accurate, primarily for comparison with analytic results

      'Bethe-Heitler' ; Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].  More accurate
          non-relativistic analytic form, often used in the literature.

      'Bethe-Heitler-Elwert' : The Bethe-Heitler form with the Elwert collisional correction
          term applied.

      'Cross3BN' : Fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
          Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
          Used as default.

      'Haug' : A functional fit to the Cross3BN relativistic cross-section.  Includes the Elwert
          collisional correction term (Haug 1997, A & A, 326, 417-418)

      'Cross3BNee' : Cross3BN plus the term due to electron-electron bremsstrahlung

      'Anisotropy' : Fully angle-dependent electron-proton cross-section. (Gluckstern &
          Hull 1953, Phys. Rev., 90, 1030). If this cross-section is chosen, keywords
          viewingangle and spreadangle should also be specified.

      The default is 'Cross3BN'.

   VIEWINGANGLE
     - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
     - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	hsi_reg_ge_bethe, hsi_reg_ge_bh_elwert, hsi_reg_ge_cross3bn
	hsi_reg_ge_cs_haug, hsi_reg_ge_directivity, hsi_reg_ge_kramers
 CALLED BY:
	hsi_regularisation_genova
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

     - CHOICE OF CROSS-SECTION

     Although the selection 'anisotropy' is valid, we caution the user that
      use of this cross-section increases the computational time considerably, since
      it entails not only a more complicated form of cross-section, but also the need fo
      significant trigonometrical calculation.  The same caution applies to addition of the
      electron-electron bremsstrahlung term through use of 'cross3bnee'.  Unless photon
      energies significantly above 100 keV are used, the results for 'cross3bn' and 'cross3bnee'
      are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_cs_haug $SSW/packages/xray/idl/regularization/hsi_reg_ge_cs_haug.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_cs_haug.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the Haug Bremsstrahlung cross section. The code takes into
       account of the limit value for the cross-section if the
       electron energy = photon energy (form 0/0)

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_cs_haug,nph,nee,eps,ee,p,Z,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   - hsi_reg_ge_brm_bremcross

 INPUTS:


   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   EPS
     - photon energy vector

    EE
     - electron energy vector

    P
     - rescaling parameter

    Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	HSI_REG_GE_BRM_BREMCROSS
 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_directivity $SSW/packages/xray/idl/regularization/hsi_reg_ge_directivity.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_directivity.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the fully angle-dependent electron-proton Bremsstrahlung cross section
       (Gluckstern & Hull 1953, Phys. Rev., 90, 1030)

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_directivity,nph,nee,eps,ee,p,Z,viewingangle,spreadangle,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   - hsi_reg_ge_angle_cross

 INPUTS:

    NPH
      - number of photon energy bins used

    NEE
      - number of electron energy bins used

    EPS
      - photon energy vector

     EE
      - electron energy vector

     P
      - rescaling parameter

     Z
      - Value of the root-mean-square atomic number of the target. Default = 1.2

   VIEWINGANGLE
      - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
      - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	HSI_REG_GE_ANGLE_CROSS
 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

      We caution the user that addition of the electron-electron bremsstrahlung term
      increases the computational time considerably.  Unless photon energies significantly
      above 100 keV are used, the results for 'cross3bn' and 'cross3bnee' are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_inverse_snr $SSW/packages/xray/idl/regularization/hsi_reg_ge_inverse_snr.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_inverse_snr

 PURPOSE:
      looks for the regularization parameter driving the cumulative residuals less than
      n/sqrt(j) where n=2 is the number of allowed standard deviations.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 result=hsi_reg_ge_inverse_snr(nph,nee,opt,eps,gsorig,err,ee,wei,u,w,sf,p)

 CALLED BY:

   - hsi_reg_ge_confidence.pro

 CALLS TO:

   None


 INPUTS:

   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used;

   OPT
     - regularization parameter making the cumulative residuals inside n/sqrt(j) (where n=3)

   EPS
     - photon energy vector

   GSORIG
    -  X-ray flux (photons/cm^2/s/keV at detector)

   ERR
    -  1 sigma uncertainty in photon flux value

   EE
     - electron energy vector

   WEI
     - weight vector

   U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   W
     - singular values of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

   P
     - rescaling parameter

 OPTIONAL INPUTS
   None

 KEYWORDS:

   None

 OUTPUTS

   None

 OPTIONAL OUTPUTS:
   None

 CALLED BY:
	hsi_reg_ge_confidence
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   None

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_kramers $SSW/packages/xray/idl/regularization/hsi_reg_ge_kramers.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_kramers.pro

 PURPOSE:
       computes the Singular Value Decomposition of the integral operator associated
       to the Kramers Bremsstrahlung cross section : Q ~ 1/eps E.
       Simple analytic form of the electron-proton bremsstrahlung cross-section.
       Not accurate, primarily for comparison with analytic results

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_kramers,nph,nee,eps,ee,p,Z,w,u,sf

 CALLED BY:

   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_confidence.pro

 CALLS TO:

   None

 INPUTS:


   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   EPS
     - photon energy vector

    EE
     - electron energy vector

    P
     - rescaling parameter

    Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

 OPTIONAL OUTPUTS:
   None

 CALLED BY:
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_regularization $SSW/packages/xray/idl/regularization/hsi_reg_ge_regularization.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_regularization.pro

 PURPOSE:
       computes the regularized solution. It is divided in two parts:
       the first one calculates the regularization parameter while
       the second one the solution.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_regularization,lambda_multiplier,nph,nee,wei,eps,gs,err,u,w,sf,p,conf,$
    ee,opt,gopt,regsol, residual_array, cumulativeresidual_array

 CALLED BY:

   - hsi_regularisation_genova.pro

 CALLS TO:

   none

 INPUTS:


   LAMBDA_MULTIPLIER
     - Factor by which the user wishes to increase or decrease the value of the smoothing
       parameter used in the algorithm.  Must be non-negative and in the range [1.e-2,1.e2].
       The default value, which is STRONGLY recommended, is 1; values of lambda_multiplier
       outside the range [0.5,2] will yield a warning message.

   NPH
     - number of photon energy bins used

   NEE
     - number of electron energy bins used

   WEI
     - weight vector

   EPS
     - photon energy vector

    GS
     - X-ray flux (photons/cm^2/s/keV at detector)

   ERR
     - 1 sigma uncertainty in flux value

    U
     - singular vectors of the SVD of the Bremsstrahlung integral operator

    W
     - singular values of the SVD of the Bremsstrahlung integral operator

   SF
     - singular functions of the SVD of the Bremsstrahlung integral operator

    P
     - rescaling parameter

 CONF
     - flag for the confidence strip (0=first iteration ; 1=it is making the strip)

   EE
     - electron energy vector


 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

   OPT
     - Value of the optimal regularization parameter

  GOPT
     - Photon flux corresponding to the recovered F(E) array

 REGSOL
     - The recovered F(E) array

 RESIDUAL_ARRAY
     - Residual photon flux (actual - recovered)

 CUMULATIVERESIDUAL_ARRAY
     - Cumulative residual, defined as : C_j = (1/j) sum_[i=1]^j res_i


 OPTIONAL OUTPUTS:
   None

 CALLED BY:
	hsi_reg_ge_confidence, hsi_regularisation_genova
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

     - CHOICE OF THE REGULARIZATION PARAMETER

     The code uses the cumulative residuals to fix the optimal regularization parameter.
     The cumulative residuals can be used as a measure of residual 'clustering'; for an
     acceptable fit to the data, abs(C_j) should be less than n/sqrt(j), where n is the
     number of allowed standard deviations (n=3 is used in the code to drive the solution
     to an 'acceptable' solution).

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_rescaling $SSW/packages/xray/idl/regularization/hsi_reg_ge_rescaling.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_rescaling

 PURPOSE:
   Look-up table to associate the rescaling parameter to a given spectral index


 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

  result=hsi_reg_ge_rescaling(gamma,infofile)

 CALLED BY:

   - hsi_regularisation_genova.pro

 CALLS TO:

   none

 INPUTS:

   GAMMA
     - spectral index

   INFOFILE
     - A text file containing various technical pieces of information, all textually labeled.


 OPTIONAL INPUTS
   None

 KEYWORDS:

   None

 OUTPUTS

   P
     - rescaling parameter


 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	SPLINE
 CALLED BY:
	hsi_regularisation_genova
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_ge_spectralindex $SSW/packages/xray/idl/regularization/hsi_reg_ge_spectralindex.pro
[Previous] [Next]

 NAME:
   hsi_reg_ge_spectralindex

 PURPOSE:
       checks if the photon fluxes are positive and at least equal to the specified 1 sigma
       uncertainty. The code uses only data points up to (but not including) the energy
       channel which first violates this criterion.
       It checks the photon energy sampling (uniform or logarithmic) and builds
       the weights vector according to the sampling.
       Finally it fits the photon spectrum with a single or double power law to
       compute the photon spectrum spectral index.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_ge_spectralindex,infofile,photon_energy_low_array,photon_energy_high_array,$
    photon_flux_array,photon_uncertainty_array,photon_bin_position,nph,eps,gs,err,wei,gamma

 CALLED BY:

   - hsi_regularisation_genova.pro

 CALLS TO:

   none

 INPUTS:

   INFOFILE
     - A text file containing various technical pieces of information, all textually labeled.

   PHOTON_ENERGY_LOW_ARRAY
    -  Lower energy of photon bin

   PHOTON_ENERGY_HIGH_ARRAY
    -  Upper energy of photon bin

   PHOTON_FLUX_ARRAY
    -  X-ray flux (photons/cm^2/s/keV at detector)

   PHOTON_UNCERTAINTY_ARRAY
    -  1 sigma uncertainty in flux value

   PHOTON_BIN_POSITION
     - Fractional location within photon energy bin to use range is 0-1,
       with 0 = low end, 0.5 = mid-point, 1 = upper end, etc. The default is 0.5.
       If the routine determines that logarithmic data sampling is to be used,
       this parameter is ignored, and the geometric mean bin energy is used by default.;

 OPTIONAL INPUTS
   None

 KEYWORDS:
   None

 OUTPUTS

   NPH
     - number of photon energy points

   EPS
     - photon energy vector

    GS
     - photon flux vector

   ERR
     - uncertainty in photon flux value vector

   WEI
     - weight vector

 GAMMA
     - spectral index

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	LINFIT, MEAN, STDDEV
 CALLED BY:
	hsi_regularisation_genova
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

   none.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_reg_invert $SSW/packages/xray/idl/regularization/hsi_reg_invert.pro
[Previous] [Next]

 NAME:
   hsi_reg_invert

 PURPOSE:
       checks the input file contents (photon and flux energy values) and the keywords settings.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_reg_invert, photon_energy_low_array, photon_energy_high_array, photon_flux_array, $
 photon_uncertainty_array, outputfile, infofile, $
 photon_bin_position=photon_bin_position, el_energy_max_factor=el_energy_max_factor, $
 electron_bin=electron_bin, lambda_multiplier=lambda_multiplier, crosssection=crosssection, $
 viewingangle=viewingangle, spreadangle=spreadangle, Z=Z, confidencestrip=confidencestrip

 CALLED BY:

   - hsi_regularized_inversion.pro

 CALLS TO:

   - hsi_regularisation_genova.pro

 INPUTS:

   PHOTON_ENERGY_LOW_ARRAY
    -  Lower energy of photon bin

   PHOTON_ENERGY_HIGH_ARRAY
    -  Upper energy of photon bin

   PHOTON_FLUX_ARRAY
    -  X-ray flux (photons/cm^2/s/keV at detector)

   PHOTON_UNCERTAINTY_ARRAY
    -  1 sigma uncertainty in flux value


 OPTIONAL INPUTS
   None

 KEYWORDS:

   PHOTON_BIN_POSITION
    - Fractional location within photon energy bin to use
      range is 0-1, with 0 = low end, 0.5 = mid-point, 1 = upper end, etc.
      The default is 0.5. If the routine determines that logarithmic data sampling
      is to be used, this parameter is ignored, and the geometric mean bin energy is used by default.

   EL_ENERGY_MAX_FACTOR
    - The maximum electron energy (in units of the maximum photon energy provided)
      in the returned electron energy spectrum array
      (i.e., Emax=el_energy_max_factor*eps_max).  Must be in the range [1,5]; the default is 2.

   ELECTRON_BIN
    - Width (keV) of the energy bins in the returned electron flux array.  Values are returned at
      values spaced by this quantity.  Default = 1.

   LAMBDA_MULTIPLIER
    - Factor by which the user wishes to increase or decrease the value of the smoothing
      parameter used in the algorithm.  Must be non-negative and in the range [1.e-2,1.e2].
      The default value, which is STRONGLY recommended, is 1; values of lambda_multiplier
      outside the range [0.5,2] will yield a warning message.

   CROSSSECTION
     - A text string containing one of possible choices for the cross-section Q(eps,E):

      'Kramers' : Q ~ 1/eps E.  Simple analytic form of the electron-proton bremsstrahlung
          cross-section.  Not accurate, primarily for comparison with analytic results

      'Bethe-Heitler' ; Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].  More accurate
          non-relativistic analytic form, often used in the literature.

      'Bethe-Heitler-Elwert' : The Bethe-Heitler form with the Elwert collisional correction
          term applied.

      'Cross3BN' : Fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
          Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
          Used as default.

      'Haug' : A functional fit to the Cross3BN relativistic cross-section.  Includes the Elwert
          collisional correction term (Haug 1997, A & A, 326, 417-418)

      'Cross3BNee' : Cross3BN plus the term due to electron-electron bremsstrahlung

      'Anisotropy' : Fully angle-dependent electron-proton cross-section. (Gluckstern &
          Hull 1953, Phys. Rev., 90, 1030). If this cross-section is chosen, keywords
          viewingangle and spreadangle should also be specified.

      The default is 'Cross3BN'.

   VIEWINGANGLE
     - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
     - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

   Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

   CONFIDENCESTRIP
     - Number of solution realizations to be determined.  Each realization is produced by randomly
      perturbing the data in inputfile using the noise levels specified therein.  Used to
      construct a 'set' of solutions in order to estimate the uncertainty in the recovered
      solution.  Default = 10, maximum = 50. Setting confidencestrip = 0 or 1 produces a
      single solution.

 OUTPUTS

   OUTPUTFILE
     File containing 3 arrays and 1 string stored in structure form.

     - Tag 1 :     STRIP       DOUBLE    Array[NE, N+2]

       where NE = number of electron energy points
              N = number of solution realizations (defined by confidencestrip value)

       The array contains the electron energies and each realization of the solution F(E)
       in the following format:

       datastruct.strip[*,0]     =  a vector of NE elements containing the electron energies
       datastruct.strip[*,1]     =  a vector of NE elements containing the original (unperturbed) solution
                                    F(E) at the specified energies
       datastruct.strip[*,2:N+1] =  array containing N different electron fluxes F(E), at the
                                    specified energies, produced by randomly perturbing the data in inputfile


     - Tag 2 : RESIDUALS       DOUBLE    Array[NPH, 6]

       where NPH = number of photon energy points

       The array contains each realization of the original (unperturbed) solution F(E).
       The data is in six columns, with each row arranged as follows:

       datastruct.residuals[*,0] = Photon energy used (defined by photon energy array and
                                   optional photon_bin_position value)
       datastruct.residuals[*,1] = Photon flux value (from the input file)
       datastruct.residuals[*,2] = Uncertainty in photon flux value (from the input file)
       datastruct.residuals[*,3] = Photon flux corresponding to the recovered F(E) array
       datastruct.residuals[*,4] = Residual photon flux (actual - recovered, i.e., column 2 - column 4)
       datastruct.residuals[*,5] = Cumulative residual, defined as
                                   C_j = (1/j) sum_[i=1]^j res_i
 CALLED BY:
	hsi_regularized_inversion
                                   Note: this can be used as a measure of residual 'clustering'; for an
                                      acceptable fit to the data, abs(C_j) should be less than n/sqrt(j),
                                      where n is the number of allowed standard deviations (n=3 is used in
                                      the code to drive the solution to an 'acceptable' solution).

     - Tag 3 : RESOLUTION      DOUBLE    Array[M, 2]

       where M = number of resolution intervals

       The array contains two columns representing sample energy resolution values.  If two F(E)
       values are distant by more than the energy resolution, then they can be
       realistically treated as independent; if they fall within the energy resolution
       they should be treated as dependent to some degree.

       datastruct.resolution[*,0] = center of the resolution bar : sqrt(elow*ehigh)
       datastruct.resolution[*,1] = width of the resolution bar  : (ehigh-elow)

       The number of resolution intervals (M) is determined by the code (it cannot be specified by the user),
       and so the number of rows in this array (typically 20-30) is similarly determined internally.

     - Tag 4 : INFORMATION      STRING    'outputfile.info'

       The string is the pathname of a text file containing various technical pieces of
       information, all textually labeled.

   INFOFILE
     - A text file containing various technical pieces of information, all textually labeled.

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	hsi_regularisation_genova
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

     - PHOTON ENERGY VALUES

     We strongly recommend that only photon energies above 10 keV be used, since the code
      has no capability to deal with spectral lines.

     The input photon energy array should have no data gaps, and it must be uniformly spaced
      (on either a linear or logarithmic scale).

     The input spectrum must contain at least 10 points.

     - PHOTON FLUX VALUES

     To avoid generation of (unphysical) negative flux values, all the photon fluxes must be positive and
      at least equal to the specified 1 sigma uncertainty.  The code uses only data points up to (but not
      including) the the energy channel which first violates this criterion.

     - CHOICE OF REGULARIZATION PARAMETER

     We cannot emphasize strongly enough the desirability of using the default value
      lambda_multiplier=1.  The value of the smoothing parameter lambda is determined
      through a rigorous procedure, and using other values of lambda usually results
      in highly undedirable features in the solution and/or the photon residuals.  Nevertheless,
      we appreciate that users may wish to vary this parameter in order to explore the
      effects of such a variation.  Attempts to use a value of lambda_multiplier outside
      the range [0.5,2] generates an appropriately intimidating warning message; an attempt
      to use a value outside the range [0.01,100] causes lambda_multiplier to be set to the
      default value of 1.

     - CHOICE OF CROSS-SECTION

     Although the selection 'anisotropy' is valid, we caution the user that
      use of this cross-section increases the computational time considerably, since
      it entails not only a more complicated form of cross-section, but also the need fo
      significant trigonometrical calculation.  The same caution applies to addition of the
      electron-electron bremsstrahlung term through use of 'cross3bnee'.  Unless photon
      energies significantly above 100 keV are used, the results for 'cross3bn' and 'cross3bnee'
      are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_regularisation_genova $SSW/packages/xray/idl/regularization/hsi_regularisation_genova.pro
[Previous] [Next]

 NAME:
   hsi_regularisation_genova

 PURPOSE:
       determines the regularized mean source electron spectrum F(E) corresponding to
       an observed hard x-ray spectrum I(eps), using the fundamental relation

              I(eps) = (nV/4 pi R^2) integral (from eps to infinity) of F(E) Q(eps,E) dE

       where Q(eps,E) is the bremsstrahlung cross-section (several options available),
       n is mean source density, V is source volume, and R = 1 AU.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_regularisation_genova, photon_energy_low_array, photon_energy_high_array, photon_flux_array, $
 photon_uncertainty_array, outputfile, infofile, $
 photon_bin_position=photon_bin_position, el_energy_max_factor=el_energy_max_factor, $
 electron_bin=electron_bin, crosssection=crosssection, viewingangle=viewingangle, $
 spreadangle=spreadangle, Z=Z, lambda_multiplier=lambda_multiplier, confidencestrip=confidencestrip

 CALLED BY:

   - hsi_reg_invert.pro

 CALLS TO:

   - hsi_reg_ge_spectralindex.pro
   - hsi_reg_ge_rescaling.pro
   - hsi_reg_ge_cross_section.pro
   - hsi_reg_ge_regularization.pro
   - hsi_reg_ge_confidence.pro

 INPUTS:

   PHOTON_ENERGY_LOW_ARRAY
    -  Lower energy of photon bin

   PHOTON_ENERGY_HIGH_ARRAY
    -  Upper energy of photon bin

   PHOTON_FLUX_ARRAY
    -  X-ray flux (photons/cm^2/s/keV at detector)

   PHOTON_UNCERTAINTY_ARRAY
    -  1 sigma uncertainty in flux value


 OPTIONAL INPUTS
   None

 KEYWORDS:

   PHOTON_BIN_POSITION
     - Fractional location within photon energy bin to use range is 0-1,
       with 0 = low end, 0.5 = mid-point, 1 = upper end, etc. The default is 0.5.
       If the routine determines that logarithmic data sampling is to be used,
       this parameter is ignored, and the geometric mean bin energy is used by default.

   EL_ENERGY_MAX_FACTOR
     - The maximum electron energy (in units of the maximum photon energy provided)
       in the returned electron energy spectrum array (i.e., Emax=el_energy_max_factor*eps_max).
       Must be in the range [1,5]; the default is 2.

   ELECTRON_BIN
     - Width (keV) of the energy bins in the returned electron flux array.  Values are returned at
       values spaced by this quantity.  Default = 1.

   LAMBDA_MULTIPLIER
     - Factor by which the user wishes to increase or decrease the value of the smoothing
       parameter used in the algorithm.  Must be non-negative and in the range [1.e-2,1.e2].
       The default value, which is STRONGLY recommended, is 1; values of lambda_multiplier
       outside the range [0.5,2] will yield a warning message.

   CROSSSECTION
     - A text string containing one of possible choices for the cross-section Q(eps,E):

      'Kramers' : Q ~ 1/eps E.  Simple analytic form of the electron-proton bremsstrahlung
          cross-section.  Not accurate, primarily for comparison with analytic results

      'Bethe-Heitler' ; Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].  More accurate
          non-relativistic analytic form, often used in the literature.

      'Bethe-Heitler-Elwert' : The Bethe-Heitler form with the Elwert collisional correction
          term applied.

      'Cross3BN' : Fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
          Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
          Used as default.

      'Haug' : A functional fit to the Cross3BN relativistic cross-section.  Includes the Elwert
          collisional correction term (Haug 1997, A & A, 326, 417-418)

      'Cross3BNee' : Cross3BN plus the term due to electron-electron bremsstrahlung

      'Anisotropy' : Fully angle-dependent electron-proton cross-section. (Gluckstern &
          Hull 1953, Phys. Rev., 90, 1030). If this cross-section is chosen, keywords
          viewingangle and spreadangle should also be specified.

      The default is 'Cross3BN'.

   VIEWINGANGLE
     - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
     - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

   Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

   CONFIDENCESTRIP
     - Number of solution realizations to be determined.  Each realization is produced by randomly
      perturbing the data in inputfile using the noise levels specified therein.  Used to
      construct a 'set' of solutions in order to estimate the uncertainty in the recovered
      solution.  Default = 10, maximum = 50. Setting confidencestrip = 0 or 1 produces a
      single solution.

 OUTPUTS

   OUTPUTFILE
     File containing 3 arrays and 1 string stored in structure form.

     - Tag 1 :     STRIP       DOUBLE    Array[NE, N+2]

       where NE = number of electron energy points
              N = number of solution realizations (defined by confidencestrip value)

       The array contains the electron energies and each realization of the solution F(E)
       in the following format:

       datastruct.strip[*,0]     =  a vector of NE elements containing the electron energies
       datastruct.strip[*,1]     =  a vector of NE elements containing the original (unperturbed) solution
                                    F(E) at the specified energies
       datastruct.strip[*,2:N+1] =  array containing N different electron fluxes F(E), at the
                                    specified energies, produced by randomly perturbing the data in inputfile


     - Tag 2 : RESIDUALS       DOUBLE    Array[NPH, 6]

       where NPH = number of photon energy points

       The array contains each realization of the original (unperturbed) solution F(E).
       The data is in six columns, with each row arranged as follows:

       datastruct.residuals[*,0] = Photon energy used (defined by photon energy array and
                                   optional photon_bin_position value)
       datastruct.residuals[*,1] = Photon flux value (from the input file)
       datastruct.residuals[*,2] = Uncertainty in photon flux value (from the input file)
       datastruct.residuals[*,3] = Photon flux corresponding to the recovered F(E) array
       datastruct.residuals[*,4] = Residual photon flux (actual - recovered, i.e., column 2 - column 4)
       datastruct.residuals[*,5] = Cumulative residual, defined as
                                   C_j = (1/j) sum_[i=1]^j res_i
 CALLED BY:
	hsi_reg_invert
                                   Note: this can be used as a measure of residual 'clustering'; for an
                                      acceptable fit to the data, abs(C_j) should be less than n/sqrt(j),
                                      where n is the number of allowed standard deviations (n=3 is used in
                                      the code to drive the solution to an 'acceptable' solution).

     - Tag 3 : RESOLUTION      DOUBLE    Array[M, 2]

       where M = number of resolution intervals

       The array contains two columns representing sample energy resolution values.  If two F(E)
       values are distant by more than the energy resolution, then they can be
       realistically treated as independent; if they fall within the energy resolution
       they should be treated as dependent to some degree.

       datastruct.resolution[*,0] = center of the resolution bar : sqrt(elow*ehigh)
       datastruct.resolution[*,1] = width of the resolution bar  : (ehigh-elow)

       The number of resolution intervals (M) is determined by the code (it cannot be specified by the user),
       and so the number of rows in this array (typically 20-30) is similarly determined internally.

     - Tag 4 : INFORMATION      STRING    'outputfile.info'

       The string is the pathname of a text file containing various technical pieces of
       information, all textually labeled.

   INFOFILE
     - A text file containing various technical pieces of information, all textually labeled.

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	hsi_reg_ge_confidence, hsi_reg_ge_cross_section, hsi_reg_ge_regularization
	hsi_reg_ge_rescaling, hsi_reg_ge_spectralindex
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

     - PHOTON ENERGY VALUES

     We strongly recommend that only photon energies above 10 keV be used, since the code
      has no capability to deal with spectral lines.

     The input photon energy array should have no data gaps, and it must be uniformly spaced
      (on either a linear or logarithmic scale).

     The input spectrum must contain at least 10 points.

     - PHOTON FLUX VALUES

     To avoid generation of (unphysical) negative flux values, all the photon fluxes must be positive and
      at least equal to the specified 1 sigma uncertainty.  The code uses only data points up to (but not
      including) the the energy channel which first violates this criterion.

     - CHOICE OF REGULARIZATION PARAMETER

     We cannot emphasize strongly enough the desirability of using the default value
      lambda_multiplier=1.  The value of the smoothing parameter lambda is determined
      through a rigorous procedure, and using other values of lambda usually results
      in highly undedirable features in the solution and/or the photon residuals.  Nevertheless,
      we appreciate that users may wish to vary this parameter in order to explore the
      effects of such a variation.  Attempts to use a value of lambda_multiplier outside
      the range [0.5,2] generates an appropriately intimidating warning message; an attempt
      to use a value outside the range [0.01,100] causes lambda_multiplier to be set to the
      default value of 1.

     - CHOICE OF CROSS-SECTION

     Although the selection 'anisotropy' is valid, we caution the user that
      use of this cross-section increases the computational time considerably, since
      it entails not only a more complicated form of cross-section, but also the need fo
      significant trigonometrical calculation.  The same caution applies to addition of the
      electron-electron bremsstrahlung term through use of 'cross3bnee'.  Unless photon
      energies significantly above 100 keV are used, the results for 'cross3bn' and 'cross3bnee'
      are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hsi_regularized_inversion $SSW/packages/xray/idl/regularization/hsi_regularized_inversion.pro
[Previous] [Next]

 NAME:
   hsi_regularized_inversion

 PURPOSE:
       determines the regularized mean source electron spectrum F(E) corresponding to
       an observed hard x-ray spectrum I(eps), using the fundamental relation

              I(eps) = (nV/4 pi R^2) integral (from eps to infinity) of F(E) Q(eps,E) dE

       where Q(eps,E) is the bremsstrahlung cross-section (several options available),
       n is mean source density, V is source volume, and R = 1 AU.

 CATEGORY:
       HESSI/ IDL/ Spectra

 CALLING SEQUENCE:

 hsi_regularized_inversion, inputfile, outputfile,$
 photon_bin_position=photon_bin_position,el_energy_max_factor=el_energy_max_factor,$
 electron_bin=electron_bin,lambda_multiplier=lambda_multiplier,$
 crosssection=crosssection, viewingangle=viewingangle,spreadangle=spreadangle,$
 Z=Z,confidencestrip=confidencestrip

 CALLED BY:

 None

 CALLS TO:

   - hsi_reg_invert.pro

 INPUTS:

   INPUTFILE
    - Name of file containing hard X-ray spectrum.  The file MUST be an ASCII file (e.g., .dat, .txt)
      organized in 4 columns of single precision data as follows:

      Lower energy of photon bin : Upper energy of photon bin :
      X-ray flux (photons/cm^2/s/keV at detector) : 1 sigma uncertainty in flux value

 OPTIONAL INPUTS
   None

 KEYWORDS:

   PHOTON_BIN_POSITION
     - Fractional location within photon energy bin to use
       range is 0-1, with 0 = low end, 0.5 = mid-point, 1 = upper end, etc.
       The default is 0.5. If the routine determines that logarithmic data sampling
       is to be used, this parameter is ignored, and the geometric mean bin energy is used by default.

   EL_ENERGY_MAX_FACTOR
     - The maximum electron energy (in units of the maximum photon energy provided)
       in the returned electron energy spectrum array (i.e., Emax=el_energy_max_factor*eps_max).
       Must be in the range [1,5]; the default is 2.

   ELECTRON_BIN
     - Width (keV) of the energy bins in the returned electron flux array.  Values are returned at
       values spaced by this quantity.  Default = 1.

   LAMBDA_MULTIPLIER
     - Factor by which the user wishes to increase or decrease the value of the smoothing
       parameter used in the algorithm.  Must be non-negative and in the range [1.e-2,1.e2].
       The default value, which is STRONGLY recommended, is 1; values of lambda_multiplier
       outside the range [0.5,2] will yield a warning message.

   CROSSSECTION
     - A text string containing one of possible choices for the cross-section Q(eps,E):

      'Kramers' : Q ~ 1/eps E.  Simple analytic form of the electron-proton bremsstrahlung
          cross-section.  Not accurate, primarily for comparison with analytic results

      'Bethe-Heitler' ; Q ~ 1/eps E [ln(1+sqrt(1-eps/E))/ln(1-sqrt(1-eps/E))].  More accurate
          non-relativistic analytic form, often used in the literature.

      'Bethe-Heitler-Elwert' : The Bethe-Heitler form with the Elwert collisional correction
          term applied.

      'Cross3BN' : Fully relativistic, solid-angle-averaged, cross section (Koch & Motz 1959,
          Rev. Mod. Phys.,31, 920-955). Includes the Elwert collisional correction factor.
          Used as default.

      'Haug' : A functional fit to the Cross3BN relativistic cross-section.  Includes the Elwert
          collisional correction term (Haug 1997, A & A, 326, 417-418)

      'Cross3BNee' : Cross3BN plus the term due to electron-electron bremsstrahlung

      'Anisotropy' : Fully angle-dependent electron-proton cross-section. (Gluckstern &
          Hull 1953, Phys. Rev., 90, 1030). If this cross-section is chosen, keywords
          viewingangle and spreadangle should also be specified.

      The default is 'Cross3BN'.

   VIEWINGANGLE
     - The angle between the mean electron propagation vector and the line of sight to the observer
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees.

   SPREADANGLE
     - Half-angle of the cone within which the electron velocities are (uniformly) distributed
      (in degrees between 0 and 180).  Ignored unless crosssection=anisotropy is chosen.
      Default = 180 degrees. Note that spreadangle=180 corresponds to an isotropic distribution.

   Z
     - Value of the root-mean-square atomic number of the target. Default = 1.2

   CONFIDENCESTRIP
     - Number of solution realizations to be determined.  Each realization is produced by randomly
      perturbing the data in inputfile using the noise levels specified therein.  Used to
      construct a 'set' of solutions in order to estimate the uncertainty in the recovered
      solution.  Default = 10, maximum = 50. Setting confidencestrip = 0 or 1 produces a
      single solution.

 OUTPUTS

   OUTPUTFILE
     File containing 3 arrays and 1 string stored in structure form.

     - Tag 1 :     STRIP       DOUBLE    Array[NE, N+2]

       where NE = number of electron energy points
              N = number of solution realizations (defined by confidencestrip value)

       The array contains the electron energies and each realization of the solution F(E)
       in the following format:

       datastruct.strip[*,0]     =  a vector of NE elements containing the electron energies
       datastruct.strip[*,1]     =  a vector of NE elements containing the original (unperturbed) solution
                                    F(E) at the specified energies
       datastruct.strip[*,2:N+1] =  array containing N different electron fluxes F(E), at the
                                    specified energies, produced by randomly perturbing the data in inputfile


     - Tag 2 : RESIDUALS       DOUBLE    Array[NPH, 6]

       where NPH = number of photon energy points

       The array contains each realization of the original (unperturbed) solution F(E).
       The data is in six columns, with each row arranged as follows:

       datastruct.residuals[*,0] = Photon energy used (defined by photon energy array and
                                   optional photon_bin_position value)
       datastruct.residuals[*,1] = Photon flux value (from the input file)
       datastruct.residuals[*,2] = Uncertainty in photon flux value (from the input file)
       datastruct.residuals[*,3] = Photon flux corresponding to the recovered F(E) array
       datastruct.residuals[*,4] = Residual photon flux (actual - recovered, i.e., column 2 - column 4)
       datastruct.residuals[*,5] = Cumulative residual, defined as
                                   C_j = (1/j) sum_[i=1]^j res_i
                                   Note: this can be used as a measure of residual 'clustering'; for an
                                      acceptable fit to the data, abs(C_j) should be less than n/sqrt(j),
                                      where n is the number of allowed standard deviations (n=3 is used in
                                      the code to drive the solution to an 'acceptable' solution).

     - Tag 3 : RESOLUTION      DOUBLE    Array[M, 2]

       where M = number of resolution intervals

       The array contains two columns representing sample energy resolution values.  If two F(E)
       values are distant by more than the energy resolution, then they can be
       realistically treated as independent; if they fall within the energy resolution
       they should be treated as dependent to some degree.

       datastruct.resolution[*,0] = center of the resolution bar : sqrt(elow*ehigh)
       datastruct.resolution[*,1] = width of the resolution bar  : (ehigh-elow)

       The number of resolution intervals (M) is determined by the code (it cannot be specified by the user),
       and so the number of rows in this array (typically 20-30) is similarly determined internally.

     - Tag 4 : INFORMATION      STRING    'outputfile.info'

       The string is the pathname of a text file containing various technical pieces of
       information, all textually labeled.

 OPTIONAL OUTPUTS:
   None

 CALLS: ***
	DEFAULT, hsi_reg_invert
 COMMON BLOCKS:
   None.

 SIDE EFFECTS:
   none

 RESTRICTIONS:

     - PHOTON ENERGY VALUES

     We strongly recommend that only photon energies above 10 keV be used, since the code
      has no capability to deal with spectral lines.

     The input photon energy array should have no data gaps, and it must be uniformly spaced
      (on either a linear or logarithmic scale).

     The input spectrum must contain at least 10 points.

     - PHOTON FLUX VALUES

     To avoid generation of (unphysical) negative flux values, all the photon fluxes must be positive and
      at least equal to the specified 1 sigma uncertainty.  The code uses only data points up to (but not
      including) the energy channel which first violates this criterion. The other data points are
      automatically neglected.

     - CHOICE OF REGULARIZATION PARAMETER

     We cannot emphasize strongly enough the desirability of using the default value
      lambda_multiplier=1.  The value of the smoothing parameter lambda is determined
      through a rigorous procedure, and using other values of lambda usually results
      in highly undedirable features in the solution and/or the photon residuals.  Nevertheless,
      we appreciate that users may wish to vary this parameter in order to explore the
      effects of such a variation.  Attempts to use a value of lambda_multiplier outside
      the range [0.5,2] generates an appropriately intimidating warning message; an attempt
      to use a value outside the range [0.01,100] causes lambda_multiplier to be set to the
      default value of 1.

     - CHOICE OF CROSS-SECTION

     Although the selection 'anisotropy' is valid, we caution the user that
      use of this cross-section increases the computational time considerably, since
      it entails not only a more complicated form of cross-section, but also the need fo
      significant trigonometrical calculation.  The same caution applies to addition of the
      electron-electron bremsstrahlung term through use of 'cross3bnee'.  Unless photon
      energies significantly above 100 keV are used, the results for 'cross3bn' and 'cross3bnee'
      are very similar.

 MODIFICATION HISTORY:

   Jan-17-2006 Written Anna M. Massone; header by Gordon Emslie


hxrs_drm2fits [2] $SSW/packages/spex/idl/original_spex/hxrs/hxrs_drm2fits.pro
[Previous] [Next]
 NAME:   hxrs_drm2fits


 PURPOSE:  write a HXRS drm to a FITS file


 CATEGORY: SPEX, spectral analysis


 CALLING SEQUENCE:
	examples

	hxrs_drm2fits, edges_in, drm

	hxrs_drm2fits, edges_in, drm, edges_out=edges_out, file=outfile, origin='NASA/GSFC LASP'


 INPUTS:
	edges_in - input energy bins
	drm - response matrix to be written to file.  Dimensioned number of detector channels by
		number of input energies.
	edges_out - edge energies of detector channels.  If not set, then edges_hxrs is called.
	file - optional name of FITS file to create.
	origin - optional name of institution making the rmf.  If not set, defaults to CU - Boulder.

 OUTPUTS:
	Detector Response Matrix is written to FITS file.

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	drm elements are assumed to have dimesnions of counts/cm^2/kev per photon/cm^2.  The drm
   elements will be mulitplied by detector channel energy width before being written to the FITS file.

 PROCEDURE:
	none

 CALLS: ***
	FXADDPAR [1], FXADDPAR [2], FXBADDCOL [1], FXBADDCOL [2], FXBCREATE [1]
	FXBCREATE [2], FXBFINISH [1], FXBFINISH [2], FXBHMAKE [1], FXBHMAKE [2]
	FXBWRITE [1], FXBWRITE [2], FXHMAKE [1], FXHMAKE [2], FXWRITE [1], FXWRITE [2]
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], edges_hxrs [1]
	edges_hxrs [2], edges_hxrs [3]
 MODIFICATION HISTORY:


hxrs_drm2fits [3] $SSW/packages/spex/pre2002/idl/hxrs/hxrs_drm2fits.pro
[Previous] [Next]
 NAME:   hxrs_drm2fits


 PURPOSE:  write a HXRS drm to a FITS file


 CATEGORY: SPEX, spectral analysis


 CALLING SEQUENCE:
	examples

	hxrs_drm2fits, edges_in, drm

	hxrs_drm2fits, edges_in, drm, edges_out=edges_out, file=outfile, origin='NASA/GSFC LASP'


 INPUTS:
	edges_in - input energy bins
	drm - response matrix to be written to file.  Dimensioned number of detector channels by
		number of input energies.
	edges_out - edge energies of detector channels.  If not set, then edges_hxrs is called.
	file - optional name of FITS file to create.
	origin - optional name of institution making the rmf.  If not set, defaults to CU - Boulder.

 OUTPUTS:
	Detector Response Matrix is written to FITS file.

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	drm elements are assumed to have dimesnions of counts/cm^2/kev per photon/cm^2.  The drm
   elements will be mulitplied by detector channel energy width before being written to the FITS file.

 PROCEDURE:
	none

 CALLS: ***
	FXADDPAR [1], FXADDPAR [2], FXBADDCOL [1], FXBADDCOL [2], FXBCREATE [1]
	FXBCREATE [2], FXBFINISH [1], FXBFINISH [2], FXBHMAKE [1], FXBHMAKE [2]
	FXBWRITE [1], FXBWRITE [2], FXHMAKE [1], FXHMAKE [2], FXWRITE [1], FXWRITE [2]
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], edges_hxrs [1]
	edges_hxrs [2], edges_hxrs [3]
 MODIFICATION HISTORY:


hxrs_fits2drm [2] $SSW/packages/spex/idl/original_spex/hxrs/hxrs_fits2drm.pro
[Previous] [Next]
 NAME:   hxrs_fits2drm


 PURPOSE:  read a HXRS drm from a FITS file into a Spex-compatible form


 CATEGORY: SPEX, spectral analysis


 CALLING SEQUENCE:
	examples

	hxrs_fits2drm, file=file, sfile=scatter_file, edges_out=edges_out, $
		edges_in=edges_in, area=area, drm=drm


 INPUTS:
	file - name of FITS file to read
	sfile - dummy input for spex compatibility


 OUTPUTS:
	edges_out - energy edges of detector channels
	edges_in - input energy bins
	area - HXRS instrument area, cm^2.
	drm - response matrix.  Dimensioned number of detector channels by
		number of input energies.


 SIDE EFFECTS:
	none


 RESTRICTIONS:
	drm elements are assumed to have dimensions of counts/cm^2 per photon/cm^2.  The drm
   elements will be divided by detector channel energy width (counts/cm^2/keV per photon/cm^2)
	before being output.


 PROCEDURE:
	none


 CALLS: ***
	MRDFITS [1], MRDFITS [2]
 MODIFICATION HISTORY:


hxrs_fits2drm [3] $SSW/packages/spex/pre2002/idl/hxrs/hxrs_fits2drm.pro
[Previous] [Next]
 NAME:   hxrs_fits2drm


 PURPOSE:  read a HXRS drm from a FITS file into a Spex-compatible form


 CATEGORY: SPEX, spectral analysis


 CALLING SEQUENCE:
	examples

	hxrs_fits2drm, file=file, sfile=scatter_file, edges_out=edges_out, $
		edges_in=edges_in, area=area, drm=drm


 INPUTS:
	file - name of FITS file to read
	sfile - dummy input for spex compatibility


 OUTPUTS:
	edges_out - energy edges of detector channels
	edges_in - input energy bins
	area - HXRS instrument area, cm^2.
	drm - response matrix.  Dimensioned number of detector channels by
		number of input energies.


 SIDE EFFECTS:
	none


 RESTRICTIONS:
	drm elements are assumed to have dimensions of counts/cm^2 per photon/cm^2.  The drm
   elements will be divided by detector channel energy width (counts/cm^2/keV per photon/cm^2)
	before being output.


 PROCEDURE:
	none


 CALLS: ***
	MRDFITS [1], MRDFITS [2]
 MODIFICATION HISTORY:


hxrs_response [2] $SSW/packages/spex/idl/original_spex/hxrs/hxrs_response.pro
[Previous] [Next]

 NAME:
	hxrs_response

 PURPOSE:
       hxrs response function, count rate per channel as a function of
		incident photon spectrum.

 CATEGORY:
       HXRS, Spectral analysis, fitting

 CALLING SEQUENCE:

 	hxrs_response, edges_out=edges_out, edges_in=edges_in, area=area, drm=drm, $
	flux=flux, em_flux=em_flux, gain=gain, newflux=newflux, con_factors=con_factors, $
	un_con=un_con, error=error

 CALLED BY:
 	drm_4_spex

 CALLS TO:
	none

 Inputs:
   FLUX
       - photons/cm2/s/keV defined at EM_FLUX,
		  optional- only needed to obtain conversion factors
	EM_FLUX
		- energy in keV for FLUX
		  optional- default is the energies of the loss matrix

	GAIN
		- HXRS gain state

 Inputs/Outputs:
	EDGES_OUT(2,8)
		- Energy edges of HXRS 8 channels in keV
   EDGES_IN(2,500)
		- Energy edges for HXRS input in keV
   AREA
       - HXRS area, 4.91 cm^2
	DFILE
		- Name of response matrix fits file to read (optional)
	NEWFLUX(I)
		- Photon flux defined midpoints of EDGES_IN,
		- Interpolated to FLUX and EM_FLUX on midpoints of EDGES_IN
		- if not input

 Outputs:
	DRM(I,J)
		- Probability of an input flux in units of photon/cm^2/s in
		- bin J resulting in a rate of counts/cm2/keV/s in bin I
	CON_FACTORS(I)
		- Conversion factors.  Ratio of the (Integrated flux/bin width)
		to NEWFLUX(I)
	UN_CON(I)
		- Uncertainties on the conversion factors.  An expression
		of the uncertainty in the detector response
	ERROR	- set if a parameter is entered out of range

 CALLS: ***
	CHECKVAR [1], INTERPOL, RESP_CALC, X_EOUT_DRM [1], X_EOUT_DRM [2], checkvar [2]
	edge_products, edges_hxrs [1], edges_hxrs [2], edges_hxrs [3]
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:

  CALCULATE THE HXRS RESPONSE MATRIX AND/OR COUNT RATE.

  Intended use:

  This procedure calculates the pulse-height response.  The matrix is computed
  from an energy-loss matrix obtained by running the program RESP_CALC, for a
  set of 100 narrow line input functions.  The energy loss matrix is broadened
  for the resolution of the detector to yield the pulse-height response matrix.
  The pulse-height response matrix may be  thought as the detector pulse-height
  spectrum in each of the 8 energy channels for an incident spectrum of a mono-
  energetic beam at one of the 100 incident energies.

  This procedure may be used in several ways:

  To obtain a pulse-height response matrix:

  HXRBS_RESPONSE, EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, DRM=DRM

  This gives the pulse-height response matrix, DRM, the edges of its energy
  input photon bins, EDGES_IN, the edges of the 8 HXRS channels, EDGES_OUT.  Using OMATRIX and
  an incident flux integrated over the E_MATRIX bins, one can compute the count
  rate in the 8 HXRS channels, i.e.

  COUNTS (counts/keV/cm2/sec) = DRM#(FLUX (Ph/cm2/s/keV) * (EDGES_IN(1:*)-EDGES_IN))

  This calculation of the count rate is extremely quick after DRM is
  obtained.

  CONVERSION FACTOR calculation

  CONVERSION FACTORS allow a simple transformation from the photon flux at a
  given energy to the count rate in a given energy channel for a specified
  model spectrum.  In general, they are defined as the ratio
  of the count rate spectrum in counts/s/keV/cm^2 to the photon spectrum in
  photons/s/keV/cm^2 provided an incident spectrum is given.  Specifically,
  the CONVERSION FACTORS used in the DECONVOLVE section of DCPFIT are the ratio
  of two quantities for a given channel I:

  		Count rate(counts/sec) in channel I
  		-----------------------------------
  		Model Photon Flux at EMID(I) * Area * Width(I)

  where EMID(I) is the mid-point energy in channel I, Area is the HXRS area
  of 4.91 cm^2, and Width(I) is the channel width in keV.

  This procedure will also return the CONVERSION FACTORS as follows:

  On the first pass:

  HXRS_RESPONSE, EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, GAIN=GAIN

  Then, compute the photon flux, FLUX, on the midpoints of EDGES_IN and
  the photon flux, NEWFLUX, on the midpoints of EDGES_OUT outside of this procedure.
  The units of the photon flux must be photons/s/keV/cm^2.

  you can get the conversion factors by calling:

  HXRS_RESPONSE, FLUX=FLUX, NEWFLUX=NEWFLUX, $
  		 CON_FACTORS=CON_FACTORS, UN_CON=UN_CON

  where the 8 CONVERSION FACTORS and their fractional uncertainties are given by
  CON_FACTORS and UN_CON, respectively.

  If the energy edges are already known, then these arguments FLUX, NEWFLUX,
  CON_FACTORS, and UN_CON can be entered on the first pass throught the program.

  As with the calculation of the response matrix , DRM, detailed above,
  this calculation is quick after the first pass.


  NON-STANDARD LIBRARY ROUTINES NEEDED:
	EDGE_PRODUCTS
	X_EOUT_DRM

 MODIFICATION HISTORY:
 Paul Bilodeau, NASA GSFC / RITSS, 31-May-2000 modified hxrbs_response for the HXRS instrument


hxrs_response [3] $SSW/packages/spex/pre2002/idl/hxrs/hxrs_response.pro
[Previous] [Next]

 NAME:
	hxrs_response

 PURPOSE:
       hxrs response function, count rate per channel as a function of
		incident photon spectrum.

 CATEGORY:
       HXRS, Spectral analysis, fitting

 CALLING SEQUENCE:

 	hxrs_response, edges_out=edges_out, edges_in=edges_in, area=area, drm=drm, $
	flux=flux, em_flux=em_flux, gain=gain, newflux=newflux, con_factors=con_factors, $
	un_con=un_con, error=error

 CALLED BY:
 	drm_4_spex

 CALLS TO:
	none

 Inputs:
   FLUX
       - photons/cm2/s/keV defined at EM_FLUX,
		  optional- only needed to obtain conversion factors
	EM_FLUX
		- energy in keV for FLUX
		  optional- default is the energies of the loss matrix

	GAIN
		- HXRS gain state

 Inputs/Outputs:
	EDGES_OUT(2,8)
		- Energy edges of HXRS 8 channels in keV
   EDGES_IN(2,500)
		- Energy edges for HXRS input in keV
   AREA
       - HXRS area, 4.91 cm^2
	DFILE
		- Name of response matrix fits file to read (optional)
	NEWFLUX(I)
		- Photon flux defined midpoints of EDGES_IN,
		- Interpolated to FLUX and EM_FLUX on midpoints of EDGES_IN
		- if not input

 Outputs:
	DRM(I,J)
		- Probability of an input flux in units of photon/cm^2/s in
		- bin J resulting in a rate of counts/cm2/keV/s in bin I
	CON_FACTORS(I)
		- Conversion factors.  Ratio of the (Integrated flux/bin width)
		to NEWFLUX(I)
	UN_CON(I)
		- Uncertainties on the conversion factors.  An expression
		of the uncertainty in the detector response
	ERROR	- set if a parameter is entered out of range

 CALLS: ***
	CHECKVAR [1], INTERPOL, RESP_CALC, X_EOUT_DRM [1], X_EOUT_DRM [2], checkvar [2]
	edge_products, edges_hxrs [1], edges_hxrs [2], edges_hxrs [3]
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:

  CALCULATE THE HXRS RESPONSE MATRIX AND/OR COUNT RATE.

  Intended use:

  This procedure calculates the pulse-height response.  The matrix is computed
  from an energy-loss matrix obtained by running the program RESP_CALC, for a
  set of 100 narrow line input functions.  The energy loss matrix is broadened
  for the resolution of the detector to yield the pulse-height response matrix.
  The pulse-height response matrix may be  thought as the detector pulse-height
  spectrum in each of the 8 energy channels for an incident spectrum of a mono-
  energetic beam at one of the 100 incident energies.

  This procedure may be used in several ways:

  To obtain a pulse-height response matrix:

  HXRBS_RESPONSE, EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, DRM=DRM

  This gives the pulse-height response matrix, DRM, the edges of its energy
  input photon bins, EDGES_IN, the edges of the 8 HXRS channels, EDGES_OUT.  Using OMATRIX and
  an incident flux integrated over the E_MATRIX bins, one can compute the count
  rate in the 8 HXRS channels, i.e.

  COUNTS (counts/keV/cm2/sec) = DRM#(FLUX (Ph/cm2/s/keV) * (EDGES_IN(1:*)-EDGES_IN))

  This calculation of the count rate is extremely quick after DRM is
  obtained.

  CONVERSION FACTOR calculation

  CONVERSION FACTORS allow a simple transformation from the photon flux at a
  given energy to the count rate in a given energy channel for a specified
  model spectrum.  In general, they are defined as the ratio
  of the count rate spectrum in counts/s/keV/cm^2 to the photon spectrum in
  photons/s/keV/cm^2 provided an incident spectrum is given.  Specifically,
  the CONVERSION FACTORS used in the DECONVOLVE section of DCPFIT are the ratio
  of two quantities for a given channel I:

  		Count rate(counts/sec) in channel I
  		-----------------------------------
  		Model Photon Flux at EMID(I) * Area * Width(I)

  where EMID(I) is the mid-point energy in channel I, Area is the HXRS area
  of 4.91 cm^2, and Width(I) is the channel width in keV.

  This procedure will also return the CONVERSION FACTORS as follows:

  On the first pass:

  HXRS_RESPONSE, EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, GAIN=GAIN

  Then, compute the photon flux, FLUX, on the midpoints of EDGES_IN and
  the photon flux, NEWFLUX, on the midpoints of EDGES_OUT outside of this procedure.
  The units of the photon flux must be photons/s/keV/cm^2.

  you can get the conversion factors by calling:

  HXRS_RESPONSE, FLUX=FLUX, NEWFLUX=NEWFLUX, $
  		 CON_FACTORS=CON_FACTORS, UN_CON=UN_CON

  where the 8 CONVERSION FACTORS and their fractional uncertainties are given by
  CON_FACTORS and UN_CON, respectively.

  If the energy edges are already known, then these arguments FLUX, NEWFLUX,
  CON_FACTORS, and UN_CON can be entered on the first pass throught the program.

  As with the calculation of the response matrix , DRM, detailed above,
  this calculation is quick after the first pass.


  NON-STANDARD LIBRARY ROUTINES NEEDED:
	EDGE_PRODUCTS
	X_EOUT_DRM

 MODIFICATION HISTORY:
 Paul Bilodeau, NASA GSFC / RITSS, 31-May-2000 modified hxrbs_response for the HXRS instrument


hxs_ph_dead [1] $SSW/packages/spex/idl/original_spex/yohkoh/hxs_ph_dead.pro
[Previous] [Next]
NAME:
	hxs_ph_dead
PURPOSE:        
       Deadtime correction factor for HXS-PH as a function of the observed count rate. 
	Taken from DTCF_PH_HXS, rewritten to
	accept vectors.  The correction is not exact
       when the deadtime-corrected count of total PH exceeds about 35,000
       counts/sec. In addition, spectral distorsion occurs when the deadtime-
       corrected count of total PH exceeds about 21,000 counts/sec. It is due
       to instrument limitation.
CALLING SEQUENCE:
	subs = dtcf_ph_hxs(float)
INPUTS:
	total hxs pha count rate (/sec)
	float - ( HXS-PH(SUM( 0-31ch.) ) [counts/sec]
Outputs:
	returns deadtime correction factor from 1 (input=0/sec) to infinity
 CALLS: ***
	POLY
 CALLED BY:
	rd_wbs_pha [1], rd_wbs_pha [2]
HISTORY:
	;FOR DTCF_PH_HXS
	26-Jun-93  (K.Suga) First written.
       25-nov-93  Revised by J.Sato,K.Morimoto and M.Yoshimori
	;hxs_ph_dead, 25-May-94, ras


hxs_ph_dead [2] $SSW/packages/spex/pre2002/idl/yohkoh/hxs_ph_dead.pro
[Previous] [Next]
NAME:
	hxs_ph_dead
PURPOSE:        
       Deadtime correction factor for HXS-PH as a function of the observed count rate. 
	Taken from DTCF_PH_HXS, rewritten to
	accept vectors.  The correction is not exact
       when the deadtime-corrected count of total PH exceeds about 35,000
       counts/sec. In addition, spectral distorsion occurs when the deadtime-
       corrected count of total PH exceeds about 21,000 counts/sec. It is due
       to instrument limitation.
CALLING SEQUENCE:
	subs = dtcf_ph_hxs(float)
INPUTS:
	total hxs pha count rate (/sec)
	float - ( HXS-PH(SUM( 0-31ch.) ) [counts/sec]
Outputs:
	returns deadtime correction factor from 1 (input=0/sec) to infinity
 CALLS: ***
	POLY
 CALLED BY:
	rd_wbs_pha [1], rd_wbs_pha [2]
HISTORY:
	;FOR DTCF_PH_HXS
	26-Jun-93  (K.Suga) First written.
       25-nov-93  Revised by J.Sato,K.Morimoto and M.Yoshimori
	;hxs_ph_dead, 25-May-94, ras


HXT_CAL_DRM [1] $SSW/packages/spex/idl/original_spex/yohkoh/hxt_cal_drm.pro
[Previous] [Next]

 NAME: HXT_CAL_DRM


 PURPOSE: Creates the detector response matrix for the HXT cal
	data with 64 output channels.


 CATEGORY: YOHKOH/HXT, SPEX


 CALLING SEQUENCE:  
	HXT_CAL_DRM, Drm, Eout, Ein, Area

 CALLED BY:
	DRM_4_SPEX

 CALLS: ***
	CHECKVAR [1], FCRYSTAL, F_DIV, G_C, INTERPOL, RESP_CALC, checkvar [2], edge_products
	xsec
 INPUTS:
       none explicit

 OPTIONAL INPUTS:
	none

 OUTPUTS:
	Drm - detector response in cts/cm2/keV per photon/cm2
	     same units as RD_HXT_DRM		
	Eout- output channel pulse-heights in keV, 2x64, from HXT 
		DatabookI
 	Ein - input photon energy bins in keV, 2x200, from 10-200 keV
	Area- Nominal maximum area of total HXT is 55 cm2   
 KEYWORDS:
'	PULSE_SHAPE - resolution broadening matrix
	DELTA_LIGHT - PHA channel widths in light units
	ERROR	    - successful completion returns 0
	NOLIGHT     - if set then don't consider light/energy function
	 

 PROCEDURE:
	Calls resp_calc with detector properties and interpolates
	to output channels.

 MODIFICATION HISTORY:
	ras, 17-jan-1996
	ras, 24-jan-1996, added light/energy function taken from BATSE


HXT_CAL_DRM [2] $SSW/packages/spex/pre2002/idl/yohkoh/hxt_cal_drm.pro
[Previous] [Next]

 NAME: HXT_CAL_DRM


 PURPOSE: Creates the detector response matrix for the HXT cal
	data with 64 output channels.


 CATEGORY: YOHKOH/HXT, SPEX


 CALLING SEQUENCE:  
	HXT_CAL_DRM, Drm, Eout, Ein, Area

 CALLED BY:
	DRM_4_SPEX

 CALLS: ***
	CHECKVAR [1], FCRYSTAL, F_DIV, G_C, INTERPOL, RESP_CALC, checkvar [2], edge_products
	xsec
 INPUTS:
       none explicit

 OPTIONAL INPUTS:
	none

 OUTPUTS:
	Drm - detector response in cts/cm2/keV per photon/cm2
	     same units as RD_HXT_DRM		
	Eout- output channel pulse-heights in keV, 2x64, from HXT 
		DatabookI
 	Ein - input photon energy bins in keV, 2x200, from 10-200 keV
	Area- Nominal maximum area of total HXT is 55 cm2   
 KEYWORDS:
'	PULSE_SHAPE - resolution broadening matrix
	DELTA_LIGHT - PHA channel widths in light units
	ERROR	    - successful completion returns 0
	NOLIGHT     - if set then don't consider light/energy function
	 

 PROCEDURE:
	Calls resp_calc with detector properties and interpolates
	to output channels.

 MODIFICATION HISTORY:
	ras, 17-jan-1996
	ras, 24-jan-1996, added light/energy function taken from BATSE


HXT_CAL_FIX [1] $SSW/packages/spex/idl/original_spex/yohkoh/hxt_cal_fix.pro
[Previous] [Next]
 PROJECT:
	YOHKOH
 NAME:  HXT_CAL_FIX


 PURPOSE: 
	This procedure reads the complete HXT  calibration data file, 
	corrects for possible counter overflow, and returns the 
	flash analyzer relative widths from the database files.


 CATEGORY: YOHKOH/HXT, INSTRUMENT


 CALLING SEQUENCE: HXT_CAL_FIX,   File, Ut,  Dout,  Flux,  Dt

 CALLED BY:


 CALLS: ***
	AVE_CTS2 [1], AVE_CTS2 [2], AVE_CTS2 [3], AVG [1], AVG [2], CHECKVAR [1], DATA_PATHS
	EXIST, FCHECK, F_DIV, GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3], GAUSSFIT [4]
	GAUSSFIT [5], GET_HXT_CAL_WIDTHS, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	MAP_MATRIX, RD_XDA [1], RD_XDA [2], Rd_Roadmap [2], anytim [1], anytim [2]
	anytim [3], anytim [4], anytim [5], checkvar [2], edge_products, rd_roadmap [1]
  INPUTS:
	File:  filename, defaults to CaL flare of 13-oct-95

 OUTPUTS:
      	Ut - Center time of each 8 sec accumulation in int. structure 
		Yohkoh format
	Flux - Counts/sec/detector for selected detectors rebinned to standard edges
	by correcting for PHA non-linearity and gain offset
	Dt  - Time in seconds of accumulation interval
 OPTIONAL OUTPUTS:
	EDGES- Standard HXT cal edges
	IOUT - YOHKOH index structures for hxt cal data
	DOUT - overflow corrected counts in each bin 64chans X 64sensors X Ntimebins, Fix
 CALLED BY:
	read_yohkoh_4_spex [1], read_yohkoh_4_spex [2]
 COMMON BLOCKS:
	hxt_cal_fix	

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	Read the roadmap, find the CAL records, read the datafile for the CAL
 	records, correct overflow, rebin to standard bins.	

 MODIFICATION HISTORY: 
	ras, 31-jan-1996
	ras, 28-apr-1996, finished rebin corrections
 CONTACT:
	richard.schwartz@gsfc.nasa.gov


HXT_CAL_FIX [2] $SSW/packages/spex/pre2002/idl/yohkoh/hxt_cal_fix.pro
[Previous] [Next]
 PROJECT:
	YOHKOH
 NAME:  HXT_CAL_FIX


 PURPOSE: 
	This procedure reads the complete HXT  calibration data file, 
	corrects for possible counter overflow, and returns the 
	flash analyzer relative widths from the database files.


 CATEGORY: YOHKOH/HXT, INSTRUMENT


 CALLING SEQUENCE: HXT_CAL_FIX,   File, Ut,  Dout,  Flux,  Dt

 CALLED BY:


 CALLS: ***
	AVE_CTS2 [1], AVE_CTS2 [2], AVE_CTS2 [3], AVG [1], AVG [2], CHECKVAR [1], DATA_PATHS
	EXIST, FCHECK, F_DIV, GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3], GAUSSFIT [4]
	GAUSSFIT [5], GET_HXT_CAL_WIDTHS, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	MAP_MATRIX, RD_XDA [1], RD_XDA [2], Rd_Roadmap [2], anytim [1], anytim [2]
	anytim [3], anytim [4], anytim [5], checkvar [2], edge_products, rd_roadmap [1]
  INPUTS:
	File:  filename, defaults to CaL flare of 13-oct-95

 OUTPUTS:
      	Ut - Center time of each 8 sec accumulation in int. structure 
		Yohkoh format
	Flux - Counts/sec/detector for selected detectors rebinned to standard edges
	by correcting for PHA non-linearity and gain offset
	Dt  - Time in seconds of accumulation interval
 OPTIONAL OUTPUTS:
	EDGES- Standard HXT cal edges
	IOUT - YOHKOH index structures for hxt cal data
	DOUT - overflow corrected counts in each bin 64chans X 64sensors X Ntimebins, Fix
 CALLED BY:
	read_yohkoh_4_spex [1], read_yohkoh_4_spex [2]
 COMMON BLOCKS:
	hxt_cal_fix	

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	Read the roadmap, find the CAL records, read the datafile for the CAL
 	records, correct overflow, rebin to standard bins.	

 MODIFICATION HISTORY: 
	ras, 31-jan-1996
	ras, 28-apr-1996, finished rebin corrections
 CONTACT:
	richard.schwartz@gsfc.nasa.gov


HXT_PRESTORE [1] $SSW/packages/spex/idl/original_spex/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_PRESTORE [2] $SSW/packages/spex/idl/original_spex/yohkoh/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.


HXT_PRESTORE [3] $SSW/packages/spex/pre2002/idl/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_PRESTORE [4] $SSW/packages/spex/pre2002/idl/yohkoh/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.