Hi, > On May 16, 2011, at 1:36 PM, Rob Gibson wrote: >> didn't realize you could pass Isis_Active_Dataset like that. Since I also didn't realize for quite some time which powerful things one can do with Isis_Active_Dataset as a model identifier, I'd like to add another example: fit_fun("constant( (Isis_Active_Dataset-1)/4 ) * ..."); Because of integer arithmetics, the quotient gives 1 for index 5-- 8, 2 for 9--12, and 3 for 13--16, i.e., does the same job as the following function (which I believe somehow needs to be defined as public in the "isis" namespace): Michael Nowak wrote: > define cst() > { > if( 5 <= Isis_Active_Dataset <=8 ) > { > return constant(1); > } > else if( 9 <= Isis_Active_Dataset <=12 ) > { > return constant(2); > } > else if( 13 <= Isis_Active_Dataset <=16 ) > { > return constant(3); > } > else > { > return constant(3); > } > } There is no doubt that the code provided by our friend in Cambridge, MA is the much cleaner one; my example is just meant to illustrate ISIS' capabilities. A merged approach could read: public define flux_level(id) { return 5<=id<=8 ? 1 % low flux : 9<=id<=12 ? 2 % med. flux : 3; % high flux (or other spectra) } fit_fun("constant( flux_level(Isis_Active_Dataset) ) * ..."); Since Isis_Active_Dataset is a global variable, it would not even have to be passed as an argument to the flux_level function, see Mike's example. Another maybe useful hint is therefore, especially if the fit function contains >>1 (e.g., 2) occurrences of Isis_Active_Dataset: :-) public define IAD() { return Isis_Active_Dataset; } fit_fun("constant( flux_level(IAD) ) * ..."); > John has also built in infrastructure (whose syntax I'm forgetting > at the moment) > to assign model expressions just to specific datasets that can achieve the > same thing. You probably think of the assign_model function. But I have never used it either, fully agreeing with the statement: > But it's nice to have the Isis_Active_Dataset with which to program. Cheers, Manfred ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. ---- 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 Mon May 16 2011 - 15:14:20 EDT
This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:47 EDT