Re: writing out data

From: John E. Davis <davis>
Date: Sun, 10 Nov 2002 16:46:54 -0500
John Houck <houck> wrote:
>The function _A() can be used to convert back and forth

If you find yourself doing this often, it is probably worthwhile to
add something like the following to your .isisrc file:

   define save_model (file, id)
   {
      variable d = get_data_counts (id);
      variable m = get_model_counts (id);
      variable exposure = get_arf_exposure (id);
      variable fp = fopen (file, "w");
      variable de = _A(m.bin_lo) - _A(m.bin_hi);

      if (fp == NULL)
        verror ("Unable to open %s\n", file);
      if ((-1 == fputs ("#bin_lo bin_hi  counts    model    modeldensity   modelflux\n", fp))
	  or (-1 == fputs ("# keV    keV   cnts/bin  cnts/bin   cnts/keV/s   ph/cm^2/s/keV\n", fp)))
	verror ("Error writing to %s\n", file);
      
      writecol (fp,
		_A(d.bin_lo,d.bin_hi), 
		reverse (d.value),
		reverse (m.value),
		reverse (m.value/de/exposure),
		reverse (eval_fun (m.bin_lo, m.bin_hi))/de);
   }


This will allow you to save the model associated with a specfied data
set to a file with the 6 columns:

#bin_lo bin_hi  counts    model    modeldensity   modelflux
# keV    keV   cnts/bin  cnts/bin   cnts/keV/s   ph/cm^2/s/keV

For example,

  isis> save_model ("model.dat", 1);

Of course, make sure you actually evaluate the model before calling
this function, i.e., call eval_counts or fit_counts first.

Good luck,
--John
----
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 Sun Nov 10 2002 - 16:47:02 EST

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