fake_grm $SSW/hessi/idl/image/fake_grm.pro
[Previous] [Next]
 PROJECT : HESSI

 NAME :   fake_grm.pro

 PURPOSE: Simulates a grm structure from a model of two fake grids with
          given sub-collimator no., slit/pitch ratio and RMS dev.  The
          grid errors are assumed to be normally distributed.
              

 CATEGORY :    Imaging

 EXPLANATION: This supplies the temporary need to test programs that use grm.
              The program creates a transparancy function for each grid of a
              collimator pair, assuming equal RMS deviations
              and computes the fourier coefficients that go into grm.

 SYNTAX :  grm=fake_grm(n_collimator,s2p, RMSdev, hmax, offset [,/plot])

 EXAMPLE : grm=fake_grm(8, 0.45, 0.05, 5, 0.25)
           

 INPUTS :  N_collimator = scalar (0-8)
           s2p = arbitrary number > 0 and < 1 (should be LE true HESSI s2p)
           RMSdev = fractional RMS deviation of grid edges in units of pitch
           hmax = maximum no. of harmonics to appear in grm.
           offset = front-back phaseshift offset of subcollimator grids
                offset=1 corresponds to a 1-pitch offset

 OPT. INPUTS:
             

 KEYWORDS:  Set plot keyword via /plot to get a screen plot of the back
            transform using the coefficients created for grm.
           
 
 CALLS: ***
	HESSI_PARAMS
 COMMON : NONE


 WARNING:  
       The origin of the coordinate system used here is the left edge of the 
       1st slit.  This has an unknown relation to the true HESSI coord system!
           

 HISTORY :  9 Dec 1998  Version 1
            
            
 NOTES :
       
       
 CONTACT :  Ed Schmahl code 682, schmahl@hesperia.gsfc.nasa.gov


fft_uv2xy [1] $SSW/hessi/idl/image/visibility/ejs/fft_uv2xy.pro
[Previous] [Next]
 NAME:
       fft_uv2xy
 PURPOSE:
       calculate dirty map/beam and report information of scales
       set as a result of uv gridding
 CATEGORY:
   OVSA APC imaging
 CALLING SEQUENCE:
      fft_uv2xy,f_GHz, m, vis_ij, uv_ij, xyint, dbeam, dmap
 INPUTS:
       vis_ij : complex visibility as a fcn of time(i) & bsl(j)
       uv_ij  : complex (u,v) at the corresponding time & bsl
   m      : dimension of desired map = m x m
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
       -
 ROUTINES CALLED:
       -
 OUTPUTS:
        xyint, dbeam, dmap

 COMMENTS:
    1. Why so named? This code would be similar to fftmap.f
       fft_uv2xy = fft (visibility in uv plane) to xy plane,
           in clear contrast to
   fft_xy2uv = fft (map in xy plane) to uv plane.
    2. uv gridding is done here.
   uvint is automatically set rather than user's choice
   convol. griid fcn is also fixed to one type: tr. gaussian.
   While dmap is mxm arrary, dbeam is double sized, i.e., 2mx2m
   to do better cleaning.
 CALLED BY:
	clean [2], clean [3], clean [4], slfcal [1], slfcal [2]
 SIDE EFFECTS: -
 RESTRICTIONS: see comments
 MODIFICATION HISTORY:
     Written 05-JAN-2001 by JL


file__define $SSW/hessi/idl/gen/file__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       file__define

 PURPOSE:
       Defines a file object to manage file names and paths

 CATEGORY:
       gen/io (?)
       currently in hessi/gen

 CALLING SEQUENCE:
       o = file()

 METHODS:
       o->set, file_mask=file_mask, path = path, filename = filename
       var = o->get( /filename, /basename, /sort, /reverse, /first,
                     /path, /file_mask )
          -- use only one option at a time.
 KEYWORDS:
          -- /filename:
             * with get: returns the list of filenames associated with
             the path and the file_mask
             * with set: sets directly the file name wanted, and
             turns off the file searching with file_mask and path
          -- /basename: returns only the file name, without the path
          -- /sort: sorts the files alphabetically
          -- /reverse: in association with /sort, reverse sorting
             order
          -- /first: returns only the first filename in the
             (optionally sorted) list
          -- path:
             * with set: an array of directories to search for the
             files
             * with get: the array of directories set
          -- file_mask:
             * with set: a regular expression for selecting the files
             * with get: the regular expression set

 RESTRICTIONS:
       Lots. I'll try to generalize more and more. If you need a
       specific option please contact me.

 CALLS: ***
	CHECKVAR [1], FILE::CLEANUP, FILE::FILE_SEARCH, FILE::GET, FILE::GETSTATUS
	FILE::INIT, FILE::PRINT, FILE::SELECT_FILE, FILE::SET, FILE_BREAK, FILE_EXIST [2]
	FILE_TEST, IS_STRING, LAST_ITEM, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	checkvar [2], file_exist [1], file_exist [3]
 SEE ALSO:
	fitsread__define, fitswrite__define
 HISTORY:
       2004-sep-15  -- some corrections in the way the sorting works
       2004-apr-21  -- deactivated file_search, which is sort of crap
       2004-apr-13  -- sorting option is always set when /last or
                       /first are used; it does not make sense otherwise.
       April 2004   -- correct a problem with passing parameters to ::get
       January 2004 -- adaptations to make it work with IDL < 5.5
                       (forward_function) acs
                    -- removed the /fold on file_search that does not
                       work on all machines acs
       October 2003 -- first version, tested with hsi_roll_db__define
           A Csillaghy, csillag@ssl.berkeley.edu (acs)


FILECACHE_CONTROL__DEFINE [1] $SSW/hessi/offline/filecache_control__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FILECACHE_CONTROL__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       filecache_control__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 SEE ALSO:
 HISTORY:
       Version 1, January 5, 2000, 
           A Csillaghy, csillag@ssl.berkeley.edu


FILECACHE_CONTROL__DEFINE [2] $SSW/hessi/offline/filecache_info__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FILECACHE_CONTROL__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       filecache_control__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	FILECACHE_INFO__DEFINE
 SEE ALSO:
 HISTORY:
       Version 1, January 5, 2000, 
           A Csillaghy, csillag@ssl.berkeley.edu


FILTER_ATTEN $SSW/hessi/idl/spectra/filter_atten.pro
[Previous] [Next]
 PROJECT: 
	SDAC
 NAME: 
	FILTER_ATTEN
 CATEGORY: 
	HESI, HESSI, RESPONSE
 PURPOSE: 
	This function returns the attenuation factor of a composite window, 0-1.
	Uses the photo-electric + 1/2 the Compton cross-section.
 CALLING SEQUENCE:  
	result = filter_atten( e, z, d)
 INPUTS:
	e - energy in keV
	z - atomic number of each component
	d - thickness of each component in cm	
 OPTIONAL INPUTS:
	None
 OUTPUTS:
	returns the attenuation factor, a floating point vector
 OPTIONAL OUTPUTS:

 CALLED BY:
	HESSI_FILTERS, ROUTINE_NAME [1], get_slider, out_spectra_4_designer, set_field
 PROCEDURE:
	The xray cross-sections and thicknesses determine the attenuation
	from the stand formula, attenuation = 1/exp( cross_section * distance )
 KEYWORD INPUTS:
	PANKOW - If set, then use Pankow MLI design of 22-0ct-1997 quoted
	by Paul Turin: Dave Pankow tells me he thinks
	the plan is more like 5 layers on the grids and 10 in the cryostat of 1/2
	mil mylar, only valid with multiple elements in Z causing
	the multilayer keyword to be set in OTHER_FILTERS()
	NOMULTILAYER - If set, then don't add any materials not included explicitly. 

	CM2PERGRAM - if set then d is in units of gm/cm3	
 CALLS: ***
	CHECKVAR [1], F_DIV, checkvar [2], other_filters [1], other_filters [2], xsec
 RESTRICTIONS:
	1-1000 keV, 87 common elements available to xsec.pro
 COMMON BLOCKS:
	FILTER_ATTEN

 MODIFICATION HISTORY:
	ras, 23-jan-94
	richard.schwartz@gsfc.nasa.gov, 22-oct-1997, added pankow keyword
	Version 3,
	richard.schwartz@gsfc.nasa.gov, 8-jan-1998, added nomultilayer keyword


filter_cmpnd $SSW/hessi/idl/spectra/filter_cmpnd.pro
[Previous] [Next]
 NAME: filter_cmpnd
	
 PURPOSE: Return the attenuation factor of a composite window
	Uses the photo-electric + 1/2 the Compton cross-section
 CALLING SEQUENCE:  
	result = filter_cmpnd( e, z, d)
 INPUTS:
	e - energy in keV
	z - atomic number of each component
	d - thickness of each component in cm	
 OPTIONAL INPUTS:
	cm2pergram - if set then d is in units of gm/cm3	
 OUTPUTS:
	returns the attenuation factor, a floating point vector
 OPTIONAL OUTPUTS:

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

 CALLS: ***
	F_DIV, xsec
 RESTRICTIONS:
	1-1000 keV, 87 common elements available to xsec.pro
 MODIFICATION HISTORY:
	ras, 23-jan-94


FIND_CLASS object class_name $SSW/hessi/idl/objects/find_class.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FIND_CLASS( object, class_name )

 PURPOSE:
       Traverses the whole tree of classe to find a class, and returns the object reference.

       *note:* this does not apply to this version any more:
       For Frameworks, it searches into all
       the sources that contain a valid object, but it traverses
       further only on the source with index 0. For Strategy_Holders,
       in uses the function Strategy_Holder::GetStrategy() to find
       out if the strategy is available (hence creating it if it is
       not already created) before traversiong on source[0] as for
       frameworks.
       *end note*

 CATEGORY:
       Objects

 CALLING SEQUENCE:
       class_found = find_class( start_object, class_name )

 INPUTS:
       start_object: the object reference where the traversing should
                     start. Must be a subclass of Framework or
                     Strategy_Holder
       class_name: the name of the class to search

 OUTPUTS:
       class_found: the object reference of the class, or -1 if not found

 KEYWORDS:
       VERBOSE: if set prints one of these ennoying messages.
       FC_GET_ID: an ID assigned by framework, no use for users.

 CALLS: ***
	FIND_CLASS
 SEE ALSO:
	framework__define
 HISTORY:
       1-sep-2004 - added the keyword fc_get_id  which allows to
                    control the classes find_class already visited
                    such that it does not visit a class twice. The
                    mechanism is internal and shoudl not be used at
                    the user level. The framework assigns an id that
                    is used to track down the recursion.

       29-oct-2003: rewritten with recursion. need to decide about
       the way to deal with strategies and/or multiple traversals of
       the object tree.

       12-aug-2003: acs, change to fix a bug that showed up in idl 6
       (returns an array instead of a scalar)

       Release 6: includes strategy_holder handling, September 2001, ACs

       Version 1, July 03, 2000,
           A Csillaghy, csillag@ssl.berkeley.edu


FITS CLASS DEFINITION $SSW/hessi/idl/util/hsi_fits__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS CLASS DEFINITION

 PURPOSE:
       Provides tools to read HESSI FITS packet files. This is an
       extension of hsi_packet_file, i.e. most of the functionality
       is there.

 CATEGORY:
       HESSI Utilities

 CONSTRUCTION:
       obj = Obj_New( 'hsi_fits' )

       The variable obj is the object reference used to
       access packet data in the fits file.

 INPUTS (CONTROL) PARAMETERS:
       Same as hsi_packet_file

 OUTPUTS (INFORMATION) PARAMETERS:
       Same as hsi_packet_file

 METHODS DEFINED IN THIS CLASS
       BuildTable: Reads the lookup table binary extension of the FITS file
       BuildfileOffset: Stores into a variable the byte # where the
                        data starts in the file.

 CALLS: ***
	FXBHEADER [1], FXBHEADER [2], FXBOPEN [1], FXBOPEN [2], FXBOPEN [3], HAVE_TAG
	HEADFITS [1], HEADFITS [2], HEADFITS [3], HSI_FITS::BUILDFILEOFFSET
	HSI_FITS::BUILDTABLE, HSI_FITS__DEFINE, HSI_SCTIME2ANY, HSI_USE_SIM, MRDFITS [1]
	MRDFITS [2], SXPAR [1], SXPAR [2], SXPAR [3], VALID_FITS, hsi_get_debug [1]
	hsi_get_debug [2]
 HISTORY:
       2002-10-24, Kim.  Changed some message calls to hsi_message.  Added
        checks for using sim data when sim not selected, or flight data
        when sim is selected
       2002-02-24: check the instrume data type to be sure it's
                   defined acs
       Release 5.1: doc header updated
       Release 4 development, December 1999,
           A Csillaghy, csillag@ssl.berkeley.edu


FITS INFORMATION CONTROL STRUCTURE DEFINITION $SSW/hessi/idl/util/hsi_fits_info__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS INFORMATION CONTROL STRUCTURE DEFINITION

 PURPOSE: 
       Defines the data type of the structure that controls the
       output of the packet object

 CATEGORY:
       HESSI Utilities
 
 CALLING SEQUENCE: 
       var = {hsi_packet_control}

 TAG NAMES:

 EXAMPLES:
       To initialize, use hsi_packet_control() which will set the
       default values 

 CALLS: ***
	HSI_FITS_INFO__DEFINE
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/reference.html#hsi_packet_control
 HISTORY:
       Version 1, April 29, 1999, 
           A Csillaghy, csillag@ssl.berkeley.edu


FITS LOOKUP TABLE STRUCTURE DEFINITION $SSW/hessi/idl/util/hsi_lookup_table__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS LOOKUP TABLE STRUCTURE DEFINITION

 PURPOSE: 
       The lookup table stores the information needed by the packet
       reader to make selections of packets to read

 CATEGORY:
       HESSI Utilities
 
 CALLING SEQUENCE: 
       var = Replicate( {hsi_lookup_table}, n_packets } 
       where n_packets is the number of packets available
 
 TAGS:
       app_id: the application id of the packet
       collect_time: the UT collect time of the packet
       bad_pak: a flag telling if the packet has been marked bad by
                hsi_contact2fits
       atten_state: the attenuator state
       fr_enable: tells if fast rate mode enabled
       in_sun: tells if the s/c is in sun or in eclipse
       ssr_state: the state of the on-board memory 0 (empty), to 8(full)

 EXAMPLES:
       

 CALLS: ***
	HSI_LOOKUP_TABLE__DEFINE
 SEE ALSO:
 HISTORY:
       12-nov-2001, jmm, Added ssr_state
       Release 6, Sept 2001, taken seq_cnt and length out, and
       introduce 
       Release 3, August 1999
       Release 2, May 3, 1999, 
           A Csillaghy, csillag@ssl.berkeley.edu


FITS READER CLASS $SSW/hessi/idl/gen/fitsread__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS READER CLASS

 PURPOSE:
       Interface to access FITS files

 CATEGORY:
       gen/fits

 CONSTRUCTION:
       o = fitsread()

 METHODS:
       data = o->getdata( [/HEADER] )

 KEYWORDS:
       HEADER (getdata): retrieves the fits header instead of the data

 CALLS: ***
	CHECKVAR [1], FITSREAD, FITSREAD_TEST, FITSREAD__DEFINE, HSI_SCTIME2ANY
	checkvar [2], datetime
 EXAMPLES:
       

 EXTENDS:
       fitsgen

 HISTORY:
      Oct-2003: created to try to find a solution to the zillions of
                fits readers that are around.


FITS READER CONSTRUCTOR $SSW/hessi/idl/gen/fitsread.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS READER CONSTRUCTOR

 PURPOSE:
       Creates an object of the class fitsread

 CATEGORY:
       gen/fits

 CONSTRUCTION:
       o = fitsread()

 SEE ALSO
       fitsread__define

 CALLS: ***
	FITSREAD
 HISTORY:
       Oct-2003: created csillag@ssl.berkeley.edu


FITS WRITER CLASS FOR ANY RHESSI DATA TYPES $SSW/hessi/idl/util/hsi_fitswrite__define.pro
[Previous] [Next]

 PROJECT:
       HESSI

 NAME:
       FITS WRITER CLASS FOR ANY RHESSI DATA TYPES

 PURPOSE:
       This is a general interface to write RHESSI any data types into
       fits files. The class is based on fitswrite, which is the general
       class for writing fits files.
 
       When writing FITS files with this writer, you get for free a primary
       header that contains all general-purpose parameters of RHESSI data
       sets. Furthermore, in its normal use, the writer also writes
       automatically two
       additional extensions before writing your data type. It writes first a
       control parameters extension and an info parameter extension, such
       that it should be possible to restart any analysis from the
       infromation contained in a given RHESSI file. 

       This FITS writer thus is strongly connected with the class
       hsi_fileandraw that manages reading RHESSI data either from FITS files or
       from raw telemetry data.

 CATEGORY:
       hessi/util

 CONSTRUCTION:
       o = hsi_fitswrite( hessi_object )

 ARGUMENT: 
       hessi_object: an object of hessi type, i.e. calib_eventlist,
       visibility, image, etc...

 METHODS:
       Check also the methods of fitswrite__define. The following methods are
       overwritten or added:

       defaultname: deals with the default hessi names, overwritten
       write: the main write method
       write_info_extension: writes all info parameters available
       write_control_extension: writes  all control parameters available
       makeheader: overwritten, allows to create the standard RHESSI promary header

 CALLS: ***
	ADD_TAG [1], ADD_TAG [2], ARR2STR [1], Arr2Str [2], CHECKVAR [1], FXADDPAR [1]
	FXADDPAR [2], HSI_CALIB_EVENTLIST, HSI_FITSWRITE::DEFAULTNAME
	HSI_FITSWRITE::INIT, HSI_FITSWRITE::MAKEHEADER, HSI_FITSWRITE::WRITE
	HSI_FITSWRITE::WRITE_CONTROL_EXTENSION, HSI_FITSWRITE::WRITE_HSI_EXTENSION
	HSI_FITSWRITE::WRITE_INFO_EXTENSION, HSI_FITSWRITE_TEST
	HSI_FITSWRITE__DEFINE, MINMAX [1], MINMAX [2], TIME2FILE, anytim [1], anytim [2]
	anytim [3], anytim [4], anytim [5], checkvar [2], hsi_params_2_top_struct
 EXAMPLES:
       Usually this object is embedded into the code of the individual hessi
       classes. See for instance the fitswrite method of hsi_calib_eventlist
       
 EXTENDS:
       fitswrite__define

 KNOWN SUBLCASS:
       hsi_image_fitswrite__define
 HISTORY:
      Aug-2005- acs, added lots of stuff to make it work for calibrated event
                lists. So at this poit it is used for images, calibrated
                event lists, spectra, and visibilities.
      Jan-2005: Version for beta testing of hsi_image
      Oct-2003: created to try to find a solution to the zillions of
                fits readers that are around. csillag@ssl.berkeley.edu


FITS WRITER CLASS FOR RHESSI IMAGES $SSW/hessi/idl/image/hsi_image_fitswrite__define.pro
[Previous] [Next]

 PROJECT:
       HESSI

 NAME:
       FITS WRITER CLASS FOR RHESSI IMAGES

 PURPOSE:
       This should be a general interface to write RHESSI data types into
       fits files. The class is based on fitswrite, which is the general
       class for writing fits files.

 CATEGORY:
       gen/fits

 CONSTRUCTION:
       o = obj_new( 'hsi_image_fitswrite' )

 METHODS:
       Check the methods of fitswrite__define. It also adds these methods:
       write_single_info_extension
       write_info_extension
       write_info_summary
       write_control_extension
       write_primary_hdu

 CALLS: ***
	APPEND_ARR, CHECKVAR [1], COMP_FITS_CRPIX, EXIST, FXADDPAR [1], FXADDPAR [2]
	HSI_IMAGE_FITSWRITE::DEFAULTNAME, HSI_IMAGE_FITSWRITE::MAKEHEADER
	HSI_IMAGE_FITSWRITE::WRITE_CONTROL_EXTENSION
	HSI_IMAGE_FITSWRITE::WRITE_INFO_EXTENSION
	HSI_IMAGE_FITSWRITE::WRITE_INFO_SUMMARY
	HSI_IMAGE_FITSWRITE::WRITE_SINGLE_INFO_EXTENSION
	HSI_IMAGE_FITSWRITE__DEFINE, REM_TAG [1], REM_TAG [2], checkvar [2], str_sub2top
 EXAMPLES:
       Currently this is used exclusively in hsi_image_strategy::fitswrite.

 EXTENDS:
       fitsgen__define

 HISTORY:
      Jan-2005: Version for beta testing of hsi_image
      Oct-2003: created to try to find a solution to the zillions of
                fits readers that are around. csillag@ssl.berkeley.edu


FITS WRITER CLASS $SSW/hessi/idl/gen/fitswrite__define.pro
[Previous] [Next]

 PROJECT:
       HESSI

 NAME:
       FITS WRITER CLASS

 PURPOSE:
       Interface to write FITS files

 CATEGORY:
       gen/fits

 CONSTRUCTION:
       o = fitswrite()

 METHODS:
       data = o->getdata( )
       header = o->getheader() --- returns the header that will be
                                   written to the fits file
       o->setheader, header --- sets the header to write, pretty
                                low-level though, use addpar instead
       o->addpar, param_name, param_value --- ads a parameter
                                              param_name to the
                                              fits header, and
                                              assigns it the value
                                              param_value
       o->write, /create --- writes the fits file on disk, either
                             adds a new extension or creates a new
                             file with the option /create
       o->adddata, data -- adds data "rows" to the data already
                           in the table
 KEYWORDS:
       CREATE (write) --- creates a new file instead of appending to
                          the old file

 CALLS: ***
	CHECKVAR [1], DIST, EXIST, FITSWRITE, FITSWRITE::ADDDATA, FITSWRITE::ADDPAR
	FITSWRITE::EMPTY_HDU, FITSWRITE::GET, FITSWRITE::GETHEADER, FITSWRITE::INIT
	FITSWRITE::MAKEHEADER, FITSWRITE::OK_PRIMARY, FITSWRITE::SET
	FITSWRITE::SETDATA, FITSWRITE::SETHEADER, FITSWRITE::WRITE
	FITSWRITE::WRITE_EXTENSION, FITSWRITE::WRITE_PRIMARY, FITSWRITE_TEST
	FITSWRITE__DEFINE, FXADDPAR [1], FXADDPAR [2], FXBHMAKE [1], FXBHMAKE [2]
	FXHMAKE [1], FXHMAKE [2], FXWRITE [1], FXWRITE [2], IS_STRING, MWRFITS, checkvar [2]
	is_number [1], is_number [2]
 EXAMPLES:


 EXTENDS:
       fitsgen__define

 HISTORY:
      Oct-2003: created to try to find a solution to the zillions of
                fits readers that are around. csillag@ssl.berkeley.edu
      Sep-2004: modified AddData to use linked list instead of
                pointers toward the
                effort to keep extensions in memory.


FITS WRITER CONSTRUCTOR [1] $SSW/hessi/idl/gen/fitswrite.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITS WRITER CONSTRUCTOR

 PURPOSE:
       Creates an object of the class fitswrite

 CATEGORY:
       gen/fits

 CONSTRUCTION:
       o = fitsread()

 SEE ALSO
       fitswrite__define
 CALLS: ***
	FITSWRITE
 HISTORY:
       Oct-2003: created csillag@ssl.berkeley.edu


FITS WRITER CONSTRUCTOR [2] $SSW/hessi/idl/util/hsi_fitswrite.pro
[Previous] [Next]
 PROJECT:
       HESSI
 NAME:
       FITS WRITER CONSTRUCTOR

 PURPOSE:
       This constructs a fits writer object for RHESSI FITS files.

 CATEGORY:
       hessi/util

 CONSTRUCTION:
       o = hsi_fitswrite( hessi_obj )

 INPUT ARGUMENT:
       hessi_obj: some hessi object like hsi_image, hsi_calib_eventlist,
       etc....

 CALLS: ***
	HSI_FITSWRITE
 SEE ALSO:
	hsi_fitswrite__define
 HISTORY: created aug 2005


FITSFILE__DEFINE [1] $SSW/hessi/idl/gen/fitsfile__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITSFILE__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       fitsfile__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	FITSFILE::CLEAR_CACHE, FITSFILE::GET, FITSFILE::SET, find_fits_ext
 SEE ALSO:
 HISTORY:
       Version 1, September 24, 2002, 
           A Csillaghy, csillag@ssl.berkeley.edu


FITSFILE__DEFINE [2] $SSW/hessi/idl/gen/fitsfile_in__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITSFILE__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       fitsfile__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	ADD_TAG [1], ADD_TAG [2], FITSFILE_IN::CLOSE, FITSFILE_IN::GETDATA
	FITSFILE_IN::GETHEADER, FITSFILE_IN::INIT, FITSFILE_IN__DEFINE, FXBTFORM [1]
	FXBTFORM [2], FXPAR [1], FXPAR [2], FXPOSIT [1], FXPOSIT [2], IEEE_TO_HOST [1]
	IEEE_TO_HOST [2], IEEE_TO_HOST [3], IEEE_TO_HOST [4], MRDFITS [1], MRDFITS [2]
	MRD_HREAD [1], MRD_HREAD [2], fitshead2struct
 SEE ALSO:
 HISTORY:
       Version 1, September 24, 2002, 
           A Csillaghy, csillag@ssl.berkeley.edu


FITSFILE__DEFINE [3] $SSW/hessi/idl/gen/fitsfile_out__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITSFILE__DEFINE

 PURPOSE:


 CATEGORY:


 CALLING SEQUENCE:
       fitsfile__define,

 INPUTS:


 OPTIONAL INPUTS:
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS:
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS:
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:


 CALLS: ***
	FITSFILE_OUT::ADDDATA, FITSFILE_OUT::ADDPAR, FITSFILE_OUT::INIT
	FITSFILE_OUT::WRITE, FITSFILE_OUT__DEFINE, FXADDPAR [1], FXADDPAR [2]
	FXBHMAKE [1], FXBHMAKE [2], FXHMAKE [1], FXHMAKE [2], FXWRITE [1], FXWRITE [2]
	MWRFITS
 SEE ALSO:
 HISTORY:
       Version 1, September 24, 2002,
           A Csillaghy, csillag@ssl.berkeley.edu


FITSFILE__DEFINE [4] $SSW/hessi/idl/util/fitsfile_eventlist__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITSFILE__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       fitsfile__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	FITSFILE_EVENTLIST::GETDATA, FITSFILE_EVENTLIST__DEFINE
 SEE ALSO:
 HISTORY:
       Version 1, September 24, 2002, 
           A Csillaghy, csillag@ssl.berkeley.edu


fitsgen $SSW/hessi/idl/gen/fitsgen__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       fitsgen

 PURPOSE:
       Superclass for the fits reader (fitsread__define) and writer (fitswrite__define)

 CATEGORY:
       gen/fits

 CALLING SEQUENCE:
       only through fitsread or fitswrite:
       o = fitsread()
       oo = fitswrite()

 METHODS:
       o->set, filename=filename, extension = extension,
       var = o->get( /filename, /extension, /header )
       par = o->getpar( parameter_name ) -- returns the value of the
                                            fits keyword named
                                            parameter_name (a string)

 KEYWORDS:
       FILENAME (set, get) -- the filename to read/write
       EXTENSION (set, get)--  the extension to read/write
       HEADER (get) -- returns the header of the current extension
                       (i.e. the extension number given by
                       o->get( /extension ) )
 RESTRICTIONS:
       Lots. I'll try to generalize more and more. If you need a
       specific option please contact me.

 CALLS: ***
	EXIST, FITSGEN::CLEANUP, FITSGEN::GET, FITSGEN::GETDATA, FITSGEN::GETEXTENSION
	FITSGEN::GETFIELD, FITSGEN::GETHEADER, FITSGEN::GETPAR, FITSGEN::INIT
	FITSGEN::NEXTEXTENSION, FITSGEN::READDATA, FITSGEN::READHEADER, FITSGEN::SET
	FITSGEN_TEST, FITSGEN__DEFINE, FITSREAD, FXPAR [1], FXPAR [2], HEADFITS [1]
	HEADFITS [2], HEADFITS [3], MRDFITS [1], MRDFITS [2], fitshead2struct
	str_tagval [1], str_tagval [2]
 SEE ALSO:
	fitsread__define, fitswrite__define
 HISTORY:
       9-Feb-2006, Kim.  add status keyword in call to getdata in getheader
       September 2004- acs, minor changes in getdata and getheader to
                       for taking into account that the primary HDU
                       is now the default.
       September 2004:  set primary extension as default in getheader.
           Sandhia Bansal
       December 2003: lots of additions csillag@ssl.berkeley.edu
       October 2003 : first version
           A Csillaghy, csillag@ssl.berkeley.edu


FITSHEADER__DEFINE $SSW/hessi/idl/gen/fitsheader__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FITSHEADER__DEFINE

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       fitsheader__define, 

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 SEE ALSO:
 HISTORY:
       Version 1, September 24, 2002, 
           A Csillaghy, csillag@ssl.berkeley.edu


FLARE_XRAY_MODEL $SSW/hessi/offline/flare_xray_model.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME: 
	FLARE_XRAY_MODEL

 PURPOSE:
	This function generates Model X-ray flux suitable for sensitivity studies.

 CATEGORY:
	XRAY, SIMULATIONS, RESPONSE

 CALLING SEQUENCE:
	flux = flare_xray_model( descriptor, edges )

 CALLS: ***
	FCHECK, F_2THERM_POW, F_VTH_BPOW, MORE [1], MORE [2], USE_VLTH, Vlth, edge_products
	wc_where [1], wc_where [2], where_arr [1], where_arr [2]
 INPUTS:
       Descriptor - A string describing the event, limited to the tags of
	flare_types = { active: active_region, micro: micro_flare,plmicro: plmicro_flare, thmicro: thmicro_flare,$
	c:c_flare, m:m_flare, x:x_flare, y:y_flare, mini:mini, june7a: june7, june7b: june7, june7c: june7, $
	june7d: june7, june7e: june7, june7f: june7, june7g: june7}
	The june7 spectra are taken from time intervals measured using SMM/HXRBS during the famed 7 June 1980 flare.
	Edges - 2xN photon channel edges in keV.
 OPTIONAL INPUTS:
	none

 OUTPUTS:
       The function returns the flare xray spectrum in units of photons/cm2/s/keV.

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 CALLED BY:
	COMPARE_SHUTTERS, HESSI_FLARE_SPECTRUM, HESSI_MODEL_COUNTS
 COMMON BLOCKS:
	flare_xray_model

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	Designed to be used in the 1-500 keV range.  No gamma ray lines have been included.

 PROCEDURE:
	This procedure has some standard soft/hard x-ray flare parameters and uses them to generate spectra using power-law
	and thermal spectral codes. This code was originally developed to model the expected HESSI count rates, but is appropriate
	for any solar X-ray spectrometer in sensitivity/pile-up trade-offs.

 MODIFICATION HISTORY:
	Version 1, Ricahrd.Schwartz@gsfc.nasa.gov, 1998.


FRAME ABSTRACT CLASS DEFINITION $SSW/hessi/offline/frame__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAME ABSTRACT CLASS DEFINITION

 PURPOSE: 
       Provides a framework for managing data transformation 
       data structures. The frame contains three main elements. The
       data structure  to be managed, the control parameters
       structure the informational parameters structure, and the
       administration structure. 

 CATEGORY:
       Object
 
 CONSTRUCTION: 
      The frame is inherited by application-specific concrete classes. The use of
      an abstract class without a concrete class does not make sense.

 METHODS:
      Get(): retrieves ancillary parameters, from control, info,
             admin and/or source objects. 
      GetData() retrieves primary data
      Set: sets values to control parameters
      SetData: passes data to a specific 
      Plot: plots the data
      Process: name of the procedure that implements teh algorithm
               associated with the data type
      Print: prints ancillary parameters
      Need_Update(): tells if the object must call the procedure
                     "process" to updat its state.

 INPUTS:
      Through the methods "Set" and "SetData"
      obj->Set, KEYWORD=value, KEYWORD=value, ...
      where KEYWORD corresponds to the name of a control parameter

 OUTPUTS:
      Through the accessor method "Get"
      value = obj->Get( /KEYWORD )
      where KEYWORD corresponds to the name of a admin, info, contro,
      or source parameter
  
 KEYWORDS: 
      ADMIN_STRUCT (Set): Initializes the admininstration structure,
                          type {admin}
      ADMIN_ONLY (Get): Retrieves only the admin parameters
      CLASS_NAME (Get, GetData): If set to a valid class name (string), retrieve
                        parameters for this class. Default: current
                                                            class
      CONTROL_STRUCT (Set): Sets the controil structure
      CONTROL_ONLY (Get): If set, retrievs only control parameters
      INFO_ONLY (Get): If set, retrievs only info parameters
      POINTER (GetData): If set, retrievs a reference to the
                         (orginal) data insteade of a copy.
      SOURCE_ONLY (Get): If set, retrievs only the source object reference
      THIS_CLASS_ONLY (Get): If set, retrieves data only for the
                             current class or for the class specified
                             by CLASS_NAME
      OBJECT_REFERENCE (Get): If set, retrieves the reference to the
                              current object.
      NOSINGLE (Get): If set, retrieves an anonymous structure even
                      if the  
      NOT_FOUND (Get, Set): Returns an array of strings containing
                            the name of the keywords that have NOT
                            been found
      FOUND (Get): Returns a string array containing the names of the
                   keywords that have been found

 CALLS: ***
	APPEND_ARR, DATATYPE [1], DATATYPE [2], DATATYPE [3], FRAME::CLEANUP, FRAME::GET
	FRAME::GETDATA, FRAME::INIT, FRAME::NEED_UPDATE, FRAME::PRINT, FRAME::PROCESS
	FRAME::SET, FRAME::SETDATA, FRAME__DEFINE, GET_TAG_INDEX, JOIN_STRUCT [1]
	JOIN_STRUCT [2], XSTRUCT, chktag, get_uniq, str_subset
 EXAMPLE:
      To create a frame that manages the algorithm for 
      y = ax^2 + bx + c, input x, output y, and returns also the time
      to compute.


      1. Define the control structure: {a: 0.0, b:0.0, c:0.0}
      2. Define the info structure: 

 HISTORY:
       HESSI SW Release 4, March 2000
       Based on hsi_super__define, but generalized.
           June 28, 1999, A Csillaghy, csillag@ssl.berkeley.edu
       hsi_super: March 4, 1999, for Release 2 
           A Csillaghy, csillag@ssl.berkeley.edu


FRAMEWORK ABSTRACT CLASS DEFINITION $SSW/hessi/idl/objects/framework__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAMEWORK ABSTRACT CLASS DEFINITION

 PURPOSE:
       Provides a generic framework to manage scientific data processing.
       The framework contains four main elements:
       - The primary data which needs to be managed
       - The control parameters
       - The informational parameters
       - The administration parameters.
       The framework is inherited by application-specific concrete
       classes. It is based on the template method design pattern.
       The abstract class cannot be used without a concrete class.

 CATEGORY:
       Object

 CONSTRUCTION:

       Only through the concrete class

       Look at
       http://hessi.ssl.berkeley.edu/software/hessi_oo_concept.html
       for information on how to use a framework.

 METHODS DEFINED IN THIS CLASS:

      All these methods have a bunch of keywords associated. Look
      down below.

      Get(): retrieves ancillary parameters, from control, information,
             administration and/or source objects.  If only one parameter is
             requested, Get returns the value of this parameter
             unless /NOSINGLE is set. If more than one parameter are
             requested, Get returns an anonymous structure that have
             for tags the parameters requested.
             For pointer-type variables, Get does an automatic
             dereferencing, i.e. it
             returns the variables to which the pointers are
             pointing rather than the pointers
             (but see also /NO_DEREFERENCE).

      GetData(): Retrieves primary data. When this function is
                 called, the object checks whether the
                 control parameters have changed, using the function
                 Need_Update (see below). If parameters have changed,
                 it assumes that data need to be recomputed and Process
                 is called. Otherwise the object retrieves the contents of
                 its memory, and makes the appropriate selection
                 depending on the keyword parameters. Note that most
                 of the time this procedure is only the generic part
                 of a redefined procedure GetData in the concrete class.

      Set: Sets values to control parameters. Set does not just store
           the parameter values into a data structure. It first
           checks if the parameters are the same as those already
           stored. If they are, it just returns. If they are not, it
           will set the need_update flag in the administration
           structure to 1.

      SetData: Input primary data into the framework. This is
               usually called by the procedure Process

      Plot: plots the data. This generally first calls GetData, and
            generates a "view" of the data. Often, tough, the data
            may be strongly summarized. The generic plotting routine
            is empty.

      Process: This procedure is called whenever an object needs to
               be updated. It reads in the control parameters
               associated with the class, reads in the data form a
               source object (or from any other sources), process the
               source data and stpres the results into the object's memory.

      Print: prints control, info, and admin parameters

      Need_Update(): Returns "1" if the object must call the procedure
                     "Process" to update its state; otherwise "0."

 INPUT (CONTROL) PARAMETERS DEFINED IN THIS CLASS:

      Through the concrete class

      Primary data: through the accessor method "SetData":
          obj->SetData, data
          data must match the object data type definition!

      Control parameters: through the accessor method "Set":
          obj->Set, KEYWORD=value, KEYWORD=value, ...
          where KEYWORD corresponds to the name of a control parameter

 OUTPUT (INFO) PARAMETERS DEFINED IN THIS CLASS:

      Through the concrete class

      Primary data: through the accessor method "GetData"
          data = obj->GetData()

      Control, info and admin parameters: through the accessor method
                                          "Get":
      value = obj->Get( /KEYWORD )
      where KEYWORD corresponds to the name of a admin, info, contro,
      or source parameter

 KEYWORDS:
      /ADMIN_ONLY: (Get) Set this to retrieve only the
                   administration  parameters
      ADMIN_STRUCT:(Set) Initializes the admininstration structure,
                    type {admin}
      CLASS_NAME: (Get, GetData) If set to a valid class name
                  (string), retrieves parameters for the class
                  specified and all its sources recursively.
                  Default: current class
      /CONTROL_ONLY: (Get) Set this to retrieve only control parameters
      CONTROL_STRUCT (Set): Sets the controil structure
      FOUND (Get): Set this to a named variable to get the names of
                   the parameters found in a string array
      /INFO_ONLY: (Get) Set this to retrieve only information parameters
      POINTER (GetData): If set, retrievs a reference to the
                         (orginal) data insteade of a copy.
      SOURCE_ONLY: (Get) Set this to retrieve the source object
                   reference. See also SRC_INDEX.
      SRC_INDEX: (Get) Set this to the index or array of indices
                 of the source object(s) you want
                 to get with SOURCE_ONLY. Default: 0
      THIS_CLASS_ONLY: (Get) Set this to retrieve data only for the
                             current class or for the class specified
                             by CLASS_NAME
      OBJECT_REFERENCE: (Get) Set this to retrieves the object
                              reference of the class specified by
                              CLASS_NAME
      NO_DEREFERENCE: (Get) Set this to prefent automatic
                      dereferencing of pointer-type tags.
      NOSINGLE: (Get) Set this to retrieve an anonymous structure even
                      for a single parameter request
      NOT_FOUND (Set): Returns an array of strings containing
                       the name of the keywords that have NOT
                       been found

 CALLS: ***
	CHECKVAR [1], DATATYPE [1], DATATYPE [2], DATATYPE [3], EXIST, FIND_CLASS
	FRAMEWORK::CLEANUP, FRAMEWORK::GET, FRAMEWORK::GETDATA, FRAMEWORK::GETID
	FRAMEWORK::GET_FC_ID, FRAMEWORK::GET_THIS_CLASS_PARS, FRAMEWORK::INIT
	FRAMEWORK::NEED_UPDATE, FRAMEWORK::NEWGET, FRAMEWORK::NEWSET, FRAMEWORK::PRINT
	FRAMEWORK::SET, FRAMEWORK::SETDATA, FRAMEWORK::SET_FC_ID
	FRAMEWORK::SET_LAST_UPDATE, FRAMEWORK__DEFINE, FREE_VAR, JOIN_STRUCT [1]
	JOIN_STRUCT [2], SINCE_VERSION [1], SINCE_VERSION [2], UNIQ [1], UNIQ [2]
	UNIQ [3], XSTRUCT, checkvar [2], chktag, hsi_get_debug [1], hsi_get_debug [2]
	str_subset
 EXAMPLE:

 HISTORY:
       2006-08-02 - Kim.  Added set_last_update method and call it from setdata.
       2005-05-10 - acs changes in the get procedure to correct a bug in the
                    way it deals with subnames. The change is a small fix
                    that shoudl hold until the ne get procedure comes along.
       2004-10-16 - acs changed free_var to heap_free for idl > 5.3,
                    to hope to try to reduce the memory leakages
       2004-09-01 - acs added a new counter, fc_get_id, that (in
                    addition to fw_get_id) flags the classes visited
                    by find_class when a specific class in the object
                    chain is searched. The classes flagged are not
                    visited again when they got the same fc_get_id as
                    the object that want to visit them.
       2004-05-21 - Now framework defines a counter to manage the
                    last_update stuff. The counter increases every
                    time setdata is called. This is needed because as
                    of 2004 may, the fastest machines get similar
                    values for last_update when using the system
                    time. the system time is only precise to the
                    milisecond, which is not enough.
                    In addition need_update was completely rewritten
                    and is twice as fast now.
       Release 5.1: January 2001 Documentation update
                    December 2000 Change ptr_free to free_var from
                     Paul Billodeau
       Release 5, July 2000
       Release 4, March 2000
       Based on hsi_super__define, but generalized.
           June 28, 1999, A Csillaghy, csillag@ssl.berkeley.edu
       hsi_super: March 4, 1999, for Release 2
           A Csillaghy, csillag@ssl.berkeley.edu


FRAMEWORK_TAG2COMMAND $SSW/hessi/idl/objects/framework_tag2command.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAMEWORK_TAG2COMMAND()

 PURPOSE: 
       

 CATEGORY:
       
 
 CALLING SEQUENCE: 
       result = framework_tag2command()

 INPUTS:
       

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       None.

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	VAL2STRING
 SEE ALSO:
 HISTORY:
       Version 1, October 30, 2002, 
           A Csillaghy, csillag@ssl.berkeley.edu


FRAMEWORK_TEMPLATE_CONTROL $SSW/hessi/idl/objects/framework_template_control.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAMEWORK_TEMPLATE_CONTROL

 PURPOSE: 
       (*
       THIS IS NOT RUNNING CODE!
       This template is designed to help define the initialization
       function that assign default values to control parameters.  
       as used by frameworks. You can modify this template
       as you wish and remove all comments that are between (* *). Replace
       framework_template_control with the name of your
       structure, which is usually the name of the object class
       followed by "_control"
       *)

 CATEGORY:
       (* put here the category of the object class *)
 
 CALLING SEQUENCE:
       (* replace by the name of your class *)
       var = Framework_Template_Control() 

 CALLED BY:
	HESSI FRAMEWORK TEMPLATE CLASS [1]
 SEE ALSO:
	(*, *)
	http://hessi.ssl.berkeley.edu/software/hessi_oo_concept.html
	Put here further references. For explanantions on how to, please check:
	use framework templates
 HISTORY:
       Version 1, February 10, 2001, 
           A Csillaghy, csillag@ssl.berkeley.edu


FRAMEWORK_TEMPLATE_CONTROL__DEFINE [1] $SSW/hessi/idl/objects/framework_template_control__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAMEWORK_TEMPLATE_CONTROL__DEFINE

 PURPOSE: 
       (*
       THIS IS NOT RUNNING CODE!
       This template is designed to help define control structures
       that can be used by frameworks. You can modify this template
       as you wish and remove all comments that are in (* *). Replace
       framework_template_control with the name of your control
       structure, which is usually the name of the object class
       followed by "_control"
       *)

 CATEGORY:
       (* put here the category of the object class *)
 
 CALLING SEQUENCE:
       (* replace by the name of your class *)
       var = {framework_template_control} 

 SEE ALSO:
	(*, *)
	http://hessi.ssl.berkeley.edu/software/hessi_oo_concept.html
	Put here further references. For explanantions on how to, please check:
	use framework templates
 HISTORY:
       Version 1, February 10, 2001, 
           A Csillaghy, csillag@ssl.berkeley.edu


FRAMEWORK_TEMPLATE_CONTROL__DEFINE [2] $SSW/hessi/idl/objects/framework_template_info__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       FRAMEWORK_TEMPLATE_CONTROL__DEFINE

 PURPOSE: 
       (*
       THIS IS NOT RUNNING CODE!
       This template is designed to help define control structures
       that can be used by frameworks. You can modify this template
       as you wish and remove all comments that are in (* *). Replace
       framework_template_control with the name of your control
       structure, which is usually the name of the object class
       followed by "_control"
       *)

 CATEGORY:
       (* put here the category of the object class *)
 
 CALLING SEQUENCE:
       (* replace by the name of your class *)
       var = {framework_template_control} 

 SEE ALSO:
	(*, *)
	http://hessi.ssl.berkeley.edu/software/hessi_oo_concept.html
	Put here further references. For explanantions on how to, please check:
	use framework templates
 HISTORY:
       Version 1, February 10, 2001, 
           A Csillaghy, csillag@ssl.berkeley.edu


free_all_lun $SSW/hessi/idl/util/free_all_lun.pro
[Previous] [Next]
NAME:
 free_all_lun
PROJECT:
 HESSI
CATEGORY:
 Hessi catalog generation
PURPOSE:
 Frees up lun's from 1 to 128
 CALLED BY:
	Hsi_contact2fits [1], Hsi_contact2fits [2], hsi_1orbit_allpak, hsi_do_catalog
	hsi_do_qlook_image [1], hsi_do_qlook_image [2], hsi_flare_position [1]
	hsi_flare_position [2], hsi_flare_position [3], hsi_flare_position [4]
	hsi_one_qlook_image, hsi_one_qlook_spectrum
HISTORY:
 15-oct-1999, jmm, jimm@ssl.berkeley.edu


FWD_CHI2 $SSW/hessi/idl/image/fwd_chi2.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME:
	FWD_CHI2
 PURPOSE:
	Calculates confidence criterion of fitting the modulation patterns MP_PP of a model
	(specified by the Gaussian parameters COEFF) to the observed calibrated event
	list FOBS_PP. Instead of using the chi-square criterion (which requires a large
	number of photons per time bin) we use here the C-statistic (Cash 1979, ApJ 228, 939),
	which is valid also for a small numbers of photons per time bin (including zeros).
	http://hesperia.gsfc.nasa.gov/~schmahl/c-statistic/c-statistic.html
 CALLING SEQUENCE:
	fwd_chi2,o,coeff,nx,ny,pix,idet_sig,fobs_pp,mp_pp,chi_,chi,map_ptr=map_ptr,background=backgr_opt
 INPUTS:
       o	= object reference  o = hsi_image()
	coeff(n_par,n_gaussians+1) = Gaussian coefficients of model, with background COEFF(0,NG)
	nx,ny	= number of pixels of model map
	pix	= pixel size [arcseconds]
	idet_sig= number of finest detector with significant modulation [0,...,8]
	fobs_pp = observed calibrated event list
 OUTPUTS:
	mp_pp	= modulation pattern of 9 detectors
	chi_(9)	= C-statistic (analogous to chi-square) of fits to 9 detectors
	chi	= average C-statistic of all detectors (with significant modulation)
 CALLS: ***
	AVG [1], AVG [2], FWD_MODELMAP, FWD_STATISTIC, MINMAX [1], MINMAX [2]
 CALLED BY:
	FWD_MINIMUM, HSI_FORWARDFIT
 MODIFICATION HISTORY:
	1999 Dec  1: Version 1, written
	2000 Mar 16: Version 2, new objects mp=o->GetData(CLASS_NAME='HSI_MODUL_PROFILE',...)
	2000 Jun 15: update THIS_AD2 --> THIS_DET
	2000 Jun 24: R.Schwartz speeds up call for hsi_modul_pattern
	2003 Jan  9: implement automated fitting of absolute fluxes
	2003 Jan 23: add background modeling (keyword BACKGROUND)
	2003 Feb  7: define two background keywords BACKGROUND_MAP and BACKGROUND_DET
       2003 Feb 17, correct sign error in residuals of (fobs-mp)
	2003 Mar  6, exclude bins with livetime=0 in Cash statistic
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_DEC_GAUSS $SSW/hessi/idl/image/fwd_dec_gauss.pro
[Previous] [Next]
 PROJECT:
   HESSI
 NAME:
   FWD_DEC_GAUSS
 PURPOSE:
   This procedure decomposes an modelmap IMAGE into a number of NG gaussians, 
   measures their centroid position x,y position and gaussian widths w,
   and fills the values into the array COEFF(NPAR,NG) of Gaussian coefficients. 
   fwd_dec_gauss,image,pix,npar,ng,coeff
 INPUTS:
   image(nx,ny)    = input image to be decomposed
   pix     = pixel-size
   npar    = number of gaussian parameters (set to 4)
   ng      = number of gaussian components
 KEYWORDS:
   /TESTPLOT   = test display of decomposition
   /VERBOSE    = prints comments on screen
 OUTPUTS:
   coeff(npar,ng)  = initial-guess Gaussian coefficients
 CALLS: ***
	EXIST, PARABOL_MAX, next_window [1], next_window [2]
 CALLED BY:
	FWD_SIMULATE, hsi_sim_par_2_model
 MODIFICATION HISTORY:
   2001 Jan 18, Version 1 put online /ssw/hessi
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_DECOMPOSE $SSW/hessi/idl/image/fwd_decompose.pro
[Previous] [Next]
 PROJECT:
   HESSI
 NAME:
   FWD_DECOMPOSE
 PURPOSE:
   This procedure decomposes an initial-guess modelmap IMAGE (e.g. produced by
   backprojection) into a number of NG gaussians, measures their centroid
   x,y position and fill the values into the array COEFF(NPAR,NG) of
   Gaussian coefficients. The decomposition algorithm iteratively subtracts
   spatial structures matching the peak value of the map inclusive related
   concentric rings. Multiple sources are required to have a minimal separation
   (defined by the variable MINSEP, e.g. 25"). This requirement eliminates
   most of the sidelobe structures caused by back-projection.
 CALLING SEQUENCE:
   fwd_decompose,image,pix,npar,ng,coeff
 INPUTS:
   o	    = object related to backprojection image IMAGE
   image(nx,ny) = input image to be decomposed
   pix     = pixel-size
   npar        = number of gaussian parameters (4,6,7)
   ng      = number of gaussian components
             The input value constrains the maximum number of gaussians,
             while the output value contains the effective number of
             decomposed gaussians that fulfil the minimum separation criterion.
 KEYWORDS:
   /TESTPLOT   = test display of decomposition
   /MINSEP     = minimum separation (in arcseconds) between multiple sources
   /VERBOSE    = prints comments on screen
 OUTPUTS:
   coeff(npar,ng+1)  = initial-guess Gaussian coefficients, background=coeff(0,ng)
 CALLS: ***
	EXIST, LOADCT, PARABOL_MAX, next_window [1], next_window [2]
 CALLED BY:
	HSI_FORWARDFIT
 MODIFICATION HISTORY:
   1999 Dec 20, Version 1 put online /ssw/hessi
   2000 Jan 10, add MINSEP as keyword option (default = 25")
   2000 Jan 14, !p.multi=[0,2,ng+1,0,0]
   2002 Nov 7, fix a bug [zoom=long(768./(ny*(ng+1))) > 1] reported by Amir
   2003 Jan 9, scale image in absolute flux units [photons/s cm^2 arcsec^2] 
   2003 Jan 23, add background component as (ng+1) "gaussian component"  
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_DISPCOEF $SSW/hessi/idl/image/fwd_dispcoeff.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME: 
	FWD_DISPCOEF
 PURPOSE:
	This is a subtask of the procedure FWD_MINIMUM to display the coefficients 
	and changes in chi-2 in a compressed one-line format
 CALLING SEQUENCE:
	fwd_dispcoeff,j,k,npar,ng,coeff,chinew,chi0
 INPUTS:
	j	= number of varied gaussian parameter
	k	= number of varied gaussian component
	npar	= total number of gaussian parameters
	ng	= total number of gaussian components
	coeff(ng,npar) = gaussian coefficients
	chinew	= new value of chi-2 
	chi0	= value of best chi-2
 OUTPUTS:
	text line printed on screen
 CALLS: ***
	FWD_DISPCOEFF
 MODIFICATION HISTORY:
	1999 Dec 20, Version 1 online /ssw/hessi
	2000 Jan 14, break up multiple sources onto multiple lines
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_DISPLAY $SSW/hessi/idl/image/fwd_display.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME:
	FWD_DISPLAY
 PURPOSE:
	Displays spatial maps and observed and best-fit modulation time profile.
	computed by the forward-fitting algorithm HSI_FORWARDFIT.PRO.
	The input is generated by HSI_FORWARDFIT.PRO and stored in an IDL savefile.
 CALLING SEQUENCE:
	fwd_display,savefile,io
 INPUTS:
	savefile	= name of IDL savefile (generated by HSI_FORWARDFIT.PRO)
	io		= output option:
				io=1	screen
				io=2	postscript file
				io=3	encapsulated postscriptfile
				io=4	color postscript file
 OUTPUTS:
	postscript files

 CALLS: ***
	ATIME [1], ATIME [2], AVG [1], AVG [2], BREAK_FILE [1], BREAK_FILE [2]
	BREAK_FILE [3], CONGRID [1], CONGRID [2], CONGRID [3], FIG_CLOSE, FIG_OPEN
	FWD_STATISTIC, HESSI_CONSTANT, LOADCT, MINMAX [1], MINMAX [2], MOMENT, XYOUTS_NORM
	break_file [4]
 CALLED BY:
	HSI_FORWARDFIT
 MODIFICATION HISTORY:
	1999 Dec 20, Version 1 put online /ssw/hessi
	1999 Dec 22, Add FTOL and NITMAX to output
	2000 Jan  6, Replace old subroutine STATISTIC by standard IDL-function MOMENT
	2000 Jun 15, Print out NITCYC, XYOFFSET
	2003 Jan 27, Simpify routine and use structure p for image parameters 
	2003 Feb 17, correct sign error in residuals of fobs-mp
	2003 Apr 16, expand format from f5.1 to f7.1 digits for x,y (Kontar)
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_MINIMUM $SSW/hessi/idl/image/fwd_minimum.pro
[Previous] [Next]
 PROJECT:
   HESSI
 NAME:
   FWD_MINIMUM
 PURPOSE:
   Minimzation of chi-2 (or C-statistic) of fit of modulation profile MP_
   to observed calibrated event list FOBS_PP, i.e. minimum of |FOBS_PP-MP_|
   by varying parameters COEFF(NPAR,NG) of modelmap that produces the
   modulation profile (MP_). The algorithm varies the Gaussian parameters
   in each dimension and determines the steepest gradient. A minimization
   of the C-statistic (analogous to chi-square) is attempted along the
   steepest gradient (a variant of the "simplex" or "downhill" method)
   by step-doubling by powers of 2 and smooth spline interpolation of
   the minimum. A few (generally <10) iterations are required for convergence.
   The chi-2 or C-statistic is evaluated by the routine FWD_CHI2.PRO
 CALLING SEQUENCE:
   fwd_minimum,o,nx,ny,pix,idet_sig,fobs_pp,coeff,ftol,nitmax,niter,nitcyc,testplot=testplot,$
       verbose=verbose
   (called from main program HSI_FORWARDFIT.PRO)
 INPUTS:
       o       = object reference  o = hsi_image()
       nx,ny   = number of pixels of model map
       pix     = pixel size [arcseconds]
       idet_sig= number of finest detector with significant modulation [0,...,8]
       fobs_pp = (pointer of) observed calibrated event list
       coeff(npar,ng+1) = Gaussian coefficients (+background) of model (input values contain initial guess
         which are computed by procedure FWD_DECOMPOSE.PRO from a backprojection map)
   ftol    = convergence criterion of chi-2 in subsequent cycles
   nitmax  = maximum number of iteration cycles (default = 10)
   niter   = iteration counter (initially niter=0) = number of calls FWD_CHI2.PRO
 KEYWORD:
   /PLOT   = test display of minimization in each parameter dimension
   /FIXED_PIXEL = option to disable automated pixel adjustement
   BACKGR_OPT[2] = options for background modeling
 OUTPUTS:
   coeff(npar,ng+1) = optimized Gaussian coefficients of model
   niter   = number of iteration
 CALLS: ***
	EXIST, FWD_CHI2, FWD_DISPCOEFF, PROGBAR, SPLINE, clearplot [1], clearplot [2]
	next_window [1], next_window [2]
 CALLED BY:
	HSI_FORWARDFIT
 MODIFICATION HISTORY:
   1999 Dec 20, Version 1 put online /ssw/hessi
   1999 Dec 21, stop infinite loops (to <10 left or right steps)
   1999 Dec 21, increase FOV radius (r_pix) from 2 to 5 Gaussian widths
   1999 Dec 22, replace SPLINE_P.PRO (2-dim) by SPLINE.PRO (1-dim cubic spline)
   1999 Dec 22, optimize new pixel-size, pixnew=long(pix*qfov)>1 (instead powers of 2)
   1999 Dec 22, implement chi0_best, coeff_best as best possible solution
   1999 Dec 22, make step size smaller step(1:3,*)=0.5-->0.1 pixel
   1999 Dec 22, change:  widmin=2.2*sqrt(3.)^(-1)=1.27" --> widmin=2.2*sqrt(3.)^(-2)=0.73"
   1999 Dec 22, change:  bound2(0,*)=2.
   1999 Dec 22, if (min(coeff4-bound1) lt 0) or (max(coeff4-bound2) gt 0) then goto,left_stop
   1999 Dec 22, if (min(coeff5-bound1) lt 0) or (max(coeff5-bound2) gt 0) then goto,right_stop
   1999 Dec 23, initial width limited by half pixel-size
   2000 Jan 12, add keyword /FIXED_PIXEL
   2000 May 16, disable automated FOV adjustement (because Set,pixel_size interferes with rmap_dim)
   2000 Jun 15, add variable NITCYC (counts interation cycles, NITCYC < NITMAX)
   2000 Jun 24: R.Schwartz speeds up call for hsi_modul_pattern using map_ptr
   2001 Jan 19  change eccentricity boundaries &bound1(4,*)=-0.8  &bound2(4,*)=4.
   2001 Jan 19, curvature step: if (npar ge 7) then step0(6,*)=0.2 ;curvature
   2001 May 17, add progress_bar
   2001 Aug 27, add interactive option to include insignificant detectors (if progress_bar)
   2002 May  8, correct bug in bound2(5,*) and bound2(6,*) which were mistypoed as bound2(4,*)
   2003 Jan  9, implement automated fitting of absolute fluxes : COEFF(0,*)
   2003 Jan 23, add background component as (ng+1) "gaussian structure": COEFF(0,NG)
   2003 Feb  7, define two background keywords BACKGROUND_MAP and BACKGROUND_DET
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_MODELMAP $SSW/hessi/idl/image/fwd_modelmap.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME:
	FWD_MODELMAP
 PURPOSE:
	Creates model map from gaussian coefficients COEFF(NPAR,NG) :
		COEFF(0,*) = amplitude 
		COEFF(1,*) = x gaussian width (in arcseconds)
		COEFF(2,*) = x-position (in arcseconds)
		COEFF(3,*) = y-position (in arcseconds)
		COEFF(4,*) = eccentricity: ecc=(x_width/y_width)-1.
		COEFF(5,*) = tilt angle of ellliptical gaussian (counterclockwise from y-axis, or North)
		COEFF(6,*) = curvature ratio:  q=coeff(1,*)/curvature radius
	The number of required parameters is NPAR=4 for spherical gaussians,
	NPAR=6 for elliptical gaussians, and NPAR=7 for curved gaussians.
 CALLING SEQUENCE:
	fwd_modelmap,coeff,nx,ny,pix,modelmap,background=backgr_opt
 INPUTS:
       coeff(npar,ng+1)Gaussian coefficients (2D array) + background
	nx,ny		pixel dimension of imageo
	pix		pixel size (in arcseconds)
 OUTPUTS:
	modelmap	MODELMAP(NX,NY) 2D-array of map
 CALLS: ***
	ARCTAN
 CALLED BY:
	FWD_CHI2, FWD_SIMULATE, HSI_FORWARDFIT, hsi_sim_par_2_model
 MODIFICATION HISTORY:
	1999 Dec 20, Version 1 online /ssw/hessi
       2001 Jan 14, change tilt-angle definition with respect to y-axis (North)
       2001 Jan 19, if (abs(q0) le 0.1) then q0=0 ;avoid excessive curvature radius
	2003 Jan  9, disable normalization of modelmap because of absolute flux fitting
	2003 Jan 23, add background component COEFF(0,NG)
	2003 Feb  7, define two background components BACKGROUND_MAP and BACKGROUND_DET
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_SIMCOEFF $SSW/hessi/idl/image/fwd_simcoeff.pro
[Previous] [Next]
 PROJECT:
       HESSI
 NAME:
       FWD_SIMCOEFF
 PURPOSE:
       Reads parameters from the file SIMFILE and defines coefficients
	for forward-fitting
 CALLING SEQUENCE:
	fwd_simulate,simfile,coeff
 INPUT:
	simfile	= (filename is required to be named *.sim)
		  ASCI file that contains the map parameters and Gaussian coefficients.
		  The format is specified in the following example,
		  which contains 4 gaussian components with 7 parameters each, mimiking a
		  Masuda-type flare image with 2 footpoint sources, a thermal loop top source,
		  and a cusp-like above-the-loop-top source:
____________________________________________________________________________________________
      ng      npar    photons_sec
      1       4       5000.
      amp     width   xpos    ypos    ecc     tilt    curvature
      1.0     8.	-25.    -25.   0.      0.      0.              ;gaussian component 1
      0.8     8.	+41.    -15.   0.      0.      0.              ;gaussian component 2
      0.6     32.	 +1.     21.   3.     10.      1.              ;gaussian component 3
      0.4     16.	 +3.     51.   2.      0.      1.5             ;gaussian component 4
____________________________________________________________________________________________
	The parameters are defined as:
		NG	= number of gaussian components	    (1,2,...,N)
		NPAR	= number of parameters per gaussian (4,6,7)
			  (4=spherical gaussian, 6=elliptical gaussian, 7=curved gaussian)
		PHOTONS_SEC = photons per sec and detector
	Each gaussian is defined by 4, 6, or 7 parameters:
               AMP	= relative amplitude (normalized to 1)
               XPOS	= x-position of gaussian with respect to image center(in arcseconds)
               YPOS	= y-position of gaussian with respect to image center(in arcseconds)
               WIDTH	= gaussian width (in arcseconds)
               ECC	= eccentricity, ecc=(ywidth/xwidth)-1  (for elliptical gaussians)
               TILT	= tilt angle of ellliptical gaussian (deg counterclockwise from x-axis)
               CURVATURE = curvature ratio, i.e. width/curvature radius
 OUTPUTS:
	COEFF = FLTARR(NPAR,NG), map containing simulated image
	NG	= number of gaussian components	    (1,2,...,N)
	NPAR	= number of parameters per gaussian (4,6,7)
		(4=spherical gaussian, 6=elliptical gaussian, 7=curved gaussian)
	PHOTONS_SEC = photons per sec and detector

 CALLED BY:
	FWD_SIMULATE
 MODIFICATION HISTORY:
	2001 Jan 24, Version 1 
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_SIMULATE $SSW/hessi/idl/image/fwd_simulate.pro
[Previous] [Next]
 PROJECT:
       HESSI
 NAME:
       FWD_SIMULATE
 PURPOSE:
       Reads parameters for a simulation from the file SIMFILE and creates a modelamp
	by superpimposing gaussians (of spherical, elliptical, or curved shape).
	Curved ellipticals are first decomposed into spherical gaussians.
	From this modelmap a HESSI telemetry file containing modulation time profiles
	of the 9 detectors is simulated.
 CALLING SEQUENCE:
	fwd_simulate,simfile,modelmap,coeff,/testplot
 INPUT:
	simfile	= (filename is required to be named *.sim)
	ASCI file that contains the map parameters and Gaussian coefficients.

	Each gaussian is defined by NPAR=4, 6, or 7 parameters:
	COEFF(NPAR,NG)
               AMP	= relative amplitude (normalized to 1)
               XPOS	= x-position of gaussian with respect to image center(in arcseconds)
               YPOS	= y-position of gaussian with respect to image center(in arcseconds)
               WIDTH	= gaussian width (in arcseconds)
               ECC	= eccentricity, ecc=(ywidth/xwidth)-1  (for elliptical gaussians)
               TILT	= tilt angle of ellliptical gaussian (deg counterclockwise from x-axis)
               CURVATURE = curvature ratio, i.e. width/curvature radius
 KEYWORDS:
	/TESTPLOT= test display comparing coordinate definitions of FWD_MODELMAP with
		   that of MAP2GAUSSIANS
 OUTPUTS:
	MODELMAP = FLTARR(NX,NY), map containing simulated image

 CALLS: ***
	FWD_DEC_GAUSS, FWD_MODELMAP, FWD_SIMCOEFF, HSI_GAUSS2, HSI_IMAGE, HSI_PIXEL_COORD
	LOADCT
 MODIFICATION HISTORY:
       1999 Dec 20, Version 1 online /ssw/hessi
	2001 Jan 19, Version 2 
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com


FWD_STATISTIC $SSW/hessi/idl/image/fwd_statistic.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME: 
	FWD_STATISTIC
 PURPOSE:
	Calculates chi-square and C-statistic (for sparse sampling)
       http://hesperia.gsfc.nasa.gov/~schmahl/c-statistic/c-statistic.html
 CALLING SEQUENCE:
	fwd_statistic,f_obs,f_theo,chi_stat,c_stat
 INPUTS:
	f_obs(n)	= observed time profile
	f_theo(n)	= theoretical model time profile
 OUTPUTS:
	chi_stat	= chi-square
	c_stat		= C-statistic (Cash 1979)
 CALLED BY:
	FWD_CHI2, FWD_DISPLAY, HSI_MAP_CLEAN [1]
 MODIFICATION HISTORY:
	1999 Dec 20, Version 1 online /ssw/hessi
 AUTHOR:
       Markus J. Aschwanden, LMSAL, phone=650-424-4001, e-mail=aschwanden@lmsal.com
	2001 May 17: circumvent negative counts in C-statistic (require f_theo>0)
	2002 May  2: DATAGAP CORRECTION by ignoring bins with zero counts (data as well as model)
		     (This improves CHI-2 and C-statistic. DP_ENABLE=1 is another option designed
		     to correct data dropouts, but fails for a number of tested time intervals) 
	2003 Feb  5: Add alternative if (n le 0) then ind=where(f_obs gt 0,n) in case f_theo<=0 
	2003 Mar  6: Change back to  C_stat  =(chi0+chi1)/float(n0+n1) to include bins with
			zero counts, if the livetime is not zero (controlled by FWD_CHI2.PRO)