This page was created by the IDL library routine
mk_html_help. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? mk_html_help
at the IDL command line prompt.
Last modified: Tue Jan 4 12:52:37 2011.
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 : GET_CONTRIBUTIONS
DEM_FIT
ZION2SPECTROSCOPIC
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
(See dem/chianti_dem.pro)
Project : SOHO - CDS
Name : DEM_FIT
Purpose : Calculates the Differential Emission Measure DEM(T) using
a set of values in common with other routines.
Category : diagnostic analysis
Explanation : This routine (called by CHIANTI_DEM.PRO) performs
a series of iterations in order to
find the DEM that minimize the chi^2. The values in common
with CHIANTI_DEM.PRO are used.
As a least squares fit to a non-linear
function, see pages 237-239, Bevington, Data Reduction and Error
Analysis for the Physical Sciences.
Use : IDL> dem_fit,y,chisqr
It has to be noted that a general use of this routine
is limited.
Inputs : the values stored in common.
Opt. Inputs : None
Outputs : log_dem_mesh,y ,chisqr
i.e. the DEM mesh values, the intensity values as resulted
from this model DEM, and the chi^2.
Opt. Outputs: None
Keywords :
FLAMBDA: the initial value of the parameter flambda.
SCALE: the initial value of the parameter scale, that
controls the steps of the iteration.
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.
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.
FAILED: If the fit fails,the routine returns and flags FAILED=1
QUIET:
optional. Set to avoid various messages
Calls : DEM_DERIV, DEM_FUNCTN, DEM_CHISQR
Common :
obs, obs_int,obs_sig,n_obs
dem, d_dem_temp,dem_temp,log_dem_temp,log_t_mesh,log_dem_mesh
contr,ch_tot_contr
Restrictions: Not always the fit is successful.
Side effects: None known.
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 :
Giulio Del Zanna (GDZ),
UCLAN (University of Central Lancashire, UK) 5 November 1997
HISTORY:
Ver 1, GDZ 5-Nov-97
Ver 2, EL 6-Apr-05
Renamed the variable "deriv" to "deriv1" to avoid conflicts
with an IDL routine with the same name.
Version : 2.0 6 April 2005
(See dem/dem_fit.pro)
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).
Purpose : calculates the contribution functions G(T) at constant
pressure or density of the lines present in the CHIANTI
database, corresponding to a given set of observed lines.
Category :
Explanation : This routine is called by CHIANTI_DEM. It cannot be used as
a stand-alone routine.
The observation file is read by CHIANTI_DEM.
GET_CONTRIBUTIONS starts reading
the ionization equilibrium file and the masterlist of the
ions present in the CHIANTI database.
GET_CONTRIBUTIONS then 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).
Then calculates the G(T) values for the temperature interval
log(T)= 4.0 - 8.0 with steps of log(T) = 0.1
A constant pressure OR a constant density for all the lines
is used. 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.
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;
these lines are then excluded from the fitting 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.
Use : called by CHIANTI_DEM to calculate the contribution functions
Examples :
Inputs : Various, in form of keywords.
Opt. Inputs : none
Outputs : OUTPUT.CONTRIBUTIONS
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.
Opt. Outputs: None
Keywords : (all passed by CHIANTI_DEM)
CUT_GT: if set, only those
theoretical lines that have a MAX(G(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 G(T) are stored.
DENSITY : the value of the density (Ne).
FILE_INPUT: if set, you are not
requested to select the observation file.
N_MATCHES:
In the unlikely event that more than 20 (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.
PRESSURE: the value of the pressure (Ne T)
OUTPUT : -the core name for the output
Calls :
READ_IONEQ
read_masterlist
CONVERTNAME
ion2spectroscopic
ZION2FILENAME
READ_WGFA2
READ_SPLUPS
POP_SOLVER
READ_ELVLC
READ_IONREC
CONVERT_TERMS
Common : elvlc - energy levels
wgfa - radiative data
upsilon - upsilon data
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: ;
THIS IS NOT A STAND-ALONE PROCEDURE.
It is called by CHIANTI_DEM,
and has a lot of common blocks with other procedures.
In the unlikely event that more than 20 (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.
Of course you need to have the enviroment variable CDS_SS_DERE
pointing to the CHIANTI database top directory.
Side effects: None known.
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 :
Version 1, Giulio Del Zanna (GDZ) 5 November 1997
UCLAN (University of Central Lancashire, UK)
Modified :
Version 2, 31-Oct-2000, GDZ, DAMTP. Rewritten completely the routine,
to make it compatible with CHIANTI v.3. Based the core calculations on
new implementations due to Peter Young, CfA.
Version 3, 5-Dec-2000, GDZ, DAMTP. Fixed a bug when checking the
values in the .splups files.
Ver. 4, 25-Apr-02, GDZ
Revised to account for v.4 variations. By default the proton
rates are included in the calculation of the level population.
V.5, Giulio Del Zanna (GDZ)
generalized directory concatenation to work for
Unix, Windows and VMS.
V. 6, 10-July-2002 GDZ
Corrected a bug. It now properly includes by default the
proton rates in the population solver.
V. 7, 4-Oct-2003, GDZ
modified the input to POP_SOLVER, now it is dealt with an
input structure.
V. 8, 3-Nov-03 GDZ
Modified format e8.2 to e9.2 for Windows compatibility.
V. 9, 4-May-05 Enrico Landi (EL)
Modified in order to include ionization and recombination
data in the input to POP_SOLVER
V.10, 12-Jun-2009, Enrico Landi
Changed the definition of the temperature array for ion fractions
in the IONREC variable, now taken directly from the output of
READ_IONEQ.PRO
VERSION : 10, 12-Jun-2009
(See dem/get_contributions.pro)
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:
PLOT_DEM
PURPOSE:
To plot differential emission measure (DEM) values
CATEGORY:
Widgets.
CALLING SEQUENCE:
PLOT_DEM,filename
INPUTS:
filename: the name of the DEM file to be plotted. The file must b
in the standard CHIANTI format for DEM files. If filename
is a blank string ('') then an interactive window will come
up to allow the user to select a DEM file from the CHIANTI
DEM directory or some other directory.
KEYWORD PARAMETERS:
PSFILE: If set, the a postscript plot will be place in the
file 'psfile' specified by the user
OUTPUTS:
None, other than a plot
EXAMPLE:
> plot_dem,'ademfile.dem'
or
> plot_dem,''
MODIFICATION HISTORY:
Written by: Ken Dere
June 1998: Version 1.0
Version 2, 21-Dec-2000, William Thompson, GSFC
Modified for better cross-platform graphics capability
V. 3, 21-May-2002, Giulio Del Zanna (GDZ)
generalized directory concatenation to work for
Unix, Windows and VMS.
VERSION : 3, 21-May-2002
(See dem/plot_dem.pro)