Re: outputting model to plain text

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Wed, 19 May 2010 12:39:20 -0400
    Roper> How can I output the values of the best-fit of a model of a
    Roper> spectrum to plain text?

Hi Quenten,

I'm assuming you mean the model values, rather than the parameter
values (written with save_par)

I'll also assume you mean the model in model space, not as counts.

Once you have the model defined (as you can see via list_par), you can
evaluate it on any specified grid.  E.g:

  (w1, w2) = linear_grid( 1.0, 40.0, 8192); % wavelength grid, 8192 points, 1-40A

  f = eval_fun( w1, w2 );  % evaluate the model on the grid; [photons/cm^2/s/bin]

To write it to ascii:

  writecol("model.tbl", w1, w2, f )

If you prefer vs keV:

  e1 = _A( w2 ) ; 
  e2 = _A( w1 ) ; 
  fe = reverse( f ) ; % still photons/cm^2/s/bin;  (apply scaling if
                      %  you want ergs or flux density).

  writecol("model_vs_e.tbl", e1, e2, fe ) ; 


If you instead wanted the folded model, you can use

  eval_counts;

  c = get_model_counts( h ) ;    

and c will be a structure; h is the data histogram index.

  print(c);   % inspect the fields.

  writecol( "model_counts.tbl", c.bin_lo, c.bin_hi, c.value );

  ce = _A( c ) ;
  write_col( "model_counts_vs_e.tbl", ce.bin_lo, ce.bin_hi, ce.value  );


Hope that helps,

-- Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu/home/dph
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:
unsubscribe
Received on Wed May 19 2010 - 12:39:23 EDT

This archive was generated by hypermail 2.2.0 : Wed Jun 23 2010 - 12:36:16 EDT