Saku> Once I have a fit that I like in Isis how do I write the model onto an Saku> ascii file? E.g. in Sherpa one says Saku> sherpa: write model filename.ascii Saku> (I like to do all my plots in sm) Hi Saku - There isn't a canned routine, but it isn't hard to define one. Here's a snippet from an example I wrote: (w_lo, w_hi) = linear_grid( 1.0, 8192*0.005 + 1.0, 8192 ); % MEG grid y = eval_fun( w_lo, w_hi ); % evaluate the model on the grid e_lo = HC / w_hi ; % make an energy grid e_hi = HC / w_lo ; variable egrid, s; egrid = reverse( 0.5*(e_lo + e_hi) ) ; % keV, ascending order, for marx s = reverse (y / (e_hi-e_lo) ); % convert to phot/cm^2/s/keV % print out the integrated photon flux; useful for marx flux param () = printf("Integrated flux = %g [phot/cm^s/s] (1-40A)\n", sum(y) ); variable i, fp=fopen( file, "w"); () = fprintf(fp, "# APED model spectrum\n"); () = fprintf(fp, "# Integrated flux = %g [phot/cm^s/s] (1-40A)\n", sum(y) ); () = fprintf(fp, "\n" ); for (i=0; i<length(s); i++) ()=fprintf(fp, "%10.6f\t%S\n", egrid[i], s[i] ); () = fclose(fp); -- 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 For reference, here's the whole function: %; Time-stamp: <2002-10-05 14:20:54 dph> %; Directory: ~dph/h3/CXC/Prop_Planning/ %; File: mk_marx_spectrum.sl %; Author: D. Huenemoerder %; Original version: 2002.10.04 %;==================================================================== % version: 1 % % PURPOSE: % % simple demonstration of how to make a model multi-temperature % thermal plasma spectrum with non-cosmic abundances, written to % and ascii table for marx input. % % REQUIRES: isis version 1.0.25 or greater for the create_aped_fun function. % aped plasma database must be loaded. % % NOTE: there is no error checking done here! % %%%%%%%%% define mk_marx_spectrum( file, LogT, Norm, Elem, Abund ) { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % example usage: % % isis> plasma(aped); % isis> evalfile("mk_marx_spectrum.sl"); % isis> mk_marx_spectrum( "Mdl_1.tbl", [6.5, 6.8, 7.1], [0.001, 0.01, 0.005], [Fe,Ne], [0.1, 2.0]); % creates model spectrum with 3 temperature components % at LogT= 6.5, 6.8, 7.1, % in 1:10:5 relative weights emission measure % 1/10 Cosmic Fe abundance, 2*Ne abundance. % % (Note: emission measure normalization are DEM * 1.e-14 / (4*PI*d^2) ) % % input arrays can be any length. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% variable p, w_lo, w_hi, e_lo, e_hi, y; variable HC = 12.3984185734; p = default_plasma_state; % retrieve plasma structure variable p.norm = Norm ; % set appropriate fields of the structure % NO checking! inputs must be meaningful. p.temperature = 10.^LogT ; p.elem = Elem ; p.elem_abund = Abund ; create_aped_fun("xaped", p); % create the function fit_fun("xaped(1)"); % use the function as the spectral model. (w_lo, w_hi) = linear_grid( 1.0, 8192*0.005 + 1.0, 8192 ); % MEG grid y = eval_fun( w_lo, w_hi ); % evaluate the model on the grid e_lo = HC / w_hi ; % make an energy grid e_hi = HC / w_lo ; variable egrid, s; egrid = reverse( 0.5*(e_lo + e_hi) ) ; % keV, ascending order, for marx s = reverse (y / (e_hi-e_lo) ); % convert to phot/cm^2/s/keV % print out the integrated photon flux; useful for marx flux param () = printf("Integrated flux = %g [phot/cm^s/s] (1-40A)\n", sum(y) ); variable i, fp=fopen( file, "w"); () = fprintf(fp, "# APED model spectrum\n"); () = fprintf(fp, "# Integrated flux = %g [phot/cm^s/s] (1-40A)\n", sum(y) ); () = fprintf(fp, "\n" ); for (i=0; i<length(s); i++) ()=fprintf(fp, "%10.6f\t%S\n", egrid[i], s[i] ); () = fclose(fp); return w_lo, w_hi, y; } ---- 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: unsubscribeReceived on Tue Oct 29 2002 - 11:48:23 EST
This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT