batse_file_search [1] $SSW/packages/spex/idl/original_spex/batse_file_search.pro
[Previous] [Next]
 PROJECT: SDAC

 NAME: batse_file_search


 PURPOSE: Look for files satisfying passed directory and filename strings,
	   Find file or files satisfying passed strings, and let user select filename
	   of choice.  Passed strings may also be a set of templates using wildcards
	   and replacement values

 CATEGORY: SPEX, BATSE, SYSTEM


 CALLING SEQUENCE:  batse_file_search, file_type=file_type, $
	spex_test_dir = spex_test_dir, test_file=test_file, $
	det_id=det_id, flare=flare, out_fname=out_fname, out_dir=out_dir, $
	sher_only=sher_only, sherb_only=sherb_only

 CALLED BY: SPEX menu


 CALLS TO:
	build_fname
	file_searcher
	datatype
 INPUTS:
	data_form - e.g. 'DISCLA','CONT','HERS','SHERS'	
	file_type - 'DATA' for time history files, e.g. sherb_ibdb_00468.fits
	            'DRM' detector response matrix files
	spex_test_dir  - directory to be combined with templates using concat_dir
		    there is already a list of default directories within this procedure
	test_file - string for file name over and above defaults list within code
	dir_queue - hierarchical list of directories to search, some to be combined
		    with burst numbers
	(see build_fname.pro for explanations of the following optional arguments)
	det_id    - detector id number, for BATSE 0-7
	flare     - flare number from 
		    SDAC BATSE archive
	batse_burst - This burst number overrides the BATSE burst trigger number
		      returned by the burst_flare routine
	sherb_only - only look for sherb or herb in BATSE SHERS or HERS
	sher_only  - only look for sher or her in BATSE SHER or HER
	event_time - time with event day, anytim format, used to construct tjds etc
 OUTPUTS:
       out_fname - filename satisfying input specification, '' if none
       out_dir   - directory satisfying input specification, '' if none

 CALLS: ***
	BUILD_FNAME [1], BUILD_FNAME [2], BURST_FLARE, CHECKVAR [1], DATATYPE [1]
	DATATYPE [2], DATATYPE [3], FCHECK, FILE_SEARCHER [1], FILE_SEARCHER [2]
	READ_FLARE, YMD2TJD, checkvar [2]
 CALLED BY:
	spex_batse_preview [1], spex_batse_preview [2]
 PROCEDURE: uses file_searcher, build_fname, and findfile to test strings in filename searches.
	     if more than one is returned, requests the user to specify interactively.
            If templates are passed, then they are checked first before test_file and spex_test_dir
 MODIFICATION HISTORY: 
	Version 1
	richard.schwartz@gsfc.nasa.gov, 29-sep-1997 from run_file_search.
	Version 1.1 richard.schwartz@gsfc.nasa.gov, 29-sep-1997 from run_file_search.6-jun-2000.
	remove conflict with test_dir.pro


batse_file_search [2] $SSW/packages/spex/pre2002/idl/batse_file_search.pro
[Previous] [Next]
 PROJECT: SDAC

 NAME: batse_file_search


 PURPOSE: Look for files satisfying passed directory and filename strings,
	   Find file or files satisfying passed strings, and let user select filename
	   of choice.  Passed strings may also be a set of templates using wildcards
	   and replacement values

 CATEGORY: SPEX, BATSE, SYSTEM


 CALLING SEQUENCE:  batse_file_search, file_type=file_type, $
	spex_test_dir = spex_test_dir, test_file=test_file, $
	det_id=det_id, flare=flare, out_fname=out_fname, out_dir=out_dir, $
	sher_only=sher_only, sherb_only=sherb_only

 CALLED BY: SPEX menu


 CALLS TO:
	build_fname
	file_searcher
	datatype
 INPUTS:
	data_form - e.g. 'DISCLA','CONT','HERS','SHERS'	
	file_type - 'DATA' for time history files, e.g. sherb_ibdb_00468.fits
	            'DRM' detector response matrix files
	spex_test_dir  - directory to be combined with templates using concat_dir
		    there is already a list of default directories within this procedure
	test_file - string for file name over and above defaults list within code
	dir_queue - hierarchical list of directories to search, some to be combined
		    with burst numbers
	(see build_fname.pro for explanations of the following optional arguments)
	det_id    - detector id number, for BATSE 0-7
	flare     - flare number from 
		    SDAC BATSE archive
	batse_burst - This burst number overrides the BATSE burst trigger number
		      returned by the burst_flare routine
	sherb_only - only look for sherb or herb in BATSE SHERS or HERS
	sher_only  - only look for sher or her in BATSE SHER or HER
	event_time - time with event day, anytim format, used to construct tjds etc
 OUTPUTS:
       out_fname - filename satisfying input specification, '' if none
       out_dir   - directory satisfying input specification, '' if none

 CALLS: ***
	BUILD_FNAME [1], BUILD_FNAME [2], BURST_FLARE, CHECKVAR [1], DATATYPE [1]
	DATATYPE [2], DATATYPE [3], FCHECK, FILE_SEARCHER [1], FILE_SEARCHER [2]
	READ_FLARE, YMD2TJD, checkvar [2]
 CALLED BY:
	spex_batse_preview [1], spex_batse_preview [2]
 PROCEDURE: uses file_searcher, build_fname, and findfile to test strings in filename searches.
	     if more than one is returned, requests the user to specify interactively.
            If templates are passed, then they are checked first before test_file and spex_test_dir
 MODIFICATION HISTORY: 
	Version 1
	richard.schwartz@gsfc.nasa.gov, 29-sep-1997 from run_file_search.
	Version 1.1 richard.schwartz@gsfc.nasa.gov, 29-sep-1997 from run_file_search.6-jun-2000.
	remove conflict with test_dir.pro


bb_rad_loss $SSW/packages/chianti/idl/low_level/bb_rad_loss.pro
[Previous] [Next]

 PROJECT:  CHIANTI

 NAME:
	bb_rad_loss

 PURPOSE:

       calculates energy loss rate by line (bound-bound) radiation

 CATEGORY:
	
	synthetic spectra

 CALLING SEQUENCE:

       BB_RAD_LOSS,Temperature,Loss_rate


 INPUTS:

	None:  the user will select various parameters such as the 
              choice of elemental abundances and ionization equilibria

  KEYWORDS:

       Pressure:  pressure in emitting region (cm^-3 K)
                  density=pressure/temperature(K)

       Density:   density (cm^-3), constant for all temperatures
                  if neither density or pressure is set, then a 
                  default constant density of 10^10 cm^-3 is used.

	Sngl_ion:  to calculate the loses spectrum for a single ion

       NOPROT    Switches off inclusion of proton rates.

       RADTEMP   The blackbody radiation field temperature (default 
                 6000 K).

       RPHOT     Distance from the centre of the star in stellar radius 
                 units. I.e., RPHOT=1 corresponds to the star's surface. 
                 (Default is infinity, i.e., no photoexcitation.)

 OUTPUTS:

       Temperature:  array of temperatures (K)
       Loss_rate:  energy loss rate in erg cm^3 s^-1


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


  if keyword pressure is set then calculations performed at constant pressure
  if keyword density is set then calculations performed at constant density
  otherwise, density is set to 1.e+10
  
  pressure = density * temperature  (cm^-3 K)


	the user will be asked to select an abundance file. 


 CALLS: ***
	ION2SPECTROSCOPIC, POP_SOLVER, PROTON_DENS, R2W, READ_MASTERLIST, SETUP_ELEMENTS
	SETUP_ION, convertname
 COMMON BLOCKS:

	ELVLC, WGFA, UPSILON, RADIATIVE, PROTON, ELEMENTS, IONREC

 CALLS

       READ_MASTERLIST, 
       SETUP_ELEMENTS, POP_SOLVER, CONVERTNAME, R2W, PROTON_DENS,
       ZION2SPECTROSCOPIC, ZION2FILENAME, SETUP_ION

 EXAMPLE:

       > bb_rad_loss,t,r


 MODIFICATION HISTORY:
 	Written by:	Ken Dere
	January 1999:  version 1, adopted from synthetic.pro
       14-Jul-2000     Peter Young, now calls pop_solver

       Ver.2, 9-Dec-2001, Peter Young
               Modified for v.4 of CHIANTI.

       V.3, 4-Oct-2003, GDZ
                  modified the input to POP_SOLVER, now it is dealt with an
                  input structure. Also shorten the whole procedure, by calling
                  other procedures.

       V.4, 5-Apr-2005, EL
                  modified the input to POP_SOLVER in order to add ion/rec
                  in the calculation of level populations. All the rest
                  is unchanged.

       V 5, 25-May-2005, GDZ 
                  corrected routine header.


 VERSION     :   5, 25-May-2005, GDZ 


bfits_burst [1] $SSW/packages/spex/idl/original_spex/bfits_burst.pro
[Previous] [Next]
 NAME: bfits_burst
	
 PURPOSE: read in BATSE bfits time history for bursts
	
 CALLING SEQUENCE: 
  bfits_burst, filename, t, rate, erate=erate, edges=edges, head=head, burst=burst
	
 INPUTS:
	filename - bfits filename
	
 OPTIONAL INPUTS:
	
 OUTPUTS:
	t - 2xnsamples, times relative to burst trigger time in seconds
	rate - count rate (/s) in each channel, (nchans x nsamples)
	
 OPTIONAL OUTPUTS:
	erate - uncertainty on rate, NaN for bad samples
	edges - nominal energy channels (2 x nchans) in keV
	head  - composite fits headers
	burst - burst trigger numbers
 PROCEDURE:

 CALLS: ***
	FXPAR [1], FXPAR [2], Fits_spectra [1], Fits_spectra [2], TJD2YMD, UTIME [1]
	UTIME [2]
 COMMON BLOCKS:

 RESTRICTIONS:

 MODIFICATION HISTORY:
	ras, 13-feb-95	


bfits_burst [2] $SSW/packages/spex/pre2002/idl/bfits_burst.pro
[Previous] [Next]
 NAME: bfits_burst
	
 PURPOSE: read in BATSE bfits time history for bursts
	
 CALLING SEQUENCE: 
  bfits_burst, filename, t, rate, erate=erate, edges=edges, head=head, burst=burst
	
 INPUTS:
	filename - bfits filename
	
 OPTIONAL INPUTS:
	
 OUTPUTS:
	t - 2xnsamples, times relative to burst trigger time in seconds
	rate - count rate (/s) in each channel, (nchans x nsamples)
	
 OPTIONAL OUTPUTS:
	erate - uncertainty on rate, NaN for bad samples
	edges - nominal energy channels (2 x nchans) in keV
	head  - composite fits headers
	burst - burst trigger numbers
 PROCEDURE:

 CALLS: ***
	FXPAR [1], FXPAR [2], Fits_spectra [1], Fits_spectra [2], TJD2YMD, UTIME [1]
	UTIME [2]
 COMMON BLOCKS:

 RESTRICTIONS:

 MODIFICATION HISTORY:
	ras, 13-feb-95	


BPOW $SSW/packages/xray/idl/bpow.pro
[Previous] [Next]
 NAME:
   BPOW

 PURPOSE:
   This function returns a broken(double) power-law for an input vector.

 CATEGORY:
   SPEX(spectroscopic analysis), fitting

 CALLING SEQUENCE:
   Spectrum = BPOW( X, A)

 INPUTS:
   E: Input vector, for X-ray spectroscopy generally an Energy in keV.
      E must be greater than 0. For a discrete spectrum, these should be
          the channel energy means (arithmetic or geometric) or an array of
          2xN low and high energy edges.  Then, arithmetic mean is used.
   A: A set of parameters describing the broken power-law.
     A(0): negative power-law index, always greater than 0.0 for E
           less than A(1)
     A(1): Break point in E. If this value is 0.0 then the whole
           spectrum is a single power-law.
     A(2): negative power-law index, always greater than 0.0 for E
           greater than A(1)
     A(3): Optional low-energy (X) break point.  If it isn't set
           on input it defaults to the value of "a_cutoff(0)"
           in the common "function_com"
     A(4): Optional negative power-law index below A(3).  If it isn't set
           on input it defaults to the value of "a_cutoff(1)"
           in the common "function_com"

 OUTPUTS:
   This function returns a broken(double) power-law for an input vector.

 CALLS: ***
	CHECKVAR [1], checkvar [2], edge_products
 CALLED BY:
	F_BPOW
 COMMON BLOCKS:
   FUNCTION_COM: see FUNCTION_COM.PRO

 PROCEDURE:
   Divides the input vector into groups of points based on the break values,
   then calculates the power-law output for each section where the normalization
   is taken as 1.0 and the X values are scaled by "Epivot" given in
   FUNCTION_COM.PRO

 EXAMPLE:
   Spectrum = BPOW( findgen(100)+15.,[2.,40.,3.])

 MODIFICATION HISTORY:
   Written by:  RAS, documented 12-dec-1995
   Version 2, richard.schwartz@gsfc.nasa.gov, use energy means or 2xn array of energies.
   30-apr-2004, richard.schwartz@gsfc.nasa.gov,
     added documentation about meaning of normalization


bpow_taper $SSW/packages/xray/idl/bpow_taper.pro
[Previous] [Next]
 NAME: bpow_taper
	
 PURPOSE: broken power-law function without discontinuities in the
	derivatives
	
 CALLING SEQUENCE: result = bpow_taper(x, a)
	
 INPUTS:
	x - independent variable, nominally energy in keV under SPEX
	a - parameters defined as
	normalization at Epivot is 1
		a(0) - negative power law index below break
		a(1) - break energy
		a(2) - negative power law index above break
		a(3) - low energy cutoff
		a(4) - negative power law index of low energy cutoff, 1<Eco<2, default 1.5
	
 OPTIONAL INPUTS:
	dx - scale length for spline interpolation around breaks 
	     in fractional units of x	
	tension - tension in spline fit
 OUTPUTS:
	result of function, a broken power law
 OPTIONAL OUTPUTS:

 CALLED BY:
	F_BPOW
 PROCEDURE:	uses a spline interpolation to give a smooth
	transitions at the break energies

 CALLS: ***
	CHECKVAR [1], SPLINE, checkvar [2]
 COMMON BLOCKS:
	function_com
	common function_com, f_model, Epivot, a_cutoff
	checkvar, Epivot, 50.0 ;Normal spectral pivot point for Hard X-ray spectra
	checkvar, f_model, 'F_VTH_BPOW' ;DEFAULT FITTING FUNCTION, THERMAL AND BPOW
	checkvar, a_cutoff, [10.,1.5]  ;parameters of low energy pl cutoff, keV and index
	
 RESTRICTIONS:
	break energy should be higher than the low energy cutoff by at least dx
 MODIFICATION HISTORY:
	ras, 15 March 1995	


BREM_49 $SSW/packages/xray/idl/brem_49.pro
[Previous] [Next]

 NAME:
 BREM_49

 PURPOSE:
 This function calculates the optically thin continuum thermal bremsstrahlung
 photon flux incident on
 the Earth from an isothermal plasma on the Sun.  Normalization is for an emission
 measure on the Sun of 1.e49 cm-3

 CATEGORY:
 SPECTRA

 CALLING SEQUENCE:
 Flux = BREM_49( Energy, Kt )

 CALLS: ***
	ACGAUNT [1], ACGAUNT [2]
 INPUTS:
       Energy - Energy vector in keV
 Kt     - Plasma temperature in keV, a scalar.

 OPTIONAL INPUTS:
 none

 OUTPUTS:
       Returns the differential photon flux in units of
 photons/(cm2 s keV) per (1e49 cm-3 emission measure)

 OPTIONAL OUTPUTS:
 none

 KEYWORDS:
 VERBOSE - If set, prints a message.
 CALLED BY:
	F_VTH
 COMMON BLOCKS:
 none

 SIDE EFFECTS:
 none

 RESTRICTIONS:
 Use at temperatures above line energies.  Never valid for kT lt 0.1 keV.

 PROCEDURE:
 bremsstrahlung radiation function
 differential spectrum seen at Earth in units of photon/(cm2 s keV)

 MODIFICATION HISTORY:
 Identical with the SMM/HXRBS group's DCP 1VTH for an emission measure of 1.e49 cm-3
 Version 2, Documented, RAS, 19-May-1996
 VERSION 3, 21-MAY-1996, Changed to call acgaunt instead of tegfc(obsolete)
 VERSION 4, 23-oct-1996, Made to return row vector
 21-jan-2002, return float, ras.


Brm_BremCross $SSW/packages/xray/idl/brm/brm_bremcross.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_BremCross

 PURPOSE:
	Computes the relativistic cross section for electron-ion bremsstrahlung,
	differential in photon energy.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_BremCross, eel, eph, z, cross

 CALLS:
	none
 INPUTS:

	eel		-	Array of abscissas at which to compute the bremsstrahlung cross
				section.

	eph		-	Array of photon energies corresponding to the array eel.

	z		-	Mean atomic number of the target plasma.


 OPTIONAL INPUTS:
	none

 OUTPUTS:
	cross	-	Array of bremsstrahlung cross sections corresponding to the
				input array eel.

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_FInner, Brm_FThin, inv_cross_section
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	The cross section is from Equation (4) of E. Haug (Astron. Astrophys. 326,
	417, 1997).  This closely follows Formula 3BN of H. W. Koch & J. W. Motz
	(Rev. Mod. Phys. 31, 920, 1959), but requires fewer computational steps.
	The multiplicative factor introduced by G. Elwert (Ann. Physik 34, 178,
	1939) is included.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/modelware.htm
   03/11/03    ch2 corrected (C12 replaced by C21) found by G. Emslie


Brm_BremSpec $SSW/packages/xray/idl/brm/brm_bremspec.pro
[Previous] [Next]
 PROJECT:
   HESSI

 NAME:
   Brm_BremSpec

 PURPOSE:
   This Function computes the thin-target bremsstrahlung x-ray/gamma-ray
   spectrum from an isotropic electron distribution function provided in
   Pro Brm_Distrn.  The units of the computed flux is photons per second per
   keV per square centimeter.

 CATEGORY:
   HESSI, Spectra, Modeling

 CALLING SEQUENCE:
   Brm_BremSpec, eph, a

 CALLS: ***
	Brm_Dmlin
 INPUTS:

   eph - Array of photon energies (in keV) at which to compute the
         photon flux.
   a - parameters describing the nonthermal electron broken power-law, where:
   a(0) - normalization factor in units of 1.0d55 cm-2 sec-1,
             i.e. plasma density * volume of source * integrated nonthermal electron flux density
   a(1) - Power-law index of the electron distribution function below eebrk.
   a(2) - Break energy in the electron distribution function (in keV)
   a(3) - Power-law index of the electron distribution function above eebrk.
   a(4) - Low energy cutoff in the electron distribution function (in keV).
   a(5) - High energy cutoff in the electron distribution function (in keV).


 OPTIONAL INPUTS:
   none


 OUTPUTS:

   Array of photon fluxes (in photons s^-1 keV^-1 cm^-2)
   corresponding to the photon energies in the input array eph.
   The detector is assumed to be 1 AU from the source.

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
   none

 CALLED BY:
	Brm_Thin, Flux model of thermal bremsstrahlung plus thintarget broken
 COMMON BLOCKS:
   none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
   Documentation is provided in the file brm_doc.pdf
   (Adobe Acrobat Reader required).
   Documentation for the Fortran Version of this code
   can be found at http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremdoc.pdf
   Version 2, 11/20/2002, Changed from procedure to function
                          Set EFD = 1, use electron flux distribution
                         Normalization factor is mutiplied at f_vth_thin.pro
                  instead of within the script
 10-May-2005 Linhui Sui, correct description of a(0)


Brm_BremThick $SSW/packages/xray/idl/brm/brm_bremthick.pro
[Previous] [Next]
 PROJECT:
   HESSI

 NAME:
   Brm_BremThick

 PURPOSE:
   This Function computes the thick-target bremsstrahlung x-ray/gamma-ray
   spectrum from an isotropic electron distribution function provided in
   Pro Distrn.  The units of the computed flux is photons per second per
   keV per square centimeter.

 CATEGORY:
   HESSI, Spectra, Modeling

 CALLING SEQUENCE:
   Brm_BremThick (eph, a)

 CALLS: ***
	Brm_DmlinO
 INPUTS:
   eph - Array of photon energies (in keV) at which to compute the
         photon flux.
   a - parameters describing the nonthermal electron broken power-law, where:
   a(0) - Total integrated electron flux, in units of 10^35 electrons sec^-1.

   a(1) - Power-law index of the electron distribution function below
          eebrk.
   a(2) - Break energy in the electron distribution function (in keV)
   a(3) - Power-law index of the electron distribution function above
          eebrk.
   a(4) - Low energy cutoff in the electron distribution function
          (in keV).
   a(5) - High energy cutoff in the electron distribution function (in keV).


 OPTIONAL INPUTS:
   none

 OUTPUTS:

   Array of photon fluxes (in photons s^-1 keV^-1 cm^-2)
   corresponding to the photon energies in the input array eph.
   The detector is assumed to be 1 AU from the source.

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
   none

 CALLED BY:
	Brm_Thick, F_BPOW_THICK, f_vth_thick
 COMMON BLOCKS:
   none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
   Documentation is provided in the file brm_thick_doc.pdf
   (Adobe Acrobat Reader required).
   Documentation for the Fortran Version of this code
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf
   03/19/2002 Linhui sui    set EFD = 1 to get electron flux distribution
   12/02/2004 Linhui Sui    update the documentation


Brm_Distrn $SSW/packages/xray/idl/brm/brm_distrn.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_Distrn

 PURPOSE:
	This routine calculates the value of the electron distribution function.
	This information is user specified.  The distribution function is
	normalized so that Int(dGAMMA)*FCN = 1.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_Distrn, gamma, gamlow, gambrk, gamhigh, p, q, fcn

 CALLS:
	none
 INPUTS:

	gamma	-	Array of gammas corresponding to abscissas calculated in the
				outer integration.

	gamlow	-	Electron gamma corresponding to the low energy cutoff.

	gambrk	-	Electron gamma corresponding to the break energy.

	gamhigh	-	Electron gamma corresponding to the high energy cutoff.

	p		-	Power-law index below the break energy.

	q		-	Power-law index above the break energy.


 OPTIONAL INPUTS:
	none

 OUTPUTS:
	fcn		-	Array containing the normalized electron distribution function
				for each element of the input array gamma.

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_FThick, Brm_FThin, brmthick_power
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
   A normalized, double power law electron distribution function is computed.
   P is the lower power-law index, between gamlow and gambrk, and q is the
   upper power-law index, between gambrk and gamhigh.


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


Brm_Dmlin $SSW/packages/xray/idl/brm/brm_dmlin.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_Dmlin

 PURPOSE:
	To integrate a function via the method of Gaussian quadrature.  Repeatedly
	doubles the number of points evaluated until convergence, specified by the
	input rerr, is obtained, or the maximum number of points, specified by the
	input maxfcn, is reached.  If integral convergence is not achieved, this
	function returns the error code ier = 120 when either the maximum number of
	function evaluations is performed or the number of Gaussian points to be
	evaluated exceeds maxfcn.  Maxfcn should be less than or equal to 2^nlim,
	or 4096 with nlim = 12.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_Dmlin(a, b, maxfcn, rerr, eph, gamlow, gambrk, gamhigh, $
		p, q, z, EFD, ier)

 CALLS: ***
	Brm_FThin, Brm_GauLeg
 INPUTS:

	a		-	Array containing the lower limits of integration for the
				corresponding photon energies in the input array eph.

	b		-	Upper limit of integration (a scalar, used for all elements of
				eph).

	maxfcn	-	Maximum number of points for the Gaussian quadrature
				integration.

	rerr	-	Desired relative error for evaluation of the integrals.  For
				example, rerr = 0.01 indicates that the estimate of the
				integral is to be correct to one digit, whereas rerr = 0.001
				calls for two digits to be correct.

	eph		-	Array of photon energies for which the flux is calculated.

	gamlow	-	Electron gamma corresponding to the low energy cutoff.  This
				input is not used in Brm_Dmlin, but is passed to
				Function Brm_FThin.

	gambrk	-	Electron gamma corresponding to the break energy.  This input
				is not used in Brm_Dmlin, but is passed to Function Brm_FThin.

	gamhigh	-	Electron gamma corresponding to the high energy cutoff.  This
				input is not used in Brm_Dmlin, but is passed to
				Function Brm_FThin.

	p		-	Power-law index below the break energy.  This input is not used
				in Brm_Dmlin, but is passed to Function Brm_FThin.

	q		-	Power-law index above the break energy.  This input is not used
				in Brm_Dmlin, but is passed to Function Brm_FThin.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_Dmlin, but is passed to Function Brm_FThin.

	EFD		-	Keyword to be passed to Function Brm_FThin.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

   Brm_Dmlin	-	Array of estimates of the integrals corresponding to the photon
					energies and limits of integration specified.

	ier			-	Array of error flags.  The numerical integration converged
					where ier = 0, and did not converge where ier = 120.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:


 CALLED BY:
	Brm_BremSpec
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	This function is based upon the routine xgauleg found in "Numerical Recipes
	Example Book (FORTRAN)," Second Edition, Cambridge University Press, p. 48.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
   Documentation is provided in the file brm_doc.pdf
   (Adobe Acrobat Reader required).
	Documentation for the Fortran Version of this code
   can be found at http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremdoc.pdf


Brm_DmlinI $SSW/packages/xray/idl/brm/brm_dmlini.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_DmlinI

 PURPOSE:
	To integrate a function via the method of Gaussian quadrature.  Repeatedly
	doubles the number of points evaluated until convergence, specified by the
	input rerr, is obtained, or the maximum number of points, specified by the
	input maxfcn, is reached.  If integral convergence is not achieved, this
	function returns the error code ier4 = 1 when either the maximum number of
	function evaluations is performed or the number of Gaussian points to be
	evaluated exceeds maxfcn.  Maxfcn should be less than or equal to 2^nlim,
	or 4096 with nlim = 12.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_DmlinI(a, b, maxfcn, rerr, eph, z, ier4)

 CALLS: ***
	Brm_FInner, Brm_GauLeg
 INPUTS:

	a		-	Array containing the lower limits of integration for the
				corresponding photon energies in the input array eph.

	b		-	Array containing the upper limits of integration for the
				corresponding photon energies in the input array eph.

	maxfcn	-	Maximum number of points for the Gaussian quadrature
				integration.

	rerr	-	Desired relative error for evaluation of the integrals.  For
				example, rerr = 0.01 indicates that the estimate of the
				integral is to be correct to one digit, whereas rerr = 0.001
				calls for two digits to be correct.

	eph		-	Array of photon energies for which the flux is calculated.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_DmlinI, but is passed to Function Brm_FInner.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

	Brm_DmlinI	-	Array of estimates of the integrals corresponding to the photon
					energies and limits of integration specified.

	ier4		-	Array of error flags.  The numerical integration converged
					where ier4 = 0, and did not converge where ier4 = 1.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_FThick
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	This function is based upon the routine xgauleg found in "Numerical Recipes
	Example Book (FORTRAN)," Second Edition, Cambridge University Press, p. 48.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
   Documentation is provided in the file brm_thick_doc.pdf
   (Adobe Acrobat Reader required).
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf


Brm_DmlinO $SSW/packages/xray/idl/brm/brm_dmlino.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_DmlinO

 PURPOSE:
	To integrate a function via the method of Gaussian quadrature.  Repeatedly
	doubles the number of points evaluated until convergence, specified by the
	input rerr, is obtained, or the maximum number of points, specified by the
	input maxfcn, is reached.  If integral convergence is not achieved, this
	function returns the error code ier1 = 120 when either the maximum number
	of function evaluations is performed or the number of Gaussian points to be
	evaluated exceeds maxfcn.  Maxfcn should be less than or equal to 2^nlim,
	or 4096 with nlim = 12.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_DmlinO(a, b, maxfcn, rerr, eph, eebrk, gamlow, gambrk, $
		gamhigh, p, q, z, EFD, ier1, ier2)

 CALLS: ***
	Brm_FThick, Brm_GauLeg
 INPUTS:

	a		-	Array containing the lower limits of integration for the
				corresponding photon energies in the input array eph.

	b		-	Upper limit of integration (a scalar, used for all elements of
				eph).

	maxfcn	-	Maximum number of points for the Gaussian quadrature
				integration.

	rerr	-	Desired relative error for evaluation of the integrals.  For
				example, rerr = 0.01 indicates that the estimate of the
				integral is to be correct to one digit, whereas rerr = 0.001
				calls for two digits to be correct.

	eph		-	Array of photon energies for which the flux is calculated.

	eebrk	-	Break energy in the electron distribution function
				(in keV).  This input is not used in Brm_DmlinO, but is passed
				to Function Brm_FThick.

	gamlow	-	Electron gamma corresponding to the low energy cutoff.  This
				input is not used in Brm_DmlinO, but is passed to
				Function Brm_FThick.

	gambrk	-	Electron gamma corresponding to eebrk.  This input is not used
				in Brm_DmlinO, but is passed to Function Brm_FThick.

	gamhigh	-	Electron gamma corresponding to the high energy cutoff.  This
				input is not used in Brm_DmlinO, but is passed to
				Function Brm_FThick.

	p		-	Power-law index below eebrk.  This input is not used in
				Brm_DmlinO, but is passed to Function Brm_FThick.

	q		-	Power-law index above eebrk.  This input is not used in
				Brm_DmlinO, but is passed to Function Brm_FThick.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_DmlinO, but is passed to Function Brm_FThick.

	EFD		-	Keyword to be passed to Function Brm_FThick.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

	Brm_DmlinO	-	Array of estimates of the integrals corresponding to the photon
					energies and limits of integration specified.

	ier1		-	Array of error flags from the outer integration.  The numerical
					integration converged where ier1 = 0, and did not converge
					where ier1 = 120.

	ier2		-	Array of error flags from the inner integration.  The numerical
					integration converged where ier2 = 0.  Elsewhere, the value of
					ier2 is the number of integrations that did not converge.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:


 CALLED BY:
	Brm_BremThick
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	This function is based upon the routine xgauleg found in "Numerical
	Recipes Example Book (FORTRAN)," Second Edition, Cambridge University
	Press, p. 48.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
   Documentation is provided in the file brm_thick_doc.pdf
   (Adobe Acrobat Reader required).
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf


Brm_ELoss $SSW/packages/xray/idl/brm/brm_eloss.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_ELoss

 PURPOSE:
	Computes the energy dependent terms of the collisional energy loss rate for
	the energetic electrons, returned as dedt.  The numerical coefficient,
	decoeff, is computed in Pro Brm_BremThick.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_ELoss, eel, dedt

 CALLS:
	none
 INPUTS:
	eel		-	Array of abscissas at which to compute the energy dependent
				terms of the energy loss rate.

 OPTIONAL INPUTS:
	none

 OUTPUTS:
	dedt	-	Array of energy dependent terms of the energy loss rates
				corresponding to the input array eel.

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_FInner
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf


Brm_FInner $SSW/packages/xray/idl/brm/brm_finner.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_FInner

 PURPOSE:
	Returns the integrand for the (inner) bremsstrahlung integration.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_FInner(eel, eph, z)

 CALLS: ***
	Brm_BremCross, Brm_ELoss
 INPUTS:

	eel		-	Two-dimensional array of abscissas calculated in
				Pro Brm_GauLeg[53 or 54].

	eph		-	Array of photon energies.  Each element corresponds to a column
				of the two-dimensional array eel.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_FInner, but is passed to Pro Brm_BremCross.


 OPTIONAL INPUTS:
	none

 OUTPUTS:
   Brm_FInner	-	Array of integrands (for inner numerical integration)
					corresponding to input array eel.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_DmlinI
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf


Brm_FThick $SSW/packages/xray/idl/brm/brm_fthick.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_FThick

 PURPOSE:
	Returns the integrand for the (outer) bremsstrahlung integration.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_FThick(eo, eph, maxfcn, eebrk, gamlow, gambrk, gamhigh, p, $
		q, rerr, z, EFD, ier3)

 CALLS: ***
	Brm_Distrn, Brm_DmlinI
 INPUTS:

	eo		-	Two-dimensional array of abscissas calculated in
				Pro Brm_GauLeg[53 or 54].

	eph		-	Array of photon energies.  Each element corresponds to a column
				of the two-dimensional array eo.

	maxfcn	-	Maximum number of points for the Gaussian quadrature
				integration.  This input is not used in Brm_FThick, but is
				passed to Function Brm_DmlinI.

	eebrk	-	Break energy in the electron distribution function
				(in keV).

	gamlow	-	Electron gamma corresponding to the low energy cutoff.  This
				input is not used in Brm_FThick, but is passed to
				Pro Brm_Distrn.

	gambrk	-	Electron gamma corresponding to eebrk.  This input is not used
				in Brm_FThick, but is passed to Pro Brm_Distrn.

	gamhigh	-	Electron gamma corresponding to the high energy cutoff.  This
				input is not used in Brm_FThick, but is passed to
				Pro Brm_Distrn.

	p		-	Power-law index below the break energy.  This input is not used
				in Brm_FThick, but is passed to Pro Brm_Distrn.

	q		-	Power-law index above the break energy.  This input is not used
				in Brm_FThick, but is passed to Pro Brm_Distrn.

	rerr	-	Desired relative error for evaluation of the integrals.  For
				example, rerr = 0.01 indicates that the estimate of the
				integral is to be correct to one digit, whereas rerr = 0.001
				calls for two digits to be correct.  This input is not used in
				Brm_FThick, but is passed to Function Brm_DmlinI.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_FThick, but is passed to Function Brm_DmlinI.

	EFD		-	Keyword.  If set, the electron flux distribution is calculated.
				Otherwise, the electron density distribution is calculated.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

	Brm_FThick	-	Array of integrands (for outer numerical integration)
					corresponding to input array eo.

	ier3		-	Array of error flags from the inner Gaussian quadrature
					integrations.  The numerical integrations converged where
					ier3 = 0.  Elsewhere, the value of ier3 is the number of
					integrations that did not converge.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:


 CALLED BY:
	Brm_DmlinO
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran version of this code can be found at
   http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremthickdoc.pdf


Brm_FThin $SSW/packages/xray/idl/brm/brm_fthin.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_FThin

 PURPOSE:
	Returns the integrand for the bremsstrahlung integration.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Result = Brm_FThin(eel, eph, gamlow, gambrk, gamhigh, p, q, z, EFD)

 CALLS: ***
	Brm_BremCross, Brm_Distrn
 INPUTS:

	eel		-	Two-dimensional array of abscissas calculated in
				Pro Brm_GauLeg[53 or 54].

	eph		-	Array of photon energies.  Each element corresponds to a column
				of the two-dimensional array eel.

	gamlow	-	Electron gamma corresponding to the low energy cutoff.  This
				input is not used in Brm_FThin, but is passed to
				Pro Brm_Distrn.

	gambrk	-	Electron gamma corresponding to the break energy.  This input
				is not used in Brm_FThin, but is passed to Pro Brm_Distrn.

	gamhigh	-	Electron gamma corresponding to the high energy cutoff.  This
				input is not used in Brm_FThin, but is passed to
				Pro Brm_Distrn.

	p		-	Power-law index below the break energy.  This input is not used
				in Brm_FThin, but is passed to Pro Brm_Distrn.

	q		-	Power-law index above the break energy.  This input is not used
				in Brm_FThin, but is passed to Pro Brm_Distrn.

	z		-	Mean atomic number of the target plasma.  This input is not
				used in Brm_FThin, but is passed to Pro Brm_BremCross.

	EFD		-	Keyword.  If set, the electron flux distribution is calculated.
				Otherwise, the electron density distribution is calculated.


 OPTIONAL INPUTS:
	none

 OUTPUTS:
   Brm_FThin	-	Array of integrands corresponding to input array eel.

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:


 CALLED BY:
	Brm_Dmlin
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran Version of this code
   can be found at http://hesperia.gsfc.nasa.gov/hessi/flarecode/bremdoc.pdf

	09/30/2002,  At final equation, PC was replaced with BETA. This removes two factors of GAMMA,
				 correcting the photon spectrum at relativistic energies.


Brm_GauLeg $SSW/packages/xray/idl/brm/brm_gauleg.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_GauLeg

 PURPOSE:
	Returns arrays x and w of length n, containing the abscissas and weights
	of the Gauss-Legendre n-point quadrature formula, using either
   Brm_GauLeg53 or BrmGauLeg54.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_GauLeg, x1, x2, n, x, w

 CALLS: ***
	Brm_GauLeg53, Brm_GauLeg54, SINCE_VERSION [1], SINCE_VERSION [2]
 INPUTS:

	x1		-	Array containing lower limits of integration.

	x2		-	Upper limit(s) of integration.  This input may be either a
				scalar, or an array corresponding to x1.

	n		-	Number of points evaluated.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

   x		-	Two-dimensional array containing the abscissas of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.

	w		-	Two-dimensional array containing the weights of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_Dmlin, Brm_DmlinI, Brm_DmlinO, F_MULTI_THERM
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	Calls Brm_GauLeg53 if IDL version 5.3 or earlier is used.
   Calls Brm_GauLeg54 if IDL version 5.4 or later is used.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern

   Documentation is provided in the files brm_doc.pdf and brm_thick_doc.pdf
   (Adobe Acrobat Reader required).
	Documentation for the Fortran Version of this code can be found at
	http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


Brm_GauLeg53 $SSW/packages/xray/idl/brm/brm_gauleg53.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_GauLeg53

 PURPOSE:
	Returns arrays x and w of length n, containing the abscissas and weights
	of the Gauss-Legendre n-point quadrature formula.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_GauLeg53, x1, x2, n, x, w

 CALLS:
	none
 INPUTS:

	x1		-	Array containing lower limits of integration.

	x2		-	Upper limit(s) of integration.  This input may be either a
				scalar, or an array corresponding to x1.

	n		-	Number of points evaluated.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

   x		-	Two-dimensional array containing the abscissas of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.

	w		-	Two-dimensional array containing the weights of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_GauLeg
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	This procedure is based upon the subroutine in "Numerical Recipes in
	Fortran 77," Second Edition, Cambridge University Press, p. 145.  This
	procedure is intended to be used with IDL Version 5.3 or earlier.  A more
	efficient version of this procedure, Brm_Gauleg54, is available for use
	with IDL Version 5.4 or later.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran Version of this code can be found at
	http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


Brm_GauLeg54 $SSW/packages/xray/idl/brm/brm_gauleg54.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_GauLeg54

 PURPOSE:
	Returns arrays x and w, containing the abscissas and weights of the
	Gauss-Legendre n-point quadrature formula.

 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:
	Brm_GauLeg54, x1, x2, n, x, w

 CALLS:
	none
 INPUTS:

	x1		-	Array containing lower limits of integration.

	x2		-	Upper limit(s) of integration.  This input may be either a
				scalar, or an array corresponding to x1.

	n		-	Number of points evaluated.


 OPTIONAL INPUTS:
	none

 OUTPUTS:

   x		-	Two-dimensional array containing the abscissas of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.

	w		-	Two-dimensional array containing the weights of the Gauss-
				Legendre n-point quadrature formula.  Each column of this array
				corresponds to an element of the input array x1.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none

 CALLED BY:
	Brm_GauLeg
 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE:
	This procedure is based upon the subroutine in "Numerical Recipes in
	Fortran 77," Second Edition, Cambridge University Press, p. 145.  This
	procedure may be used only with IDL Version 5.4 or later.

 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 23 July 2001
   IDL version:  Sally House, summer intern
	Documentation for the Fortran Version of this code can be found at
	http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


Brm_Thick $SSW/packages/xray/idl/brm/brm_thick.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_Thick

 PURPOSE: To compute and plot the thick-target bremsstrahlung flux as a
          function of photon energy from a double-power-law distribution
          of electrons.


 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:


 CALLS:
	Brm_BremThick
 INPUTS:

	eph		-	Array of photon energies (in keV) at which to compute the
				photon flux.

	eelow	-	Low energy cutoff in the electron distribution function
				(in keV).

	eebrk	-	Break energy in the electron distribution function
				(in keV).

	eehigh	-	High energy cutoff in the electron distribution function
				(in keV).

	p		-	Power-law index of the electron distribution function below
				eebrk.

	q		-	Power-law index of the electron distribution function above
				eebrk.

	dena	-	Product of densty and area, where:
					densty = number density of nonthermal electrons (cm^-3)
                            or, if /EFD is specified, flux density
                            of nonthermal electrons (cm^-2 s^-1);
					area = area of the radiating source region (cm^2).


 OPTIONAL INPUTS: (see KEYWORDS)


 OUTPUTS:

	flux	-	Array of photon fluxes (in photons s^-1 keV^-1 cm^-2)
				corresponding to the photon energies in the input array eph.
				The detector is assumed to be 1 AU from the source.

	iergql	-	Array of error flags from the outer Gaussian quadrature
				integration procedure for integration over electron energies
				below eebrk.  The numerical integration converged where
				iergql = 0.  It did not converge where iergql = 120.

	iergqh	-	Array of error flags from the outer Gaussian quadrature
				integration procedure for integration over electron energies
				above eebrk.  The numerical integration converged where
				iergql = 0.  It did not converge where iergql = 120.

	iergqi	-	Array of error flags from the inner Gaussian quadrature
				integrations.  The numerical integrations converged where
				iergqi = 0.  Elsewhere, the value of iergqi is the number
				of integrations that did not converge.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:

   EFD  	- 	If present, the electron flux distribution is provided by
  				Pro Brm_Distrn.  Otherwise, the electron density distribution
       		is provided.


 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE: Type @brm_thick at the IDL command line.


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 9 August 2001
   IDL version:  Sally House, summer intern

   Documentation is provided in the file brm_thick_doc.pdf
   (Adobe Acrobat Reader required).

	Fortran Version of this code (bremthick):
   http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


Brm_Thin $SSW/packages/xray/idl/brm/brm_thin.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	Brm_Thin

 PURPOSE: To compute and plot the thin-target bremsstrahlung flux as a
          function of photon energy from a double-power-law distribution
          of electrons.


 CATEGORY:
	HESSI, Spectra, Modeling

 CALLING SEQUENCE:


 CALLS:
	Brm_BremSpec
 INPUTS:

	eph		-	Array of photon energies (in keV) at which to compute the
				photon flux.

	eelow	-	Low energy cutoff in the electron distribution function
				(in keV).

	eebrk	-	Break energy in the electron distribution function
				(in keV).

	eehigh	-	High energy cutoff in the electron distribution function
				(in keV).

	p		-	Power-law index of the electron distribution function below
				eebrk.

	q		-	Power-law index of the electron distribution function above
				eebrk.

	nthdenv	-	Product of nth, densty, and volume, where:
					nth = number density of plasma ions (cm^-3);
					densty = number density of nonthermal electrons (cm^-3)
                            or, if /EFD is specified, flux density
                            of nonthermal electrons (cm^-2 s^-1);
					volume = volume of the radiating source region (cm^3).


 OPTIONAL INPUTS: (see KEYWORDS)


 OUTPUTS:

	flux	-	Array of photon fluxes (in photons s^-1 keV^-1 cm^-2)
				corresponding to the photon energies in the input array eph.
				The detector is assumed to be 1 AU from the source.

	iergql	-	Array of error flags from the Gaussian quadrature integration
				procedure for integration over electron energies below eebrk.
				The numerical integration converged where iergql = 0.  It did
				not converge where iergql = 120.

	iergqh	-	Array of error flags from the Gaussian quadrature integration
				procedure for integration over electron energies above eebrk.
				The numerical integration converged where iergqh = 0.  It did
				not converge where iergqh = 120.


 OPTIONAL OUTPUTS:
	none

 KEYWORDS:

   EFD		-	If present, the electron flux distribution is provided by
  				Pro Brm_Distrn.  Otherwise, the electron density distribution
				is provided.


 COMMON BLOCKS:
	none

 SIDE EFFECTS:


 RESTRICTIONS:


 PROCEDURE: Type @brm_thin at the IDL command line.


 MODIFICATION HISTORY:
   Version 1, holman@stars.gsfc.nasa.gov, 9 August 2001
   IDL version:  Sally House, summer intern

   Documentation is provided in the file brm_doc.pdf
   (Adobe Acrobat Reader required).

	Fortran Version of this code (bremspec):
   http://hesperia.gsfc.nasa.gov/hessi/modelware.htm


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

 NAME: brmthick_power.pro


 PURPOSE:
            compute  nonthermal electron energy flux at ONE time interval
            The input  model parameters are of bremsstrahlung thick-target model
 OUTPUT:
               returne  the  nonthermal energy flux at one time interval


 CATEGORY:
       SPECTRA, XRAYS

 CALLING SEQUENCE:
       brmthick_power, electronflux, lowind, brkeng, highind, lowcut, highcut

 CALLS: ***
	Brm_Distrn, TOTAL_NONTHERM
 INPUTS:   6 fitting parametes for the thick-target model which includes:
             eletronflux; integrated electron flux/1.0e35     (electron s^-1)
                   lowind:       lower power-law index
                   brkeng:       break energy                               (keV)
                   highind:      higher power-law index
                   lowcut:       Low-energy cutoff                      (keV)
                   highcut;       High-energy cutoff                     (keV)

 CALLED BY:
	spex_nontherm_energy
 History:
                Linhui Sui (linhui.sui@gsfc.nasa.gov), 09/2005


BUILD_FNAME [1] $SSW/packages/spex/idl/original_spex/build_fname.pro
[Previous] [Next]

 NAME: BUILD_FNAME


 PURPOSE: Construct filenames from templates and replacement strings.


 CATEGORY: i/o, file management


 CALLING SEQUENCE: fname=build_fname(template, wildcard, inserts)
		    e.g.
		    fname= build_fname('SHER_IBDB_%_%.FITS','%',['0','1398'])
		    PRINT,FNAME
		    SHER_IBDB_0_1398.FITS

 CALLED BY: SPEX MENU


 CALLS TO: standard idl

 INPUTS:
       template - string including wildcards for replacement
	wildcard - string indicating replacement position
	inserts  - string(s) to replace wildcards with, no action on ''
	/upcase  - force all strings to uppercase
	/lowcase - force all strings to lowercase

 CALLED BY:
	FILE_SEARCHER [1], FILE_SEARCHER [2], OCC_DBASE, batse_file_search [1]
	batse_file_search [2]
 PROCEDURE:
	uses strpos and strmid to substitute for each wildcard in turn
	works only on scalar strings

 MODIFICATION HISTORY: ras, 18-jan-94


BUILD_FNAME [2] $SSW/packages/spex/pre2002/idl/build_fname.pro
[Previous] [Next]

 NAME: BUILD_FNAME


 PURPOSE: Construct filenames from templates and replacement strings.


 CATEGORY: i/o, file management


 CALLING SEQUENCE: fname=build_fname(template, wildcard, inserts)
		    e.g.
		    fname= build_fname('SHER_IBDB_%_%.FITS','%',['0','1398'])
		    PRINT,FNAME
		    SHER_IBDB_0_1398.FITS

 CALLED BY: SPEX MENU


 CALLS TO: standard idl

 INPUTS:
       template - string including wildcards for replacement
	wildcard - string indicating replacement position
	inserts  - string(s) to replace wildcards with, no action on ''
	/upcase  - force all strings to uppercase
	/lowcase - force all strings to lowercase

 CALLED BY:
	FILE_SEARCHER [1], FILE_SEARCHER [2], OCC_DBASE, batse_file_search [1]
	batse_file_search [2]
 PROCEDURE:
	uses strpos and strmid to substitute for each wildcard in turn
	works only on scalar strings

 MODIFICATION HISTORY: ras, 18-jan-94