Packet Selection $SSW/hessi/offline/hsi_packetselect.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       Packet Selection

 PURPOSE: 
       Given a list of packets, select those with a given id number

 CATEGORY:
       HESSI Utilities (hessi/idl/util)
 
 CALLING SEQUENCE: 
       hsi_packetselect, packetIn, selectID, packetOut

 INPUTS:
       packetIn: the list of packets from which to select. May be of
                 type {source_packet} or {source_packet_word}
       selectID: the packet id as defined in the document http://xxx

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       packetOut: the list of packets with id = selectID. The
                  packets are of type {source_packet_word}

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 

 COMMON BLOCKS:
       None.

 PROCEDURE:

 RESTRICTIONS: 
       This is called by hsi_packet2eventlist and hsi_packet2fastrate
       and hsi_packet2monitorrate.

 SIDE EFFECTS:
       None.

 EXAMPLES:
       

 CALLS: ***
	DOC_MENU, HSI_PACKETSELECT, HSI_RELOAD_PACKET, MASK
 SEE ALSO:
 HISTORY:
       Release 1 dev. January 1999 ACs
       Relese 0, December 15, 1998, 
           A Csillaghy, csillag@ssl.berkeley.edu


PACKET TABLE STRUCTURE DEFINITION [1] $SSW/hessi/idl/util/hsi_itos_table__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       PACKET TABLE STRUCTURE DEFINITION

 PURPOSE: 
       The packet table stores the information given in the source
       packet headers. 

 CATEGORY:
       HESSI Utilities
 
 CALLING SEQUENCE: 
       var = Replicate( {hsi_packet_table}, n_packets } 
       where n_packets is the number of packets available
 
 TAGS:

 EXAMPLES:
       

 CALLS: ***
	HSI_ITOS_TABLE__DEFINE
 SEE ALSO:
 HISTORY:
       Release 3, August 1999
       Release 2, May 3, 1999, 
           A Csillaghy, csillag@ssl.berkeley.edu


PACKET TABLE STRUCTURE DEFINITION [2] $SSW/hessi/idl/util/hsi_packet_header__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       PACKET TABLE STRUCTURE DEFINITION

 PURPOSE: 
       The packet table stores the information given in the source
       packet headers. 

 CATEGORY:
       HESSI Utilities
 
 CALLING SEQUENCE: 
       var = Replicate( {hsi_packet_table}, n_packets } 
       where n_packets is the number of packets available
 
 TAGS:

 EXAMPLES:
       

 CALLS: ***
	HSI_PACKET_HEADER__DEFINE
 SEE ALSO:
 HISTORY:
       Release 3, August 1999
       Release 2, May 3, 1999, 
           A Csillaghy, csillag@ssl.berkeley.edu


PACKET TABLE STRUCTURE DEFINITION [3] $SSW/hessi/idl/util/hsi_packet_table__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       PACKET TABLE STRUCTURE DEFINITION

 PURPOSE: 
       The packet table stores the information given in the source
       packet headers. 

 CATEGORY:
       HESSI Utilities
 
 CALLING SEQUENCE: 
       var = Replicate( {hsi_packet_table}, n_packets } 
       where n_packets is the number of packets available
 
 TAGS:

 EXAMPLES:
       

 CALLS: ***
	HSI_PACKET_TABLE__DEFINE
 SEE ALSO:
 HISTORY:
       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


Packet to fast rate $SSW/hessi/offline/hsi_packet2fastrate.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       Packet to fast rate
;
 PURPOSE: 
       Extracts fats rate data from source packets

 CATEGORY:
       HESSI Utilities (hessi/idl/util)
 
 EXPLANATION:
       
 SYNTAX: 
       HSI_Packet2Fastrate, packet, fastRate

 EXAMPLES:
       
 INPUTS:
       packet: an array of packets, type {source_packet_words}

 OPTIONAL INPUTS: 
       None.

 OUTPUTS:
       fastRate: a array of structures of type {FastRateStruct}

 OPTIONAL OUTPUTS:
       None.

 KEYWORDS: 
       None.

 CALLS: ***
	CHECKVAR [1], HSI_PACKET2FASTRATE, HSI_SCTIME2ANY, MASK, checkvar [2]
 COMMON:
       None.

 RESTRICTIONS: 
       None.

 SIDE EFFECTS:
       It will eliminate packet that have not an ID of 100

 HISTORY:
       Release 0, October 21, 1998, 
           A Csillaghy, csillag@ssl.berkeley.edu


PASSIVE STRATEGY HOLDER ABSTRACT CLASS $SSW/hessi/idl/objects/strategy_holder_passive__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       PASSIVE STRATEGY HOLDER ABSTRACT CLASS

 PURPOSE: 
       Extends the strategy holder class to allow selecting
       startegies based on another, source, strategy holder. The
       concrete classes check the source object to decide what
       startegy the must use.  
       
       In the HESSI software, for instance, there are two strategies
       for image reconstruction: visibility-based and annular-sector
       based. Furthermore, for both imaging strategies, there are three classes
       that generate data products for each strategy: back
       projection, point spread function and modulation
       profiles. The choice of the strategy to use, however, is given by the
       source class of these three data products: hsi_modul_pattern,
       which is used by each class. This passive class allows them to
       check for the correct startegy in the source object.

 CATEGORY:
       Objects
 
 CONSTRUCTION:
       This is an abstracet class. The construction is done through
       the concrete classes.

 METHODS DEFINED IN THIS CLASS:
       INIT( strategy_available ): the initialization of the object
                                   takes a required parameter, the
                                   name of the strategy objects it
                                   will hold (strarr).
       SetStrategy: sets the used strategy according to the
                    startegy used by the source object
       GetStrategy: gets the startegy taht correspond to the startegy
                    used in the source object

 PARENT OBJECT:
       Strategy_Holder
 
 KNOWN SOURCE OBJECTS:
       HSI_Modul_Pattern

 KNOWN CONCRETE CLASSES:
       HSI_Bproj, HSI_Modul_Profile, HSI_PSF

 CALLS: ***
	STRATEGY_HOLDER_PASSIVE::GETSTRATEGY, STRATEGY_HOLDER_PASSIVE::INIT
	STRATEGY_HOLDER_PASSIVE::SETSTRATEGY, STRATEGY_HOLDER_PASSIVE__DEFINE
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/reference.html
	HESSI Utility Reference, hsi_bproj__define, hsi_modul_pattern__define
	hsi_modul_profile__define, hsi_psf__define
 HISTORY:
       Release 6: created, A.Csillaghy, csillag@ssl.berkeley.edu,
                  April 2001


phi_stamps $SSW/hessi/offline/phi_stamps.pro
[Previous] [Next]
 NAME:
      phi_stamps
 Procedure
      Create a list of photon events referenced to the spacecraft rotation angle
      for a source within the HESI fov.  The photon events are created at random
      and are modulated by a Monte-Carlo process consistent with the peak transmission
      through the collimator grids.  A set of unmodulated photons is also included
      consistent with the translucency of the grids.
 Inputs
      win - index of a point source in the brightness field to create photons for
      amap - brightness map, fltarr(3, npix^2)
        first index is distance in x from collimator axis in arcseconds for each point in field
        second index is distance in y
        third index is the number of counts unmodulated by the two grids
      peak - peak transmission fraction through the two collimators
      back - minimum transmission fraction through the collimator
      pitch- collimator pitch measured in arcseconds
      deltx- phase reference of collimator
 Outputs
      phi_arr- list of photon arrivals measured in rotation angle in radians
      nophotons- if nophotons is set, then no events made it through the collimator
 CALLS:
 CALLED BY
	make_lists


PHOTON_MODEL $SSW/hessi/idl/spectra/photon_model.pro
[Previous] [Next]
 PROJECT:
	SSW, XRAY
 NAME: 
	PHOTON_MODEL

 PURPOSE:
	This function returns a 2d photon model vs time.

 CATEGORY:
	XRAY


 CALLING SEQUENCE:
	Result = Photon_model( ph_edges, model, apar, t, t_model, t_apar, $
	flux = flux,  profile=profile )

 CALLS: ***
	AVG [1], AVG [2], CHECKVAR [1], EXIST, checkvar [2], edge_products, hsi_rd_ct_edges
 INPUTS:
       Ph_edges - photon energy edges, 2xN, keV
	Model    - photon function within $SSW/packages/xray/idl
	Apar     - parameter vector for Model
	T	 - time array desired.
	T_model  - model function used with T,i.e.
		 f(x,t)= t_model(t,t_apar)*model(ph_edges, apar)
	T_apar   - parameters used with T_model.


 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:- 
	FLUX - spectrum in ph/cm2/s/keV
	PROFILE - time profile
	
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	Version 1, richard.schwartz@gsfc.nasa.gov 27-mar-2001.


PHZ_STACKER CONTROL STRUCTURE INITIALIZATION $SSW/hessi/idl/util/hsi_phz_stacker_control.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       PHZ_STACKER CONTROL STRUCTURE INITIALIZATION

 PURPOSE:
       This function creates a phase stacker control structure
       and initializes it with its default values.

     dummy = {HSI_PHZ_STACKER_CONTROL, $
     PHZ_N_ROLL_BINS_MIN: 0L, $
     PHZ_N_PHASE_BINS: 0L, $
     PHZ_FOV: 0.0 $
     }

 CATEGORY:
       Utilities

 CALLING SEQUENCE:
       result = hsi_phz_stacker_control()

 OUTPUT:

 KEYWORDS:

 PARENT STRUCTURE:

 CALLS: ***
	HSI_PHZ_STACKER_CONTROL
  HISTORY:
   richard.schwartz@gsfc.nasa.gov, 22-may-2003
   updated, ras, 25-mar-2005
   ras. 9-aug-2005, added phz_empty_flag
   29-mar-2006, ras, added phz_n_roll_bins_max


pileup CONTROL PARAMETERS DEFINITION $SSW/hessi/idl/spectra/hsi_pileup_control__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       pileup CONTROL PARAMETERS DEFINITION

 PURPOSE
       Provides a structure with control parameters used to define
       pileup corrections

 CATEGORY
       Spectra (hessi/idl/spectra)

 CALLING SEQUENCE:
       var = {hsi_pileup_control}

 OUTPUT:
       var: the structure with the pileup control parameters

 CALLS: ***
	HSI_PILEUP_CONTROL__DEFINE
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/
 HISTORY:

   10-nov-2004, richard.schwartz@gsfc.nasa.gov
   5-jul-2005, ras, ready for beta and upload


pileup CONTROL PARAMETERS initialization $SSW/hessi/idl/spectra/hsi_pileup_control.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       pileup CONTROL PARAMETERS initialization

 PURPOSE
       Provides a structure with control parameters used to define
       pileup correction

 CATEGORY
       Spectra (hessi/idl/spectra)

 CALLING SEQUENCE:
       var = {hsi_pileup_control}

 OUTPUT:
       var: the structure with the pileup control parameters

 CALLS: ***
	HSI_PILEUP_CONTROL
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/
 HISTORY:

   10-nov-2004, richard.schwartz@gsfc.nasa.gov
   22-jun-2005, ras, changed tweak from 1.0 to 0.6 on
     rec. of Oct 2004 Berkeley sw workshop
   5-jul-2005, ras, ready for beta testing


Plot $SSW/hessi/idl/util/hsi_plot.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME: 
      Plot

 PURPOSE:
       Plots time or frequency profiles

 CATEGORY:


 CALLING SEQUENCE:
       HSI_Plot, xAxis, profile
       HSI_Plot, xAxis, yAxis, profile

 CALLS: ***
	HESSI_REF_TIME, HSI_PLOT, OUTPLOT [1], OUTPLOT [2], OUTPLOT [3], UTPLOT [1]
	UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], WRITE_GIF
 INPUTS:
       profile: the data to plot a 1D or 2D array. If 2D array, the
                 x-dimension corresponds to the x-axis.

 OPTIONAL INPUTS:
	xAxis:
       yAxis:

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
       FILENAME: the name of the file to write
       GIF: if set, produces gif output
       UT: if set uses UTPlot instead of PLOT.
       REFUT: Uses this value as reference time for plotting
       PS: if set, produces ps output

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
       Release 1 dev. Acs, Feb 1999
	Release 0, A.Csillaghy, csillag@ssl.berkeley.edu, Sept. 1998
       


PLOT_ANGC [1] $SSW/hessi/idl/sims/menu/plot_angc.pro
[Previous] [Next]
 Project     : HESI
                   
 Name        : PLOT_ANGC
               
 Purpose     : This procedure plots the angular coverage of HESSI vs other
		instruments.
               
 Category    : HESI
               
 Explanation : 
               
 Use         : 
    
 Inputs      : 
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 
		NOSOLID
		NODIMES
		DO_COLOR
		GD_FILE
 Calls	      : ***
	ANGC_GET_GD, CHECKVAR [1], LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], NOFILL_ARE
	OS_FAMILY, PATH_DIR, PSPLOT [1], PSPLOT [2], SET_X [1], SET_X [2], SPS, WRITE_GIF
	checkvar [2]
 CALLED BY:
	HESI_MENU
 Common      : None
               
 Restrictions: screen is restricted to X windows
               
 Side effects: produces gif, eps, and ps files.
               
 Prev. Hist  : 
 		Written by Eric Carzon, Hughes/STX
 		February 15, 1995

 Modified    : 
		Version 2, RAS, 14-apr-1997,
		Version 3, RAS, 23-may-1997, changed e_box limits
		Version 4, richard.schwartz@gsfc.nasa.gov, 31-dec-1997, supports overplotting previous dimensions
		when environmental, MORE_GDFILE is set to 'T'
		Version 5, richard.schwartz@gsfc.nasa.gov, modified with NOSETUP and DEF_SCR_DEVICE
		keywords to support ALL3 plot procedure.


PLOT_ANGC [2] $SSW/hessi/idl/sims/menu/plot_angc_all3.pro
[Previous] [Next]
 Project     : HESI
                   
 Name        : PLOT_ANGC
               
 Purpose     : This procedure plots the angular coverage of HESSI vs other
		instruments.
               
 Category    : HESI
               
 Explanation : 
               
 Use         : 
    
 Inputs      : 
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 
		NOSOLID
		NODIMES
		DO_COLOR
		GD_FILE
 Calls	      : ***
	ANGC_GET_GD, CHECKVAR [1], LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], NOFILL_ARE
	OS_FAMILY, PATH_DIR, PLOT_ANGC_ALL3, PSPLOT [1], PSPLOT [2], SET_X [1], SET_X [2], SPS
	WRITE_GIF, checkvar [2], curdir [1], curdir [2]
 CALLED BY:
	HESI_MENU
 Common      : None
               
 Restrictions: screen is restricted to X windows
               
 Side effects: produces gif, eps, and ps files.
               
 Prev. Hist  : 
 		Written by Eric Carzon, Hughes/STX
 		February 15, 1995

 Modified    : 
		Version 2, RAS, 14-apr-1997,
		Version 3, RAS, 23-may-1997, changed e_box limits
		Version 4, richard.schwartz@gsfc.nasa.gov, 31-dec-1997, supports overplotting previous dimensions
		when environmental, MORE_GDFILE is set to 'T'
		Version 5, richard.schwartz@gsfc.nasa.gov, modified with NOSETUP and DEF_SCR_DEVICE
		keywords to support ALL3 plot procedure.


PLOT_GD $SSW/hessi/idl/sims/menu/plot_gd.pro
[Previous] [Next]
 Project     : HESI
                   
 Name        : PLOT_GD
               
 Purpose     : This procedure plots the grid transmissions as a function of energy.
               
 Category    : HESI
               
 Explanation : 
               
 Use         : 
	plot_gd,XX,grid_sep,pitch,e_diff_10,e_diff_50,e_diff_fl,e_peak,thickness,gn,density,$
	  rmod_amp,e_diff_manual,man_rmod_amp,res,subarr,ngrids,$
	   harmonic,ymin,ymax,xmin,xmax,pl_range,ok_opl
    
 Inputs      : XX - cross_section arrays vs energy
	      Gn - collimator number, starts at 1
	      Man_rmod_amp - If set then input relative modulation amplitude, 
		using Rmod_amp as a percentage
	      Rmod_amp - Find the energies corresponding this percentage
		of the diffraction amplitude curve and 1st-3rd harmonics.
	      E_peak - Energy (keV) of peak of diffraction amp. curve
	      Harm - Harmonic number for modulation calculation
	      E_diff_manual- energies corresponding to 1st 3 harmonic numbers and Man_rmod_amp.
	      E_diff_fl - energies corresponding to 1st 3 harmonic numbers and 0 modulation.
	      E_diff_10 - energies corresponding to 1st 3 harmonic numbers and 90% modulation.
	      E_diff_50 - energies corresponding to 1st 3 harmonic numbers and 50% modulation.
	      Grid_sep- grid separation distance in mm
	      Pitch - Array of grid pitches in mm
	      Density - Array of Density of grid materials in gm/cm3
	      Thickness - Array of grid thicknesses in mm
	      Res - angular resolution of each grid pair, unused.
	      Pl_range - plot over this range of collimator numbers,
		where the numbering starts at 1.
	      Xmin, Ymin, Xmax, Ymax - Plotting ranges in data coordinates
		energy in keV for X, and dimensionless amplitude for Y
	      Ok_opl- If set overplot symbols and E_peak.
 Opt. Inputs : None
               
 Outputs     : None
	      

 Opt. Outputs: None
               
 Keywords    : GDFILE- Data file used to characterize grids.

 Calls	      : ***
	CHECKVAR [1], GD_TITLE, OS_FAMILY, PLOT_GD_CALC, PSPLOT [1], PSPLOT [2], SET_X [1]
	SET_X [2], SPS, WRITE_GIF, checkvar [2], linecolors [1], linecolors [2]
	wc_where [1], wc_where [2]
 CALLED BY:
	HESI_MENU
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  : Written by Eric Carzon, Hughes/STX, May 1993

 Modified    : 
		Modified by Brian Dennis, November 8, 1993, to include labels in the plot
		 area.
		Comments added, and calculations put in subprogram plot_gd_calc
 			EC, Jan. 1995
		Rearrange to be part of HESI_menu.pro, not a standalone program anymore
 		EC, April 1995
 		5/25/95, changes fov for det. 10-12, changes labels to reflect new placement
 		10/7/95, multiply grid 1`, 1-3 by .25,.25,.5,.75 respectively for Step
 		II proposal, change color scheme and labels to reflact dropping of LIGA
 		process, change Stacking to Van Beek Stacking
		Version 6, RAS, 14-apr-1997, remove grid factors!!! of 10/7/95
		Version 7, RAS, 28-apr-1997, added gdfile to pass on to gd_title.
 Version 7, richard.schwartz@gsfc.nasa.gov, 31-dec-1997, suppress gold mask output if not
	needed, suppress xsubtitle and title if NOSUBTITLE environmental is set to 'T'.
	


PLOT_GD_CALC $SSW/hessi/idl/sims/menu/plot_gd_calc.pro
[Previous] [Next]
 Project     : HESI
                   
 Name        : PLOT_GD_CALC
               
 Purpose     : Calculate energies to use for the Diffraction limited portion of 
	      Relative modulation amplitude (from about 1 to 100 keV)
	      Use either manual reduction in modulation amplitude or the standard
	      10,50, and 100% reductions & generate energies based on division of 10
	      in between the peak and trough

               
 Category    : HESI
               
 Explanation : The HESI grid collimator physical dimensions are used with
	      together with the Xray cross-sections to calculate the
	      transmission functions describing the performance of the HESI
	      collimator system.
               
 Use         : plot_gd_calc,XX,man_rmod_amp,e_peak,collim,harm,e_diff_manual,e_diff_fl,$
 	e_diff_10,e_diff_50,grid_sep,pitch,density,thickness,ener_pl,en_xax,st_en,rel_mod_50,$
	mod_amp,en1,tot_y,new_mod,new_rel, rmod_amp=rmod_amp
    
 Inputs      : XX - cross_section arrays vs energy
	      Collim - collimator number, starts at 1
	      Man_rmod_amp - Input relative modulation amplitude, as a percent
	      E_peak - Energy (keV) of peak ?
	      Harm - Harmonic number for modulation calculation
	      E_diff_manual- energies corresponding to 1st 3 harmonic numbers and Man_rmod_amp.
	      E_diff_fl - energies corresponding to 1st 3 harmonic numbers and 0 modulation.
	      E_diff_10 - energies corresponding to 1st 3 harmonic numbers and 90% modulation.
	      E_diff_50 - energies corresponding to 1st 3 harmonic numbers and 50% modulation.
	      Grid_sep- grid separation distance in mm
	      Pitch - Array of grid pitches in mm
	      Density - Array of Density of grid materials in gm/cm3
	      Thickness - Array of grid thicknesses in mm
 Opt. Inputs : None
               
 Outputs     : None
	      Ener_pl - Plot energies in keV
	      En_xax  - Exact energies for calculation
	      St_en   - Indices into sorted energies
	      Rel_mod_50 -Transmission limited modulation amplitude
	      Mod_amp - Diffraction limited modulation amplitude
	      En1     - New sorted energies
	      Tot_y   - total modulation amplitude defined on En1
	      New_mod - Transmission limited mod amplituded defined on En1
	      New_rel - Diffraction limited mod amplitude defined on En1
	      

 Opt. Outputs: None
               
 Keywords    : RMOD_AMP- User input value of relative mod amplitude for which
		energies need to be found.

 Calls       : ***
	CHECKVAR [1], INTERPOL, LIMITS, UNIQ [1], UNIQ [2], UNIQ [3], checkvar [2]
	grid_diffraction
 CALLED BY:
	ANGC_GET_GD, PLOT_GD
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  : Written by Eric Carzon, 1993
	
 Modified    : Version 2, RAS, 16-apr-1997 
		Version 3, richard.schwartz@gsfc.nasa.gov, relax diffraction solution to 99% from 100%.
		5-jan-1998.


PLOT_HESSI_FILTERS $SSW/hessi/idl/sims/plot_hessi_filters.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME: 
	PLOT_HESSI_FILTERS

 PURPOSE:
	This procedure displays the attenuation vs energy for all combinations of the 
	HESSI shutters.

 CATEGORY:
	HESSI

 CALLING SEQUENCE:
	plot_hessi_filters,emdges, all_fil, old_fil

 CALLS: ***
	CHECKVAR [1], CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3]
	HESSI_DATA_PATHS [1], HESSI_DATA_PATHS [2], HESSI_FILTERS, HESSI_SHUTTERS
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], SET_X [1], SET_X [2], SPS, checkvar [2]
	concat_dir [4], linecolors [1], linecolors [2]
 INPUTS:
       Emdges - center energy (keV) for filter transmissions.
       All_fil- array of 4 filter transmissions for 00, 10, 01, and 11 states

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	Old_fil - transmission curve for SMEX proposal filter.

 OPTIONAL KEYWORD INPUTS:
	X - if set, plot on xdevice()
	FILTER_PLOT_FILE - Postscript file name, def is ~/public_html/filter_plot.ps
	
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	Version 1, richard.schwartz@gsfc.nasa.gov


PLOT_HSI $SSW/hessi/idl/gen/plot_hsi.pro
[Previous] [Next]

pro plot_hsi, objects, force_number=force_number, $
              levels=level, independent=independent, ps=ps, fileps=psfile, $
              noerase = noerase, title=title, sample=sample, image=image, $
              rowcol=rowcol, nowords=nowords, nogrids=nogrids, $
              noboxes=noboxes, nocontours=nocontours,limb=limb,latlon=latlon, $
              bin=bin,nocloseps=nocloseps,colorbox=colorbox,colorcontour=color, $
              labels=plotlabel,noscaleimg=noscaleimg,nlevels=nlevels,nolimb=nolimb, $
              noimage=noimage,llgrid=llgrid,notimes=notimes,charsize=charsize, $
              landscape=landscape, portrait=portrait,lonlat=lonlat,_extra=_extra

NAME:
     PLOT_HSI
PURPOSE:
     Plots a series of HSI images as contours.
CATEGORY:
CALLING SEQUENCE:
     plot_hsi,objects
INPUTS:
     objects = array of HESSI image objects (e.g. from hsi_mreadfits)
OPTIONAL INPUT PARAMETERS:
KEYWORD PARAMETERS
     rowcol = number of rows,columns to plot, [rows,cols].  rows*columns
              must be GE to the number of images.
     level = contour levels in fraction of max value.
             default = [0.04,0.08,0.15,0.25,0.4,0.65,0.95]
     nlevels = specify the number of equally spaced levels.  Ignored if level is
               set.
     independent = Scale each image indepently.  The default is to scale
                   the entire data cube so that relative intensities are
                   preserved from image to image.
     /sample = use /sample in rebin
     image = data cube of images to display under the contours.  Must have
             the same dimensions as data.  However, if image is a 2-D array
             with the same dimension as the images in data, the single image
             is displayed under each data image.  The default is to
             use the HESSI data itself.
     /noimage = do not plot an image
     /noscaleimg = Do not bytescale the underlying images.  the default is
                   to display each image independently with tvscl.  If
                   /noscaleimg is set, the images must be byte type and
                   will be displayed with tv rather than tvscl.
     force_number = force this number of plots on the output
     /limb = Plot a contour representing the solar limb.  This is now
             the default.  Use /nolimb to turn the limb off.
     /nolimb = do not plot the limb of the Sun.
     /latlon = Plot a lat/lon grid.
     /lonlat = synonym for latlon
     llgrid = spacing of lat/lon grid in degrees.  Default = 5.
     labels = String array giving a label for each image.
     /nowords = do not annotate the plots
     /notimes = do not annotate plots with the observation interval
     /nogrids = do not plot grids on images
     /noboxes = do not plot boxes around images
     /noerase = do not erase the display before plotting.
     /nocontours = do not plot contours.
     /ps = Use PostScript.  If the current graphics device is 'PS', the /ps
           keyword is the default.
     /portrait = Set PostScript portrait mode
     /landscape = Set PostScript landscape mode (default)
     fileps = PostScript file, default is idl.ps 
     /nocloseps = Do not close the PS device after plotting.  This is
                  useful if you want to add more annotations etc to
                  the plot.  the side effects are that the device is
                  left as PS after the program and, of course, you
                  will have to close the PS file yourself. 
     title = title for plot
     bin = binup factor for the images (def = 4)
OUTPUTS:
 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3], GET_LATLON, OCONTOUR2, PIXSQUARE, PS [1]
	PS [2], PSCLOSE [1], PSCLOSE [2], anytim [1], anytim [2], anytim [3], anytim [4]
	anytim [5], draw_box_nn [1], draw_box_nn [2], get_rb0p [1], get_rb0p [2]
	tag_index [1], tag_index [2]
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
     The data cube is byte scaled and plotted as contours.  Use the 
     /independent keyword to scale each image independently
MODIFICATION HISTORY:
     T. Metcalf 2002-05-09  Converted plot_hxt to plot_hsi
     T. Metcalf 2002-06-11  Added llgrid keyword
     T. Metcalf 2002-11-05  Fixed bug in calculating time interval
     T. Metcalf 2002-11-07  Fixed bug in making time strings
     T. Metcalf 2002-11-15  Added lonlat keyword and added code to
                            open a window if one is not already open.


plotman $SSW/hessi/idl/widgets/plotman__define.pro
[Previous] [Next]

 Name:  plotman

 Project:  HESSI

 Purpose: Generic plot handling package.

 Explanation:  PLOTMAN provides access to standard IDL plotting
   options for any data set.  Options for zooming, log scale,
   image representation and much more are available.  Also offers
   standard output options such as printing the plot, saving in a
   file, or printing the data in a text file.  Most options are accessed
   through the pulldown buttons at the top of the PLOTMAN window.
   In addition, you can right-click in any plot to display the
   coordinates of a point, or left-click and drag a box to zoom in
   on any plot.  A single left-click with no dragging will restore
   the original plot limits.  The entire plotman window can be stretched
   by dragging the edges of the window, and the current plot will be
   redraw in the new window.  The maximize button provided by the
   window manager will not work.

   PLOTMAN is implemented as an object of class 'plotman'
   The required input to the object are the data (object or array) and
   the plot type.

   PLOTMAN can be called to run as a standalone widget program, or as part
   of another program (if mainbase keyword is passed).  If standalone, a
   widget base is created with pulldown menus and a draw widget.  If
   part of another program, then the main program should have already
   created the widget base with at least a file pulldown menu, and the
   plotman controls are integrated into the existing widget base.

 Calling sequence:
   obj = plotman (input=input, plot_type=plot_type, ...)
   Can call plotman with most of standard plot keywords to set defaults
   After creating plotman object, can set plot parameters that aren't available in widget
   (like xtitle) through set method.  (Example:  obj -> set, xtitle='X Axis')
   To plot from command line, must use select method first:
      obj -> select
      obj -> plot
   To retrieve parameters that are set in plotman object, use get method.  (can
      get all tags that are in plotman self structure or any nested structures)

 CALLS: ***
	ADD_METHOD, ADD_TAG [1], ADD_TAG [2], APPEND_ARR, ARR2STR [1], ASTROLIB, Arr2Str [2]
	CHECKVAR [1], CLEANPLOT [1], CLEANPLOT [2], CLEANPLOT [3], CRANGE, DATATYPE [1]
	DATATYPE [2], DATATYPE [3], DEVICELIB [1], DEVICELIB [2], EXIST, FCHECK, FILEPATH
	FLASH_MSG, FREE_VAR, GETUT [1], GETUT [2], GETUTBASE [1], GETUTBASE [2], GET_EDGES
	GET_POINTER, IS_STRING, JOIN_STRUCT [1], JOIN_STRUCT [2], LAST_ITEM, LIST_PRINTER
	LOADCT, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], MAKE_MAP, MINMAX [1], MINMAX [2]
	N_DIMENSIONS, OBJ_CLONE, OBJ_PARENTS, OBJ_PROPS, PLOTMAN::CLEANUP
	PLOTMAN::CREATE_NEW_PANEL, PLOTMAN::DELETE_PANEL, PLOTMAN::DESC2PANEL
	PLOTMAN::DEV2DATA, PLOTMAN::EXPORT, PLOTMAN::FOCUS_PANEL, PLOTMAN::GET
	PLOTMAN::GETAXIS, PLOTMAN::GETDATA, PLOTMAN::HIDE_ALL_PANELS, PLOTMAN::INIT
	PLOTMAN::INIT_PLOT_DEFAULTS, PLOTMAN::INIT_SAVED_DATA, PLOTMAN::LOAD_COLORS
	PLOTMAN::MAGNIFY, PLOTMAN::MAKE_PLOT_CMD, PLOTMAN::NEW_PANEL
	PLOTMAN::PANEL_BUTTON_IDS, PLOTMAN::PANEL_SUMMARY, PLOTMAN::PLOT
	PLOTMAN::PREPARE_DATA, PLOTMAN::PROFILES, PLOTMAN::RESET_PANEL_PC
	PLOTMAN::RESTORE_SAVED_DATA, PLOTMAN::RESTORE_UTPLOT, PLOTMAN::SAVE_PANEL
	PLOTMAN::SAVE_UTPLOT, PLOTMAN::SELECT, PLOTMAN::SET, PLOTMAN::SETDEFAULTS
	PLOTMAN::SET_PLOT_PARAMS, PLOTMAN::SET_PROPS_FROM_OBJ
	PLOTMAN::SET_WINDOW_CONTROL_PULLDOWN, PLOTMAN::SHOW_PANEL
	PLOTMAN::SUMM_PARAMS, PLOTMAN::UNSELECT, PLOTMAN::UPDATE_PANEL
	PLOTMAN::UTPLOT, PLOTMAN::VALID, PLOTMAN::VALID_WINDOW, PLOTMAN::WHICH_PANEL
	PLOTMAN_STORESYS, PLOTMAN__DEFINE, PROFILES2, PTR_EXIST, REM_TAG [1], REM_TAG [2]
	REP_TAG_VALUE, SAME_DATA [1], SAME_DATA [2], SCOPE, SELECT_WINDOWS, SETUT [1]
	SETUT [2], SINCE_VERSION [1], SINCE_VERSION [2], STC_CLONE, TAG_EXIST [1]
	TAG_EXIST [2], TRIM, USERLABEL, VALID_RANGE, XALIVE, XDEVICE, XHIDE, XMESSAGE, XSHOW
	XTEXT, XWIDUMP, anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	axis_get_edges, change_tag_value, check_plotlimits, checkvar [2]
	hsi_compute_image_axis, is_member [1], is_member [2], is_struct, plotman_widget
	prstr [1], prstr [2], rem_elem [1], rem_elem [2], ssw_strsplit, str_pow_conv
	tag_index [1], tag_index [2], wc_where [1], wc_where [2], where_arr [1]
	where_arr [2]
 CALLED BY:
	HESSI CLEAN ALGORITHM CLASS DEFINITION, HESSI SOHDATA CLASS DEFINITION
	READCOL [3], SPEX_FIT__DEFINE, SPEX_GEN__DEFINE, hsi_plot_flux
	hsi_spectrum_fitsread, hsi_ui_img, spectrogram__define
 Examples:
   Object input:
   o = hsi_image(obs_time=['2000/9/1 12:00','2000/9/1 13:00'], time_range=[1000,1004])
   plotman_obj = plotman (input=o, plot_type='image')

   X vs Y plot with labels, log y axis:
   data = indgen(10,2)
   plotman_obj = plotman (input=data, plot_type='xyplot', xtitle='Latitude', $
      ytitle='Longitude', title='Test plot', /ylog)

   Absolute time input:
   data = dblarr(10,2)
   data(*,0) = anytim('2000/9/2 15:00') + dindgen(10)*1000.
   data(*,1) = sin(indgen(10))
   plotman_obj = plotman (input=data, plot_type='utplot')

   Relative time input  (here you must supply a utbase):
   data = dblarr(10,2)
   data(*,0) = dindgen(10)*1000.
   data(*,1) = sin(indgen(10))
   plotman_obj = plotman (input=data, plot_type='utplot', utbase = '2000/9/2 15:00')

	Multiple panel plotman with two images (note: setting input to two objects
		instead of the two image arrays will work too):
	plotman_obj = plotman(/multi)
   image1=dist(512) & image2=dist(200)
	status=plotman_obj -> setdefaults (input=image1, plot_type='image')
	plotman_obj -> new_panel, 'plot1'
	status = plotman_obj -> setdefaults (input=image2, plot_type='image')
	plotman_obj -> new_panel, 'plot2'

   Input Keywords:
	INPUT - (required) input data to plotman.  Can be object or array.
     If object, must belong to one of the following classes:
       the generic image object class MAP_LIST
       the generic lightcurve object class LTC
       any HESSI object class
     Unknown object classes have not been tested, but must at least
     must conform to the following rules to have a chance of working:
       Must have 'PLOT', 'LIST', and 'GETDATA' methods.
       Must have:
         GET(/CONTROL) - get all params that control how to retrieve data from object
         GET(/INFO) - get all info parameters that describe data retrieved
         GET(/UT_REF) - get reference time
         GET(/TIME_RANGE) - get full time range of data
       For image objects, the 'PLOT' method must use the SSW plot_map routine
       For time profile objects, the 'PLOT' method must use the SSW utplot routine
	  If INPUT is not an object, then for plot type:
       image, input is a 2-d array of the image
       utplot, input is a 2-d array where data(*,0) are the times and
         data(*,1) are the y values.  Either time array must be absolute
         times (fully referenced, type double-precision) or utbase must also
         be passed in.
       xyplot, input is a 2-d array where data(*,0) are the x values and
         data(*,1) are the y values.
   PLOT_TYPE - (required) type of data to plot = 'image', 'utplot', 'xyplot', or 'specplot'
   UTBASE - absolute time of base time of data for 'utplot' plot.  Required
     if input is not object, and time array is not absolute times. (time
     array will be relative to utbase)
   WXSIZE,WYSIZE - initial size of draw widget in pixels (default:
     wxsize=.45 * screen width, wysize=.5 * screen width)
   WXPOS, WYPOS - initial location of widget in pixels from top right corner
     (default: wxpos=100, wypos=100).  Valid only for standalone plotman.
   MAINBASE - widget id of main widget base that plotman will be integrated into.
     If MAINBASE is set, then plotman is NOT in standalone mode.
     If set, then mainbase widget must have a uvalue that is a structure that
       contains at least the following tags:
       mbar - widget id of menu bar of main widget
       w_file - widget id of 'File' pulldown menu on main widget
   MULTI_PANEL - if set, then plotman allows more than one panel to be saved
     and shown.  Each panel will have the panel pulldown menu, and a window_control
     pulldown menu will be placed on top menubar.
   GROUP - Widget id of widget id calling plotman, if any.  (Note: this is different
     from mainbase - with mainbase, plotman will be integrated into the mainbase
     widget; with group, plotman is called as a standalone widget from another widget)

 Output Keywords:
   WIDGETS - structure containing widget ids of plotman widgets.  Used mainly by
     calling program if not running in standalone mode.
   ERROR - 0/1 means no error, error.

 Written: Kim Tolbert, Dec 1999.  kim.tolbert@gsfc.nasa.gov

 Modifications:
   8-Jan-2001 - added colorbar option for images
   21-Jan-2001 - Kim, added fits export option. Involved rewriting export method for list too.
   1-Feb-2001 - Kim, Do loadct,0 before checking total number of colors available
   17-Feb-2001 - Kim.  Don't unset colors after each plot (better for unix?),
		overlay_self became overlay_panel with option to overlay different images, and
		added drotate_image parameter for solar-rotating overlaid image.
   9-Mar-2001 - Kim.  Moved init of intervals to init method from setdefaults method, so
      intervals would persist.
   3-Apr-2001 - Kim.  Added dim1_... arguments to xyplot plot call.
   11-Apr-2001 - Kim.  Made dim1_use a ptr_new(/alloc) instead of ptr_new(indgen(20)), which
      was arbitrary but covered most cases.  Now have to set dim1_use in plotman obj explicitly.
   21-Apr-2001 - Kim.  Changed plot control tags from r,g,b to rcolors,...
   22-Apr-2001 - Kim.  Added set,colortable=x feature
	1-May-2001 - Kim.  Changed dim1_unit to dim1_name.
	19-Jun-2001 - Kim.  Added getaxis method
	5-Jul-2001 - Kim.  Added make_plot_cmd method, and rewrote plot method
		to use it.  Also made overlay_panel an array so can have multiple
		overlays for xy and ut plots.
	10-Jul-2001 - Kim.  Added magnify method
	19-Jul-2001 - Kim.  Use get(/utbase) as well as get(/ut_ref) to get base time. (previously
		just used ut_ref)  If neither available, do retall
	30-Jul-2001 - Kim.  Changed image_flux method.  Before relied on data object having a
	  flux method, now it will work on any input data - object or data array.
	  Also modified get(/saved_data_data) to return array if *self.data is not an object.
	31-Jul-2001, Kim.  Added get(/image_info)
	3-Aug-2001, Kim.  Moved image_flux method to its own file
	30-Aug-2001, Kim.  Added mark_limb option
	2-Sep-2001, Kim.  Added translate_overlay and legend_color options
	24-Sep-2001, Kim.  When colortable keyword is set, use color_file already saved, and
      use bottom and ncolors keywords so we don't lose individual colors in highest indices.
   29-Dec-2001, Kim.  Added psym explicitly to argument list constructed by
      make_plot_cmd (hsi_spectrum__plot checks if it's in _extra)
	22-Jan-2002, Kim.  Added mark_point option
	19-Feb-2002, Kim.  Check for white->black for PS files here instead of in
		plotman_create_files_event because didn't work for stacked plots.  Also
		contour color wasn't being used.
   20-Feb-2002, Kim.  Added user_label option
   2-Mar-2002, Kim.  Added more_commands option
	13-Apr-2002, Kim.  xneat default.  Added ways to look for start time of data
	   when input keyword is given.
   14-May-2002, Kim.  In plot method, on overlay, was calling with xrange and timerange, but
      xrange was overiding timerange.  Pass xrange=[0.,0.] to overlay if doing time plot.
   17-May-2002, Kim.  In export method, use self.class_name instead of self.saved_data.class_name.
      Also, make dialog_message use info type when it's not an error message in export method
	27-May-2002, Kim.  Added derivative option
	9-Jun-2002, Kim.  Enabled export to idl save file
	18-Jun-2002, Kim.  Added params_list, screen, quiet args to summ_params method. Added filename,
		quiet to export method
	28-Jun-2002, Kim.  Added  current_panel_struct and widgets to data returned by GET.  Check
	   if image_units tag exists before using in get(/image_info)
   18-Jul-2002, Kim.  Added times tag to image_info structure returned in get
	21-Jul-2002, Kim.  Added contour_percent, contour_thickness and imgflux structure to control parameters.  Also
		when transferring plot params, added contour_percent and overlay_panel (if it's 'self' or '')
	22-Jul-2002, Kim.  Added mark_box_contour_level, mark_box_contour_percent
	19-Sep-2002, Kim.  Added integral option
	11-Oct-2002, Kim.  Added load_colors and dev2data methods, and get(/is_hessi_obj), call
		load_colors for new panel when doing an overlay, and skip to end of overlay loop if
		panel we want to overlay has been deleted in the meantime.
   05-Nov-2002, Kim.  Retrieve image start and end times in image_info for synop images too
   05-Nov-2002, Kim.  Added grid_spacing option for image plots
   05-Nov-2002, Kim.  Add grid_color, limb_color, and translate_image options
	22-Nov-2002, Kim.  Added set_props_from_obj method, and call to it in setdefaults when
		input keyword is set.  Transfers properties from certain kinds of objects
		(e.g. xyplot, utplot, specplot, map) to plotman defaults
	22-Nov-2002, Kim.  Changed mark_limb to limb_mark for compatibility with map objects
	24-Nov-2002, KIm.  Changed log_image, square_image to log_scale, square_scale
	10-Dec-2002, Kim.  In dev2data method, use object saved in common if necessary.
	11-Dec-2002, Kim.  Only draw red box around plot if device is WIN or X
   09-Jan-2003, Kim.  In ::select, only draw red box if valid_window is true.
	05-Feb-2003, Kim.  Made getaxis,/yaxis work.
	13-Mar-2003, Kim.  Added _extra to getaxis call, and pass on to object's getaxis
	19-Mar-2003, Kim.  Added ut keyword to getaxis method.
	30-Mar-2003, Kim.  Save !x,!y after overlays so that interactive zooming and
	  pointing will work with any plot in a multiplot.  Also eliminated kludgy stuff
	  in dev2data that was needed for old kludgy version of spectro_plot
	30-Mar-2003, Kim.  Added desc_without_time keyword to get(/current_panel_desc)
	26-Jun-2003, Kim.  Added smooth_spec and exp_scale paramaters for spectrograms
	24-Jul-2003, Kim.  In plot method, replicate dim1_colors until # elements = # chan plotted
   13-Aug-2003, Mimi. In init method, changed x and y values for output_control ps structures
	26-Aug-2003, Kim.  Corrected problem with plotting color bar on images with overlays
	1-Oct-2003, Kim.  Fixed check on dim1_ids (is_string now instead of = -1)
	10-Oct-2003, Kim.  Change zlog,zexp to log_scale, exp_scale make_plot_cmd for spectrograms. Also take
		log out of arguments for spectrogram, only use for image.
	3-Nov-2003, Kim.  In get(/image_info), if current plot_type isn't image, return -1
	5-Nov-2003, Kim.  Added drange= to image plot command (using z axis limits) and added
		passing in limb_plot, grid_spacing, log_scale when doing self overlay (contours on image)
	24-Nov-2003, Kim.  In plot method, when doing overlay, was setting !x and !y to those of
	   overlay panel, but that screwed up PS plots of overlaid images.  Only set !x and !y for
	   non-image plots now.
	21-Feb-2004, Kim.  Added contour_label, contour_style, overlay_thickness, overlay_label,
	   overlay_style, n_overlay_levels, overlay_percent, overlay_levels, and
	   limb_thickness plot control parameters
	26-Feb-2004, Kim.  In setdefaults method, call ->set,input=input before set_plot_params
	   so user setting will get set after settings from input object (if it's an object)
	16-Mar-2004, Kim.  Undid change of Feb 26.  Have to find a better way - it was losing
		the default settings from data objects always - not just after user set their own
		preferences (so, e.g. trace images didn't come out in log, so look blank).
		Also, moved in make_plot_cmd, moved drange from parameters that are always set,
		to just being set if doing an image or spectrogram.
	5-Apr-2004, Kim.  Fixed user_label for overlays
   29-Jun-2004, Kim.  Added 'valid' function method.
	30-Jun-2004, Kim.  Added no_timestamp plot control parameter
	7-Jan-2005, Kim.  When setting input to a user image, allow map structure input
	   in addition to image array
	8-Jan-2005, Kim.  Removed /extend in calls to plot images.  Not nec. and collision with hessi obj.
		If info.pixel_area=0., use pixel_size to get pixel_area. Changed smooth to smooth_width to
		avoid collision with hessi obj params.
   22-Jan-2005, Kim.  Changed export, /fits method to call new image_writefits method
   16-Mar-2005, Kim.  In get(/image_info) use info.absolute_time_range
	17-Mar-2005, Kim.  In set colortable, set new color in plot_control, not image_defaults and
	   corrected bug in setdefaults (n dim eq 2, previously n dim ne 2)
	29-Mar-2005, Kim.  In getaxis, allow choice of output (edges, mean, etc) through
		call to get_edges
	30-Mar-2005, Kim.  When plot fails, print error traceback!!  Much better.
	14-Apr-2005, Kim.  In set method for 'input', if can't find time_range in data object,
		try timerange.
	24-May-2005, Kim. In set colortable, set new color in plot_control, AND image_defaults.
		Previously only in plot_control (and before that, only in image_defaults)
	24-May-2005, Kim.  Added nomap option to not map widget when plotman obj created.
	17-Jun-2005, Kim.  Changed smooth_spec to interpolate to match specplot__define
	23-Jun-2005, Kim.  Added wxsize,wysize to set method, so can set size after widget has been
		created in addition to in initialization
	29-Jul-2005, Kim.  Pass quiet keyword to image_fitswrite
	6-Aug-2005, Kim.  Added grid_thickness parameter
	11-Jan-2006, Kim.  Limit data coord to 1.e38 if it's Inf (exceeds float max) in dev2data
	22-May-2006, Kim.  Pass nomap to plotman_widget, call new_panel with noplot based on nomap,
		and commented out a widget_control.../map that I think (?) isn't necessary
	21-Jun-2006, Kim.  Added widget_control.../map change of 22-may back in.  Now that I corrected
		the nomap setup, if you init plotman with nomap, and then do a plot, it never shows up on
		screen without this.
	15-Sep-2006, Kim.  Removed some special code for PS in plot method
   21-Sep-2006, Kim.  Re-added that special PS code - needed for stacked plots
	11-Oct-2006, Kim.  On Unix, clicking the x in top right corner of hessi gui, and selecting yes
     to quit, often crashed IDL session (seemed to depend on location on screen of terminal
     window that started IDL!  for me, but not Paolo).  Error message like:
	  Xlib:unexpected async reply (sequence 0x115a)!
	  % X windows protocol error: BadFont (invalid Font parameter)
	  Traced to the tvlct in plotman::cleanup!  Now extract r,g,b out of self structure,
	  moved widget destroy down, and moved call to tvlct to be last.  Seems to fix problem,
	  but no idea why.


plotman__any_plot $SSW/hessi/idl/widgets/plotman__any_plot.pro
[Previous] [Next]
 Purpose: plotman method to check if we already have the right type of plot showing
   (xyplot or utplot), and if not, draw a blank plot (this is to allow graphical
   selection of intervals).

 Written: 16-Mar-2003, Kim.  Replaces hsi_get_plot.
 6-Jun-2003, Kim.  Added blank_plot keyword - returns 0/1


plotman__image_flux $SSW/hessi/idl/widgets/plotman__image_flux.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       plotman__image_flux

 PURPOSE:
       Plotman method to return image flux in user-specified areas

 METHOD:
	Image plot should be in plotman's draw widget.  This method pops
	up a widget that allows user to define areas on the image.  Flux
	in each area is returned.

 CATEGORY:
       Imaging (hessi/image)

 INPUT:  None
 OUTPUT:
	flux - total flux in image for each area defined by user
	cancel - 0/1 - operation not cancelled / cancelled

 Written:  Kim Tolbert, 2001

 Modifications:
  13-Jul-2002, Kim.  Added centroid calculation
  16-Jul-2002, Kim.  Added standard deviation of centroid calculation
  21-Jul-2002, Kim.  Added file writing capability.  Changed output format to be columns,
		changed to use xmessage (to get fixed pitch font) instead of dialog_message.
  26-Jul-2002, Kim.  Added box_str, header, output, units_string keywords
  02-Aug-2002, Kim.  Added peak location and value calculations (using parapeak)
  11-Apr-2003, Kim.  Added inverse option
  9-Jun-2003,  Kim.  Use 'Inv' instead of 'Box' for column heading when inverse is set.  And
		check that ind_use is not -1 before using it.
  3-Nov-2003, Kim.  Added subtract_image keyword.


plotman__spec_integr $SSW/hessi/idl/widgets/plotman__spec_integr.pro
[Previous] [Next]
 Name: plotman__spec_integr

 Purpose: spec_integr method for plotman.  Integrates spectrogram over y values.

 Method: User draws box to select y values.  (x values on zoom have no effect)

 Written: Kim Tolbert, March, 2003

 Modifications:
	24-May-2005, Kim.  Use y integration limits as yrange for spectrogram plot
	27-Jun-2005, Kim.  Added full keyword.


plotman_conf_panels $SSW/hessi/idl/widgets/plotman_conf_panels.pro
[Previous] [Next]
 Name: plotman_conf_panels
 Purpose: Allow users to select panels for plotting, exporting, summarizing, writing image cube, etc.

 Written, Kim Tolbert, 2001
 Modifications:
	5-Sep-2001, Kim.  reconfigure widgets to allow for longer panel description names
	15-Jun-2002, Kim.  Major redesign to allow printing, exporting, plot files, from multiple panels
	27-Jul-2002, Kim.  Added option for computing image flux, etc for multiple panels.
	21-Aug-2002, Kim.  Don't reset list widget and reset which are selected every time we exit
		event handler - makes the list jump around.
	09-Oct-2002, Kim.  Added nacross option
	07-Dec-2002, Kim.  Added 'show as movie' option
	14-Dec-2002, Kim.  Added search options for selecting panels
	09-Jan-2003, Kim.  Show text message while deleting panels, and save the panel_desc to
	  set current_panel_number back to current panel when done deleting.
	31-Oct-2003, Kim.  Added Change Limits to Current Plot option.
	5-Nov-2003, Kim.  Added Z limits to change limits option.
	6-Nov-2003, Kim.  Added a bunch of things to change to current plot settings. (uvalue=reset_...)
	30-Jun-2004, Kim.  Added timestamp setting to reset selections.
	?-Mar-2005, Kim.   Call image_fitswrite instead of write_image_cube method
	16-Nov-2006, Kim.  Don't need to unmap and remap main widget while deleting files any more
	  (because now in set_window_control_pulldown method don't redo the whole list anymore)
 CALLS:
 CALLED BY
	plotman_window_control_event


plotman_create_files_event $SSW/hessi/idl/widgets/plotman_create_files_event.pro
[Previous] [Next]
 Modifications:
	Kim, 17 Oct 2000.  Call wset,-1 and cleanplot after making plot.
	Kim, 21-Apr-2001.  Changed plot control tags from r,g,b to rcolors,...
   Kim, 31-Aug-2001.  For PS plots, change any dim1_colors that are white to black
	Kim, 21-Jun-2002.  Added filename, quiet, msg keywords
	Kim, 22-Jan-2003.  Previously hardcoded color of contour on PS plot to red (??)  No more.
	Kim, 18-Aug-2003.  Put " around filename before passing to psplot
	Kim, 10-Feb-2004,  For PS, increase thickness of lines
	Kim, 20-Feb-2004,  For non-color, set dim1_colors to all 0's, so does diff line styles.
	Kim, 22-Feb-2004,  For b/w PS, save all colors, set to 0, then set back to saved
	Kim, 15-Sep-2006,  Use '' for b/w, not 0
 CALLS:


plotman_draw_event $SSW/hessi/idl/widgets/plotman_draw_event.pro
[Previous] [Next]
 Name: plotman_draw_event

 Purpose: Handles right and left click events in plotman's draw widget.

 Method: Right-click show x,y of point, and for images, the image value
	Left-click and drag allows zooming.  Single left-click unzooms.

 Modifications:
	31-Jul-2001, Kim.  On right click, show image value for images, and for all types
	  of plots, print label in IDL window as well as on plot.
	12-Aug-2001, Kim.  Corrected error in image value display
	11-Oct-2002, Kim.  Call new plotman method dev2data to convert coords
	28-Mar-2003, Kim.  Made this work for multiplot plots (if they're stacked in y direction only).
	  Figures out which plot user clicked in, then sets focus to that panel temporarily to get
	  correct device to data conversion.  Then focuses back on original (top in multi) panel.
	16-Jun-2005, Kim.  In point command (right click) if x is < 1.e6 don't interpret as time.
 CALLS:


plotman_imageoptions $SSW/hessi/idl/widgets/plotman_imageoptions.pro
[Previous] [Next]
 Name: plotman_imageoptions

 Purpose: Widget to set options for displaying images

 CATEGORY:  HESSI WIDGETS

 Calling sequence:  plotman_imageoptions, event
   Normally this routine is the event_pro for the 'Image Display Options...' button on the plotman widget

 Input arguments:
   event - event structure

 Output: changes display of image in plot window

 Output Keyword:  None

 Written: Kim Tolbert
 Modifications:
   21 Dec 2000, Kim,  added sliders for x and z angles for surfaces
	17-Feb-2001, Kim.  Added overlay separate images option.
		Also included plotman_imgopt_widget_update routine in this file.
	8-Jul-2001, Kim.  Accounted for overlay_panel now being an array (multiple
		is for xy and ut plots only, images will only allow one overlay)
	30-Aug-2001, Kim.  Added mark limb option.
	2-Sep-2001, Kim.  Added legend_color, translate_overlay options. Rearranged widgets.
	22-Jan-2002, Kim.  Added mark_point option (for HESSI only)
   20-Feb-2002, Kim.  Added user_label option
	21-Jul-2002, Kim.  Added contour_percent, contour_color contour_thickness options.  Changed auto and define
 		contour levels to regular buttons instead of exclusive (radio) buttons)
	07-Oct-2002, Kim.  Allow setting of contour options for overlays
   01-Nov-2002, Kim.  Add grid spacing and color options (right now color is same as contour)
   05-Nov-2002, Kim.  Add grid_color, limb_color, and translate_image options (before translate
     was just for overlays)
	22-Nov-2002, Kim.  Changed mark_limb to limb_mark for compatibility with map objects
	24-Nov-2002, KIm.  Changed log_image, square_image to log_scale, square_scale
	24-Nov-2002, Kim.  Renamed limb_mark to limb_plot, and made Mark Pointing option unsensitive
		since there's no pointing info yet.
	5-Nov-2003. z axis was desensitized for images previously (was only for surface plots)
	20-Feb-2004, Kim.  For contours, let overlay base be sensitive (previously was sens.
	    only for image representation.
	22-Feb-2004, Kim.  Added lots of options for overlay contours.  Took contour options out of
	    main image options widget, and added 'Contour Options' button - calls plotman_contoptions.
		Reorganized rest of main image options widget.  Added limb thickness.
	5-Apr-2004, Kim.  Changed format for xyz limits to show more digits
	30-Jun-2004, Kim.  Added no_timestamp option
	6-Aug-2005, Kim.  Added grid_thickness option and commented out the mark_point stuff - not using
	25-May-2006, Kim.  Modified string format for image translate
 CALLS:


plotman_list_int $SSW/hessi/idl/widgets/plotman_list_int.pro
[Previous] [Next]
 Name: plotman_list_int
 Routine to refresh widgets showing current intervals and total number of intervals.
 Gets widget ids out if int_info structure.

 Written 30-Jan_2001, Kim.  Previously this was being done by plotman_modify_int every time
   a new interval was added.  Now add new intervals, and then call this once afterwards (on Unix
   took forever to update widget list for each new interval).
 CALLS:


plotman_mark_box $SSW/hessi/idl/widgets/plotman__mark_box.pro
[Previous] [Next]
 Name: plotman_mark_box

 Purpose: plotman method with widget to select boxes on an image

 Calling sequence:  boxes = plotman_obj -> mark_box ()

 Input arguments:
	list - (2,n) array of x,y vertices for boxes
	nop - 1-d array of number of items in list per box
	type - string, type of boxes to draw, e.g. 'Clean', 'Flux'  Used for labels, and if type is 'Flux'
		then file writing options are displayed in widget


 Output: structure containing tags list and nop.
      For each if none defined, they are = 0.
      If boxes are defined, then list is a fltarr(2,n) where the first
      dimension is x,y, and nop is the number of points used for each box.
      (example: a triangle and a rectangle would result in list(2,9), and
          nop = [4,5]

 Method:  User can draw rectangles,
    circles, or polygons to define clean boxes.

 Written:  22-Feb-2001, Kim Tolbert
 Modifications:
  22-Apr-2001, Kim.  Added polygons and circles.  Use cw_list and cw_nop instead of clean_box
  6-May-2001, Kim.  Changed from a routine to a plotman method.
  4-Jun-2001, Kim.  Added initial circle radius box for user.  On call to stretch_circle,
	 added keywords radius and message_id.
  5-Jun-2001, Kim.  Added common plotman_mark_box_common and "restore" button.  Saves boxes
    from previous time routine was called and restores them.
  13-Jul-2002, Kim.  Added contour option and color choice for boxes
  18-Jul-2002, Kim.  Use xsel_list_multi to allow multiple selection of boxes to delete
  21-Jul-2002, Kim.  Added file writing options when type = 'Flux'
  28-Jul-2002, Kim.  Allowed for larger values of contour level in widget text box
  02-Aug-2002, Kim.  Added More Info button when type = 'Flux'
  11-Apr-2003, Kim.  Added inverse option
  5-Apr-2004,  Kim.  Added option to draw fixed circle at specified center, radius.
  31-Aug-2004, Kim.  Added Keep button for contours (choose how many contours to keep)
  9-Jul-2005, Kim.  On Linux, mark box widget wasn't being re-sensitized sometimes (very rarely)
    after drawing boxes.  I think it's another of those weird timing problems on Linux, so
    I added a second command to sensitize widget - see if that fixes it.
  31-Mar-2006, Kim.  Added option to define % contour levels based on currently defined ROIs instead
    of entire image.  Also changed defaults for radius and center of circle to be 1/5 size of image and
    position of max element, respectively.
	3-Apr-2006, Kim.  Add option to delete existing ROIs before adding new contours
	18-May-2006, Kim.  Added Delete, Restrict buttons, popup widget to choose which ROIs to
	  use for contours and added Help button.


plotman_output_control_define $SSW/hessi/idl/widgets/plotman_output_control__define.pro
[Previous] [Next]
 Name: plotman_output_control_define

 Purpose:  Define output control structure for plotman

 Written: Kim Tolbert, 2000
 Modifications:
	21-Jul-2001, Kim.  Added imgflux structure
 CALLS:


plotman_panel_control_event $SSW/hessi/idl/widgets/plotman_panel_control_event.pro
[Previous] [Next]
 Name: plotman_panel_control_event
 Purpose: handles events generated by panel options pulldown
   Options are close, delete, maximize, or send to a new plotman object.

 Modifications:
 30-Jan-2001, Kim - When added 'summary' button to area above plot, had
   to create a base to put the droplist and the button in.  So now the parent
   of the droplist event isn't the draw base, it's the new little base, so
   so have to go two levels up to get parent.

 CALLS:


plotman_plot_control__define $SSW/hessi/idl/widgets/plotman_plot_control__define.pro
[Previous] [Next]
 Name:  plotman_plot_control__define

 Purpose: Define structure for plotman plot control parameters

 Kim Tolbert   Jan 2000
 Modifications:
	10 Aug 2000, Added channels
	26 Sep 2000, Added surface stuff, charsize
       Kim, 21-Apr-2001.  Changed plot control tags from r,g,b to rcolors,...
		Kim, 1-May-2001.  Changed dim1_unit to dim1_name
		Kim, 8-Jul-2001.  Made overlay_panel an array
		Kim, 30-Aug-2001.  Added mark_limb option
		Kim, 2-Sep-2001.  Added legend_color, translate_overlay
		Kim, 22-Jan-2002.  Added mark_pointing option
   	20-Feb-2002, Kim.  Added user_label option
		2-Mar-2002, Kim.  Added more_commands option
		27-May-2002, Kim.  Added derivative option
		21-Jul-2001, Kim.  Added contour_percent, contour_thickness options
		19-Sep-2002, Kim.  Added integral option
		01-Nov-2002, Kim.  Added grid_spacing option
       05-Nov-2002, Kim.  Add grid_color, limb_color, and translate_image options
		22-Nov-2002, Kim.  Changed mark_limb to limb_mark for compatibility with map objects
		24-Nov-2002, KIm.  Changed log_image, square_image to log_scale, square_scale
		24-Nov-2002, Kim.  Renamed limb_mark to limb_plot
		27-Jun-2003, Kim.  Added smooth_spec, exp_scale for spectrograms
		22-Feb-2004, Kim.  Added contour_label, contour_style, overlay_thickness, overlay_label,
	   overlay_style, n_overlay_levels, overlay_percent, overlay_levels, and
	   limb_thickness plot control parameters
		30-Jun-2004, Kim.  Added no_timestamp plot control parameter
		17-Jun-2005, Kim.  Changed smooth_spec to interpolate to match specplot__define
		06-Aug-2005, Kim.  Added grid_thickness option


plotman_reset $SSW/hessi/idl/widgets/plotman_reset.pro
[Previous] [Next]
 Name: plotman_reset

 Purpose: Tries to restore plotman settings in case of a crash.  Also lets user kill hung widgets.

 Calling sequence:  plotman_reset, plotman_obj

 Input arguments:
   plotman_obj - plotman object to clean up

 Method:
	1. Restores normal setting of 3 for device graphics setting
	2. Resets the event handler for the draw widget
	3. Clears pending events
	4. Lets user destroy any hung widgets (user can choose from list)

 Output:
   Selected widgets are destroyed.

 Written:  Kim Tolbert, 1-Aug-2002
 Modifications:
 CALLS:
 CALLED BY
	HESSI, plotman_widget


plotman_set_window_control_pulldown_basic $SSW/hessi/idl/widgets/plotman_set_window_control_pulldown_basic.pro
[Previous] [Next]
 Name: plotman_set_window_control_pulldown_basic
 Purpose: Set up the basic generic part of the Window_Control pulldown menu on plotman

 Written: Kim Tolbert, 2001
 Modifications:
	30-Jun-2002, Kim.  Added Current Panel pulldown to items in basic windows pulldown
	16-Nov-2006, Kim.  Added separator button.
 CALLED BY
	plotman_widget


plotman_setaxes $SSW/hessi/idl/widgets/plotman_setaxes.pro
[Previous] [Next]
 Name: plotman_setaxes

 Kim Tolbert
 Modifications:
   14-May-2002, Kim.  Fixed error in xyzreset line
	5-Nov-2003, Kim.  xyzreset wasn't resetting z axis
 CALLS:
 CALLED BY
	plotman_imageoptions


plotman_widget $SSW/hessi/idl/widgets/plotman_widget.pro
[Previous] [Next]
 Name: plotman_widget

 Purpose: Create and handle most events in plotman widget

 Written: Kim Tolbert, 2000
 Modifications:
   21-Jan-2001, Kim - enabled export fits option
	Kim, 21-Apr-2001.  Changed plot control tags from r,g,b to rcolors,...
	7-May-2001, Kim.  Added imageflux option
	10-Jul-2001, Kim.  call magnify method
	1-Sep-2001, Kim.  Added zoom to previous button
	18-Mar-2002, Kim.  Added angled image profiles button
	9-Jun-2002, Kim.  Enabled export to idlsave file
	18-Jun-2002, Kim.  Added /namedialog to idlsave export call
	30-Jun-2002, Kim.  Don't handle 'summparams' uvalue here.  Now handled in
	  plotman_window_control_event
   01-Aug-2002, Kim.  Added reset button
	23-Sep-2002, Kim.  Use /relaxed on restgenx call in case structure def has changed.
	01-Oct-2002, Kim.  Save exit widget id in widgets structure.
	06-Sep-2002, Kim.  Added spectrogram plot options button
	10-Jan-2003, Kim.  Use widget size info a little differently to make it work in IDL 5.6 on UNIX
	17-Jan-2003, Kim.  added plotman_cleanup procedure to clean up when widget is killed (even from outside)
	??-Mar-2003, Kim.  Added spectrogram integrate option.  Also initialized the upper buttons under
	  Plot_Control to sensitive=0.
	16-Sep-2003, Kim.  Widget resizing didn't work in IDL 6.0.  Fixed this.  Now save x_borders, y_borders
	  (diff between overall widget and main draw widget) and
	16_Mar-2004, Kim.  For standalone plotman, use widget_offset to position if group available
	21-Mar-2005, Kim.  Added average option to image profiles button
	24-May-2005, Kim.  Added nomap option.
	17-Jun-2005, Kim.  Added submenu for integrating spectrograms - full y or select y range.
	22-May-2006, Kim.  Fixed nomap in realize (had it backwards)
	16-Nov-2006, Kim.  Call widget_offset only if group is alive.

 CALLS:
 CALLED BY
	plotman


plotman_window_control_event $SSW/hessi/idl/widgets/plotman_window_control_event.pro
[Previous] [Next]
 Name: plotman_window_control_event
 Purpose: Procedure to handle events from the plotman window_control pulldown menu.
 If called with saved_uvalue and state keywords (both must be passed), then this is not
	a real event, use uvalue passed. (In this case event is a dummy argument, just set to 1
	or something.)

 Written: Kim Tolbert, 2001
 Modifications:
	30-Jun-2002, Kim.  Added currdel, currmax, currnew, currsumm to uvalues to handle
	15-Nov-2006, Kim.  uvalue is now panel description (previously had 'panel x' in name),so
	  in else: use uvalue to get panel number to use as arg to show_panel.  Also
	  for 'new plotman window' option, call with wxpos=300 to offset from original.
	  Also, don't set last_window_choice unless uvalue is one we'd want to repeat after resize.
 CALLS:
 CALLED BY
	plotman_widget


plotman_zoom $SSW/hessi/idl/widgets/plotman_zoom.pro
[Previous] [Next]
 Name: plotman_zoom
 Purpose: allow user to define borders of zoom area and zoom in plotman window

 Input:
	state - state structure containing plotman object
	event -  - draw window left click event that has already occurred, e.g. user
		has already left clicked in draw widget, and this position should
		be used as starting position for stretch box
	orig_panel_num - if set, reset focus to this panel before replotting (we zoomed on
		one of the plots in an overlay that wasn't the main plot

 Written: Kim Tolbert
 Modifications:
	1-Sep-2001, Added use_previous option.  Remember previous zoom limits for xy, ut,
	  and image plots separately in common, and restore thoseif use_previous is set.
   11-Oct-2002, Kim.  Call new plotman method dev2data to convert coords
	28-Mar-2003, Kim.  Added orig_panel_num keyword, and if it exists, reset focus to
	  that panel before replotting.

 CALLS:
 CALLED BY
	plotman_draw_event, plotman_widget


plotmanimage_fitswrite $SSW/hessi/idl/widgets/plotman__image_fitswrite.pro
[Previous] [Next]
 Name: plotman::image_fitswrite
 Purpose: Plotman method for writing a FITS file from a single or collection of panels.
	Can only be used for HESSI images.

 Written: Kim Tolbert, 22-Jan-2005.  This replaces plotman__write_image_cube
 29-Jul-2005, Kim.  Added quiet keyword
 9-Aug-2005, Kim.  Ask for filename at the beginning, instead of using the built-in feature
   in fitswrite, since merging panels into a single object takes way longer than it should.


plotmanmulti_file_output $SSW/hessi/idl/widgets/plotman__multi_file_output.pro
[Previous] [Next]
 Name: plotman::multi_file_output
 Purpose: Plotman method for handling writing fits, save, or plot files for multiple panels.
	User is prompted for base name of output files, then panel number is appended to each
	file to make it unique.

 Written: Kim Tolbert, 20-Jun-2002
 Modifications:


plotmanmulti_image_flux $SSW/hessi/idl/widgets/plotman__multi_image_flux.pro
[Previous] [Next]
 Name: plotman::multi_image_flux

 Category: HESSI

 Purpose: Plotman method for computing flux, centroid, peak for multiple image panels.

 Input:
	panels_selected - Panel numbers of panels to use
 Input keywords:
	use_box - if set, use stored boxes
	use_cont - if set, compute contour for each image and use that region
	inverse - if set, use area outside of boxes instead of inside
	Note: both use_box and use_cont can be set

 Written: Kim Tolbert, 26-Jul-2002
 Modifications:
	9-Jun-2003, Kim.  Added inverse keyword
	3-Nov-2003, Kim.  Added _extra keyword (so we can pass subtract_image through)


plotmanmulti_image_flux_widget $SSW/hessi/idl/widgets/plotman__multi_image_flux_widget.pro
[Previous] [Next]
 Name: plotman::multi_image_flux_widget

 Category: HESSI

 Purpose: plotman method with widget to select options for computing flux, centroid, peak for multiple images

 Input arguments:
	group - widget id of parent widget
	panels - panel numbers of panels to compute image info for

 Method:  After setting up options, calls multi_image_flux method to do the work.

 Written:  28-Jul-2002, Kim Tolbert
 Modifications:
	9-Jun-2003, Kim.  Added inverse button (if enabled use area outside of box)
	3-Nov-2003, Kim.  Added subtract button (if enabled, subtract current image from all
	   images before doing flux calculations.


plotmanset_window_control_pulldown $SSW/hessi/idl/widgets/plotman__set_window_control_pulldown.pro
[Previous] [Next]
 Name: plotman::set_window_control_pulldown

 Purpose: Set up the plotman Window_Control pulldown menu.  Every time we add or delete
	a panel to this menu, have to delete the whole thing, and refill it again (don't know
	why).  So first remove all buttons, then add the basic, generic buttons, then add a
	description for each panel.

 Written: Kim Tolbert, 2001
 Modifications:
	30-Jun-2002, Kim.  Use xwidump to find widget id's
	5-Jan-2005, Kim.  Changed from subroutine to object method.


plotmanwrite_image_cube $SSW/hessi/idl/widgets/plotman__write_image_cube.pro
[Previous] [Next]
 Name: plotman::write_image_cube
 Purpose: Plotman method for writing an image cube FITS file from a collection of panels.
	Can only be used for HESSI images.

 Written: Kim Tolbert, 20-Jun-2002
 Modifications:
 20-Aug-2002, Kim.  Handle writing separate info structures for each image
 16-Jul-2003, Kim.  If couldn't find current time and energy in times_all,ebands_all (so
    ind = -1) then set a fake info structure with just absolute_time_range.  Before still
    tried to use info[ind].
 30-Nov-2004, Kim.  use strlowcase for check for desc='hessi image'


pmtras_analysis $SSW/hessi/idl/pmtras/pmtras_analysis.pro
[Previous] [Next]
 PROJECT:
	HESSI

 NAME:
	pmtras_analysis

 PURPOSE:
 	Analyzes RHESSI PMTRAS alignment and flight data

		See comments in source code for details of sequence of algorithms used.

 CATEGORY:
	hessi/idl/pmtras

 CALLING SEQUENCE:
	Direct call:
		pmtras_analysis, filename [, tstart, stop] [ , /keywords ]

	Object-oriented call:
		pmtras_analysis, packet_object=packet_object [, /other_keywords]

 CALLS: ***
	HSI_MONITOR_RATE_DECOMPRESS, HSI_PMTRAS_ALIGNMENT_ANALYSIS
	HSI_PMTRAS_BLIP_INTERPOLATION, HSI_PMTRAS_CLASSIFY, HSI_PMTRAS_DATAGAP_CHECK
	HSI_PMTRAS_DEADTIME_CORRECTION, HSI_PMTRAS_GET_STARS, HSI_PMTRAS_GROUP_BLIPS
	HSI_PMTRAS_HISTPLOT, HSI_PMTRAS_PERIOD_ESTIMATOR
	HSI_PMTRAS_STAR_ASSOCIATION, HSI_PMTRAS_UNIFORM_POLY_FIT, HSI_RD_RASPMT
	HSI_SCTIME2ANY, INTERPOL, LOADCT, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], MEAN, PB0R
	POLY_FIT, REVERSE, SINCE_VERSION [1], SINCE_VERSION [2], UNIQ [1], UNIQ [2]
	UNIQ [3], UTPLOT [1], UTPLOT [2], UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6]
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], hsi_outlier
	hsi_pmtras_lookup, restgen [1], restgen [2]
 INPUTS:
 	Required if packet object is not specified as a keyword.
		filename 				= name of the input file

 OPTIONAL INPUTS:
 	Relevant only if packet_object is not specified as a keyword.
		tstart,tstop 			= optional parameters to indicate the relevant timerange
										(seconds from start of file)

 OUTPUTS:
	Keyword /PMTRAS_SOLUTION specifies solution structure, with tags:
		.t0 		= time of first solution datum (ANYTIME format)
		.reltime	= array of times, relative to t0 (seconds)
		.posn_angle	= s/c position angle, measured +ve W of 'north' in monatonically
							increasing radians

	Otherwise, only screen output and optional plots are provided.

 OPTIONAL OUTPUTS:
	As specified by keywords.

 KEYWORDS:
	threshold 			= optional minimum value of peak counts in a valid sample (default = 0)
	period_est			= (input)estimated period of rotation (correct to +-30%)  (default = 4s)
	padded				= set if input is calibration data in padded format
							Default is level-0 data (viz, not 'padded')
	class_display_flag 	= set to request display of blip classification and status
 	dumppacket 			= array of packet numbers to dump to PMTPACKETDUMP.TXT
 	blipdump			= set to request display of details of valid blips
 	blipmin				= minimum blip total to consider as a potential star
							(Default is blipmin is set dynamically to correspond to a
								predetermined average blip rate.)
 	alignfile			= present iff alignment data is to be analyzed.  Indicates name of
                           ascii file with	calibration timing information
 	alignmode			= present iff preflight alignment data is to be analyzed.
							Indicates which calibration run is to be analyzed.
 	no_starid			= set to suppress attempts to associate blips with specific stars.
 	period				= named variable to receive the average rotation period.
 	packet_object		= used in call from hsi_aspect_solution, or after packet_object is defined
 	pmtras_solution		= structure name to receive solution for direct use by imaging software
 	plotflag			= has bit 2^N set if plot window N is desired.  (See below for plotlist)
								If /NO_STARID is set,
									default is 512=>Prelimary Rotation Period plot only.
								Bit 2^11 (2048) enables printed diagnostics.
								Otherwise, default is plotflag=0 ==> no plots
 	quadfit				= vector of 3 parameters such that PA(t) = A[0] + A[1]*t + A[2]*t^2
 	equat_ns			= set if solution y-axis should point toward equatorial (celestial)north.
									(Default is solar north.)
 	sc_sun_offset		= (input) approximate s/c pointing offset (+W,+N) in degrees relative to sun center
								(Default = [0,0], which is ok for solar observations.)
 	deadtime			= set to perform deadtime correction (default=no deadtime correction)
	july23				= set to use database in c:\ssw\hessi\dbase\aspect\pmtras_solution_20020723.sav
	publication			= set to format plots 3,5,7 and 9 in publication format (no color, no titles, thicker lines)
									(Default is PUBLICATION = 0)
	dbase_solution		= structure name to receive solution for use by PMTRAS_DBASE_GENERATOR
	nolookup			= set to bypass roll database (default is NOLOOKUP=0)
	rdb_time_range		= roll data base time range (excludes ras_time_extension)
	nostop				= set to suppress stopping when executing fatal MESSAGE routines.
   rasjuly23			= set to use solution found in RAS_SOLUTION_20020723.genx for July23'02 flare (default)
 	_extras				=

 List of optional output plots and files:
	Window 1:	   2 Fractional Time Interval Distribution
	Window 2:	   4 Blip Total vs Time
	Window 3:	   8 Preliminary Timing Residuals
	Window 4:	  16 Alignment									in PMTRAS_ALIGNMENT_ANALYSIS
	Window 5:	  32 Intensity/Phase Grouping					in PMTRAS_GROUP_BLIPS
	Window 6:	  64 Observed vs Predicted intensity
	Window 7:	 128 File-Averaged Phase Residuals
	Window 8:	 256 Background vs Time
	Window 9:	 512 Preliminary Estimate of Rotation Period
	Window 10:	1024 Phase Histogram							in PMTRAS_GROUP_BLIPS
	Window 11:	2048 Enables printed diagnostics.
	Window 12:	4096 Blip Total Distribution					in PMTRAS_HISTPLOT
	Window 13:	8192 Bliptot vs Timing Correction

 CALLED BY:
	HSI_LOCATE_FLARE [2], HSI_LOCATE_FLARE [4], HSI_QLOOK_ASPECT
	hsi_flare_position_image [1], hsi_flare_position_image [2]
	hsi_full_sun_image [1], hsi_full_sun_image [2], hsi_locate_flare [1]
	hsi_locate_flare [3], hsi_ras_pmt
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	Will execute a MESSAGE procedure if a fatal problem is encountered which prevents roll solution.

 RESTRICTIONS:
	Does not handle data gaps or sparse star fields well.
	Requires observations of at least 2 identified stars within the data set.
	A warning is displayed on screen if solution is generated but is suspect.
	Not recommended for use over multi-orbit intervals or for timescales <~15 minutes.

 MODIFICATION HISTORY:

  2-17-00 		Initial version, adapted from PMTRAS_ANALYSIS of 1-07-00 whose parameters were hardcoded.
  4-06-00 gh	Discard samples where 3 counts are equal
				Minor revision to rough period calculation to support larger datasets.
  1-26-01 gh	Add optional classification display, which writes output to PMTCLASSDISPLAY.TXT.
  1-29-01 gh	Add optional screen display of illegal samples.
  1-30-01 gh	Adapt to new version of HSI_RD_RASPMT, which uses level-0 data as default input.
  1-31-01 gh	Restore provision for optional histogram of blip total.
  2-01-01 gh	Add provision for non-default readout and accumulation intervals.
               Add status and hv output to classification display
  2-23-01 gh	Formalize optional provision for alignment calibration analysis.
  3-19-01 gh	Reorganization to deemphasize packet association of samples.
			 	Improve classification scheme.
  3-20-01 gh	Eliminate data from packets in which accumulation interval was changed.
				Correct handling of last accum_interval when accum_interval is not 1 ms.
  3-21-01 gh	Break out period estimator code as a separate function.
 10-May-01 gh	Begin to implement provision to group blips according to phase and intensity.
 11-Jul-01 gh	Minor cleanup, debug PMTRAS_GROUP_BLIPS
 31-Jan-02 gh	Add provision for star association.
  1-Feb-02 gh	Transferred functions to separate modules.
  4-Feb-02 gh	Add calculation of final fit and residual display.
  6-Feb-02 gh	Minor debugging, refinements.
  8-Feb-02 gh	Add background vs time plot.
				Make WINDOW calls conditional on plotting device.
  9-Feb-02 gh	Add graceful exit if no PMTRAS packets are found.
 10-feb-02 gh	Debugging...
 14-Feb-02 gh	Minor correction to histogram plot
 16-Feb-02 gh	Add PERIOD_EST keyword.
 22-Feb-02 gh	Change blipmin default from 0 to 300.
				Add NO_STARID keyword to stop after getting rotation periods.
 27-Feb-02 gh	Incorporate stepwise varying period in preliminary phase calculation.
 28-Feb-02 gh	Add TFIT_RANGE to specify time range over which to fit final phase and rotation rate.
 13-Mar-02 gh	Use quadratic interpolation to more correctly deduce rough phases.
 27-Feb-02	ac	Added PACKET_OBJECT keyword
 21-Mar-02 gh	Allowed for case where PACKET_OBJECT keyword is missing.
 26-Mar-02 mf	Added pmtras_solution keyword.
 28-Mar-02 gh  Discard blip groups which have questionable star association.
 30-Mar-02 gh	Debugging.
				Add cross-check to star association.
 				Add hardwired term to provide absolute roll.
 04-Apr-02 mf  Introduce keywords PMTRAS_DIAGNOSTIC and _EXTRA to interface.
 09-Apr-02 mf  Pass _EXTRA keyword to hsi_rd_pmtras.
 09-Apr-02 gh	Add !PI correction to absolute roll value to compensate for reflection error.
 10-Apr-02 gh	Make default blipmin depend on accumulation interval.
				Apply blipmin test within hsi_pmtras_group_blips, instead of at the classification stage.
 				Gather all 'adjustable' analysis parameters in one location, including specification of defaults.
 11-Apr-02 gh	Eliminate obsolete tfit_range keyword
				Eliminate outliers in final output.
 12-Apr-02 gh	Eliminate obsolete PLOT keyword whose role is now played by PMTRAS_DIAGNOSTIC.
 				Use /FREE switch to create new X-terminal plot windows.
				Make printed diagnostics conditional on plotflag.
				Suppress color table loading if not needed.
 13-Apr-02 gh	Add /HELIO_NS switch.
 15-Apr-02 gh	Make HELIO_NS the default.
 17-Apr-02 gh	Remove STATUS keyword in calls to POLY_FIT (not supported in IDL5.3.1)
 18-Apr-02 gh	Write IDLversion specific calls to POLY_FIT. (YFIT,STATUS & RMSERROR not supported in 5.3.1)
 28-Apr-02 gh	Add MIN_STAR_INT keyword to hsi_get_stars
				Add MIN_PA_SEP keyword to hsi_get_stars to eliminate closely spaced stars.
 29-May-02 gh	Replace HELIO_NS with EQUAT_NS switch.  Default is still solar north.
  8-Jun-02 gh	Added QUADFIT keyword.
 18-Jun-02 gh	Added SC_SUN_OFFSET keyword.
 19-Jun-02 gh	Use UTPLOT for time plots.
           	Removed STATUS keyword from quadfit POLY_FIT call to preserve compatibility with IDL5.3.1
				Changed MIN_PA_SEP to 1.0 instead of 0.
				Introduce dummy function, hsi_blip_interpolation.
 27-Jun-02 gh	Add optional diagnostic plot (13) of bliptotal vs timing correlation
				Restrict bliptot histogram plot to events with class=0
 				Determine blipmin internally, on the basis of an predetermined average number of blips per packet.
 28-Jun-02 gh	Add BLIP_FWHM keyword to support interpolation based on a gaussian blip profile.
  2-Jul-02 gh	Change minpopulation from fixed number of blips (5) to a fraction (2%) of total number.
				Iterate estimates of rough period.
  4-Jul-02 gh	Lower minpredcount factor from 0.6 to 0.4
				Change min_pa_sep from 1 to 2 degrees.
  5-Jul-02 gh	Use multiple trials to choose the best star association.
				Change difftol from .01 to .002
				Change minpredcount_factor from 0.4 to 0.33
				Use /SEQUENCE option for bliptime interpolation.
  6-Jul-02 gh	Add DEADTIME switch, but leave default at no deadtime correction.
				Revise output measure of rms error to indicate internal short-term errors.
           	Add warning messages in output if datagaps, period gaps or large internal errors.
				Add provision to exempt really bright stars from the double-star rejection requirement
  7-Jul-02 gh	Added ssw template (at last).
  8-Jul-02 gh	Corrected coding in final warning message.
				Exit with MESSAGE if only 1 preliminary period can be estimated.
 11-Jul-02 gh	Added doublestars as triangles in phase/intensity plot.
 12-Jul-02 gh	Added support for case when hsi_pmtras_period_estimator returns a -1.
 16-Jul-02 gh	Correct minor bug preventing use of /blipdump switch
				Revise calculation of blipmin to use only class=0 bliptot's.
				Base missing period estimate on 2nd iteration of period_estimator instead of the 1st.
 16-Jul-02 gh/kt Change the loop variable to a long integer to support more than 2^15 associated blips.
 22-Jul-02 gh	Calculate min_blip_group_intensity on the basis of grouped blips only.
 24-Jul-02 rs/gh	Add kluge to support access to July 23 interpolated data base.
 25-Jul-02 gh	Correct recent bug which prevented returning avperiod when NO_STARID was set.
  5-Sep-02 gh	Revise symbol in Rotation Period plot.
 11-Sep-02 gh	Minor changes to plot labels.
				Add /NOCOLOR switch
 22-Sep-02 gh	Replace /NOCOLOR switch with /PUBLICATION to generate plots 3,5,7,9 in publication quality.
 28-Sep-02 gh	Add DBASE_SOLUTION keyword to accept solution in form required by PMTRAS_DBASE_GENERATOR.
 15-Nov-02 gh	Add kluged call to hsi_pmtras_lookup to use pmtras database if available.
				Add /NOLOOKUP keyword to bypass lookup table.
 22-Dec-02 gh	Replace 2 remaining STOP statements with MESSAGE calls.
				Convert posn_angle tag in pmtras-solution output structure to D.P.
 23-Dec-02 gh	Integrate call to use hsi_pmtras_lookup to use pmtras database if available.
 31-dec-02 gh	Debug access to time_range parameter.
 28-Jan-03 gh	Change min_brightness_ratio parameter from 5.0 to 4.0
 29-Jan-03 KT/gh Prepended $ to HSI_ASPECT in loc_file call
 23-May-03 gh	Correct plotting code to handle case of a single double star.
  7-Jul-03 gh	Accomodate name change of hsi_outlier function.
 30-Jul-03 gh/mf	Use new approach for specifying time_range (per mf email of 28-july)
				Add rdb_time_range keyword.
			gh	Sets dbase_solution = -1 just before returning with any fatal MESSAGE.
  4-Aug-03 gh	Add /NOSTOP keyword to suppress stopping when executing fatal MESSAGE routines.
				Issue fatal MESSAGE if only 1 blipgroup.
 11-aug-03 gh	Correct 23-July-02 data for 1ms timing error.
 14-Aug-03 gh	Generate info message if database roll solution is not useable.
 24-Sep-03 gh	Add /RASjuly23 keyword to use RAS tabulated solution for July 23'02 flare
 25-Sep-03 gh	Revise code to access July 23'02 tabulated solution to exploit rdb_time_range input option.
 28-Sep-03 gh	Having served its purpose, RASjuly23 keyword is converted to an internal switch.
			gh	Change default access for July 23 to the normal roll database.
  1-Dec-03 gh	Correct bug which mishandled calculation of median_period_est when there was only 1 datum.
 20-Mar-04 gh	Correct bug in calculation of packetime to remove unnecessary dependence on clock drift.
					This had caused timing (and hence roll) errors corresponding to the change in clock
					drift compared to that at the beginning of the analysis interval.
 24-Oct-05 gh	Delete unnecessary parameters in call to hsi_pmtras_uniform_poly_fit and clarify some messages&comments.


POINT SPREAD FUNCTION CLASS DEFINITION $SSW/hessi/idl/image/hsi_psf__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       POINT SPREAD FUNCTION CLASS DEFINITION

 PURPOSE:
       Provides the data management of the RHESSI point spread functions
       for a given map coordinate. You give a map pixel location in
       annsec coordinates and it returns the psf for that particular
       pixel.
       Since May 2004, the class returns by default the class summed
       over detectors. There is a control parameter to get the psfs for
       individual detectors, but using this control parameters might
       disrupt the way the imaging algorithms work.

 CATEGORY:
       Imaging (idl/image)

 CONSTRUCTION:
       psf_obj = Obj_New( 'hsi_psf' )
       psf_obj = HSI_PSF()

 (INPUT) CONTROL PARAMETERS DEFINED IN THIS CLASS:

      xy_pixel - the xy position of the pixel for which the psf must
                 be processed
      psf_no_sum - if set, the psfs are returned by
                   detectors. default is 0, i.e. the psfs are summed
                   over the chosen detectors. This is not a true
                   control parameter, it does not add to the general
                   list and must be set specifically for this class,
                   with for instance
                   ooo->get( class_name = 'hsi_psf' )
                   ooo->set, /psf_no_sum

 (OUTPUT) INFO PARAMETERS DEFINED IN THIS CLASS:

      none yet

 KEYWORDS:
       THIS_DET_INDEX: use with GetData; retrieves the psf only for
                       this detector index. Note that the psf is
                       weighted by the factor determined in the back
                       projection calculation. Note in particular
                       that the weighting depends on the choice of
                       the detectors, with the control parameter
                       det_index_mask. If you want to get the psf
                       without weighting (i.e. weighting 1), for
                       instance for the detector #4,  then it is
                       advised to set
                       det_index_mask=[0,0,0,1,0,0,0,0,0] and not set
                       psf_no_sum at all.
       THIS_HARMONIC_INDEX: use with GetData; retrieves the psf only
                            for this harmonic index (fundamental is
                            0)

 CALLS: ***
	ARR2STR [1], Arr2Str [2], CHECKVAR [1], EXIST, HSI_ANNSEC_PROFILE [1]
	HSI_ANNSEC_PROFILE [2], HSI_BPROJ, HSI_IMAGE, HSI_PSF, HSI_PSF::GET
	HSI_PSF::GETDATA, HSI_PSF::INIT, HSI_PSF::PROCESS, HSI_PSF::SET, HSI_PSF_CONTROL
	HSI_PSF_TEST, HSI_PSF__DEFINE, PLOT_IMAGE, checkvar [2], is_number [1]
	is_number [2]
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/reference.html
	hsi_psf_control__define
 HISTORY:
       12-May-2004 - acs. The linked list that was used was not
                     working at all, and the psf were summed every
                     time they were called. This has changed. A new
                     cache mechanism is in place and the sum is taken
                     care at the back projection level. The default
                     is to return the summed detectors.
       7-Nov-2002, Kim.  Use self.debug instead of get(/debug) and don't init in init
	Re;ease 7: ras, 17-may-02, after the profile is used
		it is freed using ptr_free, sealing a memory leak.
       Release 5.1: fixes for the object updates ACs
       Release 4: psf separated from modul_pattern object
                  uses annular sectors
                  March / April 2000
       Release 3 development, August / September 1999,
           A Csillaghy, csillag@ssl.berkeley.edu
       Based on the release 2 software of Richard Schwartz
       Fundamental developments by Richard Schwartz, GSFC


PROCESS_XCOM_GD $SSW/hessi/idl/sims/menu/process_xcom_gd.pro
[Previous] [Next]
 Project     : HESI
                   
 Name        : PROCESS_XCOM_GD
               
 Purpose     : This procedure is used to retrieve X and Gamma-ray 
               cross-sections.
               
 Category    : HESI
               
 Explanation : 
               
 Use         : 
    
 Inputs      : Xcom_file - a string specifying a material file
               used in Xcom, e.g. gold, tungsten, ...
               If a null string is entered, the user is queried.
               
 Opt. Inputs : None
               
 Outputs     : Ox- Array of 7 cross-sections and energy
          created for the searched substance by XCOM
          Ox is generally an ~550 x 8 floating point array
          where:
          Ox(*,0) = Photon Energy at which coefficients are calculated (MeV)
          Ox(*,1 & 2) = Coherent and Incoherent Scattering coeff. (cm^2/g) 
          Ox(*,3) = photoelectric absorption (cm^2/g)
          Ox(*,4 & 5) = Pair production in nuclear and electron field (cm^2/g)
          Ox(*,6 & 7) = Total attenuation with and without coherent
                          scattering (cm^2/g)
               Dens- Density of material in gm/cm3
               Subs- String indicating material file found

 Opt. Outputs: None
               
 Keywords    : 

 Calls	      : ***
	IXCOM, Read_mat_xcom
 CALLED BY:
	ANGC_GET_GD, GD
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :
 By Eric Carzon

 Modified    : 
 
   June 1995, use Richard Schwartz's program Read_mat_xcom to
   retrieve data from an indexed, xdr, stream file stored in
   SSWDB_HESI
   Version 2, ras, 16-apr-1997, added documentation


PS_FORM [2] $SSW/hessi/idl/widgets/plotman_ps_form.pro
[Previous] [Next]
 NAME:
   PS_FORM

 PURPOSE:

   This function displays a form the user can interactively manipulate
   to configure the PostScript device driver (PS) setup. The function returns
   a structure of keywords that can be sent directly to the DEVICE command
   via its _EXTRA keyword

 AUTHOR:

   FANNING SOFTWARE CONSULTING
   David Fanning, Ph.D.
   2642 Bradbury Court
   Fort Collins, CO 80521 USA
   Phone: 970-221-0438
   E-mail: davidf@dfanning.com
   Coyote's Guide to IDL Programming: http://www.dfanning.com

 MAJOR TOPICS:

   Device Drivers, Hardcopy Output, PostScript Output

 CALLED BY:
	XPS_SETUP
 PROCEDURE:

   This is a pop-up form widget. It is a modal or blocking widget.
   Keywords appropriate for the PostScript (PS) DEVICE command are returned.
   The yellow box in the upper right hand corner of the form represents the
   PostScript page. The green box represents the "window" on the PostScript
   page where the graphics will be drawn.

   Use your LEFT mouse button to move the plot "window" around the page.
   Use your RIGHT mouse button to draw your own plot window on the page.

   The CREATE FILE and ACCEPT buttons are meant to indicate slightly
   different operations, although this is sometimes confusing. My idea
   is that PS_FORM is a *configuration* dialog, something the user displays
   if he or she wants to change the way the PostScript device is configured.
   Thus, in many of my widget programs if the user clicks a "Write PostScript File"
   button, I just go ahead and write a PostScript file without displaying the
   form. (I can do this because I always keep a copy of the current device
   configuration in my info structure.) To get to the form, the user must
   select a "Configure PostScript Device" button.

   At that time, the user might select the ACCEPT button to just change
   the PostScript device configurations. Or the user can select the
   CREATE FILE button, which both accepts the configuration *and* creates
   a PostScript file. If you find the CREATE FILE button confusing, you
   can just edit it out of the form and use the ACCEPT button for the
   same purpose.

 HELP:

   formInfo = PS_FORM(/Help)

 USAGE:

  The calling procedure for this function in a widget program will look something
  like this:

     info.ps_config = PS_FORM(/Initialize)
     ...
     formInfo = PS_FORM(Cancel=canceled, Create=create, $
                        Defaults=info.ps_config, Parent=event.top)

     IF NOT canceled THEN BEGIN
        IF create THEN BEGIN
           thisDevice = !D.Name
           Set_Plot, "PS"
           Device, _Extra=formInfo

           Enter Your Graphics Commands Here!

           Device, /Close
           Set_Plot, thisDevice
        ENDIF
        info.ps_config = formInfo
     ENDIF

 OPTIONAL INPUT PARAMETERS:

    XOFFSET -- Optional xoffset of the top-level base of PS_Form. Default is
    to try to center the form on the display.

    YOFFSET -- Optional yoffset of the top-level base of PS_Form. Default is
    to try to center the form on the display.

 INPUT KEYWORD PARAMETERS:

    BITS_PER_PIXEL -- The initial configuration of the bits per pixel button.

    BLOCKING -- Set this keyword to make this a blocking widget under IDL 5.0.
    (All widget programs block under IDL 4.0.)

    COLOR -- The initial configuration of the color switch.

    DEFAULTS -- A stucture variable of the same type and structure as the
    RETURN VALUE of PS_FORM. It will set initial conditions. This makes
    it possible to start PS_FORM up again with the same values it had the
    last time it was called. For example:

       mysetup = PS_FORM()
       newsetup = PS_FORM(Defaults=mysetup)

 CALLS: ***
	DOC_LIBRARY, EXIST, FILEPATH, PICKFILE, PLOTMAN_PS_FORM, PS_FORM_DRAWBOX
	PS_FORM_DRAW_EVENTS, PS_FORM_EVENT, PS_FORM_MOVEBOX, PS_FORM_NULL_EVENTS
	PS_FORM_NUMEVENTS, PS_FORM_PLOTBOX_COORDS, PS_FORM_SELECT_FILE
	PS_FORM_SET_LOCAL_DEFAULTS, PS_FORM_SET_PERSONAL_LOCAL_DEFAULTS
	PS_FORM_SET_SYSTEM_DEFAULTS, PS_FORM_WHAT_BUTTON_PRESSED
	PS_FORM_WHAT_BUTTON_RELEASED, PS_FORM_WHAT_BUTTON_TYPE, RSTRPOS, XMANAGER
    NOTE: Using the DEFAULTS keyword will nullify any of the other
    DEVICE-type keywords listed above (e.g., XSIZE, ENCAPSULATED, etc.)

    ENCAPSULATED -- The initial configuration of the encapsulated switch.

    FILENAME -- The initial filename to be used on the form.

    HELP -- Prints a helpful message in the output log.

    INCHES -- The initial configuration of the inches/cm switch.

    INITIALIZE -- If this keyword is set, the program immediately returns the
    "localdefaults" structure. This gives you the means to configue the
    PostScript device without displaying the form to the user. I use this
    to write a PostScript file directly and also to initialize my info
    structure field that contains the current PostScript form setup. Passing
    the setup structure into PS_FORM via the DEFAULTS keyword gives my PS_FORM
    a program "memory".

        info.ps_setup = PS_FORM(/Initialize)

    LANDSCAPE -- The initial configuration of the landscape/portrait switch.

    LOCALDEFAULTS -- A structure like the DEFAULTS structure. Used if the
    "Local Defaults" button is pressed in the form. This gives you the
    opportunity to have a "local" as well as "system" default setup.
    If this keyword is not used, the procedure PS_Form_Set_Personal_Local_Defaults
    is called. Use this procedure (see below) to define your own local
    defaults.

    XOFFSET -- The initial XOffSet of the PostScript window.

    YOFFSET -- The initial YOffSet of the PostScript window.

    XSIZE -- The initial XSize of the PostScript window.

    YSIZE -- The initial YSize of the PostScript window.

 OUTPUT KEYWORD PARAMETERS

    CANCEL -- This is an OUTPUT keyword. It is used to check if the user
    selected the "Cancel" button on the form. Check this variable rather
    than the return value of the function, since the return value is designed
    to be sent directly to the DEVICE procedure. The varible is set to 1 if
    the user selected the "Cancel" button. Otherwise, it is set to 0.

    CREATE -- This output keyword can be used to determine if the user
    selected the 'Create File' button rather than the 'Accept' button.
    The value is 1 if selected, and 0 otherwise.

 RETURN VALUE:

     formInfo = { PS_FORM_INFO, $
                  xsize:0.0, $        ; The x size of the plot
                  xoff:0.0, $         ; The x offset of the plot
                  ysize:0.0, $        ; The y size of the plot
                  yoff:0.0 $          ; The y offset of the plot
                  filename:'', $      ; The name of the output file
                  inches:0 $          ; Inches or centimeters?
                  color:0, $          ; Color on or off?
                  bits_per_pixel:0, $ ; How many bits per image pixel?
                  encapsulated:0,$    ; Encapsulated or regular PostScript?
                  landscape:0 }       ; Landscape or portrait mode?

 MAJOR FUNCTIONS and PROCEDURES:

   None. Designed to work originally in conjunction with XWindow,
   a resizable graphics window.

 MODIFICATION HISTORY:

   Written by: David Fanning, RSI, March 1995.
   Given to attendees of IDL training courses.

   Modified to work when grapics device set to PostScript: 6 May 95.
   Modified to configure initial conditions via keywords: 13 October 95.
   Modified to load personal local defaults if LocalDefaults keyword not
      used: 3 Nov 95.
   Found and fixed bits_per_pixel error in Local Defaults setting
     procedure: 3 Nov 95.
   Modified to produce initial plot box with the same aspect ratio as
      the current graphics window. (XSIZE or YSIZE keywords overrule this
      behavior.) 22 Apr 96.
   Fixed annoying behavior of going to default-sized plot box when selecting
      the Landscape or Portrait option. Now keeps current plot box size.
      22 Apr 96.
   Made the size and offset text widgets a little bigger and changed the
      size and offset formatting from F4.2 to F5.2 to accomodate larger plot
      box sizes. 29 Apr 96.
   Fixed a bug in the filename text widget that caused a crash when a CR
      was hit. 3 Sept 96.
   Added the Initialize keyword to immediately return the "localdefaults"
      structure. 27 Oct 96.
   Fixed another problem with the BITS_PER_PIXEL keyword. 27 Oct 96.
   Made the return value a named structure of the name PS_FORM_INFO.
      3 Nov 96.
   Discovered and fixed a problem whereby YOFFSET was set incorrectly if
      LOCALDEFAULTS was used instead of DEFAULTS keyword. 3 Nov 96.
   Fixed bug in how Portrait mode was set using YSIZE and XSIZE keywords.
      25 Nov 96.
   Fixed a bug in how YOFFSET was calculated when in Landscape mode. 27 Nov 96.
   Fixed a memory leak with the local defaults pointer. 25 Jan 97.
   Added the CREATE keyword and modified the appearance of the form. 22 Apr 97.
   Modifed subroutine names to avoid confusion. 22 Apr 97.
   Fixed a bug I introduced when I added the CREATE keyword. 23 Apr 97.
   Modified the program for IDL 5. 30 May 97, DWF.
   Fixed Inches to CM exclusive button problem. 30 May 97, DWF.
   Fixed a problem when the widget is killed with the mouse. 30 May 97. DWF
   Added a Select Filename button. 12 Oct 97.
   Modified program layout slightly. 12 Oct 97.
   Added valid directory/file error checking for the filename. 12 Oct 97. DWF
   Added further support for IDL 5 modal functionality. 20 Oct 97. DWF
   Renamed to plotman_ps_form from ps_form.  For local defaults button, check if landscape is already set, and if
     so, switch x and y values. 13 Aug 03. Mimi Li, mimster@stars.gsfc.nasa.gov