make_lists $SSW/hessi/idl/image/make_lists.pro
[Previous] [Next]
 NAME: make_lists
	
 PURPOSE:
	Take datacubes in x,y,energy, and time and generate rotation angle histograms
	for each of up to 12 rotation modulation collimators.  Each element of the
	cube in the x,y plane returns an array of 12 histograms dimensioned to the
	size needed for the finest grids of the rmc's.
	
 CALLING SEQUENCE:
	hist_lists = make_lists( datacube, rotation_bins, xoff=xoff, yoff=yoff )	
 INPUTS:
	datacube 
		Up to four dimensional datacube in x, y, energy, and time.
		x and y refer to the spatial dimensions in pixels, 1 arcsecond default.
		The value of the datacube at each point is the counts 
		which would be measured by a detector unmodulated by the grids (rmc's).
		The average transmission through the rmc's is 25% for perfect black grids.
		The number of pixels in x and y must be equal.
	xoff - offset from the rotation axis in arcseconds along x
	yoff - offset along y

 OPTIONAL INPUTS:
	pitch_list - set of collimator grid pitches in arcseconds
	arcsec_pixel - number of arcseconds per pixel	
	transmission - 2 elements for each energy,
		       peak - peak transmission through grids, .5 for black grids
		       back - mimimum transmission through two grids, 0 for black grids
 OUTPUTS:
	function returns hist_lists 
	dimensioned: fltarr(maxbins, number_of_pitches, number_of_energies, number_times) 
	It is set of histograms in rotation angle of counts for each collimator
	for every xy plane in the datacube.
	Maxbins is given by the max(rotation_bins)
		
	If the datacube has no explicit energy or time entries, the returned
	hist_lists is dimensioned to 1.
	e.g. for a datacube (64,64) then hist_lists is (maxbins, number_of_pitches,1,1)
	and for a datacube (64,64,10,1) hist_lists is (maxbins, number_of_pitches,10,1)

	rot_bins - number of rotation angle bins (from 0-2pi) for each collimator
 OPTIONAL OUTPUTS:

 PROCEDURE:

 CALLS: ***
	phi_stamps
 COMMON BLOCKS:

 RESTRICTIONS:

 MODIFICATION HISTORY:
	TEST 31 aug 1998, 15:44


MAXIMUM ENTROPY SATO VERSION CLASS DEFINITION $SSW/hessi/idl/image/hsi_mem_sato__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       MAXIMUM ENTROPY, SATO VERSION,  CLASS DEFINITION

 PURPOSE:
       Object class for the MEM SATO image reconstruction algorithm.

 CATEGORY:
       Imaging

 CONSTRUCTION:
       image_obj = Obj_Name( 'hsi_mem_sato' )
       usually, this object is used from the image class
       hsi_image. This is recommended. In this case, it is used as
       follows:
       o = hsi_image()
       im = o->GetData( IMAGE_ALG = 'mem sato' )

 CONTROL (INPUT) PARAMETERS:
       see HSI_MEM_Sato_INIT

 OUTPUT (INFORMATION) PARAMETERS:
       see hsi_mem_sato_init 

 CALLS: ***
	HSI_MEM_SATO [1], HSI_MEM_SATO [2], HSI_MEM_SATO::IMAGE_ALG_HOOK
	HSI_MEM_SATO::INIT, HSI_MEM_SATO_INIT, HSI_MEM_SATO__DEFINE
 SEE ALSO:
	http://hessi.ssl.berkeley.edu/software/reference.html#mem_sato
	HSI_MEM_SATO [1], HSI_MEM_SATO [2], HSI_MEM_SATO_INIT, hsi_image__define
 HISTORY:
       Algorithm: Jim McTiernan / Jun Sato

       Development for Release 4, February-March 2000
           A Csillaghy, csillag@ssl.berkeley.edu

       06-feb-2001 J. Sato Change initial parameter of lambda max
       26-feb-2001 J. Sato Change initial parameter of lambda max

       Release 6: Annsec2xy and minor changes, ACs, Apr 2001
       Release 6: adaptation for the prefixes, ACs


mem [1] $SSW/hessi/idl/image/visibility/ejs/mem.pro
[Previous] [Next]
 NAME:
       mem
 PURPOSE:
   Implement a Maximum Entropy Algorithm within OVSA's
   Solar Microwave Imaging Software
 CATEGORY:
   OVSA APC imaging
 CALLING SEQUENCE:
   pro mem, cmap, cln, uv, vis, wgt, nmap, misc
 INPUTS:
   cmap    CLEAN map array of [m, m] dimension,
           where m is the number of pixels in one direction.
           Temperatures are in [MK].
   cln     Structure returned by clean.pro.
   uv      2D complex array of uv coordinate in [time, baseline] form.
           The real part is the west component and the imaginary part is
           the north component.
   vis     2D complex visibility array in [time, baseline] form
   wgt     2D complex array of the weight for each uv point
           in [time, baseline] form. The real part is for RCP
           and the imaginary part is for LCP.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
   model   Model map array of the same size as cmap. Temperatures are in [MK].
           Default models are cmap truncated at tmin.
   flux    Flux array of each frequency map in Solar Flux Unit (S.F.U.).
           Default values are model map fluxes.
   ferr    Array of acceptable flux errors in S.F.U.
           Default values are tol * flux.
   tmin    Array of the minimum temperature acceptable as model in [MK].
           Dafault values are 0.01.
   tol     Small number used in convergence criteria. Default value is 0.03
   savefile    File name to save the result.
               Saved file can be read using readmou.pro
                  result = readmou(savefile).
               result is anonymous structure
                   f_ghz   float[1]        Frequency in [GHz].
                   tb_xy   float[m, m]     Temperature map in [MK].
                   xyint   float[1]        Pixel size in [arcsec].
                   bmin    float           Minor axis of the CLEAN beam in pixels.
                   bmaj    float           Major axis of the CLEAN beam in pixels.
                   pa      float           Position angle of the CLEAN beam in degree.
                                           Counter clockwise from the y axis.
                   alp     float[1]        Lagrange multiplier alpha.
                   bet     float[1]        Lagrange multiplier beta.
   continue    Set this keyword to resumed the aborted process.
               Maps and Lagrange multipliers are restored from savefile
               but other inputs are assumed to be the same as
               that of the aborted precess.
 ROUTINES CALLED:
   mem_get_input.pro
   readmou.pro
   ssmem_uvgrid.pro
   ssmem_grd_chi2.pro
   ssmem_show_uv.pro
   ssmem_chi2chk.pro
   ssmsm_control.pro
   ssmem_optimiz.pro
   fft_xy2uv.pro
   plot_3maps.pro
   plot_vis2vis_simpl.pro
   savemou.pro
 OUTPUTS:
   nmap    MEM map of the same size as cmap. Temperatures are in [MK].
   misc    String array containing informative values.
           misc =
           ['Remark : Maximum Entropy Method', $
            'Remark : MEM, frq[GHz] = (frequency in [GHz])', $
            'Remark : MEM, iterat   = (iterations spent in optimization)', $
            'Remark : MEM, chi2_nrm = (Actual / Expected)', $
            'Remark : MEM, flux_nrm = (Actual / Expected)', $
            'Remark : MEM, alpha    = (Lagrange multipliers)', $
            'Remark : MEM, beta     = (Lagrange multipliers)']
 COMMENTS
   This is a modified program of ssmem.pro that is currently compatible with imagr.pro
   The internal process is essentially same as SSMEM.
   To use in imagr.pro, remove mem_get_input procedure at the beginning.
   Otherwise, all the inputs are retrieved from ssmem_get_input.pro.
 CALLS: ***
	MEM_MAXIMIZ, MEM_UVGRID, PLOT_3MAPS, PLOT_VIS2VIS_SIMPL, fft_xy2uv
 CALLED BY:
	imagr [1], imagr_batch
 SIDE EFFECTS:

 RESTRICTIONS:
 MODIFICATION HISTORY:
       Written 2001 by Su-Chan Bong


MEM_BTOT_WEIGHTS $SSW/hessi/idl/image/mem_btot_weights.pro
[Previous] [Next]
NAME:
     MEM_BTOT_WEIGHTS
PURPOSE:
     The total expected number of counts in an HESSI image is found
     using a weighted sum of the subcollimator data. 
     MEM_BTOT_WEIGHTS Finds weights from the modulation patterns.
PROJECT:
     HESSI
CATEGORY:
     Image deconvolution
CALLING SEQUENCE:
     mem_btot_weights
INPUTS:
     in common mod_patt_saved, patterns, pix2, nmp, btot_ci
     patterns = modulation patterns.  fltarr(pix2,nmp)
                btot_ci = the output weights, in common
KEYWORD PARAMETERS
     weights = on output, contains the weights.  fltarr(nmp)
     guess = input, an initial guess for the weights.  fltarr(nmp)
     minval = output, the minimum value of the sum array, 
              (should be close to 1.0)
     maxval = output, the maximum value of the sum array, 
              (should be close to 1.0)
     minerr = output, the minimum possible error in btot, 
              The minimum error would occur for a very extended source.
     maxval = output, the maximum possible error in btot, 
              The maximum error would occur for a point source at the
              worst possible place.
OUTPUTS:
     btot_ci = in the common block, the weights for the sum for BTOT
 CALLS: ***
	BTOT_W_FUNC, BTOT_W_GRAD
COMMON BLOCKS:
     in common mod_patt_saved, patterns, pix2, nmp, btot_ci
     patterns = modulation patterns.  fltarr(pix2,nmp)
                btot_ci = the output weights, in common
SIDE EFFECTS:
RESTRICTIONS:
     The calculation of the weights is very time consuming.  However,
     once the weights are computed, the calculation of the total
     counts is fast.  
     If the min or max value of the sum array is not 1.0, the 
     estimate of the total count rate will have reduced accuracy.

     The transpose function and the ## operator require IDL version
     4 or above.
PROCEDURE:
     If a set of weights for the mod patterns can be found such
     that the sum of the weighted mod patterns is identically 1, 
     the the total counts in the image is equal to the sum of the 
     sumcollimator data using the same weights.
MODIFICATION HISTORY:
     T. Metcalf  1997-01-17
                 1997-Jul-08 Fixed max error print statement (TRM)
     jmm, 11-18-1997, changed name, optimized for HESSI
     jmm, 11-5-1998, Made instrument indepeendent
 
     jimm@ssl.berkeley.edu


MEM_NJIT $SSW/hessi/idl/image/visibility/ejs/mem_njit.pro
[Previous] [Next]
 NAME:
       MEM_NJIT
 PURPOSE:
   Implement a Maximum Entropy Algorithm for RHESSI.
 CATEGORY:

 CALLING SEQUENCE:
   Image = MEM_NJIT(Vis, U, V, FLUX = value
           [, FERR = value] [, IMSIZ = integer] [, MISC = variable]
           [, SVIS = array] [, TOL = value] [, XYINT = variable])
 INPUTS:
   Vis     Array containing complex visibility data.
   U       Array containing u coordinates of the visibility data.
   V       Array containing v coordinates of the visibility data.
   FLUX    Set this keyword equal to the flux of the map in the same unit
           with Vis.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
   FERR    Set this keyword equal to the acceptable flux error.
           Default value is TOL * FLUX.
   IMSIZ   Set this keyword equal to the output image size in one direction.
           Default value is 128.
   SVIS    Set this keyword equal to an array containing standard deviation
           of visibility data.
           The expectation value of |(Vis - <Vis>)|^2 should be SVIS^2.
           If not given, TOL * |Vis| is used.
   TOL     Set this keyword equal to a small number used in convergence
           criteria. Default value is 0.03.
 ROUTINES CALLED:
   ssmem_uvgrid.pro
   ssmem_grd_chi2.pro
   ssmem_show_uv.pro
   ssmem_chi2chk.pro
   ssmsm_control.pro
   ssmem_optimiz.pro
 OUTPUTS:
   Image   An (IMSIZ by IMSIZ) array containing MEM map in
           (<unit of Vis> / pixel) unit.
   MISC    Set this keyword equal to a named varible that will contain
           string array of informative values.
           Misc =
           ['%MEM_NJIT: frq[GHz] = (frequency in [GHz])', $
            '%MEM_NJIT: iterat   = (iterations spent in optimization)', $
            '%MEM_NJIT: chi2_nrm = (Actual / Expected)', $
            '%MEM_NJIT: flux_nrm = (Actual / Expected)', $
            '%MEM_NJIT: alpha    = (Lagrange multipliers)', $
            '%MEM_NJIT: beta     = (Lagrange multipliers)']
   XYINT   Set this keyword equal to a named variable that will contain
           the pixel interval in arcsec. If this keyword not set, the default
      pixel size is determined by 206256/(4 * max([|U|,|V|]))
      under the Nyquist theorem.
 COMMENTS
   This is a modified program of mem.pro which is a part of
   the Spatio-Spectral Maximum Entropy Method program
   written for Owens Valley Solar Array.
 CALLS: ***
	SSMEM_CHI2CHK, SSMEM_CONTROL, SSMEM_GRD_CHI2, SSMEM_OPTIMIZ, SSMEM_SHOW_UV
	SSMEM_UVGRID
 SIDE EFFECTS:

 RESTRICTIONS:
 MODIFICATION HISTORY:
       Written 2004 by Su-Chan Bong as part of his PhD. thesis, SNU, 
				Aug. 2004.
				Originally developed for analysis of the OVSA data and adapted
				for the RHESSI data in collaboration with Ed Schmahl, Sep. 20, 2005.
       Added keyword, XYINT, and made associated modifications.
       This change allows users to set the map pixel size (xyint)
       if they want. These changes are marked with comment "*090105*"
       in mem_njit.pro & ssmem_uvgrid.pro. This code returns
       a structure containing map & parameters. Example:
     	IDL> restore,'mem_njit_input.sav'
       IDL> m = MEM_NJIT(Vis, U, V, FLUX=flux,IMSIZ=256, XYINT=0.8)
       IDL> contour,m.map,m.x,m.y,xtit=m.xtit,ytit=m.ytit
       01-Sep-2005 JL


mem_sato $SSW/hessi/idl/image/mem_sato.pro
[Previous] [Next]
NAME:
	mem_sato
PROJECT:
       HESSI
CATEGORY:
       Image Reconstruction Algorithm
PURPOSE:
	mem_sato performs image deconvolution using the maximum entropy method.
       The J. Sato algorithm is used.. as in HXT_MEMIMG
CALLING SEQUENCE:
       Mem_sato, fobs, sig, p, b_out, show_image = show_image, $
                 quiet = quiet, Chi_limit = chi_limit, bsmooth = bsmooth, $
                 lambda_max = lambda_max, iter_max = iter_max, $
                 delta_max = delta_max, Btot_in = btot_in, $
                 no_chi2 = no_chi2, outpars = outpars, itgain = itgain, $
                 lnorm = lnorm
INPUT:
	fobs= the observed counts in the collimators
	sig= the uncertainty in fobs
	p= the 2-d modulation pattern, an array of (nfobs, pxln^2), 
          so that fobs = p#b, where b is the brightness
OUTPUT:
	b_out= the brightness, a n_pix^2 array of
                 counts/pixel^2, THE ANSWER. n_pix is obtained from
                 the mod pattern (18-jul-94, jmm)
KEYWORDS:
       show_image = if set, show intermediate images and parameters
       quiet = if set, run quietly, no diagnositic output;
               this will NOT turn off /show_image
       chi_limit = limiting chi^2, the default is 1.0
       bsmooth = if set, smooth the data over 3 pixels
       lambda_max = max value of lambda allowed, default is 150
       no_chi2 = if set, do not used the chi^2 to stop the iterations,
                 instead stop at the max. value of lambda
       iter_max = max no. of iterations for a given lambda, default is 150
       delta_max = max value of delta for a switch to a new lambda,
                  default is 0.03
       btot_in = An estimate of the total # of counts in the image
                 The default is a weighted sum of the counts in the SC's
       outpars = the output values of [lambda, iter, chi^2, delta, btot]
       itgain = the initial value of the iteration gain, the default is 0.10
       lnorm = a normalization factor for lambda, the actual value used in the
               deconvolution is lnorm*sqrt(btot)*lambda, default is 1.0e-2
DESCRIPTION:
	mem_sato uses the maximum entropy method to make an HXT image,
       given the SC modulation patterns, p, and the counts and variances
       in the sub-collimators, fobs and var. It's a two step procedure,
       the entropy (b*log(b)) is maximized subject to the constraint that
       chi^2 is of order 1. This constraint is included as a lagrange
       multipliers, lambda. Starting with a gray map initially, the image
       is improved for a given value of lambda until delta<0.03, i.e., the
       change between images is very small. Then lambda is varied, until we
       reach a chi^2 value less than or equal to 1.
 CALLS: ***
	te_scale
MODIFICATION HISTORY:
	Translated from FORTRAN routine MAKIMG, of T. Sakao,
         by J. McTiernan, July '92
	30-Sep-92 (JMM) - changed chilim form an absolute of 2.0 to 
			 0.40*Sqrt(total(var))/64, found semi-empirically
        8-Jun-93 (JMM) - changed chilim back to 2.0
       26-oct-93 (JMM) - added chi_limit keyword
       29-dec-94 (JMM) - restored use of hgain in calculation of btot
       13-Jun-95 (jmm) - added bsmooth keyword
       1-Aug-95  (jmm) - removed call to GETVAR, since the systematic error
                         is now in HXTIMG_ACCUM, Also added lambda_max,
                         iter_max, and delta_max keywords
       27-jan-1997 (jmm) - added btot_in keyword
       5-jun-1998 (jmm) - New method, based on J.Sato's thesis work
                          Btot is now a variable, the modulation
                          pattern matrix is a 2d matrix, the algorithm
                          here is pulled from HESSI_MEMIMG
       5-Nov-1998 (jmm) - Renamed, made into an instrument independent code,
                          for use with HESSI
       jimm@ssl.berkeley.edu


migen test procedure $SSW/hessi/idl/image/hsi_migen_test.pro
[Previous] [Next]
 PROJECT:
	HESSI
 NAME:
	migen test procedure

 PURPOSE:
	


 CATEGORY:
	

 CALLING SEQUENCE:


 OUTPUT:
      

 INPUT:
       
       


 CALLS: ***
	HSI_MIGEN_TEST, HSI_MULTI_IMAGE
 MODIFICATION HISTORY:
	Version 1, csillag@ssl.berkeley.edu, march 2003


MK_ID_PATTERN [1] $SSW/hessi/offline/hsi_mk_1d_pattern.pro
[Previous] [Next]
 Project : HESSI

 Name :    MK_ID_PATTERN.PRO

 Purpose :     Returns the modulation pattern cross section for a
               set of harmonics (default is 0,1,2,3)
               of a triangle waveform for given slit/pitch ratio s2p.

 Category :    Imaging

 Explanation : Returns Fourier-series representation of a perfect
               collimator with slit/pitch ratio s2p

 Syntax :      Result=modulate(Ncoll, s2p [,harmonics] [,/positive])

 Examples :    tri= hsi_mk_1d_pattern(8,0.5,findgen(10))
               The array tri is a triangle waveform

 Inputs :   Ncoll = collimator number (scalar 0-8)
            The function is maximum when x = 0,1,2,3,...
            s2p = slit/pitch ratio (scalar)
            harmonics = integer array in any order, with or without 0

 Opt. Inputs : harmonics need not be specified.
               Default is harmonics=[0,1,2,3]
             
 Opt. Outputs: To enforce positivity use /positive or POSITIVE=1
               TBL_SIZE=tablesize can be used to increase the table size

 Keywords : Use "/positive" to enforce positivity
            (The default is to set no lower bound)

 CALLS: ***
	HESSI_PARAMS, HSI_MK_1D_PATTERN
 Common : NONE

 Restrictions:  Values must not be repeated in harmonics array.

 Warning:  Result can have negative values if s2p LT 0.5 and harmonics
           are few. This can have undesirable consequences in some
           mapping programs.  Use /positive to enforce positivity.

 History :  Version , 1998/8/5 -- Based on modulate.pro
            1.1 richard schwartz, 24-nov-1998. Made parallel version to MK_1D_PATTERN.

 Contact :  Ed Schmahl code 682


MK_ID_PATTERN [2] $SSW/hessi/offline/mk_1d_pattern.pro
[Previous] [Next]
 Project : HESSI

 Name :    MK_ID_PATTERN.PRO

 Purpose :     Returns the modulation pattern cross section for a
               set of harmonics (default is 0,1,2,3)
               of a triangle waveform for given slit/pitch ratio s2p.

 Category :    Imaging

 Explanation : Returns Fourier-series representation of a perfect
               collimator with slit/pitch ratio s2p

 Syntax :      Result=modulate(Ncoll, s2p [,harmonics] [,/positive])

 Examples :    tri= mk_1d_pattern(8,0.5,findgen(10))
               The array tri is a triangle waveform

 Inputs :   Ncoll = collimator number (scalar 0-8)
            The function is maximum when x = 0,1,2,3,...
            s2p = slit/pitch ratio (scalar)
            harmonics = integer array in any order, with or without 0

 Opt. Inputs : harmonics need not be specified.
               Default is harmonics=[0,1,2,3]
             
 Opt. Outputs: To enforce positivity use /positive or POSITIVE=1
               TBL_SIZE=tablesize can be used to increase the table size

 Keywords : Use "/positive" to enforce positivity
            (The default is to set no lower bound)

 CALLS: ***
	HESSI_PARAMS, MK_1D_PATTERN
 Common : NONE

 Restrictions:  Values must not be repeated in harmonics array.

 Warning:  Result can have negative values if s2p LT 0.5 and harmonics
           are few. This can have undesirable consequences in some
           mapping programs.  Use /positive to enforce positivity.

 History :  Version , 1998/8/5 -- Based on modulate.pro
            1.1 richard schwartz, 24-nov-1998. Made parallel version HSI_MK_1D_PATTERN.
		MK_1D_PATTERN to be phased out.

 Contact :  Ed Schmahl code 682


MK_MODUL_PATRN $SSW/hessi/offline/mk_modul_patrn.pro
[Previous] [Next]
  FUNCTION: MK_MODUL_PATRN.PRO
  
  PURPOSE:
          This function returns a 1-D  modulation pattern by projecting a 1-dimensional 
          given a 2-dimensional array input.

  EXPLANATION:
          Makes a modulation pattern by projecting a 1-dimensional 
          modulation pattern onto a 2-dimensional
          array.  The vector F1d must have 1-arcsec pixels.
          The pattern pixel locations given by the vectors xpixel and ypixel
          used to project F1d, are optional; they will be created by the 
          program if they do not exist, and then used in subsequent calls.
          The array F1D must be at least 3000 pixels (arcsec) long.
	
  CATEGORY:
	HESSI	
  INPUTS:
          F1D = 1-D array of values to be projected.  Must be larger
                than 3000 pixels in size.  1 pixel = 1 arc sec
          theta = vector angle (radians) of F1D vector, CW from the x axis
          aspp = scalar arc sec per pixel in modulation pattern map
          offset=[xoffset,yoffset]= x,y position of map center (in arc sec)
          pixels = vector of pixel  coordinates [ix,jy] (pos & neg)
                relative to the offset (where ix,iy=0)

  OPTIONAL INPUTS:
          Aspect =[dx,dy] solution vectors (same size as [theta,theta])
             Default is to use (dx,dy)=0*[theta,theta] 
          Quiet - If set, only error messages to screen.

  OUTPUTS: 
           If theta is a scalar, an array containing
           Modulation pattern matrix = FLOAT(n_elements(pixels)/2)
             = a linear (reformed) version of the map. 
           If theta is a vector and pixels is a scalar, the result is 
            an array of mod patterns = FLOAT(n_elements(theta), pixels^2)
           If pixels is a 2-element vector (i.e. representing a single
               pixel, the result is a vector = FLOAT(n_elements(theta)). 

  CALLING SEQUENCE:

          RESULT=mk_modul_patrn(F1D,theta,aspp,offset,pixels [,aspect=vectr])
              Result is a vector version of the modulation pattern.
              Use reform(result,nx,nx) to square it up if required.
          Example 1:
            xyarray=[(findgen(64^2) mod 64)-64/2+.5, $
                         fix(findgen(64^2)/64)-64/2+.5] 
            mod_pat=mk_modul_patrn(F1D,theta,aspp,offset,xyarray)
          Example 2:
             The following returns the same result: 
             mod_pat=mk_modul_patrn(F1D,theta,aspp,offset,64)   
          Example 3:
             The mod pat at a single point [3,-5] is returned by:  
             mod_pat=mk_modul_patrn(F1D,theta,aspp,offset,[3,-5])    

  METHOD:
          Each pixel of the modulation is read from the F1d "lookup table".
          The appropriate index in F1d is found by projecting a perpendicular
          from (xpixel,ypixel) in the modulation pattern onto the line
          passing through (dx,dx) with an orientation theta measured CCW
          from the x axis.  For the finest HESSI collimator, pitch=4.3,
          so there are over 4 points per cycle for all collimators.
          There is no interpolation, since that would slow the program, but
          if better sampling is required, the lookup table F1d can be
          increased in size without appreciable decrease in speed.

  SPEED:
          Each call to mk_modul_patrn (for one pixel) takes about 3.8 ms 
          on a Sun Ultra-1,or about 1.4 ms on a Sun Ultra-10,
          or a 333-MHz Pentium II.
          This suggests that one single-collimator back-projection map would 
          take about 4 s (for an Ultra-1, or proportionately less for the 
          faster machines), assuming 1000 photons or 1000 time bins.
  COMMON BLOCKS
	MODUL_PATTERN_INTERNAL- Intended exclusively for re-usable storage.
 CALLS: ***
	SYS2UT
 CALLED BY:
	MODEL_to_SCORE [2], SCORE_BPROJ, model_to_score [1]
  VERSION HISTORY: 
                  1.0 EJS 22 June 1998
                  1.1 Changed name, changed index s by 0.5 pixel
                      Extended to permit theta to be vector
                  1.2 Changed dx,dy to aspect option
                      Joined xoffset,yoffset as single vector offset
                      Replaced xpixel,ypixel arrays by vector/scalar pixels
                  In later versions, xpixels,ypixels won't have to be
                      created more than once.
                  1.3 richard schwartz, 9-oct-1998. Use vector multiplication
                      and removed hyper-slow out-of-range test for index to f1d 
                  1.4 richard schwartz, 28-oct-1998. Added results buffer.
                  Most large vectors placed in the same array.
                  1.5 richard schwartz, 24-nov-1998. This version will be phased out in
			favor of HSI_MK_MODUL_PATRN.
                  


model_to_score [1] $SSW/hessi/offline/model_to_score.pro
[Previous] [Next]
 MODEL_TO_SCORE.PRO

 Model_to_score reads a model from disk and computes arrival times of
 photons given the inputs in structure "PARAMS"
 inputs are from structure   the parameter file is simplified.
 instrumental parameters are generated by hessiparams.pro.
 this is version 1.2
 see main for more info.

 INPUTS:
         PARAMS -- A structure returned by model_to_score_params
                 coll=list of collimators (vector), e.g. [0 8]
                 aspp = arc sec per pixel in model map, e.g., 2.0 
                 offset = vector offset of map center from spin axis (asec) 
                 stdout = -1 for screen output, N>0 for output to disk,
                 dev ='x', 'ps', 'null' 
                 model_name = full path name of model file 
                 time_range = Start and end time, e.g. [0,4] 
                 factor = Multiplicative factor for map, e.g. 1000.

 OPTIONAL INPUTS: 
           SASZERO: If set, the simulated aspect solution = zero vector


 OUTPUTS: A FITS file containing:
           Time tags, collimators, pulse heights
           ID of source (in FITS header)
           ID of aspect (in FITS header)

 CALLING SEQUENCE:
           model_to_score,input_structure
           model_to_score,input_structure,/SASZERO

 REVISION HISTORY
           Fixed bug in function phi2score which revised the
             pulse-height distribution.       9/23/98  EJS
 CALLS:


MODEL_to_SCORE [2] $SSW/hessi/offline/model_to_score.pro
[Previous] [Next]
 NAME: MODEL_to_SCORE

 PURPOSE: Makes a fits-file score from a given model flare map set
       CALLED BY: User
       INPUTS:
             params_struct: The structure returned by model_to_score_params
                  coll
                  aspp (arc sec per pixel)
                  Xoffset, Yoffset
                  stdout
                  dev
                  model_name: pathname of model flare map on disk
                  time_range
                  factor
                  chan_range ; Channel range (2 integers from 0 to 8191)

       OPTIONAL INPUTS: 
             /SASZERO
                  If set, simulated aspect solution [dx,dy] will be zeroes
             Default is to produce a simulated SAS solution 
             In either case an aspect sav file will be created, 
             name stored in header
 
       OUTPUTS: A FITS file containing:
             Time tags, collimators, pulse heights
             ID of source=model_name (in FITS header)
             ID of aspect (in FITS header)

 CALLS: ***
	ASPECT_SIM, CATENATE, FXADDPAR [1], FXADDPAR [2], HESSI_PARAMS, HISTO_SCORE
	MINMAX [1], MINMAX [2], MKHDR [1], MKHDR [2], MK_1D_PATTERN, MK_MODUL_PATRN
	PHI2SCORE, TIME_ORDER, WRITEFITS [1], WRITEFITS [2], XY_DISK
       EXAMPLES: 
             model_to_score,input_structure
             model_to_score,input_structure,/SASZERO

 VARIABLES:

 Npho          = # photons incident on one HESSI SC during time_range
                 This is found from the model map--differs for each pixel
 time_range    = time range of rotation [0,2] => 180-degree rotation
 phi           = array of rotation angles during time_interval 

 MODIFICATION HISTORY:
    Added specification of pulse height channel range.  9/23/98  EJS


model_to_score_params $SSW/hessi/offline/model_to_score_params.pro
[Previous] [Next]
 PURPOSE:
   Returns a structure with the following parameters needed by
   model_to_score.pro:
   quick and dirty inputter awaiting glorious full-featured version by RSKT

 INPUTS:  None

 OUTPUTS:
    Structure with the following:

     coll       ; list of collimators (vector), e.g. [0 8]
     aspp       ; arc sec per pixel in model map, e.g., 2.0
     offset     ; offset of map center from spin axis e.g.,[700,200]
     stdout     ; standard output (negative if to screen)
     dev        ; options are 'x', 'ps', 'null'
     model_name ; full path name of model file
     time_range ; Start and end time, e.g. [0,4]
     factor     ; Multiplicative factor for map, e.g. 1000.
     chan_range ; Channel range (2 integers from 0 to 8191)


 USAGE:
    struc=model_to_score_params()

 CALLS: ***
	STR_SEP
 MODIFICATION HISTORY: 
          Added channel range input, 9/22/98  EJS


MODULATION PATTERN PRODUCTS CLASS DEFINITION [1] $SSW/hessi/idl/util/hsi_modpat_products__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       MODULATION PATTERN PRODUCTS CLASS DEFINITION

 PURPOSE: 
       Provides a stadardized access interface to the  modulation
       pattern data products, which are the modulation patterns, the
       back projection, the modulation profiles and the point spread
       function(s). 

       This class is a container (strategy holder) of the four
       objects hsi_modul_pattern, hsi_bproj, hsi_modul_profile, and
       hsi_psf. HSI_Modul_Pattern is the source object of the other
       three classes.  

 CATEGORY:
       HESSI Utilities
 
 CONSTRUCTION: 
       modul_pattern_obj = Obj_New( 'hsi_modul_pattern' )

 INPUTS (CONTROL) PARAMETERS:

 OUTPUTS (INFO) PARAMETERS:


 CALLS: ***
	HSI_MODPAT_PRODUCTS::INIT, HSI_MODPAT_PRODUCTS__DEFINE, HSI_MODUL_PATTERN
 SEE ALSO:
	HESSI Utility Reference http://hessi.ssl.berkeley.edu/software/reference.html
 HISTORY:
       Release 6: introduction of the strategy holder. ACs
       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


MODULATION PATTERN PRODUCTS CLASS DEFINITION [2] $SSW/hessi/offline/hsi_modpat_products__define_old.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       MODULATION PATTERN PRODUCTS CLASS DEFINITION

 PURPOSE: 
       Provides data structures and methods to work with modulation patterns

 CATEGORY:
       HESSI Utilities
 
 CONSTRUCTION: 
       modul_pattern_obj = Obj_New( 'hsi_modul_pattern' ) ;

       The variable modul_pattern_obj is the object references used to
       access modulation pattern data and methods.

 INHERITANCE
       HSI_Calib_Eventlist (direct)
       HSI_Eventlist, HSI_Packet, Universal

 INPUTS:
       Provided by the "Set" method:
       packet_obj->Set, KEYWORD=value
       See below for the list of available keywords

 OUTPUTS:
       For control variables: provided by the "Get" method;
       For data: provided by the methods:
                 GetModulPattern
                 GetModulProfile
                 GetBProj
                 GetPSF

 OBJECT-SPECIFIC METHODS:



 SEE ALSO:
	HESSI Utility Reference http://hessi.ssl.berkeley.edu/software/reference.html
 HISTORY:
       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


MONITOR RATE INFORMATION PARAMETER DEFINITION $SSW/hessi/idl/util/hsi_monitor_rate_info__define.pro
[Previous] [Next]
 PROJECT:
       HESSI

 NAME:
       MONITOR RATE INFORMATION PARAMETER DEFINITION

 PURPOSE: 
       Defines the information parameters for the monitor rate class

 CATEGORY:
       Utilities
 
 CALLING SEQUENCE: 
       var = {hsi_eventlist_info}

 TAG (PARAMETER) NAMES:
       dtime
       mon_ut_ref: the reference time of the time in the monitor rate
                   structure
       ncycles: the number of cyles found in the time interval read

 CALLS: ***
	HSI_MONITOR_RATE_INFO__DEFINE
 SEE ALSO:
	Hsi_monitor_rate_read
	hessi.ssl.berkeley.edu/software/reference.html#hsi_monitor_rate
	hsi_monitor_rate_control__define
 HISTORY:
       Release 2 development, April 27, 1999, 
           A Csillaghy, csillag@ssl.berkeley.edu