[Previous]
[Next]
NAME:
cal_fig_mich
PURPOSE:
To display the spatial map for the Michelson calibration results
SAMPLE CALLING SEQUENCE:
cal_fig_mich
cal_fig_mich, 1
OPTIONAL INPUT:
code - the pages to display (setting bits)
CALLS: ***
ARR2STR [1], Arr2Str [2], CAL_COEFF, CFIG_MICH_ANG, OUTPLOT [1], OUTPLOT [2]
OUTPLOT [3], PAUSE [1], RD_MMAP_SUM, RFITS [1], RFITS [2], RFITS [3], SS_POS
STR2ARR [1], STR2ARR [2], SXPAR [1], SXPAR [2], SXPAR [3], UTPLOT [1], UTPLOT [2]
UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], bits [1], bits [2], circle_mask
clearplot [1], clearplot [2], deriv_arr [1], deriv_arr [2], fig_summary
font_size [1], font_size [2], get_hk_info [1], get_hk_info [2], pause [2]
pprint [1], pprint [2], rd_tfile [1], rd_tfile [2], tv2 [1], tv2 [2]
HISTORY:
Written 29-Jun-94 by M.Morrison
30-Aug-94 (MDM) - Added temperature plot to OVEN plot
V2.1 12-Sep-94 (MDM) - Added plotting of spatial non-uniformity fit figures
[Previous]
[Next]
NAME:
cal_fig_pol
PURPOSE:
display the fit results of 'cal_pol' - read the fits files created
by 'cal_pol' and calculate the contrast, and sigma in % and display
the four results of the fit on a summary page (phase, contrast, offset
sigma)
INPUT:
reads the fits files from 'indir'
OPTIONAL INPUT:
when /test is specified:
res optional user supplied image array to be displayed;
must be an array of (x,y,4) where x,y are the dimensions of
each image
CALLS: ***
LOADCT, READFITS [1], READFITS [2], READFITS [3], SXPAR [1], SXPAR [2], SXPAR [3]
fig_summary
OPTIONAL KEYWORD INPUT:
hc hard copy: will print summary page instead of display to screen
test only displays supplied image array 'res'
OUTPUT:
the summary page; either on paper or on screen depending on 'hc'
OPTIONAL OUTPUT:
when /test is NOT specified:
res the image array as last read from the fitsfiles is stored in
this variable
HISTORY:
Written 9-September-94 by I. Zayer (Ver. 1.0)
Ver 2.0 12-Sep-94 IZ: added display for fixed input & rotating PAW.
[Previous]
[Next]
NAME:
cal_pol
PURPOSE:
analyze polarization test data: for each paw position do a sine-fit
to resulting intensity (cal and obs) as input polarization is rotated
- for lcp/rcp use rotating input quarterwave (behind fixed polarizer)
- for s/p use rotating input halfwave (behind fixed polarizer)
store resulting phase, amplitude, offset and sigma as fits images
to be read later and displayed by 'cal_fig_pol'
INPUT:
OPTIONAL INPUT:
CALLS: ***
SINFIT, SXADDPAR [1], SXADDPAR [2], SXADDPAR [3], read_mdi, wrt_fits [1]
wrt_fits [2]
OPTIONAL KEYWORD INPUT:
OUTPUT:
four fits files per set, 32 total in directory 'outdir'
HISTORY:
Written 9-Sep-94 by I. Zayer (Ver. 1.0)
Ver 1.1 12-Sep-94 IZ: fixed bug when switching to lin. pol.
Ver 2.0 12-Sep-94 IZ: add fit for fixed input & rotating PAW, and also
add fit fo rotating input for all PAW positions.
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
Name : CALC_DMM_DR
Purpose : Calculates CHIANTI density sensitive line ratios.
Explanation :
Use : Called from DMM_NE
Inputs : ciz - element number
cion - ion number
denmin, denmax - log density range
mess_win - message widget ID for DMM_NE use.
Opt. Inputs : None
Outputs : None
Opt. Outputs: None
Keywords : Temperature - if set use this temperature rather than
temp at max of ioneq.
Calls : ***
Bell, CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], EMISS_CALC, READ_IONEQ, STRPAD
concat_dir [4]
CALLED BY:
CHIANTI_NE
Common :
Restrictions: None
Side effects: None
Category : Spectral
Prev. Hist. : Based on density_ratios by K Dere.
Written : C D Pike, RAL, 22-Jan-96
Modified : Send warning message to widget. CDP, 27-Jan-96
Update generally. CDP, 7-Jun-97
Corrected typo in reading elvlc file. CDP, 14-Jul-97
Added minimum line ratio factor. CDP, 17-Jul-97
Added multiple wavelength ranges. CDP, 18-Jul-97
Fix typo for XXII stage. CDP, 05-Mar-98
Update list of elements. CDP, 18-Jun-99
v. 9. Correct hiccup in above. CDP, 13-Jul-99
Update for compatibility with CHIANTI v.3. Replaced populate
with pop_solver. Left out 'dielectronic' lines. ouput
temperature. plus various small additions.
Now ratios are calculated with 0.1 increment in log Ne
Giulio Del Zanna (GDZ) 10-Oct-2000
Ver.11, 7-Dec-01, Peter Young (PRY)
modified for v.4 of CHIANTI
Ver. 12, 1-May-02, GDZ
Fixed a bug: Added nlist = 0 when no lines are present.
V. 13, 21-May-2002, GDZ
generalized directory concatenation to work for
Unix, Windows and VMS.
V.14, 06-Aug-02 GDZ
Changed the use of CHIANTI system variables.
V.15, 16-Sep-2004, GDZ
added /NO_DE in call to emiss_calc as chianti_te expects
emissivities in photon units
Version : Version 15, 16-Sep-2004
[Previous]
[Next]
Project : SOHO - CDS
Name : CALC_DMM_TR
Purpose : Calculates CHIANTI temperature sensitive line ratios.
Explanation :
Use : Called from DMM_TE
Inputs : ciz - element number
cion - ion number
wmin, wmax - wavelength range
temmin, temmax - log temperature range
mess_win - message widget ID for DMM_TE use.
Opt. Inputs : None
Outputs : None
Opt. Outputs: None
Keywords : None
Calls : ***
Bell, EMISS_CALC, STRPAD
CALLED BY:
CHIANTI_TE
Common :
Restrictions: None
Side effects: None
Category : Spectral
Prev. Hist. : Based on temperature_ratios by K Dere.
Written : C D Pike, RAL, 22-Jan-96,
Modified : H E Mason, 03-Oct-96 (density to temperature)
Modified : Send warning message to widget. CDP, 27-Jan-96
Update list of elements and cut call to
read_elvl. CDP, 18-Jun-99
V.3. Fix hiccupp in above. CDP, 13-Jul-99
V.4. Rewritten completely, adding possibility to pass on the
density at which the intensities are calculated, and making
this routine compatible ith CHIANTI v.3.
Giulio Del Zanna (DAMTP), 10 Oct-2000
Ver.5, 7-Dec-2001, Peter Young
Modified for v.4 of CHIANTI.
Ver. 6, 1-May-02, GDZ
Fixed a bug: Added nlist = 0 when no lines are present.
V.7, 16-Sep-2004, Peter Young
added /NO_DE in call to emiss_calc as chianti_te expects
emissivities in photon units
Version : Version 7, 16-Sep-04
[Previous]
[Next]
NAME:
calctst
PURPOSE:
Rebin back the convolved array of intensities into
the array of observed SXT pixels,
from convolved array "con"
CALLING SEQUENCE:
res = calctst(psf,dime,div,con)
INPUTS:
dime - dimension of the frame: 64 for (64x64) array
div - superresolution factor (f.i. 5)
psf - PSF
con - convolved array of intensities
KEYWORDS:
METHOD:
CALLED BY:
adrlb
HISTORY:
written, J. Sylwester, Jan 1996
[Previous]
[Next]
CARTDIST - just return the distance between two vectors in
Cartesian N-space. You pass it two N-vectors, and it applies
Pythagoras' Theorem.
Hastily crufted together 11-Jan-97 Craig DeForest
CALLS:
CALLED BY
zunwrap
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME: ch_check_str
PURPOSE:
To check that an input structure is of the right type
CALLED BY:
CH_READ_FITS, CH_WRITE_FITS, MAKE_CHIANTI_SPEC, ch_ss
PROCEDURE:
This function checks that the input structure has at least the basic
tags that should be present. Two types of basci structures are checked:
1) the standard CHIANTI structure, output of the synthetic program
CH_SYNTHETIC, that contains line INTENSITIES
2) The standard CHIANTI structure output of MAKE_CHIANTI_SPEC, that contains a
synthetic SPECTRUM.
CATEGORY:
spectral synthesis.
CALLING SEQUENCE:
IDL> result=ch_check_str (tran, [/int , /sp])
INPUTS: the IDL structure TRAN
OPTIONAL INPUTS :
OUTPUTS:
OPTIONAL OUTPUTS:
KEYWORDS:
intensities
spectrum
CALLS: ***
required_tags
COMMON BLOCKS: none
RESTRICTIONS:
SIDE EFFECTS:
EXAMPLE:
PREV. HIST. :
WRITTEN :
Ver.1, 22-May-02, Giulio Del Zanna (GDZ), DAMTP
MODIFICATION HISTORY:
VERSION : 1, 22-May-02, GDZ
[Previous]
[Next]
NAME:
CH_DRAWBOX()
EXPLANATION
Allows the selection of a sub-region within a plot using a
"rubberband box".
INPUTS
WID ID of window where box is drawn. (!D.Window by default.)
INTERACTIVE INPUTS
By clicking-and-holding the left mouse button (LMB), a box will
appear on the plot window. Moving the mouse will change the size
of the box. When the box is in the right position, let go of the
LMB.
OPTIONAL INPUTS
COLOR The color index of the box. (!D.N_Colors-1 by default.)
KEYWORDS
DATA Box coordinates returned in DATA coordinates.
NORMAL Box coordinates returned in NORMAL coordinates.
OUTPUT
The function returns the box coordinates, either in device (default),
data or normal coordinates. See keywords /DATA and /NORMAL.
PREVIOUS HISTORY
This is a modified version of the routine drawbox.pro that is
available from
http://www.dfanning.com/documents/tips.html
HISTORY
Ver.1, 11-Dec-2001, Peter Young
CALLED BY
ch_ss
[Previous]
[Next]
PROJECT : CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME : CH_GET_FILE
PURPOSE : to select a file from either a selected directory or the working
directory, having an extension.
EXPLANATION : a file in either a selected directory or the working
directory, having an extension can be selected using a
widget. Note that both directory and extension have to be
supplied. If no file is found, an empty string is returned. ;
USE : IDL> name = ch_get_file( '~/', '.pro', tit=' Select a procedure ')
CALLED BY:
CH_LINE_LIST, CH_SYNTHETIC, GOFNT, G_OF_T, INTEGRAL_CALC, ISOTHERMAL
MAKE_CHIANTI_SPEC, PLOT_POPULATIONS, get_ieq
EXAMPLES : dir= concat_dir(!xuvtop),'dem')
dem_name=ch_get_file(path=dir,filter='*.dem',title='Select DEM File')
INPUTS : directory, extension
OPT. INPUTS :
OUTPUTS : the file name
OPT. OUTPUTS:
KEYWORDS : title
CALLS : ***
BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CH_GET_AB_EVENT, CONCAT_DIR [1]
CONCAT_DIR [2], CONCAT_DIR [3], CW_FIELD, CW_PDMENU, XMANAGER, XREGISTERED
break_file [4], concat_dir [4]
COMMON : co
RESTRICTIONS: both directory and extension have to be
supplied.
SIDE EFFECTS:
CATEGORY :
PREV. HIST. : extracted from CDS/CHIANTI routines.
WRITTEN :
Giulio Del Zanna (GDZ),
DAMTP (University of Cambridge, UK)
MODIFIED : Version 1, GDZ 10-Oct-2000
V.2, GDZ, corrected a typo at the end of the file.
V.3, GDZ, generalized directory concatenation to work for
Unix, Windows and VMS.
V. 4, 19-July-2002, GDZ
Added the option to select files also with the standard IDL
dialaog_pickfile, and changed a few things...
V.5, 2-Aug-02, GDZ
reduced the size of the widget.
V.6, 12-Aug-02, GDZ
corrected for a bug in the directory output.
V.7, 3-Nov-03 GDZ
Fixed a bug when using Windows, the returned path was not
correct.
VERSION : 7, 3-Nov-03
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME:
CH_LINE_LIST
PURPOSE:
Create a latex or an ascii file of predicted spectral line intensities and
wavelengths corresponding to selected parameters, as calculated by
CH_SYNTHETIC. Needs as input the line intensity structure calculated by
CH_SYNTHETIC (default) or the SPECTRUM structure output of
MAKE_CHIANTI_SPEC.
CALLING SEQUENCE:
IDL> ch_line_list, transitions, outname, latex=latex, ascii=ascii, $
abundfile=abundfile, min_abund=min_abund, $
wmin=wmin,wmax=wmax,$
SPECTRUM=SPECTRUM, minI=minI,photons=photons,kev=kev, $
all=all,no_sort=no_sort, sngl_ion=sngl_ion
CALLED BY:
ASCII_WVL_DEM, LATEX_WVL_DEM, ch_ss
PROCEDURE:
INPUTS:
The structure created by CH_SYNTHETIC
OPTIONAL INPUTS:
Wmin: lower limit of the wavelength/energy range of interest (Angstroms)
if kev keyword set, then wmin is in kev
Wmax: upper limit of the wavelength/energy range of interest (Angstroms)
if kev keyword set, then wmax is in kev
Mini: Minimum intensity for line to be included in output
SNGL_ION: specifies a single ion (or a list of ions) to be used instead
of the complete set of ions specified in the structure.
MIN_ABUND: If set, outputs only those elements which
have an abundance greater than min_abund.
For example, from Allen (1973):
abundance (H) = 1.
abundance (He) = 0.085
abundance (C) = 3.3e-4
abundance (O) = 6.6e-4
abundance (Si) = 3.3e-5
abundance (Fe) = 3.9e-5
KEYWORD PARAMETERS:
LATEX: Create a latex file (default, exclusive with /ASCII)
ASCII: Create an ascii file (exclusive with /LATEX)
MINI: Minimum intensity for line to be included in output
PHOTONS: units will be in photons rather than ergs
KEV: wavelengths will be given in kev rather than Angstroms
ALL: if set, then all lines are included. This means that lines for which
only an approximate wavelength is known, denoted by a negative
wavelength value in the .wgfa file, are included.
These lines are listed in the file with a * preceding the wavelength.
NO_SORT:
If set, then the lines are *not* sorted in wavelength (or energy).
SPECTRUM
If set, IT IS ASSUMED that the input structure is the SPECTRUM
structure output of MAKE_CHIANTI_SPEC, where the line
intensities have already been multiplied by the abundance factor!!
OUTPUTS:
A latex (default) or an ascii file with the line list
CALLS: ***
ANYTIM2CAL, ARR2STR [1], Arr2Str [2], BREAK_FILE [1], BREAK_FILE [2]
BREAK_FILE [3], CH_GET_FILE, CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3]
FILE_EXIST [2], GET_UTC, READ_ABUND, REPSTR [1], REPSTR [2], REPSTR [3]
SPECTROSCOPIC2ION, STRPAD, TAG_EXIST [1], TAG_EXIST [2], TRIM, break_file [4]
concat_dir [4], file_exist [1], file_exist [3]
COMMON BLOCKS:
none.
SIDE EFFECTS:
EXAMPLE:
> ch_line_list, trans,'linelist.tex',/latex, wmin=100.,wmax=200.,/all
CATEGORY:
spectral synthesis.
WRITTEN :
Version 1, Written by: Giulio Del Zanna (GDZ) Oct 31 2001.
MODIFICATION HISTORY:
V.2, 9-Nov-2001 GDZ.
Now correctly handles the case when no
abundances are passed to the routine.
v.3, 11-Dec-2001, PRY.
Removed calls to get_utc and anytim2cal. Replaced with
call to systime()
v.4, 29-Apr-02, GDZ
Fixed a few small bugs, some caused by a change in the
database file format for V4.
Added only_mini, file_effarea keywords to be able to use as
input the structure created by MAKE_CHIANTI_SPEC.
V.5, 22-May-2002, GDZ
generalized directory concatenation to work for
Unix, Windows and VMS. changed tags.
Changed and added various things, including flabel
V.6, 12-Aug-02, GDZ
Modified the output labeling, and fixed two bugs: 1) when /all was used
the keyword /mini was not working. 2) min_abund was not working
properly when /spectrum was used. Reduced size of latex output (was
12pt)
Changed output in isothermal case (no Tmax given). Better info printed (GDZ)
V.7, 3-Nov-03 GDZ
Modified format e8.2 to e9.2 for Windows compatibility.
v.8, 18-Jul-2005 GDZ
Modified the use of the /kev keyword. Also, now the
routine accepts input structure with the units in keV.
v.9, 4-Aug-2005 GDZ
Corrected a bug introduced in the previous version.
Also switched to \documentclass when making the latex file.
VERSION : 9, 4-Aug-2005
[Previous]
[Next]
PROJECT: CHIANTI
http://wwwsolar.nrl.navy.mil/chianti.html
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME:
CH_READ_FITS
PURPOSE:
Read standard CHIANTI FITS binary table data containing the output from
CH_SYNTHETIC and output a TRANSITIONS structure.
CALLING SEQUENCE:
CH_READ_FITS, Filename, TRANSITIONS
INPUTS:
Filename = String containing the name of the CHIANTI FITS file written
by CH_WRITE_FITS.
OUTPUTS:
TRANSITIONS = Structure to be written.
OPTIONAL INPUTS: none
KEYWORDS: none
NOTES:
CALLS: ***
ADD_TAG [1], ADD_TAG [2], MRDFITS [1], MRDFITS [2], VALID_FITS, ch_check_str
CALLED BY:
ch_ss
COMMON BLOCKS: none.
RESTRICTIONS:
(3) The input FITS file must have been written by CH_WRITE_FITS
PREV. HIST. :
EXAMPLE:
ch_read_fits, 'file.fits', transitions
WRITTEN :
Ver.1, 8-Apr-02 Giulio Del Zanna (GDZ)
V.2 GDZ 31 May 2002 added more checks.
MODIfICATION HISTORY:
VERSION : 2, 31 May 2002
[Previous]
[Next]
PROJECT
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME
CH_SS
PURPOSE:
Widget-based multi-purpose routine
to calculate CHIANTI line intensities and continua, to create a
synthetic spectrum, to make tables of lines, etc.
CALLING SEQUENCE:
IDL> ch_ss
PROCEDURE:
This routine calculates a synthetic spectrum by merging line
intensities and continua.
The widget is organised into four Sections:
SECTION 1:
-The Calculation of the CHIANTI line intensities.
This can be done in two ways:
1-Restore a save file with the CHIANTI line intensities already
calculated.
2-Calculate CHIANTI line intensities with a call to CH_SYNTHETIC.
In this case, A series of parameters must be set:
- Minimum and maximum wavelengths in Angstroms
- The model used for the calculation. Three are the options:
1) a constant density (cm^-3)
2) a constant pressure (cm^-3 K)
3) a general (Te,Ne) model. In this case, a file will be read.
This file should have two columns, one with the Te (K)
values, and one with the Ne (cm^-3) values.
- The ionization fraction file to be used. "*.ioneq" files
can be selected from either the CHIANTI database, the
working directory or selected via a widget.
- All ions ? If set to yes (default), then all the ions present in the
database will be included.
If set to no, then it is possible to select a list of ions
with a widget
- All lines ? If set to no (default), only the lines for which there are
observed energy levels are included
If set to yes, also the lines that do not have
corresponding observed energy levels are included. In this
case, the wavelengths are calculated from the theoretical
energy levels, and might not be very accurate.
- Isothermal ? If set to no (default), a DEM file must be selected.
"*.dem" files (i.e. files with a .dem extension)
can be selected from either the CHIANTI database, the
working directory or selected via a widget.
If set to yes, then the user is requested to enter one
or more temperatures (as logarithmic values - Log T )
and correspondent column emission measures EM
logarithmic values.
NOTE: if more than one value is entered, then the
sequence must be separated by commas (e.g.: 6.0,
6.5, 7.), and both Log T and Log EM must have the
same number of values
- Photoexcitation ?
If set to yes, you have to define:
Trad: The blackbody radiation field temperature
R/Ro: Distance from the centre of the star in stellar
radius units
Units: Photons or Ergs'
Protons: If set to Yes, the proton data are used to calculate the level population
Once all the parameters have been defined, the user should click on the
"Calculate intensities" button to start the calculation (which calls
CH_SYNTHETIC).
Once the calculation is finished, an IDL structure is loaded into
memory. It is then possible to save it for later use by clicking on the
"SAVE" button.
The RESTORE button is to restore previously saved files into an IDL
structure in memory.
Once the IDL structure with the line intensities is in the memory, it is
then possible to calculate and plot a spectrum (SECTION 2).
SECTION 2:
This section controls the parameters that are needed to fold the
line intensities and the continua into a synthetic
spectrum. These parameters are used by MAKE_CHIANTI_SPEC.
Before this is done, a set of line intensities MUST be in the
program memory. This is done either by calculating the
intensities or by restoring a save file with
previously calculated values (SECTION 1).
Setting the parameters:
-Minimum and maximum wavelengths in Angstroms
-spectrum bin size in Angstroms. Disallowed if an Effective area
file is used.
-instrumental FWHM: Setting this to a non-zero value broadens
each of the spectral lines with a Gaussian of
the specified FWHM (in Angstroms) so
mimicking the effects of instrumental
broadening.
-continuum: Add continua to the binned spectrum:
free-free, free-bound and two-photon.
Please note that the continuum calculation takes some
time and you may want to define a minimum abundance
value to speed the calculations.
- All lines ? If set to no (default), only the lines for which there are
observed energy levels are included.
If set to yes, the "unobserved lines" will be added, but
only if they are present in the structure.
-elemental abundances
"*.abund" files (i.e. files with a .abund
extension) can be selected either from the CHIANTI database,
the working directory, or via a widget.
-select a minimum abundance value
If set not null, only the lines of those elements
which have an abundance greater than the value set are
selected. Also, the continuum is calculated only for
those elements which have an abundance greater than
the value set. This can significantly speed up the
calculations. By default, the minimum value in the
selected abundance file is used. To have an idea of
what minimum abundance should be set, the abundances
of Allen (1973) give:
abundance (H) = 1.
abundance (He) = 0.085
abundance (C) = 3.3e-4
abundance (O) = 6.6e-4
abundance (Si) = 3.3e-5
abundance (Fe) = 3.9e-5
Eff. Area: Yes/No
If you want to fold the spectrum with an effective area.
If set to Yes, you are requested to choose an input ascii file
with two columns, the wavelength and the effective area values
(cm^2).
The wavelenghts in the file (that might not be linear) are used
to create the spectrum, that is multiplied with the effective
area values.
Note that this option only works well if a sufficient number
of bins is given. The line intensities contributing to each
bin are summed, and subsequently convolved with a gaussian
of full-width-half-maximum FWHM, if FWHM is not set = 0.
Please note that the convolution might not work if a small
number of bins is defined.
Also note that to have the correct output units (counts s-1
bin-1) the appropiately scaled DEM (or EM) values must be provided.
After this, by clicking on the "Calculate and plot" button the
program calculates and plots the synthetic spectrum.
Once the spectrum is displayed, it is then possible to
view the details of the lines by clicking with the mouse in the
plot window, and to perform various operations by clicking on
the buttons in SECTION 3
SECTION 3:
This Section allows the user to select a few parameters for the
plotting, and to create different types of OUTPUT.
Labels ? : Setting this to yes plots a vertical line for each
spectral line in the spectrum, and also writes a label
above the strongest lines indicating the ion from
which the line arises.
Min.: Only lines which have an intensity greater than the
value set here will be listed and, if requested,
labelled and selected for inclusion in the various
outputs. Setting the value=0. will result in all
lines being listed and written in the outputs.
X,Y, XOOM, UNZOOM: It si possible to select a region of the
spectrum, by zooming with the use of the mouse
or by setting the X,Y ranges.
NOTE that only the line details and portion of
the spectrum shown will be output.
LINEAR/LOG To plot the spectrum in linear or log scale
Create PS file: A postscript file is created.
Hardcopy: the postscript file "idl.ps" is created and sent to the
default printer.
Save Line details (latex): The details of the lines shown in the
plot will be saved in a latex file.
Save Line details (ascii): The details of the lines shown in the
plot will be saved in an ascii file.
Save Spectrum (ascii): The X,Y values of the plot are saved in
an ascii file.
Save Spectrum (IDL/FITS): The details of all the lines and the arrays
of the X,Y values of the plot are saved into
an IDL or FITS file. The IDL structure
has the following tags:
.LAMBDA: The array of wavelength X values
.SPECTRUM: The array of spectrum Y values
.UNITS The units of LAMBDA, SPECTRUM
.INSTR_FWHM The Instrumental FWHM
.BIN_SIZE Width of the Bins (fixed) in angstroms
.ABUND_NAME The CHIANTI abundance file name
.ABUND The abundance values
.MIN_ABUND The minimum abundance value used
.ABUND_REF The references
.CONTINUUM The values of the continuum (if
calculated)
.EFFAREA The array of effective area
values (optional)
.FILE_EFFAREA The name of the effective area file used (optional).
.IONEQ_NAME The ion balance file used (full path).
.IONEQ_LOGT The Log10 T values associated.
.IONEQ_REF The references.
.DEM_NAME The differential emission measure file eventually used
(full path).
.DEM The Log10 DEM values
.DEM_LOGT The Log10 T values associated.
.DEM_REF The references.
.MODEL_NAME A string indicating the model used
(e.g. constant density or constant pressure).
.MODEL_NE the Ne value.
.MODEL_PE the Pe value.
.WVL_UNITS The wavelength units.
.WVL_LIMITS The wavelength limits specified by the user.
.INT_UNITS The intensity units
.LOGT_ISOTHERMAL
The Log10(T) values used.
.LOGEM_ISOTHERMAL
The Log10(EM) values used.
.TIME The date and time when the structure was created.
.VERSION The version number of the CHIANTI database used.
.ADD_PROTONS
A flag (0/1) to indicate whether proton data were used (1)
or not (0) to calculate the level population.
.PHOTOEXCITATION
A flag (0/1) to indicate if photoexcitation was included (1)
or not (0).
.RADTEMP
The blackbody radiation field temperature used (if
photoexcitation was included).
.RPHOT
Distance from the centre of the star in stellar radius units
(if photoexcitation was included).
THEN, FOR EACH LINE USED TO CALCULATE THE
SPECTRUM:
.LINES A structure containing information about the lines.
Its size is the number of lines in the spectrum. The
tags are:
.peak The peak intensity value
.iz The atomic number of the elements (e.g., 26=Fe)
.ion The ionisation stage (e.g., 13=XIII)
.snote The identification of the ion (e.g., 'Fe XXIV d')
.ident The identification of the transition, configuration
and terms in text form.
.ident_latex
The identification of the transition, configuration
and terms in latex form.
.lvl1 The lower level of the transition (see .elvlc
file for ion)
.lvl2 The upper level for transition.
.tmax The temperature of maximum emission of the line
(i.e., the temperature at which the product of
the emissivity and the ion fraction has its
maximum). Rounded to nearest 0.1, and zero in case
the isothermal approximation is used.
.fwhm
.wvl Wavelength of the transition, in Angstroms.
.flag A flag, =-1 if the line has only theoretical energy
levels. Otherwise flag=0.
.int Intensity of line (with the abundance factor multiplied)
Save Spectrum (FITS): The entire information contained in the
IDL structure is stored in a FITS file.
SECTION 4:
Here, text information messages are printed.
INPUTS
None.
OPTIONAL INPUTS:
The font
OUTPUTS:
Many.
KEYWORD PARAMETERS:
FONT the font to be used. Can be useful to customize the appearance of
the widget.
CALLS: ***
ADD_TAG [1], ADD_TAG [2], ANYTIM2CAL, ARR2STR [1], Arr2Str [2], BIGPICKFILE
BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], Bell, CALC_SYN_SPECTRUM
CH_DRAWBOX, CH_LINE_LIST, CH_READ_FITS, CH_SYNTHETIC, CH_WRITE_FITS, CH_XMENU_SEL
CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], CW_BGROUP, CW_PSELECT
DATATYPE [1], DATATYPE [2], DATATYPE [3], DELVARX [1], DELVARX [2], DELVARX [3]
DELVARX [4], FILE_EXIST [2], GET_DFONT [1], GET_DFONT [2], GET_UTC
ION2SPECTROSCOPIC, LOADCT, MAKE_CHIANTI_SPEC, OPLOT_LINES, PLOT_SYN_SPECTRUM
PS [1], PS [2], PSCLOSE [1], PSCLOSE [2], PSPLOT [1], PSPLOT [2], READ_ABUND
READ_ASCII, READ_DEM, READ_IONEQ, READ_MASTERLIST, REM_DUP [1], REM_DUP [2]
REM_DUP [3], REM_TAG [1], REM_TAG [2], RESTORE_LINE_INT, RESTORE_SPECTRUM, REVERSE
SPECTROSCOPIC2ION, SPLINE, STRPAD, STR_SEP, SYN_CURSOR, SYN_MAIN_EVENT, SYN_WID
TAG_EXIST [1], TAG_EXIST [2], TRIM, TVERASE, VALID_NUM [1], VALID_NUM [2]
VALID_NUM [3], XMANAGER, XPOPUP, XREGISTERED, XSEL_PRINTER, break_file [4]
ch_check_str, concat_dir [4], convertname, delvarx [5], dir_exist [1]
dir_exist [2], file_exist [1], file_exist [3], required_tags, restgen [1]
restgen [2], savegen [1], savegen [2], str_replace [1], str_replace [2]
where_arr [1], where_arr [2]
COMMON BLOCKS:
many
RESTRICTIONS:
SIDE EFFECTS:
EXAMPLE:
IDL> ch_ss
CATEGORY:
spectral synthesis.
WRITTEN :
Ver.1, 7-Nov-01, Giulio Del Zanna (GDZ) and Peter Young (PRY)
MODIFICATION HISTORY:
V.2, 7-Nov-01, GDZ . Fixed a small bug (now the spectrum plot is always
plotted within the widget), and modified the option to add continua.
Changed the suggested names of the outputs.
Corrected a bug when creating an IDL save file with the spectrum, when
no line details are present.
V.3 28-Jan-02 GDZ
fixed a bug in the density text widget, added a few buttons
and options, including the effective area.
Added noprot, rphot, radtemp keywords to the call to ch_synthetic
V 4, 18-Apr-2002, GDZ
Added photoexcitation, changed IDL save files to FITS files,
V.5, 21-May-2002, GDZ
fixed a few small bugs: checking min_abund before calculating the
spectrum; checking the ioneq file when
restoring the structure; changed the status of
all lines; chnaged the font system.
generalized directory concatenation to work for
Unix, Windows and VMS.
V.6, 15-July-2002, GDZ - New major revision.
Changed the chianti top directory (for Effective areas).
Changed Linear/Log button.
Rearranged the sizes of the buttons and added a special cursor to
highlight the area where details of the lines will be given. Works
only in linear scale.
Added quite a lot of new checks to avoid crashes and
fixed the problem with the zoom/unzoom/change units.
V.7, 2-Aug-02, GDZ
Modified the output labels on the plot, inside and on the axis.
Also modified a few minor things like the appearance of the Log T,EM
values.
Fixed a bug when creating the latex output.
Now it restores at the end previous colors and settings.
V.8, 8-Aug-02, GDZ
Changed the CHIANTI system variables. Fixed.
Also fixed a problem with the element ab. file.
V.9, 13-Aug-02, GDZ
Restored the correct use of ch_line_int, now only the lines in the
plot window are listed, and the ALL keyword is in use.
Now the correct xrange is loaded into COMMON when line int. are
restored. Now it checks if all ions were in the structure, when
restoring the line intensities, and flags the widget button accordingly.
Added a device,decomposed=0. to remove problems with colors.
Corrected the use of the DEM, IONEQ and ABUND pulldown menus,
avoiding conflicts between files in the working and CHIANTI
directory having the same name.
Added printing of references for ancillary files, and a check on the
element abundances vs. the elements present in the structure.
V.10, 7-Nov-03 GDZ
Modified format e8.2 to e9.2 for Windows compatibility.
Replaced f9.4 with f11.4 format for the wavelengths.
Some minor modifications to the widget.
Added extended details in the ascii output spectrum.
Added more explanations in the HELP buttons.
V.11, 22-Jul-2005 GDZ
-Added keV option and a few more extra checks.
V.12, 2-Aug-2005 GDZ
put RETAIN=2 in the main plotting window.
V.13, 3-Oct-2005 GDZ
Replaced FOR i=0, calls with FOR i=0L, calls, so
the routine does not crash with a large number of lines.
TO DO LIST:
Control the range of Angstroms when clicking
kev
Allow plots in intensities instead of intensities A-1
VERSION : V.13, 3-Oct-2005
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME:
CH_SYNTHETIC
PURPOSE:
to calculate CHIANTI line intensities or G(T) and output an IDL structure.
CALLED BY:
ASCII_WVL_DEM, GOES_TF, GOES_TF_COEFF, GOFNT
HW_SYNSPEC__DEFINE defines the class HW_SYNSPEC Objects of this [1]
HW_SYNSPEC__DEFINE defines the class HW_SYNSPEC Objects of this [2]
ISOTHERMAL, LATEX_WVL_DEM, SYNTHETIC, ch_ss, make_goes_chianti_response [1]
make_goes_chianti_response [2], make_goes_chianti_response [3]
make_goes_chianti_response [4]
PROCEDURE:
This routine calculates as default line intensities for a user-specified
differential emission measure and ionisation balance. The actual
creation of a synthetic spectrum (i.e., wavelength vs. intensity)
is performed by other routines - see CH_SS.PRO and
MAKE_CHIANTI_SPEC.PRO.
Note that this routine does not include the element abundances
in the line intensities, as this will be performed by
make_chianti_spec. One of the reasons why element abundances are not
included in the line intensities calculation is so that it is easier
for the user to see how modifying abundances affects their spectra in
e.g. CH_SS.PRO.
The calculations are performed at constant pressure or
at constant density.
The routine can also output line intensities calculated with an
isothermal approximation.
If the isothermal approximation is not used, then the user will be asked
to select two files, that can either be in the
standard CHIANTI database or in the working directory.
These files are:
- an ionization fraction file
- a differential emission measure (DEM) file.
The routine can also output the contribution functions G(T) of the lines,
instead of the intensities, if the keyword GOFT is used. In this case,
only the ionization equilibrium file needs to be selected.
The G(T), or intensity per emission measure, is calculated as:
G=(hc/lambda_ij)*A_ji*(N_j(X^+m)/N(X^+m))*(N(X^+m)/N(X))/ N_e /(4.*!pi)
where A_ji is the A-value of the transition;
(N_j(X^+m)/N(X^+m)) is the population of the upper level,
calculated by solving the statistical equilibrium equations;
(N(X^+m)/N(X)) is the ionization equilibrium
N_e is the electron density.
unless /PHOTONS is set, in which case the (hc/lambda_ij) factor
is not included.
If not specified otherwise, with the use of the MASTERLIST or SNG_ION
keywords, then the standard masterlist of the ions, which has
all the ions in the current CHIANTI database, is used.
PROGRAMMING NOTES
The DEM is not assumed to be specified at 0.1 logT intervals (which
is how the ion fraction are specified). Thus this routine reads
in the DEM vs. logT information and then uses the IDL spline
function to tabulate the DEM over 0.1 logT intervals. The minimum
and maximum temperatures are those in the DEM file, rounded up to
the nearest 0.1. The new DEM function tabulated over 0.1 logT
intervals is contained in 'dem_int'.
For some of the dielectronic files, radiative decays that were in
the standard .wgfa file will also be present in the dielectronic
version of the .wgfa file. In these cases the line intensity
produced from the latter file needs to be ignored and so we have a
check in ch_synthetic to do this. An example is the 1-7 decay in
the ca_19.wgfa and ca_19d.wgfa files. In the latter case, the
model of the ion does not include electron excitation to level 7
and so the model for the 1-7 decay is incorrect, hence we ignore
it.
CATEGORY:
spectral synthesis.
CALLING SEQUENCE:
IDL> ch_synthetic,wmin,wmax, output=output, pressure=pressure,$
[MODEL_FILE=MODEL_FILE, err_msg=err_msg, msg=msg, $
density=density,all=all,sngl_ion=sngl_ion, $
photons=photons, masterlist=masterlist, $
save_file=save_file , verbose=verbose, $
logt_isothermal=logt_isothermal,$
logem_isothermal=logem_isothermal,$
goft=goft, ioneq_name=ioneq_name, dem_name=dem_name,$
noprot=noprot, rphot=rphot, radtemp=radtemp, progress=progress ]
INPUTS:
Wmin: minimum of desired wavelength range in Angstroms
Wmax: maximum of desired wavelength range in Angstroms
PRESSURE: pressure in emitting region (Pe, cm^-3 K).
Only a single value is accepted, and the calculation is
performed at constant pressure.
OPTIONAL INPUTS :
DENSITY: density in emitting region (Ne, cm^-3).
Only a single value is accepted, and the calculation is
performed at constant density, unless LOGT_ISOTHERMAL is
defined. In this case, DENSITY can be an array of values, but
has to have the same number of elements as LOGT_ISOTHERMAL.
MODEL_FILE Full path of the (Te,Ne) file if defined.
This file should have two columns, one with the Te (K)
values, and one with the Ne (cm^-3) values. If these
values are not sorted in ascending order of Te, the
routine does sort them.
SNGL_ION: specifies a single ion (e.g. SNGL_ION='Fe_10' to include
only Fe X lines) or an array (e.g. SNGL_ION=['Fe_10','Fe_11']
to include only Fe X and Fe XI lines) of ions to be used
instead of the complete set of ions specified in
!xuvtop/masterlist/masterlist.ions
MASTERLIST: string of a specific masterlist file (full path).
If defined as a keyword (i.e. MASTERLIST=1 or /MASTERLIST)
then a widget allows the user to select a user-defined
masterlist file. Shortcut for SNGL_ION.
IONEQ_NAME: Name of the ionization equilization name to use. If not
passed, then the user is prompted for it.
DEM_NAME: Name of the DEM file to used. If not passed, then the user
is prompted for it.
LOGT_ISOTHERMAL
Array of logarithmic temperatures.
If defined, the emissivities are calculated with an
isothermal approximation. The values are sorted in ascending
order.
LOGEM_ISOTHERMAL
Array of logarithmic emission measures.
If defined, the emissivities are calculated with an
isothermal approximation. The values are sorted in ascending
order. If LOGT_ISOTHERMAL is specified without
LOGEM_ISOTHERMAL then the emission measures are set to 1
(logem_isothermal=0).
RADTEMP The blackbody radiation field temperature (default 6000 K).
RPHOT Distance from the centre of the star in stellar radius units.
I.e., RPHOT=1 corresponds to the star's surface. (Default is
infinity, i.e., no photoexcitation.)
OUTPUTS:
OUTPUT: The name of the structure containing the line intensities and
details.
The tags of the structure are:
.lines A structure containing information about the lines.
Its size is the number of lines in the spectrum. The
tags are:
.iz The atomic number of the elements (e.g., 26=Fe)
.ion The ionisation stage (e.g., 13=XIII)
.snote The identification of the ion (e.g., 'Fe XXIV d')
.ident The identification of the transition, configuration
and terms in text form.
.ident_latex
The identification of the transition, configuration
and terms in latex form.
.lvl1 The lower level of the transition (see .elvlc
file for ion)
.lvl2 The upper level for transition.
.tmax The temperature of maximum emission of the line.
If the G(T) are output, tmax is the maximum of G(T).
If the isothermal approximation is used tmax=0.
If a DEM is used, tmax is the maximum of the
emissivity that includes the product of the ion
fraction and the DEM.
Rounded to nearest 0.1
.wvl Wavelength of the transition, in Angstroms.
.flag A flag, =-1 if the line has only theoretical energy
levels. Otherwise flag=0.
.int Intensity of line (erg/cm2/s/sr or phot/cm2/s/sr),
divided by the element abundance (exclusive with .goft).
.goft The G(T) of the line (optional /exclusive with .int).
.ioneq_name The ion balance file used (full path).
.ioneq_logt The Log10 T values associated.
.ioneq_ref The references.
.dem_name The differential emission measure file eventually used
(full path).
.dem The Log10 DEM values
.dem_logt The Log10 T values associated.
.dem_ref The references.
.model_name A string indicating the model used:
1- Constant density
2- Constant pressure
3- Function (Te,Ne)
.model_file Full path of the (Te,Ne) file if defined. Null string otherwise.
.model_ne the Ne value(s).
- a scalar if 'Constant density' is selected.
- an array if 'Function' is selected.
- 0. if constant pressure is selected.
.model_pe the Pe value.
- a scalar if constant pressure is selected.
- 0. if 'Constant density' is selected.
- an array=density*temperature if 'Function' is selected.
.model_te the Te values if 'Function' is selected. Otherwise 0.
.wvl_units The wavelength units.
.wvl_limits The wavelength limits specified by the user.
.int_units The intensity units.
1) If LOGT_ISOTHERMAL is defined, we have two cases:
a) LOGEM_ISOTHERMAL is not defined, and is therefore
assumed to be 0 (EM=1). In this case, units are
'photons cm+3 sr-1 s-1' or 'erg cm+3 sr-1 s-1'.
b) LOGEM_ISOTHERMAL is defined. In this case, units are
'photons cm-2 sr-1 s-1' or 'erg cm-2 sr-1 s-1'.
2) If LOGT_ISOTHERMAL is not defined, we have two cases:
a) intensities are calculated. In this case, units are
'photons cm-2 sr-1 s-1' or 'erg cm-2 sr-1 s-1'.
b) Contribution functions G(T) are calculated. In this
case, units are
'photons cm+3 sr-1 s-1' or 'erg cm+3 sr-1 s-1'.
.logt_isothermal
The Log10(T) values used.
.logem_isothermal
The Log10(EM) values used.
.date The date and time when the structure was created.
.version The version number of the CHIANTI database used.
.add_protons
A flag (0/1) to indicate whether proton data were used (1)
or not (0) to calculate the level population.
.photoexcitation
A flag (0/1) to indicate if photoexcitation was included (1)
or not (0).
.radtemp
The blackbody radiation field temperature used (if
photoexcitation was included).
.rphot
Distance from the centre of the star in stellar radius units
(if photoexcitation was included).
OPTIONAL OUTPUTS:
SAVE_FILE: If defined, then an IDL save file is created, with the output
structure.
GOFT: If set, the G(T) of the lines are calculated, and put in
the output structure, instead of the line intensities.
Units are 'photons cm+3 sr-1 s-1' or 'erg cm+3 sr-1 s-1'
KEYWORDS:
ALL: if set, then all lines are included. This means that lines for
which only an approximate wavelength is known,
denoted by a negative wavelength value in the .wgfa file, are
included. These are the lines for which there are no observed
energy levels.
PHOTONS: The output intensities will be in photons instead of
ergs.
VERBOSE: If set, the routine will list each ion it is looking at,
and how many lines from each ion it is including in the
spectrum.
GOFT: If set, the G(T) of the lines are calculated, and put in
the output structure, instead of the line intensities.
Units are 'photons cm+3 sr-1 s-1' or 'erg cm+3 sr-1 s-1'
NOPROT Switch off the inclusion of proton rates in the level
balance (default).
PROGRESS If set, a widget appears, showing the progress of the
calculation and allowing the user to halt the calculation.
NO_SUM_INT Prevents the summing of intensities over temperature.
Only works in conjunction with the LOGT_ISOTHERMAL
option, and is implemented in order to work the
ISOTHERMAL routine. The .INT tag in OUT.LINES becomes
an array with the same number of elements as
LOGT_ISOTHERMAL, corresponding to the intensities at
each temperature.
CALLS: ***
BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CH_GET_FILE, CONCAT_DIR [1]
CONCAT_DIR [2], CONCAT_DIR [3], CONVERT_TERMS_ALL, DATATYPE [1], DATATYPE [2]
DATATYPE [3], FILE_EXIST [2], INFO_PROGRESS, ION2SPECTROSCOPIC, PICKFILE
POP_SOLVER, PROTON_DENS, R2W, READ_ASCII, READ_DEM, READ_ELVLC, READ_IONEQ
READ_IONREC, READ_MASTERLIST, READ_SPLUPS, READ_WGFA2, REMOVE [1], REMOVE [2]
SPLINE, TRIM, VALID_NUM [1], VALID_NUM [2], VALID_NUM [3], XKILL, XREALIZE
ZION2FILENAME, break_file [4], concat_dir [4], convertname, file_exist [1]
file_exist [3], savegen [1], savegen [2]
COMMON BLOCKS:
wgfa, wvl,gf,a_value
upsilon,splstr
elvlc,l1a,term,conf,ss,ll,jj,ecm,eryd,ecmth,erydth,eref
elements,abund,abund_ref,ioneq,ioneq_logt,ioneq_ref
radiative, radt, dilute
proton, pstr
ionrec,rec_rate,ci_rate,temp_ionrec,luprec,lupci,status
RESTRICTIONS:
SIDE EFFECTS:
CATEGORY:
spectral synthesis.
EXAMPLE:
This routine can be called in this way:
IDL> ch_synthetic,5.,10., output=structure, pressure=1.e+15
To make use of the output structure, use MAKE_CHIANTI_SPEC or CH_SS
PREV. HIST. :
Based on synthetic.pro, written by Ken Dere
WRITTEN :
Ver.1, 22-Jun-00, Peter Young (PRY) and Giulio Del Zanna (GDZ)
MODIFICATION HISTORY:
Ver.1, 22-Jun-00, Peter Young and Giulio Del Zanna
Ver.2, 25-Jul-00, PRY
Removed /all keyword; make_chianti_spec can be
used to filter out negative wavelengths.
Added flabel tag to output in order to pick out
dielectronic recombination lines.
Ver.3, 4-Oct-00, PRY
Replaced /all keyword.
Corrected bug when .wgfa files contain two A-values
for the same transition.
Ver.4, 5-Oct-00, PRY
Corrected bug that gave rise to lines from the same
transition when the dielectronic file existed.
V.5, 11-Oct-2000, GDZ
eliminate the abundance call; reinstate the /masterlist keyword;
added the tag ident_latex to have the identification in
late-style format; added a tag flag=-1 for the unobserved lines,
and =0 otherwise; reinstated all wavelengths > 0. ;
added the calculation of the G(T);
added a few other tags in the output, and various checks and
comments.
V.6 15-Oct-2000 ,GDZ
Replaced calls to solarsoft routines to standard IDL ones.
Corrected an error in the output creation, in relation to the
isothermal case. Added isothermal in the output. added checks to
the wavelengths. Default output name is TRANSITIONS. changed
const_net and added const_net_value + a few other things.
v.7, 27-Nov-2000, GDZ. Corrected an error in the calculation of the
G(T).
Version 8, 5-Dec-2000, GDZ, DAMTP. Fixed a bug when checking the
values in the .splups files.
V. 9, GDZ, 10-Apr-2001, corrected another error in the G(T) calc.
V. 10, GDZ, 30-Oct-2001 added CHIANTI Version number, changed isothermal
to logt_isothermal and added logem_isothermal to the output.
Removed the use of log T values, and the calculation.
Added err_msg, a text string with an error message.
Version 11, 8-Nov-01, GDZ
Changed the MASTERLIST keyword. Allowed double use, as a keyword
and as a string.
Version 12, 18-Nov-01, Peter Young
Added /NOPROT, RPHOT and RADTEMP keywords; changed upsilon
common block.
Version 13, 29-Apr-02, GDZ
Added no_protons, photoexcitation, rphot, radtemp
tags into the output structure.
Revised Header. Added the PROGRESS widget.
Added a check if the ion is present in the Ion. Frac. file.
Added informative MSG keyword.
Now uses savegen.pro to save the structure.
V. 14, 28-May-2002, GDZ:
generalize directory concatenation to work for Unix, Windows
and VMS.
modified tags:
limits -> wvl_limits
ioneq_t -> ioneq_logt
wvlunits -> wvl_units
intunits -> int_units
time --> date
no_protons -> add_protons
dem_t -> dem_logt
const_nte -> model_name
const_nte_value -> model_ne, model_pe, model_te
removed from the main STR: .ioneq ctemp
removed from the LINES STR: fwhm flabel
Added model_file input for model Ne(T). Had to considerably
modify the routine.
V. 15, 16-Jul-2002, Peter Young
Added keyword /NO_SUM_INT.
V. 16, 22-Jul-2002, Peter Young
Corrected a bug related to /NO_SUM_INT; logt_isothermal
can now be specified without logem_isothermal.
V. 17, 23-July-2002, GDZ
Modified a few checks on the input. Also, now it prints the
error message whenever the program aborts
V.18, 2-Aug-02, GDZ
Replaced all DBLARR and DOUBLE calls with floats.
Added a comment at the end of the routine when it finishes.
V.19, 8-Aug-02, GDZ
Added more error info. Changed the use of the DENSITY
keyword. It is possible to input an array of values if
LOGT_ISOTHERMAL is defined.
V. 20, 17-Sep-02, GDZ
Corrected a bug: the functional (T,N) form
is now only accepted if DENSITY is an array with at least two
values.
V. 21, 19-Sep-02, GDZ
Corrected the definition of the UNITS in case LOGT_ISOTHERMAL
is defined.
V. 22, 19-Aug-03, Peter Young
when logem_isothermal is input, the derived EM is now a
DOUBLE array rather than FLOAT, preventing infinities when
logem_isothermal values are large.
V. 23, 4-Oct-2003, GDZ
modified the input to POP_SOLVER, now it is dealt with an
input structure.
V.24, 10-Oct-2003, K.Dere
added modifications from K.Dere, regarding the satellite
lines.
V 25, 3-Nov-2003, GDZ
Added GROUP keyword, and modified so the progress widget can
be stopped within IDL Windows.
V 26, 17-Apr-2004, Enrico Landi (EL)
Added the recombination/ionization population processes.
V.27, 13-Apr-2005, EL
Replaced the main loop to calculate individual line intensities
with operations among arrays, to speed the whole program in case
of large numbers of lines.
v.28, 31-Aug-2005, GDZ
Fixed bug concerning the case when multiple temperatures
(i.e. logt_isothermal) were defined as input. The program
was, in some cases, returning null values.
The problem was the use of nt, the number of good temperatures
for each ion, for the definition of the arrays, instead of
using the number of logt_isothermal values (and the t_index).
VERSION : 28, 31-Aug-2005
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
NAME:
CH_WRITE_FITS
PURPOSE:
Write standard FITS binary table data from CHIANTI input structure.
CALLING SEQUENCE:
CH_WRITE_FITS, Input, Filename
INPUTS:
Input = Structure to be written to FITS file.
OUTPUTS:
Filename = String containing the name of the file to be written.
CH_WRITE_FITS creates two binary table extension in a single
FITS file. The second one is appended as a new extension.
OPTIONAL INPUTS: Header COMMENTS.
KEYWORDS:
head1, head2
Additional COMMENTS to be added at the bottom of the two binary tables.
NOTES:
Any existing FITS file can be over-written or not.
Use CH_READ_FITS to convert the FITS file back into a structure.
CALLS: ***
CHK_AND_UPD, FXADDPAR [1], FXADDPAR [2], FXPAR [1], FXPAR [2], HOST_TO_IEEE [1]
HOST_TO_IEEE [2], HOST_TO_IEEE [3], HOST_TO_IEEE [4], IS_IEEE_BIG [1]
IS_IEEE_BIG [2], MWR_DUMMY, MWR_HEADER, MWR_TABLEDAT, MWR_TABLEHDR, REM_TAG [1]
REM_TAG [2], ch_check_str
CALLED BY:
ch_ss
COMMON BLOCKS: none.
RESTRICTIONS:
(1) Limited to 127 columns in tables by IDL structure limits.
(2) String columns with all columns of zero length crash the
program
(3) The input structure has to be of the type TRANSITIONS.
PREV. HIST. :
The subroutines in this procedure are extracted without modifications from
the MWRFITS.PRO routine, written by T. McGlynn Version 0.95 2000-11-06
and present in the ASTRON library (in SolarSoft under /gen/idl_libs/astron/).
EXAMPLE:
ch_write_fits, transitions , 'test.fits'
WRITTEN :
Ver.1, 22-May-02 Giulio Del Zanna (GDZ)
MODIfICATION HISTORY:
VERSION : 1, 22-May-02, GDZ
[Previous]
[Next]
NAME:
CH_XMENU_SEL
PURPOSE:
Allow user to select a set of items from a list. Widget equivalent
of WMENU_SEL
CALLING SEQUENCE:
ss = ch_xmenu_sel(array)
ss = ch_xmenu_sel(array, /one)
ss = ch_xmenu_sel(array, /fixed) - use fixed font (keep column alignement)
INPUTS:
ARRAY A string or string array of values to be displayed for
selection
CALLS: ***
CHIANTI_FONT, CH_XMENU_SEL_EV, CH_XMENU_SEL_LAB, EVENT_NAME, GET_WVALUE
REMOVE [1], REMOVE [2], XMANAGER, XMENU [1], XMENU [2], tbeep [1], tbeep [2]
tbeep [3]
CALLED BY:
DENSITY_RATIOS, GOFNT, TEMPERATURE_RATIOS, ch_ss, emiss_select
OPTIONAL KEYWORD INPUT:
ONE If set then only one button may be turned on at a time.
TIT The title of the widget
GROUP The parent widget id (so that if the parent widget exits,
this widget is destroyed too)
FIXED_FONT If set, use fixed font (keep columns aligned)
SIZE_FONT Size of (fixed) font to use - default=15 (implies /FIXED)
NLINES How many lines to display. Default is 20
OUTPUTS:
The result returns the select indices of the array ARRAY.
RESTRICTIONS:
Must have widgets available.
HISTORY:
Written 30-Jan-95 by M.Morrison using Elaine Einfalt
YO_TAPE_WIDG as a starting point
10-Jul-96 (MDM) - Ajustment to make the output scaler if it
is a single item
11-nov-96 (SLF) - add FIXED_FONT and SIZE_FONT keywords
15-Apr-97 (MDM) - Re-added the 9-Jan-97 (MDM) modification
to merge with 11-Nov-96 version
9-Jan-97 (MDM) - Added NLINES option
22-Jul-97 (MDM) - Added call to WMENU_SEL if the device is
not X (so that terminal prompting is
enabled.
9-may-2001 Giulio Del Zanna (GDZ)
added keywords text and include, renamed ch_xmenu_sel
V.7, 15-Aug-2002 GDZ
Modified a few cosmetics, and add the option to have a TEXT string
array to add as a comment in the top widget.
V.8 30 Jan 2002, GDZ
Now it returns an ordered list, according to how the lines where
selected. It works only the first time the routine is called.
V.9, 30-Jun-2003, Peter Young
Added call to CHIANTI_FONT to correct problem with fixed font in
Windows.
V.10 3-Oct-2003, GDZ
inserted the ,/MODAL keyword within the main widget, for
compatibility with IDL v.5.4
VERSION : 10 3-Oct-2003
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an Atomic Database Package for Spectroscopic Diagnostics of
Astrophysical Plasmas. It is a collaborative project involving the Naval
Research Laboratory (USA), the University of Florence (Italy), the
University of Cambridge and the Rutherford Appleton Laboratory (UK).
Name : CHIANTI_DEM
Purpose : Calculates the Differential Emission Measure DEM(T) using
the CHIANTI database, from a given set of observed lines.
Constant pressure or density can be used.
Category : diagnostic analysis
Explanation : This routine has several options, all in the form of keywords.
First, the input file with the observed fluxes is read.
THE FIRST TIME YOU USE THIS ROUTINE
you'll have to do the calculation of the contribution
functions G(T), so the routine GET_CONTRIBUTIONS will come
into play. You'll have to specify the value of the
pressure or density, and you'll be asked to select an
ionization equilibrium file and an abundance file.
GET_CONTRIBUTIONS searches the CHIANTI database (ion per ion)
for all the theoretical lines corresponding to the observed
lines, i.e. that lie in a OBS_WVL(i) +/- DELTA_LAMBDA_OBS(i)
interval centered on the observed wavelength OBS_WVL(i).
The routine calculates the C(T) values (G(T)=Ab(element)*C(T))
for the temperature interval log(T)= 4.0 - 8.0
with steps of log(T) = 0.1 .
You can either select a constant pressure OR a constant
density for all the lines; if you select a constant pressure,
for each ion the contribution function is calculated at an
electron density N_e equal to the ratio of the pressure
and the temperature of maximum ionization fraction:
C=C( T, N_e= P/T_ion )
The C(T) values are stored by GET_CONTRIBUTIONS in the output
file OUTPUT.CONTRIBUTIONS that can be used later to calculate
the DEM, changing various parameters,
without having to start again and read the CHIANTI database,
which can take long time.
In the case no theoretical lines corresponding to an observed
line are found, the routine writes the wavelength of the line
(to be excluded from the fit) in the array
EXCLU_OBS_WVL_NO_TEO. The lines with no theoretical
counterparts are then automatically excluded from the fit by
CHIANTI_DEM. You might consider the possibility to start again
incrementing the DELTA_LAMBDA_OBS, to see if there are
theoretical lines in the vicinity.
Note: if you want to exclude some of the observed lines from
the fit, you just have to use the keyword EXCLUDE_OBS_WVL,
BUT GET_CONTRIBUTIONS will store anyway the results (if any)
in the C(T) file.
After having excluded the lines in EXCLUDE_OBS_WVL,
any *.abund file present in the CHIANTI database or in
the working directory can be selected, and eventually edited,
if you like to change some abundances.
Then the $G(T)$ are calculated, multiplying each theoretical
line by the abundance factor. Then the
theoretical lines contributing to each blend are sorted by
intensity and then their G(T) can be plotted if the keyword
PLOT_GT is activated. It is recommended to do this the first
time, to check if there are some observed lines terribly
blended with lines of other elements, in which case it is
better to exclude them with a second run (if you are not
sure about the abundances).
Then the G(T) for each blend are summed and plotted.
Then the fit starts calling DEM_FIT.
A series of parameters can change the
result (DEM), especially the number and position of the mesh
points of the spline that represents the DEM. The keyword
MESH_POINTS serves for this purpose.
The other keywords that control the fit are N_ITER, DCHISQ_M.
At the end of the fit, the files OUTPUT.DEM and OUTPUT.GENERAL
are created.
Use : IDL>chianti_dem,output='serts89',file_input='serts89.obs',$
pressure=3.e15
Examples :
Assume you have a file input 'serts89.obs' like this:
243.031 491. 97. 0.1 He II
256.323 1580. 186. 0.1 He II b
315.024 253. 31. 0.1 Mg VIII
335.401 10400. 1650. 0.1 Fe XVI
319.839 113. 14. 0.1 Si VIII
356.027 218. 25. 0.1 Si X
IDL>chianti_dem,output='serts89',file_input='serts89.obs',$
pressure=3.e15,cut_gt=1e-30,/plot_gt
After having selected the ionization file,
the C(T) (with MAX(C(T)) gt 1e-30) are stored in the file
'serts89.contributions'. Then select one of the abundance
files.
Have a look at the plots of the G(T), and annotate
if there is a line you want to exclude, let's say the second.
Have a look at the DEM obtained ('serts89.dem') and at
the details contained in the file 'serts89.general'.
Maybe there is another line you want to exclude, let's say
the last one. Maybe you want to change the mesh points, too.
So run
IDL>chianti_dem,output='serts89_2',file_input='serts89.obs',$
file_gt='serts89.contributions',$
exclude_obs_wvl=[243.031,356.027 ],$
mesh_points= [4.5,5.,5.5,6.2,7.5]
The files 'serts89_2.dem' and 'serts89_2.general' will be
created. They have the essential information about what you
did.
Inputs : various, all in form of keywords. The required ones are
OUTPUT and FILE_GT (or PRESSURE/DENSITY)
Opt. Inputs : various... see the software note.
Outputs : OUTPUT.CONTRIBUTIONS
Created only if the keyword FILE_GT is NOT set.
Is the file where all the contribution functions G(T) are
stored. In the first two lines the ionization equilibrium
file name, and the constant value of pressure or density
adopted are reported. Then for each line you have reported
the observed wavelength, the theoretical one, the element and
ionization stage, then the C(T) values. At the end the
specification for each transition.
OUTPUT.DEM
Is the file where the log T and log DEM values are
written, with a format suitable
as input for the DMM_SS procedure,that calculates the
synthetic spectrum. At the end some info on how it was
calculated are printed.
OUTPUT.GENERAL
Is the file where general information is stored.
The abundance file, the ionization equilibrium file and the
constant value of pressure or density used are reported.
Then there is one line for each
observed line, with the provisional identification, the
observed wavelength, the observed flux, the theoretical one
(corresponding to the DEM), the error on the flux,
the square of the difference between the theoretical and the
observed fluxes divided by the error (this number should be
close to zero if the line is well reproduced), and finally
the ratio of the theoretical flux versus the observed one
(which should be close to 1).
After this line, there is one line per each theoretical line
contributing to the blend, with the identification, the
theoretical wavelength, the configuration and terms, and the
contribution to the total theoretical flux (in percentage)
of each line in the blend.
OUTPUT.OUT
This file , toghether with OUTPUT.DEM ,
can be used to reproduce the results using
user-written software. See the software notes.
The ouput has this format:
format='(a20,1x, 1f10.3,1x, 3e10.3, 1x, f4.2,1x,f6.3)'
Opt. Outputs:
An abundance file with the modifications inserted.
Postscript files of the G(T).
A postscript file with the DEM (OUTPUT.DEM.PS)
A postscript file with other plots too (OUTPUT_4PLOTS.PS)
Keywords :
ARCSEC:
optional. If set, it means that the intensities in the input
file are per arcsec-2 .
These intensities are then converted to
sterad-1 .
CUT_GT:
optional. If set, only the those theoretical lines that
have a MAX(C(T)) greater than the value set, are kept;
it is useful to set this value in order to reduce the number
of lines in the file where the C(T) are stored.;
if not set, a default value of 1e-30 is adopted.
DCHISQ_M:
optional. If not set, a default value of DCHISQ_MIN=1.e-5
is assumed. For each iteration, the CHISQ and it's variation
are calculated. As long as the iteration achieves an
improvement in CHISQ greater than DCHISQ_MIN , another
iteration will be performed.
DEM_FILE:
optional.If set (,/DEM_FILE) you have to choose a DEM file to
be used as a start, instead of the default constant value of
10.^22.
You can either choose one of the files in the CHIANTI database
or any you have in the working directory.
The values in the file are marked as crosses, the mesh points
are marked with triangles.
DENSITY :
the value of the density (Ne). Required if you do NOT have
already the contribution functions G(T).
EXCLUDE_OBS_WVL:
optional.
If set, you can exclude some of the observed lines from
the fit. Note that even if you set this keyword and run
GET_CONTRIBUTIONS all the theoretical lines found corresponding
to all the lines in the input file are written in the C(T)
file. It is only in the fit that the lines are excluded.
FILE_GT:
optional.
If NOT set, the routine GET_CONTRIBUTIONS is called.
If set, it has to specify the name of the file created by
GET_CONTRIBUTIONS, where all the contribution functions G(T)
are stored. In the first two lines the ionization equilibrium
file name, and the value of the pressure or density
adopted is reported. Then for each line you have reported
the observed wavelength, the theoretical one, the element and
ionization stage, then the C(T) values. At the end the
specification for each transition.
FILE_INPUT:
optional.
if set, you are not requested to select the observation file
using a widget-type search.
The input file must contain 5 columns, unformatted:
1)the observed wavelength (A)
2)the observed flux in erg cm-2 s-1 st-1
3)the corresponding error on the flux in erg cm-2 s-1 st-1
4)half the width (A) of the range (centered on the observed
wavelength) where you want to look for the corresponding
theoretical lines. A value of HWHM or more would do.
5)The identification, written as string (max 20 characters)
MESH_POINTS:
optional. It is a vector that specifies the mesh points for the
spline that represent the fitted DEM, in log(T).
If not set, the default values
[4.,4.5,5.,5.5,6.,6.5,7.,7.5,8.0] are assumed.
N_ITER:
optional.It is the number of iterations of the fitting routine.
If not set, a default value of 20 is assumed.
Changing this value alone might not affect the fit, since
also the value of DCHISQ_MIN is checked during the fit.
N_MATCHES:
optional.
In the unlikely event that more than 50 (default value for
N_MATCHES) theoretical lines corresponding to an observed
line are found, the routine stops; in this case, you have to
start again setting N_MATCHES equal to a greater number.
OUTPUT :
required.
It is the output name. Suffixes will be added when creating
the various outputs.
PHOT:
optional.
If set, it means that in the input file the intensities
are in photons instead of ergs.
PLOT_GT:
optional.
If set (,/PLOT_GT), plots of the G(T) for each
observed line not excluded are created.
PRESSURE:
the value of the pressure (Ne T). Required if you do NOT have
already the contribution functions G(T).
QUIET:
optional. Set to avoid various messages and the details of the
result.
Calls : ***
BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CONCAT_DIR [1], CONCAT_DIR [2]
CONCAT_DIR [3], CW_FIELD, CW_PDMENU, DEM_FIT, ERRPLOT [1], ERRPLOT [2]
FILE_EXIST [2], GET_AB_EVENT, PICKFILE, READ_ABUND, READ_DEM, REMOVE [1], REMOVE [2]
SPLINE, STRPAD, TAG_EXIST [1], TAG_EXIST [2], TRIM, XMANAGER, Z2ELEMENT
ZION2SPECTROSCOPIC, break_file [4], concat_dir [4], file_exist [1]
file_exist [3], get_contributions, print2d_plot
Common : obs, obs_int,obs_sig,n_obs
obs_o, obs_wvl,obs_id,obs_delta_lambda
dem, d_dem_temp,dem_temp,log_dem_temp,log_t_mesh,log_dem_mesh
contr, ch_tot_contr
ab, abund_name,abund_info,xuvtop,ioneq_name
these are the commons with GET_CONTRIBUTIONS.PRO:
various, exclu_obs_wvl_no_teo,const_net,$
dem_temp_min,dem_temp_max,n_dem_temp,$
ch_wvl,ch_l1,ch_l2,ch_id,ch_z,ch_ion,ch_contr_wa,$
ch_pop,ch_contr_list, ch_term,ch_n_contr
Restrictions:
In the unlikely event that more than 50 (default value for
N_MATCHES) theoretical lines corresponding to an observed
line are found, the routine stops; in this case, you have to
start again setting N_MATCHES equal to a greater number.
Also, if the starting DEM values are not proper, or you
don't have enough constraints at lower and higher temperatures,
you might get "strange" results, and should consider using
different starting values.
Of course you need to have the enviroment variable CDS_SS_DERE
pointing to the CHIANTI database top directory.
Side effects: None known yet.
Category : spectrum
Prev. Hist. :
Written by Ken Dere (NRL) as part of the CHIANTI package
in collaboration with Brunella Monsignori Fossi, Enrico Landi
(Arcetri Observatory, Florence), Helen Mason and Peter Young
(DAMTP, Cambridge Univ.). Incorporated into the CDS software.
Written :
V. 1.0 5 November 1997 Giulio Del Zanna (GDZ),
UCLAN (University of Central Lancashire, UK)
Modified : Removed the print2d_plot subroutine. Increased the default value
of N_MATCHES from 20 to 50. Changed way to deal with xuvtop.
GDZ, 31-Oct-2000
Version : 2.0 GDZ, DAMTP, 31-Oct-2000
V.3, Giulio Del Zanna (GDZ)
generalized directory concatenation to work for
Unix, Windows and VMS.
VERSION : 3, 21-May-2002, GDZ
[Previous]
[Next]
NAME:
CHIANTI_FONT
PURPOSE:
Generates standard fonts for CHIANTI GUIs suitable for both Unix and
Windows operating systems.
CATEGORY:
Widgets, fonts
CALLING SEQUENCE:
CHIANTI_FONT, FONT [, /BIG, /FIXED ]
INPUTS:
None.
OPTIONAL INPUTS:
None.
KEYWORD PARAMETERS:
BIG Output a descriptor for a large font.
FIXED Output a descriptor for a fixed-width font.
OUTPUTS:
FONT A descriptor for a font suitable for passing to IDL widget
routines.
OPTIONAL OUTPUTS:
None.
CALLED BY:
CH_XMENU_SEL, RATIO_PLOTTER [1], ratio_plotter [2]
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Has not been tried with a MAC OS.
PROCEDURE:
CHIANTI_FONT, FONT [, /BIG, /FIXED ]
EXAMPLE:
IDL> chianti_font,font
IDL> print,font
Arial*bold*16
MODIFICATION HISTORY:
Ver.1, 6-Aug-2003, Peter Young
[Previous]
[Next]
; PROJECT:
; SSW/XRAY
; NAME:
; CHIANTI_KEV
; PURPOSE:
; This function returns a thermal spectrum (line + continuum) for EM=1.e44 cm^-3
; Uses a database of line and continua spectra obtained from the CHIANTI distribution
;
; CALLING SEQUENCE:
; Flux = Chianti_kev(Te6, energy, /kev, /earth, /photon, /edges) ; ph cm-2 s-1 keV-1 at the Earth
;
; INPUTS:
; Temp = Electron Temperature in MK (may be a vector)
; Energy = Array of 2XN energies in keV, if 1D then they are assumed to be contiguous lower
; and upper energy edges
;
; CALLS:
;
;
; OUTPUTS:
; Flux = Fluxes in ph s-1 or erg s-1
; Fluxes = fltarr(N_elements(Te6),N_elements(wave))
;
; OPTIONAL INPUT KEYWORDS:
; KEV = Units of wave are in keV, output units will be ph keV-1
; If KEV is set, assumes EDGES is set so EDGES must be 2XN
; EARTH = calculate flux in units cm-2 s-1 (bin unit, ang or keV)-1
; DATE = optional date for calculation of earth flux, def='2-apr-92'
; 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.
; ENVIRONMENT VARIABLE SETUPS:
; LINE_FILE = explicit file name for extracted CHIANTI line dbase
; CONT_FILE = explicit file name for extracted CHIANTI continuum dbase
; XR_AB_TYPE - A string designating the type of stored abundance distribution
; to use
; corresponding to the XR_AB_TYPE argument in xr_rd_abundance(),eg "cosmic", "sun_coronal", ...
;
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
RESTRICTIONS:
N.B. If both edges aren't specified in WAVE, then the bins of WAVE must
be equally spaced.
METHOD:
Reads in a database from $SSWDB_XRAY, nominally 'chianti_setup.geny'
CALLS: ***
CHIANTI_KEV_CONT, CHIANTI_KEV_LINES, DEFAULT
COMMON BLOCKS:
CHIANTI_KEV holds the line and continuum database obtained from CHIANTI.
MODIFICATION HISTORY:
richard.schwartz@gsfc.nasa.gov, 6-dec-2003
richard.schwartz@gsfc.nasa.gov, 24-jan-2005
24-mar-2006, ras, supports temp array
4-Apr-2006, Kim, fixed bug - for multi temp noline, wasn't initializing contspectrum
correctly - needs correctly dimensioned array of 0s. Added nocont keyword
24-apr-2006, richard.schwartz@gsfc.nasa.gov,
reoved ab_filename, see xr_rd_abundance and setup.xray_env
[Previous]
[Next]
Project : SOHO - CDS
Name : CHIANTI_NE
Purpose : Calculate and plot CHIANTI density sensitive line ratios.
Explanation : CHIANTI_NE (density ratios)
calculates and plots density sensitive line ratios based on
the CHIANTI atomic database of Dere et. al.
Use : IDL> chianti_ne
Inputs : None
Opt. Inputs : None
Outputs : None
Opt. Outputs: None.
Keywords : None
Calls : ***
ANYTIM2CAL, Bell, CALC_DMM_DR, CHIANTI_NE_EVENT, CW_FIELD, CW_PDMENU, DELVARX [1]
DELVARX [2], DELVARX [3], DELVARX [4], FMT_VECT, GET_DFONT [1], GET_DFONT [2]
GET_UTC, LOADCT, MAKE_ION_LIST, PLOT_DMM_DR_FIG, PRINT_STR, PS [1], PS [2], PSPLOT [1]
PSPLOT [2], REPCHAR, SET_X [1], SET_X [2], STR2ARR [1], STR2ARR [2], WIDG_HELP, XINPUT
XMANAGER, XPDMENU, XREGISTERED, XSEL_PRINTER, delvarx [5]
Common : dmm_dr_com dmm_lines(with plot_dmm_dr_fig),
Restrictions: None
Side effects: None
Category : Spectral
Prev. Hist. : Started life as 'density_ratios' by Ken Dere
Written : C D Pike, RAL, 13-Jan-96
Modified : Added selection of els/ions from master file. CDP, 21-Jan-96
Added hardcopy of line list, refs etc. CDP, 22-Jan-96
Include multiple lines in ratio. CDP, 27-Jan-96
General upgrade and added temp/unit selections. CDP, 6-Jun-97
Added intensity ratio selection. CDP, 17-Jul-97
Added wavelength ranges. CDP, 18-Jul-97
Fixed typos introduced in version 7. CDP, 22-Jul-97
Float the user-supplied Log Temperature. CDP, 1-Aug-97
Update for IDL v5.2. CDP, 20-Apr-99
v. 11 Update list of elements. CDP, 18-Jun-99
V.12. Added ratio plots and hardcopies in linear scale, added various
checks and minor things. Added a few tags to the
ratio output structure (temperature, units, comment).
Removed optional output structure.
Updated to be CHIANTI v.3-compatible.
Giulio Del Zanna, DAMTP, 7-Oct-2000
Version 13, 21-Dec-2000, William Thompson, GSFC
Modified for better cross-platform graphics capability
V. 14, 1-May-02, GDZ, commented out a few refs.
V. 15, 21-May-2002, GDZ, changed the way to deal with fonts.
V.16, 17-Sep-2002 (GDZ)
added !p.multi = 0 upon exit and added X-label.
Version : Version 16, 17-Sep-2002
[Previous]
[Next]
Project : SOHO - CDS
Name : CHIANTI_TE
Purpose : Calculate and plot CHIANTI temperature sensitive line ratios.
Explanation : CHIANTI_TE (temperature ratios)
calculates and plots temp. sensitive line ratios based on
the CHIANTI atomic database of Dere et. al.
Use : IDL> chianti_te
Inputs : None
Opt. Inputs : None
Outputs : None
Opt. Outputs: none.
Keywords : None
Calls : ***
ANYTIM2CAL, Bell, CALC_DMM_TR, CHIANTI_TE_EVENT, CW_FIELD, CW_PDMENU, DELVARX [1]
DELVARX [2], DELVARX [3], DELVARX [4], FMT_VECT, GET_DFONT [1], GET_DFONT [2]
GET_UTC, LOADCT, MAKE_ION_LIST, PLOT_DMM_TR_FIG, PRINT_STR, PS [1], PS [2], PSPLOT [1]
PSPLOT [2], REPCHAR, SET_X [1], SET_X [2], STR2ARR [1], STR2ARR [2], WIDG_HELP, XINPUT
XMANAGER, XPDMENU, XREGISTERED, XSEL_PRINTER, delvarx [5]
Common : dmm_tr_com
Restrictions: None
Side effects: None
Category : Spectral
Prev. Hist. : Started life as 'temperature_ratios' by Ken Dere
Written : H.E. Mason, 3 Oct 1996
Modified : Update for IDL v5.2. CDP, 20-Apr-99
V.3. Update list of elements. CDP, 18-Jun-99
V.4 , Giulio Del Zanna (DAMTP), 10 Oct-2000
Rewritten completely, adding possibility to select the density
at which the intensities are calculated, making this routine
compatible ith CHIANTI v.3, and with the same characteristics as
CHIANTI_TE. Added ratio plots and hardcopies in linear scale, added various
checks and minor things. Added a few tags to the
ratio output structure (density, units, comment).
Removed optional output structure.
Version 5, 21-Dec-2000, William Thompson, GSFC
Modified for better cross-platform graphics capability
V. 6, 1-May-02, GDZ, commented out a few refs.
V.7, 21-May-2002, GDZ, fixed a bug with the fonts.
V.8, 17-Sep-2002 (GDZ)
added !p.multi = 0 upon exit and added X-label
Version : Version 8, 17-Sep-2002
[Previous]
[Next]
NAME:
chisq
PURPOSE:
Calculates normalized chisqr parameter for two arrays
measured and calculated when array of uncertatinties is known.
CALLING SEQUENCE:
res = chisq(meas, calc, uncert)
INPUTS:
meas = array of measurements
calc = array's values of calculations
uncert = array of unceratinties
OPTIONAL INPUT KEYWORDS:
METHOD:
Pearson's approach, normalized (per pixel)
CALLED BY:
adrlb
HISTORY:
Jan 1996, J. Sylwester, written
[Previous]
[Next]
PROJECT: SPEX
NAME: chk_batse_env
PURPOSE:
Check that BATSE environment variables are properly defined and return
full name of read_flare.pro. If not, generate an error message.
CALLING SEQUENCE:
chk_batse_env, err_msg, file
INPUTS:
none
OUTPUTS:
err_msg - string array containing any errors,
single element an empty string otherwise
file - string with full path of read_flare.pro
KEYWORDS:
none
OPTIONAL OUTPUTS:
none
CALLS: ***
CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], UNIQ [1], UNIQ [2], UNIQ [3]
concat_dir [4], get_logenv [1], get_logenv [2]
CALLED BY:
setup_params [1], setup_params [2]
RESTRICTIONS:
none
MODIFICATION HISTORY:
Written by Paul Bilodeau, RITSS 21-June 2000.
[Previous]
[Next]
PROJECT: SPEX
NAME: chk_batse_env
PURPOSE:
Check that BATSE environment variables are properly defined and return
full name of read_flare.pro. If not, generate an error message.
CALLING SEQUENCE:
chk_batse_env, err_msg, file
INPUTS:
none
OUTPUTS:
err_msg - string array containing any errors,
single element an empty string otherwise
file - string with full path of read_flare.pro
KEYWORDS:
none
OPTIONAL OUTPUTS:
none
CALLS: ***
CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], UNIQ [1], UNIQ [2], UNIQ [3]
concat_dir [4], get_logenv [1], get_logenv [2]
CALLED BY:
setup_params [1], setup_params [2]
RESTRICTIONS:
none
MODIFICATION HISTORY:
Written by Paul Bilodeau, RITSS 21-June 2000.
[Previous]
[Next]
NAME:
CI_REC_INTERP()
PROJECT
CHIANTI
EXPLANATION
For including ionization and recombination into the level balance, it's
necessary to interpolate the data stored in the CHIANTI files and, in
addition, perform extrapolation to lower or higher temperatures.
This routine performs the interpolation and extrapolation for general
input arrays.
INPUTS
TEMP Temperature at which rate required. Units: K. Must be a scalar
quantity.
RATE_TEMP Temperatures at which RATE is tabulated. Input as Log (base 10)
values.
RATE The rate coefficient, tabulated at temperatures RATE_TEMP.
KEYWORDS
EXTRAP_ABOVE Extrapolation to higher temperatures will only take place
if this keyword is set.
EXTRAP_BELOW Extrapolation to lower temperatures will only take place
if this keyword is set.
OUTPUT
The value of the rate coefficient at the temperature TEMP. If no data is
available at the specified temperature then a value of zero is returned.
HISTORY
Ver.1, 29-Jun-2005, Peter Young
adapted from original code by Enrico Landi
CALLED BY
CORRECT_POPS
[Previous]
[Next]
Name:
CLEAN_GIF
Purpose:
To fix-up a gif image with a weird color table. Gifs, in general,
have color tables in random order. It is helpful to have them sorted
out in intensity order. CLEAN_GIF does that. It is designed to be
used on memory-resident gif images or as a replacement for READ_GIF
(with a slight change of parameter order from READ_GIF).
Usage:
CLEAN_GIF,a,r,g,b,f - Read a gif image, clean, and return in (a,r,g,b)
CLEAN_GIF,a,rgb,f - Read a gif image, clean, and return in (a,rgb)
CLEAN_GIF,a,f - Read a gif image, clean, and return in (a)
CLEAN_GIF,a,r,g,b - Clean (a,r,g,b) in place
CLEAN_GIF,a,rgb - Clean (a,rgb) in place
PARAMETERS:
A - the image to fix. (I/O; if 'F' specified, output only)
RGB - a 256x3 matrix containing the complete color table (I/O)
(This may be used INSTEAD of r,g, and b).
R - a 256 element array; the red part of the color table (I/O)
G - a 256 element array; the green part of the color table (I/O)
B - a 256 element array; the blue part of the color table (I/O)
F - A file to load in. (Input only)
Method:
If necessary, a gif image is read in from a file. Then the
color table is sorted and the image values diddled to match the
sorting order. Finally, appropriate values are stuck back into the
parameters.
CALLS: ***
READ_GIF, data_chk [1], data_chk [2]
CALLED BY:
CLEAN [1], ITOOL_RD_GIF
History:
Written by Craig DeForest, 2-Sep-98
[Previous]
[Next]
Closest_time
Given a list of times (or "datify"-style filenames), and a reference
time, return the index of the one closest to the reference time.
Useful for movification of heterogeneous data sets.
Calling sequence: idx = closest_time(time,list,[/datify],[times=t])
INPUT PARAMTERS:
TIME - the time to search for
LIST - a list of times, or datify-generated filenames, to search
KEYWORDS:
DATIFY - a binary keyword indicating whether LIST is an array
of datify-generated filenames or (by default) naked timestamps.
TIMES - Points to an array used to cache the floating-point
time array between multiple calls.
LERP - If set, return a number whose integer part is the index
of the last frame BEFORE the given time and whose
floating part is the weighting factor between that
frame and the next one for lerping purposes.
AFTER - Returns the first time(s) in the array that is/are AFTER
the specified time(s).
BEFORE - Returns the last time(s) in the array that is/are BEFORE
the specified time(s).
CALLS:
CALLED BY
cube_interp
[Previous]
[Next]
PROJECT:
SDAC
NAME:
COEFDATA
PURPOSE:
This procedures reads in coefficients needed to calculate xray xsections
from 1-1000 keV. Coefficients are taken from McMaster et al 1968.
CATEGORY:
SPECTRA, XRAYS, XRAY RESPONSE, xray analysis,
CALLING SEQUENCE:
COEFDATA, Coef
CALLED BY: xcross
CALLS: ***
CONV_VAX_UNIX, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], USE_VAX_FLOAT, curdir [1]
curdir [2]
INPUTS:
none explicit, only through commons;
OPTIONAL INPUTS:
none
OUTPUTS:
none explicit, only through commons;
OPTIONAL OUTPUTS:
coef - structure with need coefficients
EXPLANATION FOR TAG_NAMES
Z: ATOMIC NUMBER
AT_DEN: ATOMIC DENSITY - DENSITY IN UNITS OF 10^24 ATOMS/CC
CONV: CONVERSION CONSTANT - CROSS_SECTION(CM2/GM)*CONV=CS(BARNES/ATOM)
EDGE: SHELL EDGES IN KEY
PE : COEFFICIENTS FOR PHOTOELECTRIC CROSS SECTION
SCC : COEFFICIENTS FOR COHERENT SCATTERING (RAYLEIGH)
SCI : COEFFICIENTS FOR INCOHERENT SCATTERING (COMPTON)
KEYWORDS:
ERROR - If set can't find or read data file.
CALLED BY:
ATMOS, BATSE_SPEC_MODEL, GE_WINDOW [1], HESSI_FILTERS, TOTPAIR_XSEC, xsec
COMMON BLOCKS:
xrcoef,n,z,ad,conversion,edge,pearr,scc,sci
SIDE EFFECTS:
none
RESTRICTIONS:
87 elements from 1-94
missing z=[83,85,87,88,89,91,93]
PROCEDURE:
none
MODIFICATION HISTORY:
documented, ras, 20-dec-94
ras, 12-jan-95, include conv_vax_unix for unix
ras, 16-jan-96, include conv_vax_unix for unix for n
Version 4, ras, 8-apr-97, add SSWDB_XRAY to data file search and ERROR.
Version 5, richard.schwartz@gsfc.nasa.gov, 24-jul-1997, removed PERM_DATA.
Version 6, richard.schwartz@gsfc.nasa.gov, 8-feb-1999, add call to use_vax_float.
Need a more permanent solution, e.g. a FITS file!
Version 7, richard.schwartz@gsfc.nasa.gov, 15-may-2000, added explanation
of missing datafile problem.
[Previous]
[Next]
PROJECT: CHIANTI
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME:
CONF2N
PURPOSE:
Extract the highest principal quantum number from the configuration
CALLING SEQUENCE:
CONF2N,conf,n
INPUTS:
Conf: the configuration returned from read_elvlc_direct
KEYWORD PARAMETERS:
None
OUTPUTS:
N: the principal quantum number
EXAMPLE:
> conf2n,'2s2.3p 2P1.0',n
> print,n
> 3
CALLS:
3S2.3P2), If the configurations are written in upper case (e.g.
If the principal quantum number is 10 or greater, None, RESTRICTIONS
it will not be, of 0 will be returned)., picked up.
then the principal quantum numbers will not be picked up (a value
MODIFICATION HISTORY:
Ver.1, April-2000, Ken Dere
Ver.2, 17-Oct-2000, Peter Young
removed call to str_index
[Previous]
[Next]
PROJECT : CHIANTI
CHIANTI http://wwwsolar.nrl.navy.mil/chianti.html
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME : CONVERT_TERMS
PURPOSE :
to convert the transition information into readable formats.
CALLING SEQUENCE:
IDL>this_design = convert_terms(l1, l2, result_latex =result_latex)
CALLED BY:
get_contributions
PROCEDURE:
This function is used to convert the transition information into
readable formats, including spaces and calulating the J values.
The process is quite complex since the notation of the level
designations in the CHIANTI files is not standard.
A very useful latex-style output is also created.
INPUTS :
l1: the index of the lower level
l2: the index of the upper level
the rest of the input info is taken from the COMMON.
OPT. INPUTS : none
OUTPUTS :
a string with the transition information.
OPT. OUTPUTS:
a string with the transition information in latex format.
KEYWORDS :
RESULT_LATEX: the name of an output string.
CALLS : ***
CONVERT_CONFIG, REPSTR [1], REPSTR [2], REPSTR [3], STR_INDEX [1], STR_INDEX [2]
VALID_NUM [1], VALID_NUM [2], VALID_NUM [3]
COMMON BLOCKS: elvlc,l1a,term,conf,ss,ll,jj,ecm,eryd,ecmth,erydth,eref
from here, all the information needed is taken.
RESTRICTIONS: It will not convert every case.
SIDE EFFECTS: None known yet.
EXAMPLES :
this_design = convert_terms(l1, l2, result_latex =result_latex)
CATEGORY :
spectral synthesis.
PREV. HIST. :
parts of the function convert_terms are derived from the CHIANTI
routines.
WRITTEN :
Giulio Del Zanna (GDZ), 10-Oct-2000
DAMTP (University of Cambridge, UK)
MODIFIED : Version 1, GDZ 10-Oct-2000
Version 2, GDZ 10-Oct-2001
Uses standard SolarSoft routines.
V. 3, 18-Sep-2002, GDZ
Fixed a bug with the jvalue
VERSION : 3, 18-Sep-2002
[Previous]
[Next]
PROJECT : CHIANTI
CHIANTI http://wwwsolar.nrl.navy.mil/chianti.html
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME : CONVERT_TERMS_ALL
PURPOSE :
to convert level information into readable formats for all the levels
of an ion.
CALLING SEQUENCE:
IDL>convert_terms_all, res_ascii, res_latex
CALLED BY:
CH_SYNTHETIC
PROCEDURE:
This function is used to convert the level information into
readable formats, including spaces and calculating the J values.
A very useful latex-style output is also created.
It has been adapted to manage all the levels of a given ion
at once from the original routine CONVERT_TERMS.PRO.
INPUTS : all the input info is taken from the COMMON.
OPT. INPUTS : none
OUTPUTS :
RES_ASCII: a string array with the transition information in ASCII format.
RES_LATEX: a string array with the transition information in LATEX format.
CALLS : ***
CONVERT_CONFIG, REPSTR [1], REPSTR [2], REPSTR [3], STR_INDEX [1], STR_INDEX [2]
VALID_NUM [1], VALID_NUM [2], VALID_NUM [3]
COMMON BLOCKS: elvlc,l1a,term,conf,ss,ll,jj,ecm,eryd,ecmth,erydth,eref
from here, all the information needed is taken.
RESTRICTIONS: It will not convert every case.
SIDE EFFECTS: None known yet.
EXAMPLES :
convert_terms_all, res_ascii, res_latex
CATEGORY :
spectral synthesis.
PREV. HIST. :
convert_terms_all has been derived from the existing CHIANTI
routine CONVERT_TERMS.
WRITTEN :
Enrico Landi, 11-Apr-2005
Naval Research Laboratory
MODIFIED : Version 1, EL 11-Apr-2005
VERSION : 1, 11-Apr-2005
[Previous]
[Next]
PROJECT: CHIANTI
PROJECT: CHIANTI
CHIANTI is an atomic database package for the calculation of
continuum and emission line spectra from astrophysical plasmas. It is a
collaborative project involving the Naval Research Laboratory
(Washington DC, USA), the Arcetri Observatory (Firenze, Italy), and the
Cambridge University (United Kingdom).
NAME:
convertname
PURPOSE:
Ion names as character strings are converted into
numerical values (note c_2 is C II or C^+1
in spectroscopic or atomic notation)
CATEGORY:
naming utility
CALLING SEQUENCE:
CONVERTNAME,Name,Iz,Ion
INPUTS:
Name: such as 'c_2'
OUTPUTS:
Iz: nuclear charge Z (6 for 'c_2', the equivalent of C II)
Ion: ionization stage: (2 for 'c_2')
OPTIONAL OUTPUTS
DIELECTRONIC Set to 1 if NAME has a 'd' appended to it
(indicating dielectronic recombination data) else
set to 0
CALLS: ***
STR_SEP
CALLED BY:
CH_SYNTHETIC, DENSITY_RATIOS, MAKE_ION_LIST, PLOT_POPULATIONS, POP_PROCESSES
POP_SOLVER, RATE_COEFF, TEMPERATURE_RATIOS, TWO_PHOTON, WHICH_LINE [1]
WHICH_LINE [2], bb_rad_loss, ch_ss, dens_plotter, get_contributions, temp_plotter
EXAMPLE:
> convertname,'c_2',iz,ion
> print,iz,ion
> 6,2
> convertname,'o_6d',iz,ion
> print,iz,ion
> 8,6
MODIFICATION HISTORY:
Written by: Ken Dere
March 1996: Version 2.0
October 1999: Version 3. by kpd
Ver.4, 11-Dec-01, Peter Young
Revised routine, removing ch_repstr call.
Added DIELECTRONIC optional output.
[Previous]
[Next]
NAME:
COORD
PURPOSE:
Transform coordinates from a first image into the coordinate system of
a second image. x and y scales are assumed to be the same. The
returned result is an Nx2 matrix, where N is the number of elements in
x or y. Doubling-point values are returned where appropriate.
RETURNS:
an Nx2 matrix containing the transformed coordinates
CALLING SEQUENCE:
result = coord(x, y, from, to)
INPUTS:
X, Y = Coordinates from the first image. X and Y may be vectors,
as long as they have the same number of elements.
FROM = FITS header of the first image.
TO = FITS header of the second image.
fromsolar: If set, use a "standard solar co-ordinates" header for the FROM hdr
tosolar: If set, use a "standard solar co-ordinates" header for the TO hdr
arcmin: In conjunction with fromsolar and tosolar, causes i/o for the default
headers to be in arc minutes rather than arc seconds.
KEYWORDS:
zero: if set, causes points mapped outside TO's image range to
be mapped instead to (0,0) on the TO image plane.
CALLS: ***
SXPAR [1], SXPAR [2], SXPAR [3], ZCOORD, ZHDRUNIT, safetag, solar_hdr, zcheck_hdr
zprfits
RESTRICTIONS:
(1) X and Y must have the same number of elements.
(2) Both FITS headers must contain the following parameters, which
are unique to MSSTA FITS images:
CTYPE1 = Units of distance on x axis.
CTYPE2 = Units of distance on y axis (not implemented).
CROT = Rotation ccw from solar N = +y (degrees).
CDELT1 = Size of a pixel in x, in units of CTYPE1.
CDELT2 = Size of a pixel in y, in units of CTYPE2.
CRPIX1 = X coordinate of co-ordinate datum, in pixel co-ords
CRPIX2 = Y coordinate of co-ordinate datum, in pixel co-ords
CRVAL1 = X coordinate of co-ordinate datum, in unit-ed co-ords
CRVAL2 = Y coordinate of co-ordinate datum, in unit-ed co-ords
REFLECT = T if image is flipped with respect to the sun as
seen by the naked eye; else F.
MODIFICATION HISTORY:
C. Kankelborg, CSSA, Stanford University, February, 1994.
Sped up and improved memory by using matrices
C. DeForest, Feb 1995
Added zero masking, C. DeForest, May 1995
Fixed-up for structure type headers, CED May 1997
Added fromsolar, tosolar, and arcmin options, CED 6-Aug-97
Added CRVAL evaluations, CED 24-Oct-97
Added INSTRUME additions to keep location context in /tosolar and /fromsolar
cases, CED 27-Jul-99
[Previous]
[Next]
NAME:
COORD
PURPOSE:
Transform coordinates from (r,theta) to (x,y) pixel coords, in
the context of a particular solar image. R is specified in
solar radii, theta in degrees.
CALLING SEQUENCE:
result = zra2xy(ra,hdr)
INPUTS:
ra = coordinates (r,theta) of the points to transform
hdr = the fits header of the image with the (x,y) coordinates
Alternatively, you may specify "r","a", and the header separately.
If 'a' is a scalar, then it is 'repeated' over all the elements of 'r'.
KEYWORD INPUTS:
log: Force logarithmic r coordinates to be used
EXAMPLE:
ra=[2,3]
pix = zra2xy(ra,hdr)
pix = zra2xy(r,a,hdr)
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], ZHDRUNIT, ZRA2XY, safetag
RESTRICTIONS:
CTYPE1 = Units of distance on x axis.
CTYPE2 = Units of distance on y axis (not implemented).
CROT = Rotation ccw from solar N = +y (degrees).
CDELT1 = Size of a pixel in x, in units of CTYPE1.
CDELT2 = Size of a pixel in y, in units of CTYPE2.
CRPIX1 = X coordinate of center of the sun's disk.
CRPIX2 = Y coordinate of center of the sun's disk.
REFLECT = T if image is flipped with respect to the sun as
seen by the naked eye; else F.
MODIFICATION HISTORY:
C. DeForest, April 1 1995
20-Aug-1997 - Modified to take structure headers. (We still
don't do vectorization properly...)
13-Mar-1998 - Modified to use CRPIX1 & CRPIX2 relative to (1,1)
as per fits specification...
[Previous]
[Next]
NAME:
COORD
PURPOSE:
Transform coordinates from (x,y) to (r,theta) pixel coords, in
the context of a particular solar image. (X,Y) is specified in
pixels in the given header; ra is returned in solar radii and degrees.
CALLING SEQUENCE:
result = zxy2ra(xy,hdr)
result = zxy2ra(x,y,hdr)
INPUTS:
xy = coordinates (pixels) of the points to transform.
hdr = the fits header of the (r,theta) image
KEYWORD INPUT
EXAMPLE:
ra=[2,3]
pix = zxy2ra(xy,hdr)
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], ZHDRUNIT, ZXY2RA
RESTRICTIONS:
CROT is not implemented.
(2)the FITS headers must contain the following parameters
CTYPE1 = Units of angle (degrees only at the moment)
CTYPE2 = Units of distance on y axis.
CDELT1 = Size of a pixel in x, in units of CTYPE1.
CDELT2 = Size of a pixel in y, in units of CTYPE2.
CRPIX1 = X coordinate of center of the sun's disk.
CRPIX2 = Y coordinate of center of the sun's disk.
REFLECT = T if image is flipped with respect to the sun as
seen by the naked eye; else F.
MODIFICATION HISTORY:
C. DeForest, May 10 1996
Modified 25-Feb-97
Updated to structure type headers, 20-Aug-1997
Modified to use CRPIX relative to (1,1), 13-Mar-1998 CED
Modified to use logarithmic radii when appropriate, 8-Jun-98 CED
[Previous]
[Next]
Project : ALL
Name : COORD_ADDINDEX
Purpose : complete solar ephemerides in INDEX
Category : Coordinate systems, Utility
Explanation : Adds ephemerides R0, L0, B0, P into
fields .solar_r, solar_l0, solar_b0, solar_p
Syntax : IDL> fig_open,io,form,char
CALLED BY:
STEREO_LOOP
Examples : IDL>coord_addindex,index
Inputs : index - structure
Opt. Inputs : None
Outputs : None
Opt. Outputs: None
Keywords : None
CALLS: ***
ADD_TAG [1], ADD_TAG [2], GET_SUN [1], GET_SUN [2], struct2ssw
Common : None
Restrictions: Millenium crisis in ephemeris values at 2000-Jan-01
(probably created by subroutine GET_SUN)
Side effects: None
History : Version 1, 9-OCT-1998, Markus Aschwanden. Written
Contact : aschwand@sag.lmsal.com
[Previous]
[Next]
Project : SOLAR
Name : COORD_CART_HELIO()
Purpose : Coordinate transformation from cartesian image coordinates
into heliographic coordinates
Category : Coordinate systems
Explanation : The coordinate reference system of an image is defined
in the structure INDEX. The routine extracts the relevant
information from INDEX and calculates for a given
(X,Y) position in the image the corresponding
heliographic coordinates (L,B) in longitude and latitude.
(See also definitions and descrition in reference
3D-Stereoscopic Analysis of Solar Active Region Loops:
I.SoHO/EIT Observations at Temperatures of 1.0-1.5 MK"
(Aschwanden, Newmark, Delaboudiniere, Neupert,
Klimchuk, Gary, Portier-Fozzani, and Zucker 1998,
THE ASTROPHYSICAL JOURNAL, in press).
URL="ftp://ftp.sag.lmsal.com/pub/aschwand/ar7986_paper.ps.gz"
Syntax : IDL> coord_cart_helio,index,r,ix,iy,x,y,r,l,b
CALLED BY:
STEREO_LOOP
Examples : IDL> !x.range=[0,naxis1] ;defines coordinates of x-axis
IDL> !y.range=[0,naxis2] ;defines coordinates of y-axis
IDL> tv,bytscl(data) ;displays image
IDL> cursor,ix,iy ;reads out position (x,y)
IDL> radii=1.0 ;photospheric radius
IDL> coord_car_helio,index,r,ix,iy,x,y,r,l,b
IDL> print,'heliographic coordinates l,b = ',l,b
Inputs : index - structure containing descriptors of data1
r - altitude in units of solar radii
(r=1.000 for photoshpere )
(r=1.004 for chromospheric height of 2500 km)
ix - x-pixel in image DATA (with structure INDEX)
iy - y-pixel in image DATA (with structure INDEX)
x,y,r - can be vector arrays
Opt. Inputs : None
Outputs : x - x coordinate in arcsecs relative to Sun center
y - y coordinate in arcsecs relative to Sun center
l - heliographic longitude of position (X,Y)
b - heliographic latitude of position (X,Y)
x,y,l,b - are arrays if (r,ix,iy) are arrays
Opt. Outputs: None
Keywords : None
CALLS: ***
ARCTAN, GET_SUN [1], GET_SUN [2]
Common : None
Restrictions: structure INDEX is required to have some minimal solar
keywords, such as
.solar_r solar radius in arcseconds
.solar_l0 heliograph.longitude of disk center
.solar_b0 heliograph.latitude of disk center
.solar_p solar position angle
.crota2 roll angle correction
Side effects: None
History : 1998-Oct-06, Version 1 written, Markus J. Aschwanden
2000-Jan-17, replace ephemerides by GET_SUN
Contact : aschwanden@sag.lmsal.com
[Previous]
[Next]
Project : SOLAR
Name : COORD_CART_HELIO()
Purpose : Coordinate transformation from heliographic coordinates
into cartesian image coordinates of an image
(inverse routine to COORD_CART_HELIO.PRO)
Category : Coordinate systems
Explanation : The coordinate reference system of an image is defined
in the structure INDEX. The routine extracts the relevant
information from INDEX and calculates for a given
heliographic position (L,B) the corresponding
cartesian coordinates (X,Y) in pixel units of the image.
(See also definitions and descrition in reference
3D-Stereoscopic Analysis of Solar Active Region Loops:
I.SoHO/EIT Observations at Temperatures of 1.0-1.5 MK"
(Aschwanden, Newmark, Delaboudiniere, Neupert,
Klimchuk, Gary, Portier-Fozzani, and Zucker 1998,
THE ASTROPHYSICAL JOURNAL, in press).
URL="ftp://ftp.sag.lmsal.com/pub/aschwand/ar7986_paper.ps.gz"
Syntax : IDL> coord_car_helio,index,r,l,b,ix,iy,x,y,z
CALLED BY:
STEREO_LOOP
Examples : IDL> ix=0.
IDL> iy=0.
IDL> print,'image coordinate origin ix,iy=',ix,iy
IDL> r=1.0
IDL> coord_cart_helio,index,r,ix,iy,x,y,l,b
IDL> print,'heliographic coordinates of disk center l,b = ',l,b
IDL> l0=index.solar_l0
IDL> b0=index.solar_b0
IDL> print,'disk center coordinates in INDEX l0,b0 = ',l0,b0
IDL> coord_helio_cart,index,r,l,b,r,ix_,iy_,x_,y_
IDL> print,'consistency check ix,iy-->l,b--ix_,iy_=',ix_,iy_
Inputs : index - structure containing descriptors of data1
r - altitude in units of solar radii
(r=1.000 for photoshpere )
(r=1.004 for chromospheric height of 2500 km)
l - heliographic longitude of position (X,Y)
b - heliographic latitude of position (X,Y)
l,b,r - can be vector arrays
Outputs : ix - x-pixel in image DATA (with structure INDEX)
iy - y-pixel in image DATA (with structure INDEX)
x - x-coordinate in arcseconds west from Sun center
y - y-coordinate in arcseconds north from Sun center
ix,iy,x,y - are vector arrays if (l,b,r) are
Opt. Inputs : None
Opt. Outputs: None
Keywords : None
CALLS: ***
COORD_HELIO_CART, GET_SUN [1], GET_SUN [2]
Common : None
Restrictions: structure INDEX is required to have some minimal solar
keywords, such as
.solar_r solar radius in arcseconds
.solar_l0 heliograph.longitude of disk center
.solar_b0 heliograph.latitude of disk center
.solar_p solar position angle
.crota2 roll angle correction
Side effects: None
History : 1998-Oct-06, Version 1 written, Markus J. Aschwanden
2000-Jan-17, replace ephemerides by GET_SUN
Contact : aschwanden@sag.lmsal.com
[Previous]
[Next]
Project : SOLAR
Name : COORD_HELIO_SPHERE()
Purpose : Overplots heliographic coordinate grid onto an image plot
Category : Coordinate systems, Graphics
Explanation : The heliographic coordinate system is referenced to the
ephemeris parameters in structure INDEX
Syntax : IDL> coord_sphere,index,grid
CALLED BY:
FIG_MULTI_TV
Examples : IDL> grid=5. ;5 degree spacing
IDL> !x.range=[-1000,1000]
IDL> !y.range=[-1000,1000]
IDL> plot,[0,0],[0,0]
IDL> coord_helio_sphere,index,grid
Inputs : index - structure containing descriptors of data1
grid - spacing of heliographic grid in degrees
Outputs : None
Opt. Inputs : None
Opt. Outputs: None
Keywords : None
CALLS: ***
COORD_HELIO_CART, GET_SUN [1], GET_SUN [2]
Common : None
Restrictions: structure INDEX is required to have some minimal solar
keywords, such as
.solar_r solar radius in arcseconds
.solar_l0 heliograph.longitude of disk center
.solar_b0 heliograph.latitude of disk center
.solar_p solar position angle
.crota2 roll angle correction
Side effects: None
History : Version 1, 6-Oct-1998, Markus J. Aschwanden. Written
Contact : aschwanden@sag.lmsal.com
[Previous]
[Next]
NAME:
CORRECT_POPS()
PROJECT
CHIANTI
EXPLANATION
Corrects CHIANTI level populations with the ionization and recombination
rate coefficients
INPUTS
PP The level populations that need to be corrected.
T Temperature at which calculation is performed. Units: K.
XNE Electron density at which calculation is performed. Units: cm^-3
IONREC Structure with the following tags
.rec Effective recomb. rate coefficients
.ci Effective ionization rate coefficients
.temp Temperatures at which rates are tabulated
.lev_up_rec Levels to which recombination takes place
.lev_up_ci Levels to which ionization takes place
.status Either +1 (ion/rec data exists) or -1 (dosen't exist)
.ioneq Ion fractions of the 3 ions
CC 2D matrix produced by MATRIX_SOLVER that contains the rate
coefficents from the standard CHIANTI processes.
OPTIONAL OUTPUTS
CRATE A 1D array of same size as POP containing the collisional
ionization rate coefficients (units: cm^3 s^-1).
RECRATE A 1D array of same size as POP containing the recombination
rate coefficients (units: cm^3 s^-1).
CORRECTION A 1D array of same size as POP containing the correction
factors for each level.
FRAC_LOW The ratio of the current ionization fraction to the fraction
of the one lower ion (i.e., less ionized).
FRAC_HIGH The ratio of the current ionization fraction to the fraction
of the one higher ion (i.e., more ionized).
CALLS
ION_FRAC_INTERP(), CI_REC_INTERP()
HISTORY
Ver.1, 10-Jun-2005, Peter Young
Taken original code of Enrico Landi and inserted it into a separate
routine.
Ver.2, 16-Aug-2005, Peter Young
Changed total_exc to be dblarr in order to prevent NaNs.
Ver.3, 1-Feb-2006, Peter Young
Corrected error: sum of populations is now renormalized to 1.
CALLS:
CALLED BY
POP_SOLVER
[Previous]
[Next]
NAME: countsmod_plot
PURPOSE: plot the details of the count spectrum model
CALLING SEQUENCE:
INPUTS:
OPTIONAL INPUTS:
OUTPUTS:
OPTIONAL OUTPUTS:
CALLED BY:
spec_plot [1], spec_plot [2], spec_plot [3], spec_plot [4]
PROCEDURE:
CALLS: ***
CALIBRATE [1], CALIBRATE [2], CHECKVAR [1], DATPLOT, FCOLOR [1], F_DIV, INTERPOL
MINMAX [1], MINMAX [2], checkvar [2], edge_products, fcolor [2]
get_conversion [1], get_conversion [2], spex_current [1], spex_current [2]
wsetshow [1], wsetshow [2]
COMMON BLOCKS:
RESTRICTIONS:
MODIFICATION HISTORY:
[Previous]
[Next]
NAME: countsmod_plot
PURPOSE: plot the details of the count spectrum model
CALLING SEQUENCE:
INPUTS:
OPTIONAL INPUTS:
OUTPUTS:
OPTIONAL OUTPUTS:
CALLED BY:
spec_plot [1], spec_plot [2], spec_plot [3], spec_plot [4]
PROCEDURE:
CALLS: ***
CALIBRATE [1], CALIBRATE [2], CHECKVAR [1], DATPLOT, FCOLOR [1], F_DIV, INTERPOL
MINMAX [1], MINMAX [2], checkvar [2], edge_products, fcolor [2]
get_conversion [1], get_conversion [2], spex_current [1], spex_current [2]
wsetshow [1], wsetshow [2]
COMMON BLOCKS:
RESTRICTIONS:
MODIFICATION HISTORY:
[Previous]
[Next]
NAME:
cray_filter
PURPOSE:
This compares each image with the image before and after it, in sequence.
This checks each pixel, and if it isn't a median value of the 3, it compares it
with a contant (tolerance) times median standard of deviation. If an atomic ray is
detected in this way, it is replaced by the median value.
SAMPLE CALLING SEQUENCE:
cray_filter, 3d_Array
PARAMETERS:
The 3d array to be checked (there must be at least three different
pictures, as the medians are calculated with the two nearest pics.)
DETAILS:
The borders aren't checked as of now. Also, note that the first and
last pictures are checked against the next two and previous two,
respectively.
CALLS: ***
CRAY_FILTER_MEDIAN, CRAY_FILTER_STDEV
HISTORY:
Created 10-Jul-97 J.Abrehamson
[Previous]
[Next]
NAME: CREATE_FAMILY
CALLING SEQUENCE:
create_family, str, fam, title, commands
SAMPLE CALLS:
Each family of parameters has a corresponding structure that looks like:
str = {family_info, $
fam:'', $ ; family name
title:'',$ ; title for section of menu
commands:strarr(60)} ; commands in this family
CALLING ARGUMENTS:
STR - Name of structure to create or add to
FAM - String. Family name.
TITLE - Title to use for this family's section of the menu.
COMMANDS - Valid commands for this family
Written 17-mar-94 akt
CALLED BY
setup_params [1], setup_params [2]
[Previous]
[Next]
NAME: CREATE_FAMILY
CALLING SEQUENCE:
create_family, str, fam, title, commands
SAMPLE CALLS:
Each family of parameters has a corresponding structure that looks like:
str = {family_info, $
fam:'', $ ; family name
title:'',$ ; title for section of menu
commands:strarr(60)} ; commands in this family
CALLING ARGUMENTS:
STR - Name of structure to create or add to
FAM - String. Family name.
TITLE - Title to use for this family's section of the menu.
COMMANDS - Valid commands for this family
Written 17-mar-94 akt
CALLED BY
setup_params [1], setup_params [2]
[Previous]
[Next]
NAME: CREATE_PARAM
CALLING SEQUENCE:
create_param, str, nam, fam, typ, val, numval, min, max, opt
SAMPLE CALLS:
To create a new parameter:
create_param, str, nam, fam, typ, val, numval, min, max, opt
Creates structures of parameters for menu driven program.
Creates or adds onto the parameter structure. The purpose
of families is to have
groups of menu items - list_op can be called to only display a particular
family, or to display multiple families separated by a space and with the
family title.
The structure for each parameter looks like:
str = {param_structure2, $
nam:'', $ ; parameter name
fam:'', $ ; family that parameter belongs to
typ:'', $ ; variable type (fix,long,float,double,string)
val:strarr(20), $ ; current value of parameter
numval: 0L, $ ; number of values to use from val tag
min:0.d0, $ ; minimum value allowed for parameter
max:0.d0, $ ; maximum value allowed for parameter
opt:strarr(20)} ; choices for string parameters
After multiple calls, there will be an array of such structures, one
element for each parameter.
Each family of parameters has a corresponding structure (that must be
created by a call to create_family) that looks like:
str = {family_info, $
fam:'', $ ; family name
title:'', $ ; title for section of menu
commands:strarr(40)} ; commands for family
CALLING ARGUMENTS:
STR - Name of structure to create or add to
NAM - String. Parameter name that will appear in menu
FAM - String. Family parameter belongs to. For each family, must
also call create_param with family and title keywords to
create parameter info structure entry.
TYP - String. Type of variable: fix,long,float,double,string,ut
VAL - String. Current value of parameter. Array of up to 20.
ras, 6-nov-02, array of up to 200 to support more lines in
in f_bpow_nline
NUMVAL - Long. Number of values in VAL to use.
MIN - Double. If VAL is numeric, minimum value allowed. -999. means
don't check min.
MAX - Double. If VAL is numeric, maximum value allowed. -999. means
don't check max.
OPT - String. Array of up to 20 allowed options if VAL is a string.
Written 9-mar-94 akt
Version 2, ras, 8-april-1996, aligned structure boundary, numval ==> longword
Version 3, richard.schwartz, allow up to 60 values in a parameter array.
11-jan-2001
Version 4, ras, 6-nov-2002, enable up to 200 parameters in spex after 5.1
CALLS:
CALLED BY
setup_params [1], setup_params [2]
[Previous]
[Next]
NAME: CREATE_PARAM
CALLING SEQUENCE:
create_param, str, nam, fam, typ, val, numval, min, max, opt
SAMPLE CALLS:
To create a new parameter:
create_param, str, nam, fam, typ, val, numval, min, max, opt
Creates structures of parameters for menu driven program.
Creates or adds onto the parameter structure. The purpose
of families is to have
groups of menu items - list_op can be called to only display a particular
family, or to display multiple families separated by a space and with the
family title.
The structure for each parameter looks like:
str = {param_structure2, $
nam:'', $ ; parameter name
fam:'', $ ; family that parameter belongs to
typ:'', $ ; variable type (fix,long,float,double,string)
val:strarr(20), $ ; current value of parameter
numval: 0L, $ ; number of values to use from val tag
min:0.d0, $ ; minimum value allowed for parameter
max:0.d0, $ ; maximum value allowed for parameter
opt:strarr(20)} ; choices for string parameters
After multiple calls, there will be an array of such structures, one
element for each parameter.
Each family of parameters has a corresponding structure (that must be
created by a call to create_family) that looks like:
str = {family_info, $
fam:'', $ ; family name
title:'', $ ; title for section of menu
commands:strarr(40)} ; commands for family
CALLING ARGUMENTS:
STR - Name of structure to create or add to
NAM - String. Parameter name that will appear in menu
FAM - String. Family parameter belongs to. For each family, must
also call create_param with family and title keywords to
create parameter info structure entry.
TYP - String. Type of variable: fix,long,float,double,string,ut
VAL - String. Current value of parameter. Array of up to 20.
ras, 6-nov-02, array of up to 200 to support more lines in
in f_bpow_nline
NUMVAL - Long. Number of values in VAL to use.
MIN - Double. If VAL is numeric, minimum value allowed. -999. means
don't check min.
MAX - Double. If VAL is numeric, maximum value allowed. -999. means
don't check max.
OPT - String. Array of up to 20 allowed options if VAL is a string.
Written 9-mar-94 akt
Version 2, ras, 8-april-1996, aligned structure boundary, numval ==> longword
Version 3, richard.schwartz, allow up to 60 values in a parameter array.
11-jan-2001
Version 4, ras, 6-nov-2002, enable up to 200 parameters in spex after 5.1
CALLS:
CALLED BY
setup_params [1], setup_params [2]
[Previous]
[Next]
NAME:
CROSS
PURPOSE:
Cross two vectors.
AUTHOR:
Craig DeForest
CALLED BY:
find_launchpoints
to do simple numerical ie nontransform cross correlation
HISTORY:
Slapped together 16-Dec-97
[Previous]
[Next]
NAME: cube_interp
PURPOSE: Given a not-so-complete data set, linearly interpolate images
into the specified sample cadence.
USAGE: b = cube_interp(a,hdr,cadence=60,lerp=lerp,sample=sample,tolerance=tolerance)
INPUTS: A - the cube to interolate
HDR - The IDL structure array containing A's fits header info
KEYWORD INPUTS:
START - Time of start of movie (default is closest minute to
the first frame.)
STOP - Time of stop of movie (default is closest minute to the
last frame.)
CADENCE - Period, in seconds, between interpolated frames
(default 60 sec)
LERP - if set, always interpolate.
SAMPLE - if set, always sample.
TOLERANCE - the interpolation/sampling distance threshhold
for normal behavior (default: 1/2 of cadence).
RETURNS: The data cube in 'A', interpolated to a uniform cadence.
AUTHOR: Craig DeForest
CALLS: ***
ISVALID [1], ISVALID [2], ISVALID [3], NLM [1], NLM [2], STR2UTC [1], STR2UTC [2]
STR2UTC [3], UTC2STR, closest_time
HISTORY: Written 22-Jan-98
[Previous]
[Next]
NAME:
CURVFIT
PURPOSE:
Non-linear least squares fit to a function of an
arbitrary number of parameters.
Function may be any non-linear function where
the partial derivatives are known or can be approximated.
CATEGORY:
E2 - Curve and Surface Fitting
CALLING SEQUENCE:
YFIT = CURVFIT(X,Y,W,A,SIGMAA,NITER=NITER,FREE=FREE,CHISQR=CHISQR,$
RANGE=RANGE)
INPUTS:
X = Row vector of independent variables.
Y = Row vector of dependent variable, same length as x.
W = Row vector of weights, same length as x and y.
For no weighting
w(i) = 1., instrumental weighting w(i) =
1./y(i), etc.
A = Vector of nterms length containing the initial estimate
for each parameter. If A is double precision, calculations
are performed in double precision, otherwise in single prec.
Keyword Parameters:
Function_Name = Name of function (actually, a procedure) to fit.
If omitted, use "FUNCT". The procedure must be written as
described below.
Niter = number of loops for calculating curvature matrix
Free = index describing parameters, 1=free, 0=fixed
Nolambda - if set, then fit is obtained with FLAMBDA set to zero
Chisqr - Value of reduced chisquare when curvefit is exited
Range - Maximum and minimum values allowed for free parameters
OUTPUTS:
A = Vector of parameters containing fit.
Function result = YFIT = Vector of calculated
values.
OPTIONAL OUTPUT PARAMETERS:
Sigmaa = Vector of standard deviations for parameters
A.
CALLS TO:
SPEX_FCHISQR, CHECKVAR
CALLS: ***
CHECKVAR [1], F_DIV, SPEX_FCHISQR [1], SPEX_FCHISQR [2], checkvar [2]
CALLED BY:
RUN_CURVEFIT [1], RUN_CURVEFIT [2]
COMMON BLOCKS:
NONE.
SIDE EFFECTS:
The function to be fit must be passed
as FUNCTION_NAME. It and its partial derivatives
are calculated inside SPEX_FCHISQR using a call to the procedure
FUNCT1. This procedure accepts values of
X (the independent variable), Function_name
and A (the fitted function's
parameter values), and returns F (the function's values at
X), and PDER (a 2D array of partial derivatives).
Call to FUNCT1 is:
FUNCT1, FUNCTION_NAME, X, A, F, PDER
where:
FUNCTION_NAME - Name of the fitting function which accepts X & A.
X = Vector of NPOINT independent variables, input.
A = Vector of NTERMS function parameters, input.
F = Vector of NPOINT values of function, y(i) = funct(x(i)), output.
PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
PDER(I,J) = DErivative of function at ith point with
respect to jth parameter. Optional output parameter.
PDER should not be calculated if parameter is not
supplied in call (Unless you want to waste some time).
RESTRICTIONS:
NONE.
PROCEDURE:
Copied from "CURFIT", least squares fit to a non-linear
function, pages 237-239, Bevington, Data Reduction and Error
Analysis for the Physical Sciences.
"This method is the Gradient-expansion algorithm which
compines the best features of the gradient search with
the method of linearizing the fitting function."
Iterations are perform until the chi square changes by
only 0.1% or until 20 iterations have been performed.
The initial guess of the parameter values should be
as close to the actual values as possible or the solution
may not converge.
MODIFICATION HISTORY:
Written, DMS, RSI, September, 1982.
Does not iterate if the first guess is good. DMS, Oct, 1990.
Added CALL_PROCEDURE to make the function's name a parameter.
(Nov 1990)
Added call to SPEX_FCHISQR. ras, apr, 1992
fixed iarray problem, ras, 11-aug-94
changed array divides to f_div to protect against 0's
[Previous]
[Next]
NAME:
CURVFIT
PURPOSE:
Non-linear least squares fit to a function of an
arbitrary number of parameters.
Function may be any non-linear function where
the partial derivatives are known or can be approximated.
CATEGORY:
E2 - Curve and Surface Fitting
CALLING SEQUENCE:
YFIT = CURVFIT(X,Y,W,A,SIGMAA,NITER=NITER,FREE=FREE,CHISQR=CHISQR,$
RANGE=RANGE)
INPUTS:
X = Row vector of independent variables.
Y = Row vector of dependent variable, same length as x.
W = Row vector of weights, same length as x and y.
For no weighting
w(i) = 1., instrumental weighting w(i) =
1./y(i), etc.
A = Vector of nterms length containing the initial estimate
for each parameter. If A is double precision, calculations
are performed in double precision, otherwise in single prec.
Keyword Parameters:
Function_Name = Name of function (actually, a procedure) to fit.
If omitted, use "FUNCT". The procedure must be written as
described below.
Niter = number of loops for calculating curvature matrix
Free = index describing parameters, 1=free, 0=fixed
Nolambda - if set, then fit is obtained with FLAMBDA set to zero
Chisqr - Value of reduced chisquare when curvefit is exited
Range - Maximum and minimum values allowed for free parameters
OUTPUTS:
A = Vector of parameters containing fit.
Function result = YFIT = Vector of calculated
values.
OPTIONAL OUTPUT PARAMETERS:
Sigmaa = Vector of standard deviations for parameters
A.
CALLS TO:
SPEX_FCHISQR, CHECKVAR
CALLS: ***
CHECKVAR [1], F_DIV, SPEX_FCHISQR [1], SPEX_FCHISQR [2], checkvar [2]
CALLED BY:
RUN_CURVEFIT [1], RUN_CURVEFIT [2]
COMMON BLOCKS:
NONE.
SIDE EFFECTS:
The function to be fit must be passed
as FUNCTION_NAME. It and its partial derivatives
are calculated inside SPEX_FCHISQR using a call to the procedure
FUNCT1. This procedure accepts values of
X (the independent variable), Function_name
and A (the fitted function's
parameter values), and returns F (the function's values at
X), and PDER (a 2D array of partial derivatives).
Call to FUNCT1 is:
FUNCT1, FUNCTION_NAME, X, A, F, PDER
where:
FUNCTION_NAME - Name of the fitting function which accepts X & A.
X = Vector of NPOINT independent variables, input.
A = Vector of NTERMS function parameters, input.
F = Vector of NPOINT values of function, y(i) = funct(x(i)), output.
PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
PDER(I,J) = DErivative of function at ith point with
respect to jth parameter. Optional output parameter.
PDER should not be calculated if parameter is not
supplied in call (Unless you want to waste some time).
RESTRICTIONS:
NONE.
PROCEDURE:
Copied from "CURFIT", least squares fit to a non-linear
function, pages 237-239, Bevington, Data Reduction and Error
Analysis for the Physical Sciences.
"This method is the Gradient-expansion algorithm which
compines the best features of the gradient search with
the method of linearizing the fitting function."
Iterations are perform until the chi square changes by
only 0.1% or until 20 iterations have been performed.
The initial guess of the parameter values should be
as close to the actual values as possible or the solution
may not converge.
MODIFICATION HISTORY:
Written, DMS, RSI, September, 1982.
Does not iterate if the first guess is good. DMS, Oct, 1990.
Added CALL_PROCEDURE to make the function's name a parameter.
(Nov 1990)
Added call to SPEX_FCHISQR. ras, apr, 1992
fixed iarray problem, ras, 11-aug-94
changed array divides to f_div to protect against 0's