Re: writing out data

From: John Houck <houck>
Date: Sat, 9 Nov 2002 19:51:23 -0500
On Sat, Nov 09, 2002 at 19:32 -0500, Saku Vrtilek wrote:
> 
> Thanks to John Houck I am able to write out my model and data:
> 
> m = get_model_counts(1);  
> writecol ("filename.ascii", m.bin_lo, m.bin_hi, m.value);
> 
> However, athough the plot that I see when using rplot_counts is
> counts vs energy the ascii file has counts vs wavelength.  Can
> someone tell me how to get counts vs energy?


The function _A() can be used to convert back and forth
between wavelengths in Angstroms and energies in keV.
For example:

isis> e=[1:3];
isis> print(_A(e));
4.132806e+00  
6.199209e+00  
1.239842e+01  

isis> print(_A(_A(e)));
1.000000e+00  
2.000000e+00  
3.000000e+00  

isis> 

If given two vectors, it interprets them as bin_lo,bin_hi and
automatically swaps the order. So, to get counts vs. energy:

  (elo, ehi) = _A (m.bin_lo, m.bin_hi);
  writecol ("filename.ascii", elo, ehi, reverse(m.value));

Note that its necessary to reverse the order of the
bin-value array to match the energy grid:

isis> e=[1:3];
isis> v = [4,3,1];
isis> writecol (stdout, e, v);
           1             4
           2             3
           3             1
isis> writecol (stdout, _A(e), reverse(v));
     4.13281             1
     6.19921             3
     12.3984             4


> 
> Also how to get counts/sec/kev
>

To get counts/sec/keV, just divide by the exposure time
and bin-width:

t = get_arf_exposure(1);   % or you might use get_data_exposure(1)

(elo, ehi) = _A (m.bin_lo, m.bin_hi);
e_width = ehi - elo;

e_value = reverse(m.value);

writecol ("filename.ascii", elo, ehi, e_value / t / e_width);


-John

-- 
John C. Houck                       MIT Center for Space Research
NE80-6005: 617-253-3849                   77 Massachusetts Avenue
42:21:55.105N, 71:05:28.122W             Cambridge, MA 02139-4307
----
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 Sat Nov 09 2002 - 19:51:26 EST

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:44 EDT