X [1] $SSW/packages/spex/idl/original_spex/x.pro
[Previous] [Next]
 Project     : 
	SDAC                   
 Name        : 
       X        
 Purpose     : 
       Set the window to X graphics        
 Category    : 
 	DISPLAY, SPEX              
 Explanation : 
       set_plot,window_for_device        
 Use         : 
       X
 Inputs      : 
       none        
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 

 Calls       : ***
	SET_X [1], SET_X [2]
 CALLED BY:
	EVAL_SHERB, GE_WINDOW [1], euv_plot_auto [1], euv_plot_auto [2]
	plotbth v30 IDL2
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : 
	Version 2, support pc and mac, richard.schwartz@gsfc.nasa.gov, 1-feb-1998


X [2] $SSW/packages/spex/pre2002/idl/x.pro
[Previous] [Next]
 Project     : 
	SDAC                   
 Name        : 
       X        
 Purpose     : 
       Set the window to X graphics        
 Category    : 
 	DISPLAY, SPEX              
 Explanation : 
       set_plot,window_for_device        
 Use         : 
       X
 Inputs      : 
       none        
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 

 Calls       : ***
	SET_X [1], SET_X [2]
 CALLED BY:
	EVAL_SHERB, GE_WINDOW [1], euv_plot_auto [1], euv_plot_auto [2]
	plotbth v30 IDL2
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : 
	Version 2, support pc and mac, richard.schwartz@gsfc.nasa.gov, 1-feb-1998


X_EOUT_DRM [1] $SSW/packages/spex/idl/original_spex/x_eout_drm.pro
[Previous] [Next]

 NAME: X_EOUT_DRM


 PURPOSE:
	Given a Detector Response Matrix, (cnts/keV), calculated on output
	energy bins, IN_E_OUT, interpolate the output rows to the actual 
	detector output bins.

 CATEGORY:
	Spectral Analysis

 CALLING SEQUENCE:
       DRM = $
	 X_EOUT_DRM( IN_DRM=IN_DRM, IN_E_OUT=IN_E_OUT, OUT_E_OUT=OUT_E_OUT, $
		NSUB_BINS=NSUB_BINS, USESPLINE=USESPLINE )

 CALLS TO:
	INTERPOL

 INPUTS:
       IN_DRM 	 - Response matrix in cnts/energy
	IN_E_OUT - Output energy edges for IN_DRM,  2 x N, Lo_edge, Hi_edge
	OUT_E_OUT- Output energy edges for new DRM
	[NSUB_BINS] - Divide each output bins into N sub-bins, interp, then sum
                     Default is 1 sub-bin
	USESPLINE   - If set, use spline interpolation.
	USELOG      - If set, use log-log interpolation for linear or spline
 CALLS: ***
	CHECKVAR [1], INTERPOL, SPLINE, checkvar [2]
 CALLED BY:
	ADD_SCATTER_DRM, BUILD_DRM, Enorm_drm, LAD_DRM, Load_sher, hxrbs_response
	hxrs_response [1], hxrs_response [2], hxrs_response [3]
 PROCEDURE:
	Uses INTERPOL

 MODIFICATION HISTORY:
	Written 21-May-1993, RAS


X_EOUT_DRM [2] $SSW/packages/spex/pre2002/idl/x_eout_drm.pro
[Previous] [Next]

 NAME: X_EOUT_DRM


 PURPOSE:
	Given a Detector Response Matrix, (cnts/keV), calculated on output
	energy bins, IN_E_OUT, interpolate the output rows to the actual 
	detector output bins.

 CATEGORY:
	Spectral Analysis

 CALLING SEQUENCE:
       DRM = $
	 X_EOUT_DRM( IN_DRM=IN_DRM, IN_E_OUT=IN_E_OUT, OUT_E_OUT=OUT_E_OUT, $
		NSUB_BINS=NSUB_BINS, USESPLINE=USESPLINE )

 CALLS TO:
	INTERPOL

 INPUTS:
       IN_DRM 	 - Response matrix in cnts/energy
	IN_E_OUT - Output energy edges for IN_DRM,  2 x N, Lo_edge, Hi_edge
	OUT_E_OUT- Output energy edges for new DRM
	[NSUB_BINS] - Divide each output bins into N sub-bins, interp, then sum
                     Default is 1 sub-bin
	USESPLINE   - If set, use spline interpolation.
	USELOG      - If set, use log-log interpolation for linear or spline
 CALLS: ***
	CHECKVAR [1], INTERPOL, SPLINE, checkvar [2]
 CALLED BY:
	ADD_SCATTER_DRM, BUILD_DRM, Enorm_drm, LAD_DRM, Load_sher, hxrbs_response
	hxrs_response [1], hxrs_response [2], hxrs_response [3]
 PROCEDURE:
	Uses INTERPOL

 MODIFICATION HISTORY:
	Written 21-May-1993, RAS


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

 NAME: 
	XCROSS

 PURPOSE: 
	This function returns the xray cross-sections using fits to coefficients in
	McMaster et al.  See XSEC.PRO.

 CATEGORY: 
	spectra, xrays, xray response

 CALLING SEQUENCE: result = xcross( energy, coefficients)


 CALLED BY:
       xsec

 CALLS:
	none
 INPUTS:
       energy - energy in keV
	coefficients - coefficients in log/log polynomial fit
 OPTIONAL INPUTS:
	none

 OUTPUTS:
       xray cross-section in units of barns/atom

 OPTIONAL OUTPUTS:
	none

 CALLED BY:
	xsec
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	The coefficients are used in a log/log 3rd degree polynomial fit

 MODIFICATION HISTORY:
	ras, 20-dec-94


xlinflx $SSW/packages/xray/idl/xlinflx.pro
[Previous] [Next]
  NAME:
   xlinflx
  PURPOSE:
   Compute the Mewe line spectrum for EM=1.e44 cm^-3
  CALLING SEQUENCE:
    xlinflx,Te6,wave,Flux               ; ph s-1
    xlinflx,Te6,wave,Flux,/photon       ; ph s-1
    xlinflx,Te6,wave,Flux,/erg          ; erg s-1
    xlinflx,Te6,wave,Flux,wave_range=wave_range
    xlinflx,Te6,wave,Flux,/cosmic  ; Use cosmic abudances
    xlinflx,Te6,wave,Flux,Line,Trans   ; Return line information
    xlinflx,Te6,wave,Flux,rel_abun = [26, 0.8] ;Fe abundance 80% of nominal.

  INPUTS:
    Te6        = Electron Temperature in MK
  OUTPUTS:
    wave       = Wavelengths of lines
    Flux       = Fluxes of lines.  If Te6 is
                 a vector, then Flux = fltarr(N_elements(Te6),N_elements(wave))
  OPTIONAL INPUT KEYWORDS:
    photon     = If set, calculation is made in ph s-1 (default)
    erg        = If set, calculation is made in erg s-1
    wave_range = A 2-element vector with the desired lower and upper wavelength
                 limits (Ang).  For example, wave_range = [2.,60.] will
                 calculate only those lines between 2 and 60 A.
    cosmic = If set, read the cosmic abundance file
    file_in    = To explicitly specify the Mewe line-list file.
    rel_abun      = A 2XN array, where the first index gives the atomic number
     of the element and the second gives its relative abundance
     to its nominal value given by ABUN.
  OPTIONAL OUTPUTS:
    Line   = Character string with ion information
    Trans  = Character string with transition informaiton
  OPTIONAL OUTPUT KEYWORDS:
    Abun   = Abundances used for calculation
    elem   = Elements corresponding to the abundances

  METHOD:
    Reads $DIR_SXT_SENSITIVE/mewe_solar.genx
       or $DIR_SXT_SENSITIVE/mewe_cosmic.genx if /cosmic switch is specified.

 CALLS: ***
	DOC_LIBRARY, DSPLINE, IDL_RELEASE, INTERPOL, LOC_FILE [1], LOC_FILE [2]
	LOC_FILE [3], PICKLAMBDA [1], PICKLAMBDA [2], SPLINE, restgen [1], restgen [2]
	where_arr [1], where_arr [2]
    Note:      If Line argument is present, then picklambda is not called
           to sum up lines at the same wavelength

  MODIFICATION HISTORY:
    29-oct-92, Written, J. R. Lemen, LPARL
    25-jan-93, JRL  -- change call to picklambda
    25-feb-93, JRL  -- Mewe file converted to genx file.
     8-apr-93, JRL  -- Added optional output parameter
     7-jul-93, JRL  -- Added file_in keyword
    18-may-94, JRL  -- Fixed up check to prevent unnecessary file reads.
    21-jun-95, JRL  -- Minor change to make 171A line calculation work with
      with the SPEX85 data files.  And change to be able
      work with the SPEX95 data files.
      Changed the units to return in terms of 1.e44
    20-aug-1997, richard.schwartz@gsfc, switched spl_interp from spline to
   increase speed by a factor of 4 on a call with T a scalar.  Unsure
   when spl_interp was defined so protect version lt 4.0 with spline.
   Saved spl_init setup in new structure in common, mewe_spl.
   For single temperature input identify valid transitions both on
   wavelength range and temperature range of ion.  Identify prior
   to loop for additional 30% increase.  New version takes 15% of time
   old version for single temperature input at 10 MegaK for wavelengths
   shorter than 12.4 Angstroms on a Digital Unix. Also REL_ABUN
   keyword allows changes in abundances from nominal.  Information on
   abundances used after calculation of remaining lines, so this isn't
   the way to code this to run for a single ion.  Also, noted that
   Argon is encoded as AR for a species but as A for an elem and
   called that to the attention of the parties responsible under SSW.
    12-sep-1997, richard.schwartz@gsfc, fixed element sorting bug with use of rel_abun.
    10-nov-1998, richard.schwartz@gsfc, use DIR_GEN_SPECTRA, changed to xlinflx from linflx.
    1-dec-1998, richard.schwartz added ".genx" to loc_file call. Proc won't work without.
    19-jul-2003, richard.schwartz, changed common block name to avoid conflict with linflx
    29-aug-2003, richard schwartz, use reform instead of transpose to make more robust
   Changed most prints to message,/info.  Turn off messages with !quiet set to 1.
    19-aug-2004, kim.tolbert@gsfc.nasa.gov.  Fix of 29-aug needed tweak - if one element
      still needs to be array, not scalar for reform to work.
	 10-mar-2006, richard.schwartz, fixed test on temp and lines


Xplot_grid $SSW/packages/xray/idl/xplot_grid.pro
[Previous] [Next]
 NAME:
	Xplot_grid
 Purpose:
 	program to create a log-log grid for Xplot plots

 CATEGORY: HESI, Gen

 CALLING SEQUENCE:
       xplot_grid,xlimits,ylimits
	usuually called from program XPLOT

 CALLS:
	none
 INPUTS:
       xlimits:  Min. and Max. values for X axis
	ylimits:  Min. and Max. values for Y axis

 OPTIONAL INPUTS:
       none

 OUTPUTS:
       Returns to Plotting routine

 OPTIONAL OUTPUTS:
       none

 KEYWORDS:
       none
 COMMON BLOCKS:
       none

 SIDE EFFECTS:
       none

 RESTRICTIONS:
       Only set up to run with XPLOT

 PROCEDURE:
       Call HESI_MENU or IXCOM in IDL, they will call this program

 Modification History:
 	by Eric Carzon, January, 1995
 	Hughes, STX


xps [1] $SSW/packages/spex/idl/original_spex/xps.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME:
       xps
 PURPOSE:
       preview Postscript files
 CATEGORY:
	SPEX, GRAPHICS
 CALLING SEQUENCE:
       xps,file
 INPUTS:
       file [def='idl.ps']
 OUTPUTS:
       none
 CALLED BY:
	SPEX_COMMONS [2], SPEX_COMMONS [4], SPEX_PROC [1], SPEX_PROC [2]
 PROCEDURE:
       spawns local previewer
 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], is_open
 RESTRICTIONS:
	HIGHLY SITE DEPENDENT, NEEDS EXTENSIVE GENERALIZATION.
 HISTORY:
       Written Jun'94 (DMZ,ARC)
       mod by ras 25-aug-94 to enhance vms view call


xps [2] $SSW/packages/spex/pre2002/idl/xps.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME:
       xps
 PURPOSE:
       preview Postscript files
 CATEGORY:
	SPEX, GRAPHICS
 CALLING SEQUENCE:
       xps,file
 INPUTS:
       file [def='idl.ps']
 OUTPUTS:
       none
 CALLED BY:
	SPEX_COMMONS [2], SPEX_COMMONS [4], SPEX_PROC [1], SPEX_PROC [2]
 PROCEDURE:
       spawns local previewer
 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], is_open
 RESTRICTIONS:
	HIGHLY SITE DEPENDENT, NEEDS EXTENSIVE GENERALIZATION.
 HISTORY:
       Written Jun'94 (DMZ,ARC)
       mod by ras 25-aug-94 to enhance vms view call


xr_mk_abun_file $SSW/packages/xray/idl/xr_mk_abun_file.pro
[Previous] [Next]
 PROJECT:
   HESSI
 NAME:


 PURPOSE:


 CATEGORY:


 CALLING SEQUENCE:


 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CHIANTI_VERSION, CONCAT_DIR [1]
	CONCAT_DIR [2], CONCAT_DIR [3], DEFAULT, ELEMENT2Z, LOC_FILE [1], LOC_FILE [2]
	LOC_FILE [3], READ_ABUND, break_file [4], concat_dir [4], restgen [1], restgen [2]
	savegen [1], savegen [2]
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
   none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
   none
 COMMON BLOCKS:
   none

 SIDE EFFECTS:
   none

 RESTRICTIONS:
   none

 PROCEDURE:
   none

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


XR_RD_ABUNDANCE $SSW/packages/xray/idl/xr_rd_abundance.pro
[Previous] [Next]
 PROJECT:
   XRAY
 NAME:
   XR_RD_ABUNDANCE

 PURPOSE:
   This returns the abundances written in the xray_abun_file.genx
   The abundances are taken from CHIANTI and MEWE.  The source filenames are:
   cosmic sun_coronal sun_coronal_ext sun_hybrid sun_hybrid_ext sun_photospheric mewe_cosmic mewe_solar
   The first six come fron Chianti, the last two from Mewe.  They are:
   cosmic sun_coronal sun_coronal_ext sun_hybrid sun_hybrid_ext sun_photospheric mewe_cosmic mewe_solar
	These abundances are used with CHIANTI_KEV.  MEWE_KEV can only use the two mewe sourced
	abundance distributions unless using a heavily modified rel_abun structure for all of the elements.

 CATEGORY:


 CALLING SEQUENCE:
   abundance = xr_rd_abundance( [AB_TYPE,] [/coronal,] [/photospheric,] [/mewe,][/cosmic,]
     [/hybrid,][/ext])

 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], DEFAULT, EXIST, FCHECK, LOC_FILE [1]
	LOC_FILE [2], LOC_FILE [3], concat_dir [4], curdir [1], curdir [2], restgen [1]
	restgen [2]
 INPUTS:
      AB_TYPE - optional, give it one of the eight filenames (string)
      From Chianti
      1. cosmic
      2. sun_coronal - default abundance
      3. sun_coronal_ext
      4. sun_hybrid
      5. sun_hybrid_ext
      6. sun_photospheric
      7. mewe_cosmic
      8. mewe_solar - default for mewe_kev

 OPTIONAL INPUTS:
   none

 OUTPUTS:
       Returns array of 50 abundance levels for first 50 elements.  Also sets values
       in common block chianti_kev_abundance.

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
     VERBOSE - If set, display the XR_AB_TYPE used.
     CORONAL - USE ONE OF CHIANTI CORONAL ABUNDANCES
     HYBRID - SELECT ONE OF TWO HYBRID CHIANTI ABUNDANCES
     EXT - SELECT ONE OF THE TWO EXTENDED CHIANTI ABUNDANCES
     PHOTOSPHERIC - SELECT THE CHIANTI PHOTOSPHERIC ABUNDANCE
     COSMIC - SELECT ONE OF THE TWO COSMIC ABUNDANCES
     MEWE - SELECT ONE OF THE TWO MEWE ABUNDANCES
     MEWE HAS PRECEDENCE, THEN COSMIC, THEN CORONAL, THEN HYBRID
      EXT MUST BE USED IN COMBINATION WITH CORONAL OR HYBRID
     NOSAVE - If set, don't set values in common block

 CALLED BY:
	get_abun_table, get_fe_abun_rel2h
 COMMON BLOCKS:
   none

 SIDE EFFECTS:
   none

 RESTRICTIONS:
   none

 PROCEDURE:
   none

 MODIFICATION HISTORY:
   Version 1, richard.schwartz@gsfc.nasa.gov, 8-FEB-2005
	16-feb-2006, richard.schwartz@gsfc.nasa.gov, added sun_photospheric to case statement
	24-apr-2006, richard.schwartz@gsfc.nasa.gov,
		Changed CHIANTI_AB_FILE to XR_AB_FILE - this is the file containing the various types
		of abundance distributions, some coming from MEWE_SPEC(KEV), and others coming
		from the CHIANTI package. The default abundance distribution is sun_coronal from CHIANTI
   5-May-2006, kim.tolbert@gsfc.nasa.gov.  Added nosave keyword.



XRAY_MODEL_ARRAY $SSW/packages/xray/idl/xray_model_array.pro
[Previous] [Next]
 NAME:
	XRAY_MODEL_ARRAY

 PURPOSE:
	Returns a matrix of flux values, 1 for each energy and each set of model parameters.

 CATEGORY:
	SPEX, Modeling

 CALLING SEQUENCE:

	flux_each_model = XRAY_MODEL_ARRAY( Model, Energy, Model_param_array)

 INPUTS:
	Model	: Name of model function, e.g. 'F_vth_bpow', may also be different for each interval.
	Energy	: Vector of first argument to Model function.  Usually a vector
		energies in keV. May also be 2x N_channels
	Model_param_array:
		  An array of model parameters, e.g. a set for each fit interval.
		  #pars x #intervals.
	
 OPTIONAL INPUTS:
	
 KEYWORD PARAMETERS:

 OUTPUTS:
	Function returns the flux as an array, number_energies_each_model x number_of_models

 OPTIONAL OUTPUTS:

 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:
	Loops over each set of parameters to save the user the grief of a visible loop.

 EXAMPLE:
	
		flux_array =XRAY_MODEL_ARRAY( 'F_VTH_BPOW', findgen(100)+10., Apar_arr)

 MODIFICATION HISTORY:
 	Written by:	RAS, 22-March-1996
	Version 1
	Version 2	ras, 13-april-1996, made energy input more robust
	Version 3, richard.schwartz@gsfc.nasa.gov, orginally spex_model_array, 8-oct-1999.
	changed to function.


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

 NAME: 
	xsec

 PURPOSE:  
	This function calculates xray xsections from 1-1000 keV.


 CATEGORY:
	spectra, xrays, detector response

 CALLING SEQUENCE:
        xray_cross_section = xsec(energy,z,type, cm2pergram=cm2per, barns_atom=barns)

 CALLED BY:


 CALLS: ***
	COEFDATA, XCROSS
 INPUTS:
       energy - an array or scalar from 1-1000. in units of keV
	z      - a scalar from 1-94, the atomic number of the element for which
		 the cross-section is desired
		 missing z=[83,85,87,88,89,91,93]
	type   - a string used to choose the specific cross-section
		 'pe' - photoelectric cross-section
		 'si' - Inelastic Scattering Cross-section, Compton Scattering
		 'sc' - Rayleigh Scattering
		 'ab' - Total Absorption, some of all 3 above

 OPTIONAL INPUTS:
	cm2pergram - if set, then cross section returned in units of cm^2/gm
       barns_atom - if set, then cross section returned in units of barns/atom

 OUTPUTS:
       xray cross section in units of 1/cm

 OPTIONAL OUTPUTS:
	error - if an invalid argument is given, this is set to 1

 CALLED BY:
	ATMOS, DET_XSEC, FILTER_ATTEN, FLUORESCENCE, F_CON_LIN, F_MULTI_SPEC
	HESSI_FIGURE4_INPUTS [2], HSI_MOD_AMP, HXT_CAL_DRM [1], HXT_CAL_DRM [2], Klein
	RESP_CALC response calculation, ROUTINE_NAME [1], filter_cmpnd, get_slider
	low_e_spec_eff [1], low_e_spec_eff [2], other_filters [1], other_filters [2]
	out_spectra_4_designer, set_field, soxs_czt_photopeak, soxs_photopeak
 COMMON BLOCKS:
	xrcoef
 CALLS: ***
	COEFDATA, XCROSS
 SIDE EFFECTS:
	none

 RESTRICTIONS:
	energy is restricted to gt 1 and lt 1000 keV or an error is generate.
 PROCEDURE:
	none

 MODIFICATION HISTORY:
	documented, ras, 20-dec-94


xsm_fits2spectrum $SSW/packages/spex/idl/object_spex/xsm/xsm_fits2spectrum.pro
[Previous] [Next]
 Name: xsm_fits2spectrum

 Category: XSM, UTIL, FITS

 Purpose: Read spectral rate data from a FITS file, including the ENEBAND
 extension, if any.  This procedure is based on fits2spectrum.

 Calling sequence:

 Inputs:
 file - FITS file to read.
 Extnumber - extension number to find Rate

 Outputs:

 Input keywords:
 EXTNAME - keyword passed to rd_fits_ext.  Trapped.
  The next three keywords control which extension(s) are read.  If
  none of these are set, then all three of the primary, rate, and
  eneband data extensions are read.
 READ_PRIMARY - Set to read primary header.
 READ_RATE - Set to read rate extension data.
 READ_ENEBAND - set to read eneband extension data.
 EXTNO - extension number to read.  Trapped.
 SETNO - number of extension with given extension type to read in
         file.  Set this to 1 if you want the second rate extension
         and its corresponding eneband extension.
 SILENT - Set this to suppress printing of error messages.

 Output keywords:
 PRIMARY_HEADER - primary FITS header
 EXT_HEADER - header for the RATE extension, with any necessary
          keywords.
 EXT_DATA - data from the RATE / Flux extension.
 EXT_STATUS - status from mrdfits call to read rate extension.
 ENEBAND_HEADER - header from the ENEBAND extension, if any.
 ENEBAND_DATA - data from the ENEBAND extension, if any.
 ENEBAND_STATUS - status from mrdfits call to read eneband extension.
 RESPFILE - name of response file with rmf,  0 if not set in header
 ERR_MSG - error message.  Null if no error occurred.
 ERR_CODE - 0/1 if [ no error / an error ] occurred during execution.

 Calls: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], FITS_INFO [1], FITS_INFO [2]
	FXPAR [1], FXPAR [2], HEADFITS [1], HEADFITS [2], HEADFITS [3], LOC_FILE [1]
	LOC_FILE [2], LOC_FILE [3], SSW_PICKFILE, break_file [4], xsm_rd_fits_ext
 CALLED BY:
	read_xsm_4_ospex
 Modification History:


XSM_PREP $SSW/packages/spex/idl/object_spex/xsm/xsm_prep.pro
[Previous] [Next]
 PROJECT:
   SPEX
 NAME:
   XSM_PREP

 PURPOSE:
   This procedures takes XSM data files and prepares the three files
   needed for analysis, data - prefix.fits, drm - prefix.rmf and prefix.arf
   Prefix is a string including the date and time of the observation start.

 CATEGORY:
   SPEX

 CALLING SEQUENCE:


 CALLS: ***
	AVG [1], AVG [2], BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CONCAT_DIR [1]
	CONCAT_DIR [2], CONCAT_DIR [3], DEFAULT, FXBCREATE [1], FXBCREATE [2]
	FXBFINISH [1], FXBFINISH [2], FXBWRITE [1], FXBWRITE [2], FXHMODIFY [1]
	FXHMODIFY [2], FXWRITE [1], FXWRITE [2], GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3]
	GAUSSFIT [4], GAUSSFIT [5], INTERPOL, LINFIT, LOC_FILE [1], LOC_FILE [2]
	LOC_FILE [3], MRDFITS [1], MRDFITS [2], READFITS [1], READFITS [2], READFITS [3]
	break_file [4], concat_dir [4], curdir [1], curdir [2]
 INPUTS:
       datafilename - xsm data file (a fits file even if it has a .dat extension)

 OPTIONAL INPUTS:
   none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
    fitsdatafile - name of fits data file to write, optional
    rmf_file - name of rmf (matrix redistribution) file to write, optional, filename only
    ancrfile - name of ancr (ancillary response) file to write, optional, filename only
    outdir - destination directory
    err_msg - text message on error return
    err_code - error status, 0 no problems, 1 means problem see err_msg
 COMMON BLOCKS:
   none

 SIDE EFFECTS:
   none

 RESTRICTIONS:
   Need write privileges in the current directory.

 PROCEDURE:
   This procedure takes a fits file of an observation interval made with the XSM
   detector on the SMART-1 spacecraft.  The data set contains energy calibration data,
   the count data, and the effective area vs energy for each observation interval.
   From this file three files will be written, xsm*.fits containing the counts data,
   xsm*.rmf and xsm*.arf containing the equivalent of the detector response matrix.
   These are the input files to be used with Object SPEX (ospex).  A second procedure,
   xsm_filter_channels.pro can be used to select a subset of data in energy and time.


 MODIFICATION HISTORY:
   22-Jun-2005, Version 1, richard.schwartz@gsfc.nasa.gov


xsm_rd_fits_ext $SSW/packages/spex/idl/object_spex/xsm/xsm_rd_fits_ext.pro
[Previous] [Next]
 NAME:
  xsm_rd_fits_ext

 PURPOSE:
  Read a specified extension from a FITS file.  The extension can be
  specified by its EXTNAME, its EXTNO, and / or the instance of the
  given EXTNAME.
 CALLED BY:
	xsm_fits2spectrum
  NOTE:
  This procedure is based on rd_fits_ext.

 CATEGORY: FITS, UTIL

 CALLING SEQUENCE:
  xsm_rd_fits_ext, FILE='some_fits_file.fits', EXTNUMREAD=2, extname='rate', $
     /SILENT, HEADER=fits_extension_header, DATA=fits_extension_data

 INPUT KEYWORDS:
  FILE - Name of FITS file to read.

 OPTIONAL INPUT KEYWORDS:
  EXTNUMREAD - index to the extension to be read
  EXTNAME - name of the extension to be read
  SILENT - set to deactivate printing error messages.
  Input Keywords for find_fits_ext.

 OUTPUT KEYWORDS:
  HEADER - header from requested extension of FITS file.
  DATA - requested extension from FITS file.

 OPTIONAL OUTPUT KEYWORDS:
  STATUS - keyword from mrdfits.
  ERR_CODE - set to [ 0 / 1 ] if an error [ did not / did ] occur
  ERR_MSG - string containing error message.  Null string if no
            errors occurred.
  Output keywords from find_fits_ext.

 CALLS: ***
	MRDFITS [1], MRDFITS [2], find_fits_ext
 MODIFICATION HISTORY:
 WRITTEN: Sandhia Bansal - 16-Nov-2004


XSM_VALID $SSW/packages/spex/idl/object_spex/xsm/xsm_valid.pro
[Previous] [Next]
 PROJECT:
   SPEX
 NAME:
   XSM_VALID

 PURPOSE:
   This procedures edits XSM data fits files and rmf files
   and leaves only the designated energy and time ranges

 CATEGORY:
   SPEX, XSM

 CALLING SEQUENCE:
   xsm_valid, energy_range=energy, time_range=time_range

 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], DEFAULT, FXADDPAR [1]
	FXADDPAR [2], FXPAR [1], FXPAR [2], LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	MINMAX [1], MINMAX [2], MRDFITS [1], MRDFITS [2], MWRFITS, REP_TAG_VALUE, anytim [1]
	anytim [2], anytim [3], anytim [4], anytim [5], break_file [4]
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
   none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
   none

 KEYWORDS:
   ENERGY_RANGE - given as 2 element vector with energies in keV, >0 < 20, in keV
   TIME_RANGE - 2 times recognizable by anytim()
   RMF_DIR - optional, directory of rmf file if not in same directory as data fits file.
 COMMON BLOCKS:
   none

 SIDE EFFECTS:
  data fits file and rmf files are modified to reflect the new ranges. If you
   want to preserve the current versions of the fits and rmf files, you must make copies
   of them.  The .arf ancillary response file is unchanged.

 RESTRICTIONS:
   none

 PROCEDURE:
   none

 MODIFICATION HISTORY:
   Version 1, richard.schwartz@gsfc.nasa.gov
   23-jun-2005


xyouts2 [2] $SSW/packages/lparl/idl/ucon/morrison/xyouts2.pro
[Previous] [Next]
NAME:
  xyouts2
PURPOSE:
  Wrapper for xyouts -- use pseudo pixel coordinates when writing to PostScript file.
  Must "set up" the coordinates with a previous call to tv2,/init,xsize,ysize first.

  If !d.name is not set to 'PS', the xyouts2 simply calls xyouts,/device

CALLING SEQUENCE:
  xyouts2, x0, y0, str

INPUTS:
  x0		- In PostScript mode, this the xvalue in pseudo pixel space
  y0   	- In PostScript mode, this the yvalue in pseudo pixel space
  str		- The string to write;
OPTIONAL INPUT KEYWORDS:
  size		- The size of the text  (default = 1.0)
  charsize 	- Same as size.  If both size and charsize are present, size orrides.
  charthick	- Thickness of the text (default = 1.0)
  orientation	- Desired angle in degress counter-clockwise.
  alignment	- 0 for left-justified, 0.5 for centered, 1.0 for right-justified.
  font		- 0 for hardware fonts or -1 for vector drawn fonts.
  color	- Color of the text.
  device	- /device does not mean anything 
			- xyouts2 units are always in window pixel device units

  /norm and /data switches are not allowed.  In that case, simply call xyouts.
METHOD:
 xyouts2 requires the PostScript plotting size to be set by a previous call
 to tv2.  The necessary information is stored in the named common block: tv2_blk.

 See also the following routines:    tv2, ocontour, draw_grid (sxt_grid), plots2

 CALLED BY:
	ROLL_PLOT, disp1focus [2], disp1focus_flt, disp_dt_genx, disp_focus, disp_gen [1]
	disp_gen [2], disp_sci160k [1], disp_sci160k [2], disp_sci5k, fig_summary
	img_summary [1], img_summary [2], isas_ps_print, jitter_gif_xyimg
	lcur_plotr [1], lcur_plotr [2], mdidust, mk_refbar [1], mk_refbar [2]
	mk_sun_mosaic, mon_health [1], mon_health [2], msu_tekprint2, new_disp_sci5k [1]
	new_disp_sci5k [2], new_mon_health [1], new_mon_health [2], timeline
	wrt_sci160k_img, xdisp_sci5k
HISTORY:
  25-apr-1995, M. D. Morrison (LPARL), Written
  19-jan-1996, J. R. Lemen (LPARL), Added document header and various keywords.