On Fri, Apr 18, 2003 at 15:38 -0400, Marc Audard wrote: > Hi- > > If I would like to fit simultaneously HEG-1 and HEG+1 but leave the > wavelength > free and different in each detector (to account for calibration errors), how > can I do this? Furthermore, will get_params save each parameter, so > that I can use them later and so that fakeit will use wavelength 1 for > dataset 1 > and wavelength 2 for dataset 2? > > Thanks > > Marc Hi Marc, Shifting wavelengths is possible but I must admit that the appended example code is mostly untested (apart from verifying that it produces the plots that I expected). I _think_ it does what you want -- please let me know if it doesn't. In the example, I defined a fit-operator which handles the grid shift and which allows each dataset to have its own wavelength shift. fakeit uses the current fit-function, so the wavelength shifts come from the fit-function definition. To answer your other question -- yes, get_params() will return an array of structures containing information on all the fit-parameters. Within a script, those values can be restored using set_params(): variable p = get_params(); ..... do stuff, maybe change the fit-parameters... set_params(p); % restore the saved parameters. Hope that helps, -John -- John C. Houck MIT Center for Space Research NE80-6005: 617-253-3849 77 Massachusetts Avenue 42:21:55.105N, 71:05:28.122W Cambridge, MA 02139-4307 % load 2 datasets for this example: load_dataset ("o1318_heg+1_pha.fits", "acisheg1D1999-07-22rmfN0003.fits.gz", "acisf01318_000N001HEG_1_garf.fits.gz"); load_dataset ("o1318_heg-1_pha.fits", "acisheg1D1999-07-22rmfN0003.fits.gz", "acisf01318_000N001HEG_-1_garf.fits.gz"); % wlshift is an operator-function (somewhat like xspec's % convolution models). It wavelength-shifts the result of % any model by an amount specific to each dataset. define wlshift_fit (l,h,p,val) { variable offset; switch (Isis_Active_Dataset) { % datasets 1 and 3 get shifted by "offset1" = p[0] case 1 or case 3: offset = p[0]; } { % datasets 2 and 4 get shifted by "offset2" = p[1] case 2 or case 4: offset = p[1]; } { % default error("*** wlshift: unsupported dataset index"); return -1; } return rebin (l, h, l+offset, h+offset, val); } add_slang_function ("wlshift", ["offset1", "offset2"]); set_function_category ("wlshift", ISIS_FUN_OPERATOR); % apply the wavelength shift to a delta-function line fit_fun ("wlshift (delta(1),1)"); set_par ("delta(1).norm", 1.e-2); set_par ("delta(1).lambda", 12); set_par ("wlshift(1).offset1", -0.5); set_par ("wlshift(1).offset2", +0.5); list_par; % evaluate the model to make sure the shifts are applied: () = eval_counts; plot_model_counts(1); oplot_model_counts(2); % now create 2 fake datasets assign_rmf(1,3); assign_arf(1,3); assign_rmf(2,4); assign_arf(2,4); fakeit; xrange(11,13); plot_pause; rplot_counts(3); plot_pause; rplot_counts(4); ---- 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 Fri Apr 18 2003 - 16:19:26 EDT
This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT