Re: code issue

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Thu, 22 Jan 2009 11:55:39 -0500
    Bert> I was trying to make a code that plots spectral lines and I
    Bert> was using the command from the manual

    Bert> fe_lines= where (wl(1.0,10.0) and el_ion(26,[25,26]));

    Bert> This works just fine in interactive mode, but when I put it
    Bert> in a script it says that fe_lines is undefined. If i say
    Bert> variable fe_lines... it says it is an array type not an
    Bert> integer type. I'm not really sure what I should do here any
    Bert> thoughts? Also is there a more comprehensive book somewhere
    Bert> on formatting?

In scripts which you ".load" or use evalfile(), you need to declare
variables, unless you specify

_auto_declare = 1 ; 

How did you get the "array type" message?  The result should be an

Here is a simple script, call it


 variable fe_lines= where (wl(1.0,10.0) and el_ion(26,[25,26]));
 () = printf( "typeof(fe_lines) = %S, length(fe_lines) = %S\n", 
     typeof( fe_lines), length(fe_lines) );

Then when you load it, you should see something like this:

  isis> .load ./tst
  Reading database version 1.3.1 from /nfs/cxc/a1/share/atomdb
  Initializing: emissivity data
  Scanning: line emissivity tables [50 hdus]
  hdu:  50/50
  Loading: line emissivity tables [50 hdus]
  hdu:  50/50
  Loading: continuum emissivity tables [50 hdus]
  hdu:  50/50

  typeof(fe_lines) = Array_Type, length(fe_lines) = 288

Perhaps you evaluated fe_lines properly, but then used it in the wrong
context.  E.g, you can do this:

isis> page_group( fe_lines);
#  index        ion   lambda    F (ph/cm^2/s)  A(s^-1)  upper lower   label
 162202 *   Fe XXVI    1.3917    0.000e+00   1.546e+13    19     1 5p~^2P_{3/2} - 1s~^2S_{1/2}
 162201 *   Fe XXVI    1.3919    0.000e+00   1.543e+13    18     1 5p~^2P_{1/2} - 1s~^2S_{1/2}
 162200 *   Fe XXVI    1.4249    0.000e+00   3.066e+13    12     1 4p~^2P_{3/2} - 1s~^2S_{1/2}
 162199 *   Fe XXVI    1.4254    0.000e+00   3.062e+13    11     1 4p~^2P_{1/2} - 1s~^2S_{1/2}
 311290 *   Fe XXVI    1.4475    0.000e+00   0.000e+00  10067     7 

since page_group expects an Array_Type variable.

But if you tried to use the result as an Integer_Type in some
function, you will get an error.

    Bert> thoughts? Also is there a more comprehensive book somewhere
    Bert> on formatting?

There is no published book on S-Lang, but for generic S-Lang syntax,

Hope this helps,

-- Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f);
MIT Kavli Institute for Astrophysics and Space Research
70 Vassar St., NE80-6065,
Cambridge, MA  02139
[Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden
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:
Received on Thu Jan 22 2009 - 11:55:41 EST

This archive was generated by hypermail 2.2.0 : Thu Jan 22 2009 - 16:06:13 EST