a couple isis-related analysis items...

From: David P. Huenemoerder <dph>
Date: Fri, 11 Jan 2002 21:40:43 -0500
I forgot to mention a couple details at the meeting today I thought
might be of general interest (but just as well, since it was a
long-ish meeting today).

The recent features John added to ISIS are very useful for model-data
comparisons.  They are the parameters on the model_spectrum() function
which allow you to evaluate the APED plasma model for just lines, just
selected lines, or the continuum.

The other item is the trans() function, which allows you to easily
pick individual lines or multiplets. In fact, this is the best
way to reference the lines, since the line indices can change with
database version (it is not so clear if levels won't also change as
weak lines are added; we might need to re-define these w/ wavelength
ranges instead).

I've used the associative array functions of slang to define a draft
"feature name" array, which maps to the trans functions for about 100
prominent or important lines.  I'll append it below -
Trans_List_define.sl.  

Example use is in the 2nd file appended, get_line_fluxes.sl.  It's not
so user friendly (no error checking, usage message), but should be
instructive (it does have comments). I used it to generate a table of
model line fluxes.  (I'm still somewhat schizophrenic, because I then
went to IDL to read this table, my flux table, and plot residuals.)


-- Dave

David Huenemoerder (617-253-4283; fax: 253-8084)
MIT Center for Space Research/Chandra X-ray Center
70 Vassar St., NE80-6023,
Cambridge, MA  02139
[Admin. Asst.: Deborah Gage 617-253-0228, dgage_at_email.domain.hidden


%; Time-stamp: <2002-01-11 09:26:18 dph> 
%; MIT Directory: ~dph/d1/CXO_Data/AR_Lac/Sl
%; File: Trans_List_define.sl
%; Author: D. Huenemoerder
%; Original version: 2001.12.20
%;====================================================================
% version:1
%
% purpose: define an assoc array which maps line mnemonics to the
%	   isis transition function string.
%
%  groups are delimited by
%   %+
%   %-
% Those groups with more than one trans() were fit w/ multiple
% components  simultaneously (e.g.,  "gauss(1)+gauss(2)+gauss(3)")
% Those features with "or" are blends and were fit as one component.
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define the array:
%
variable trans_list = Assoc_Type[String_Type];

% used like this, for example:
%   g = where( eval( trans_list["Fe26HLa"] ) );
%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Note on upper levels  (lower level = 1):
%    HLa     4,3
%    HLb     7,6
%    HLg   11,12
%    HLyd  18,19

%    HeLaf   2
%    HeLai 5,6
%    HeLar   7
%    HeLb    13
%    HeLg    23
%    HeLd    37

% Other notes:
%
%    DR    Dielectronic Recombination
%
%    ";" seperate resolved components in feature names
%
%    "," delimit blends in feature names and line names - i.e., blends
%        to which only one parametric model (gaussian) is fit.
%
%    "w" is used for a line wavelength (to 2 decimals), following the 
%        element/ion name, for lines without a convenient H- or
%        He-like designation (e.g., most Fe lines).
%
%    "B" is used to indicated blended (unresolved) components.
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define the features:

%+
trans_list["Fe26HLa"] = "trans(Fe, 26, [4,3], 1)";
%-

%+
trans_list["Fe25HeLa"] =
  sprintf("%s or %s or %s",
  "trans(Fe, 25, [7,6,5,2], 1)",
  "trans(Fe, 25, [10242,10248], 3)",
  "trans(Fe, 25, 10247, 2)") ;
%-

%+
trans_list["Ca20HLa"] = "trans(Ca, 20, [4,3], 1)";
%-

%+
trans_list["Ca19HeLaB"] =
   sprintf( "%s or %s or %s",
   "trans(Ca, 19, [7,6,5,2], 1)",
   "trans(Ca, 19, [10247,10248], [2,3])",
   "trans(Ar, 17, 23, 1)" );
%-

%+
trans_list["Ar17HeLb"] = "trans(Ar, 17, 13, 1)";
%-

%+
trans_list["Ar18HLa"] = "trans(Ar, 18, [4,3], 1)";
%-

%+
%"Ar17HeLar;Ar17HeLai;Si16HLb,Ar17HeLaf"
trans_list["Ar17HeLar"] = "trans(Ar,17, 7, 1)";
trans_list["Ar17HeLai"] = "trans(Ar, 17, [6,5], 1)";
trans_list["S16HLb,Ar17HeLaf"] = "trans(S, 16, [7,6], 1) or trans(Ar,17,2,1)";
%-


%+
trans_list["S16HLa"] = "trans(S, 16, [4,3], 1)";
%-

%+
%"S15HeLar;S15HeLai;S15HeLaf"
trans_list["S15HeLar"] = "trans(S, 15, 7, 1)";
trans_list["S15HeLai"] = "trans(S, 15, [6,5], 1)";
trans_list["S15HeLaf"] = "trans(S, 15, 2, 1)";
%-

%+    2001.01.06 - fixed...  was S16HLb
trans_list["Si14HLb"] = "trans(Si, 14, [7,6], 1)";
%-

%+
trans_list["Si14HLa"] = "trans(Si, 14, [4,3], 1)";
%-

%+
%"Si13HeLar;Si13HeLai;Si13HeLaf"

trans_list["Si13HeLar"] = "trans(Si, 13, 7, 1)";
trans_list["Si13HeLai"] = "trans(Si, 13, [6,5], 1)";
trans_list["Si13HeLaf"] = "trans(Si, 13, 2, 1)";
%-

%+
% "Mg12HLb;Fe24w7.17"

trans_list["Mg12HLb"] = "trans(Mg, 12, [7,6], 1)";
trans_list["Fe24w7.17"] = "trans(Fe, 24, [17,18], 1)";
%-


%+
% "Al12HeLar;Mg11HeLb;Al12HeLaf"

trans_list["Al12HeLar"] = "trans(Al, 12, 7, 1)";
trans_list["Mg11HeLb"] = "trans(Mg, 11, 13, 1)";
trans_list["Al12HeLaf"] = "trans(Al, 12, 2, 1)";
%-

%+
trans_list["Fe24w7.99"] = "trans(Fe, 24, [11,10], 1)";
%-

%+
% "Fe24w8.32;Fe24w8.23;Fe24w8.28;Fe23w8.30"

trans_list["Fe24w8.32"] = "trans(Fe, 24, [12,13], 3)";
trans_list["Fe24w8.23"] = "trans(Fe, 24, 12, 2)";
trans_list["Fe24w8.28"] = "trans(Fe, 24, 9, 2)";
trans_list["Fe23w8.30"] = "trans(Fe, 23, 52, 1)";
%-

%+
trans_list["Mg12HLa"] = "trans(Mg, 12, [4,3], 1)";
%-

%+
trans_list["Fe23w8.81"] = "trans(Fe, 23, 56, 5)";
%-

%+
trans_list["Fe22w8.97"] = "trans(Fe, 22, 72, 1)";
%-


%+
%"Mg11HeLar;Fe20w9.22,Mg11HeLaDR;Mg11HeLai"

trans_list["Mg11HeLar"] = "trans(Mg, 11, 7, 1)";
trans_list["Fe20w9.22,Mg11HeLaDR"] =
   "trans(Fe,20,566,2) or trans(Mg,11,10067,4)";
trans_list["Mg11HeLai"] = "trans(Mg, 11, [5,6], 1)";
%-

%+
trans_list["Mg11HeLaf"] = "trans(Mg, 11, 2, 1)";
%-

%+
trans_list["Ne10HLd"] = "trans(Ne, 10, [19,18], 1)";
%-

%+
trans_list["Ne10HLg"] = "trans(Ne, 10, [12,11], 1)";
%-

%+
trans_list["Ne10HLb"] = "trans(Ne, 10, [7,6], 1)";
%-


%+
%"Fe24w10.62;Fe24w10.66"

trans_list["Fe24w10.62"] = "trans(Fe,24,6,1)";
trans_list["Fe24w10.66"] = "trans(Fe,24,5,1)";
%-

%+ added 2001.12.24
% "Fe17w10.77;Fe19w10.82"
trans_list["Fe17w10.77"] = "trans(Fe,17,155,1)";
trans_list["Fe19w10.82"] = "trans(Fe,19,243,1)";
%-


%+
%"Fe23w10.98;Ne9HeLg;Fe23w11.02;Fe24w11.03"
trans_list["Fe23w10.98"] = "trans(Fe,23,15,1)";
trans_list["Ne9HeLg"] = "trans(Ne,9,23,1)";
trans_list["Fe23w11.02"] = "trans(Fe,23,13,1)";
trans_list["Fe24w11.03"] = "trans(Fe,24,7,2)";
%-

%+
trans_list["Fe24w11.18"] = "trans(Fe,24,8,3)";
%-

%+ added 2001.12.24
% "Fe18w11.33"
trans_list["Fe18w11.33"] = "trans(Fe,18,[176,178,180],1)";
%-

%+
% "Fe18w11.53;Ne9HeLb"
trans_list["Fe18w11.53"] = "trans(Fe,18,138,1)";
trans_list["Ne9HeLb"] = "trans(Ne,9,13,1)";
%-


%+
% "Fe23w11.74;Fe22w11.77"
trans_list["Fe23w11.74"] = "trans(Fe,23,20,5)";
trans_list["Fe22w11.77"] = "trans(Fe,22,21,1)";
%-

%+
% "Fe17w12.12,Ne10HLa,Fe22w12.14,Fe23w12.16"
trans_list["Fe17w12.12"] = "trans(Fe,17,71,1)";
trans_list["Ne10HLa"] = "trans(Ne,10,[4,3],1)";
trans_list["Fe22w12.14"] = "trans(Fe,22,54,7)";
trans_list["Fe23w12.16"] = "trans(Fe,23,12,5)";
%-

%+
% "Fe17w12.27;Fe21w12.28"
trans_list["Fe17w12.27"] = "trans(Fe,17,59,1)";
trans_list["Fe21w12.28"] = "trans(Fe,21,40,1)";
%-

%+ added 2001.12.24
% "Fe20w12.58"
trans_list["Fe20w12.58"] = "trans(Fe,20, [72,73], 1)";
%- 

%+ added 2001.12.24
% "Fe22w12.75"
trans_list["Fe22w12.75"] = "trans(Fe,22, 23, 6)";
%- 

%+
% "Ne9HeLar;Fe19w13.46;Fe19w13.50;Fe21w13.51;Fe19w13.52;Ne9HeLai"
trans_list["Ne9HeLar"] = "trans(Ne,9,7,1)";
trans_list["Fe19w13.46"] = "trans(Fe,19,74,1)";
trans_list["Fe19w13.50"] = "trans(Fe,19,71,1)";
trans_list["Fe21w13.51"] = "trans(Fe,21,42,7)";
trans_list["Fe19w13.52"] = "trans(Fe,19,68,1)";
trans_list["Ne9HeLai"] = "trans(Ne,9,[6,5],1)";
trans_list["Ne9HeLaf"] = "trans(Ne,9,2,1)";
%-

%+
% "Fe18w14.21;Fe18w14.26,Fe20w14.27;Fe20w14.27"
trans_list["Fe18w14.21"] = "trans(Fe,18,[56,55],1)";
trans_list["Fe18w14.26"] = "trans(Fe,18,[52,53],1)";
trans_list["Fe20w14.27"] = "trans(Fe,20,54,6)";
%-

%+
trans_list["Fe18w14.53"] = "trans(Fe,18,41,1)";
%-

%+
trans_list["O8HLd"] = "trans(O,8,[19,18],1)";
%-


%+
% "Fe17w15.01;Fe19w15.09"
trans_list["Fe17w15.01"] = "trans(Fe,17,27,1)";
trans_list["Fe19w15.08"] = "trans(Fe,19,11,1)";
%-

%+
% "O8HLg;Fe17w15.26"
trans_list["O8HLg"] = "trans(O,8,[12,11],1)";
trans_list["Fe17w15.26"] = "trans(Fe,17,23,1)";
%-

%+ "Fe18w15.62"
trans_list["Fe18w15.62"] = "trans(Fe, 18, 9, 1)";
%-


%+ 
% "Fe18w15.82;Fe18w15.87"
trans_list["Fe18w15.82"] = "trans(Fe,18,7,1)";
trans_list["Fe18w15.87"] = "trans(Fe,18,10,2)";
%-

%+
% "O8HLb,Fe18w16.00;Fe18w16.07;Fe19w16.11;Fe18w16.16"
 trans_list["O8HLb"] = "trans(O,8,[7,6],1)";     % blended w/ "Fe18w16.00"
 trans_list["Fe18w16.00"] = "trans(Fe,18,5,1)";  % blended w/ "O8HLb"
%trans_list["O8HLb,Fe18w16.00"] = "trans(O,8,[7,6],1) or trans(Fe,18,5,1)";  
trans_list["Fe18w16.07"] = "trans(Fe,18,4,1)";
trans_list["Fe19w16.11"] = "trans(Fe,19,37,6)";
trans_list["Fe18w16.16"] = "trans(Fe,18,64,3)";
% NOTE: "Fe18w16.00" is about same emis as "Fe18w15.16"; use to scale "O8HLb".
%-

%+
trans_list["Fe17w16.78"] = "trans(Fe,17,5,1)";
%-


%+
% "Fe17w17.05;Fe17w17.10"
trans_list["Fe17w17.05"] = "trans(Fe,17,3,1)";
trans_list["Fe17w17.10"] = "trans(Fe,17,2,1)";
%-

%+
trans_list["Fe18w17.62"] = "trans(Fe,18,29,3)";
%-

%+
trans_list["O7HeLb"] = "trans(O,7,13,1)";
%-

%+
trans_list["O8HLa"] = "trans(O,8,[4,3],1)";
%-

%+
% "O7HeLar;O7HeLai;O7HeLaf"
trans_list["O7HeLar"] = "trans(O,7,7,1)";
trans_list["O7HeLai"] = "trans(O,7,[6,5],1)";
trans_list["O7HeLaf"] = "trans(O,7,2,1)";
%-

%+
trans_list["N7HLa"] = "trans(N,7,[4,3],1)";
%-

%+
trans_list["Al13HLa"] = "trans(Al,13,[4,3],1)";
%-



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%; Time-stamp: <2002-01-10 11:29:05 dph> 
%; MIT Directory: ~dph/d1/CXO_Data/AR_Lac/Sl
%; File: get_line_fluxes.sl
%; Author: D. Huenemoerder
%; Original version: 2001.01.05
%;====================================================================
% version: 1
%
% purpose: utilities to compute line fluxes, given a plasma model.
%          Line info is given by
%              Bump_trans.sl, which defines an assoc array, used via:
%
% () = evalfile("Sl/Trans_List_define.sl");
%
% examples:
%
% trans_list["Fe25HeLa"];
%
% page_group(where(eval(trans_list["Fe25HeLa"])));
%
% g=(where(eval(trans_list["Fe25HeLa"])));
%
% w = (line_info(g[0])).lambda;
%

% we will assume that a model has been defined, so that
% eval_fun() returns the model flux array.
% To get flux in al line, we will :

%  f = sum( eval_fun( xlo, xhi ) );
%  
% which assumes that aped_fit_models.sl has been eval'd, and the model
% is aped_multi or aped_multi_rv.  These models have a flag for
% evaluating line-only models (in isis 0.9.70 or greater).
%

%+                  pre-define names; function defs to follow.
  define wave_mean();
  define find_logtmax();
%-

%+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  define get_line_fluxes( trans_list )
  {

 % trans_list is an associative array which maps line mnemonics, such
 % as "O8HLa" or "Fe17w17.01" to a function string which evaluates to
 % a list of aped line indices.
 % One definition of a trans_list is in Trans_List_define.sl

    variable keys = assoc_get_keys( trans_list );
    variable nlines = length( trans_list );

    variable f, w, ii ;

    variable result = struct { flux, wave, name, LogTmax };
    result.flux = Float_Type[nlines];
    result.wave = Float_Type[nlines];
    result.name = String_Type[nlines];
    result.LogTmax = Float_Type[nlines];
  
%  specify a temperature grid for finding LogT_max
%
    variable dw = 0.05, 
             wstep = 0.005,
	     t=10.^[6.0:8.5:0.1];

%
% Set a flag so that binning the plasma model spectrum w/
% model_spectrum() evaluates only the line-component.

    Aped_Filter.type = MODEL_LINES;  

% loop over all features in the trans_list[]
%
    for (ii=0; ii<nlines; ii++)
    {
      variable g = where( eval( trans_list[ keys[ii] ] ) );

      w = wave_mean( g );  % mean wavelength of the bump; if the bump
                           % were a complex blend and broad, this
                           % might be the wrong thing to use for
                           % defining the center of the region bounded
                           % by +-dw.

% LogT_max is tabulated in the aped files, but ISIS <=0.9.71 does not
% retrieve this.  So do it empirically.  This is also safer if the
% bump is actually a blend (though the max may not be meaningful if
% logT_max of components makes the emissivity bi-modal)

      result.LogTmax[ii] = find_logtmax(t,g);   

% define the region of interest.  This is in model-space, so +-0.05A
% is probably plenty.

      variable x = [w-dw : w+dw : wstep];


% set the model_spectrum() filter to the lines of interest:

      Aped_Filter.lines = g;

% Evaluate the model flux of the lines.  This assumes that the
% fit_fun() has been defined.

      f = sum( eval_fun( x, x+wstep ) );

      result.flux[ii] = f;
      result.wave[ii] = w;
      result.name[ii] = keys[ii];

% DEBUG print each line as it is processed...

      ()=printf("%4d %20s %8.3f %6.2f %10.3e\n",
         ii,
	 result.name[ii],
	 result.wave[ii],
	 result.Logtmax[ii],
	 result.flux[ii]);
    } 


    Aped_Filter.type = NULL;   % reset, so model_spectrum() returns line+continuum.

    return result;

  }
%- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    

% UTILITY functions

%+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  define wave_mean( g )
  {
    variable ng = length(g),
             ii,
	     wmean = 0.0;

    for (ii=0; ii<ng; ii++)
    {
      wmean += ( line_info( g[ii] ) ).lambda;
    }

    wmean /= ng;

    return wmean;

  }
%- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  define find_logtmax( t, g )
  {
    variable eps=Float_Type[length(t)],
             LogTmax;

    eps = line_em( g, t );
    LogTmax =  log10 ( t[ where( eps == max(eps) ) ] );

    if (length(LogTmax) > 1)      LogTmax = LogTmax[0];

    return LogTmax[0];

  }
%- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    
----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Fri Jan 11 2002 - 21:40:50 EST

This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT