Re: making an overplot of a curve function

From: David P. Huenemoerder <dph>
Date: Fri, 14 Feb 2003 08:55:05 -0500
Hi Greg - 

The only "complicated" part in what you want to do is avoiding
division  by zero.

Suppose your spectra are in histograms 1 and 2:

d1=get_data_counts(1);
d2=get_data_counts(2);

lz = where(d2 > 0);    % find non-zero points.

tau = log( d1.counts[lz] / d2.counts[lz] );

xlin; ylin; xrange(1,25); yrange(0);

hplot( d1.bin_lo[lz], d1.bin_hi[lz], tau );

If you don't want to keep indexing by lz, you could:

x1=d1.bin_lo[lz];
x2=d1.bin_hi[lz];

hplot( x1, x2, d1.counts, red );  % or plot_data_counts(d1, red)
ohplot(x1, x2, tau, green );      


(Note: I didn't put the data back into histogram tables.  If you want
to fit tau(x), then you would want to store it. )


I've assumed that d1 and d2 are on the same grids and have the same
ARF. You might want to take care of any necessary normalizations (via
get_data_flux, or get_arf_exposure, or get_arf for examples).

Hope this helps.

-- Dave

David Huenemoerder (617-253-4283; fax: 253-8084)
MIT Center for Space Research/Chandra X-ray Center
70 Vassar St., NE80-6023,
Cambridge, MA  02139
[Admin. Asst.: Deborah Gage 617-253-0228, dgage_at_email.domain.hidden



    goldsteing> Using Isis I am familiar with the commands to subtract one spectrum from
    goldsteing> another, and then plot the residual flux.
    goldsteing> eg where one spectrum is data and the other model

    goldsteing> d = get_data_counts(1);
    goldsteing> m = get_model_counts(1); % continuum model only

    goldsteing> d.value -= m.value; % subtract the continuum model

    goldsteing> id = define_counts (d); % define a new continuum-
    goldsteing> % subtracted data set.

    goldsteing> My present issue is a case where one spectrum (A) is
    goldsteing> considered to have had absorption occur over a
    goldsteing> considerable wavelength region, and the other (B) has
    goldsteing> not; I want to calculate

    goldsteing> tau =   ln (fluxB / fluxA) 

    goldsteing> and  plot this value as an optical depth, with the x-axis in angstroms. 

    goldsteing> I would ideally like to overplot the optical depth curve. 

    goldsteing> Any suggestions would be greatly appreciated.

    goldsteing> Greg
----
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 Feb 14 2003 - 08:55:10 EST

This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT