Re: plotting model components

From: Michael Nowak <mnowak_at_email.domain.hidden>
Date: Fri, 7 Dec 2012 14:09:57 -0500
On Dec 7, 2012, at 1:50 PM, juan luna wrote:

> I would like to plot the individual contribution of each model component, from a multi-component model, separately. Something similar to what can be done with setplot add command in XSPEC. Is there a similar function in ISIS?

See the attached below which is a cut and paste from me answering this for
someone else (Matteo Bachetti, who had sent me a script wrapper on this
to make it nicer, which unfortunately I have lost at this point - Matteo, if you're
out there, send it again!).  I need to make this nicer one of these days.

The upshot of why ISIS doesn't do this as simply as XSPEC is that ISIS is 
far more agnostic about what a model is and can do, so it doesn't keep an
internal sense of what is additive or multiplicative.  (constant(1) can do either!)

But still, I should clean this up.

Cheers,

Mike

> One can use plot_data/unfold (with res=0, so residuals aren't plotted) and plot_residuals separately so as to be able to mix and match as you see fit.  I'm attaching a few examples.  They each follow a basic structure:
> 
> Declare a multiplot:  
> 
> 	multiplot([5,2,2,2]);  % 4 panels, with vertical ratios of 5:2:2:2
> 
> and then do one pane at a time:
> 
> 	mpane(1);  
> 	% Do stuff ...
> 	plot_unfold(1;no_reset=1,...);
> 	plot_unfold(2;no_reset=1,oplt=1,...);
> 	...
> 	mpane(2); 
> 	...
> 	mpane(4);
> 	...
> 	plot_residuals(1;no_reset=0,oplt=1);
> 
> The "no_reset=1" option means "don't automatically jump to the next pane, keep working in the same pane".  The last plot of the last panel should have no_reset=0 so as to go back to the default behavior, so one is set up to do the next new plot. The "oplt=1" means that one is overplotting.  So, starting a new pane, *don't* use oplt=1, but *do* use oplt=1 for every subsequent plot in that same pane.  When necessary, I save the original starting parameters in the /tmp/ directory, and just reload them after mucking about with turning on and off model components.  This can be done when plotting the data and/or the residuals.  (E.g., sometimes I like to show the residuals with and without a narrow line component in the same residual plot.) Also note that I *try* to set parameters on and off using names of parameters, rather than parameter numbers.  Makes the scripts a little bit more generic that way.  This will work 9 times out of 10, with this one major exception:  ISIS doesn't like to see mathematical operators in parameters names, e.g., "/".  Not all XSPEC models are friendly this way, and in those cases the parameters have to be referred to by number, not by name (see the eqpair model in the load_all.sl script below).
> 
> Anyhow, the attached examples are as follows:
> 
> * plot_three.sl produced fig5.ps  Note that when noticing different ranges for the data, you might have to set the xrange/yrange qualifiers explicitly in each plot to make sure the autoscaling doesn't shift the axes around on you for the different panels.
> 
> * fig10.ps was produced by defined functions as in the attached script, load_all.sl.  Specifically, the plotres*(lo,ho) functions.  (I won't guarantee it's the exact same script that did the plotting - too many rewrites and data files on that paper.)  That's a complicated one, where I've got multiple data sets, and I'm not always doing just additive components.  Sometimes I am changing model parameters to see things like just the reflection spectrum, or just the seed photons for Comptonization, etc.  And for the plotresjet function, the jet model itself writes out model components to an external file, and I read this in and plot them.  This is about as complicated as the examples get.  But hopefully it gives you an idea of how to proceed.
> 
> At any rate, I should think of a way of simplifying and automating this.  But since I don't always deal with "zeroing out" a model component, I haven't thought of a good way of making it generic enough, without being overly complicated.  I'm open to suggestions.
> 
> Anyhow, if you have more questions after looking at these, please drop me another line.
> 
> Cheers,
> 
> Mike
> 
> 

----
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 Dec 07 2012 - 14:10:18 EST

This archive was generated by hypermail 2.2.0 : Wed Dec 26 2012 - 12:56:21 EST