Pass information to a fit function via metadata
Jump to navigation
Jump to search
In ISIS, the definition of fit functions has to follow the form
define somefun_fit(lo,hi,pars) {...}
but sometimes it is desirable to use additional (dataset specific) information within the fit function. Instead of defining those as global variables that need to be defined before defining the fit function, the information can be made accessible through user-defined meta data associated with particular datasets:
set_dataset_metadata(hist_index,meta);
and, within the fit function,
define somefun_fit(lo,hi,pars){ ... variable meta = get_dataset_metadata(hist_index); ... }
While the help to set_dataset_metadata suggests passing a string
set_dataset_metadata (1, "SKY_X=4013.42; SKY_Y=3987.4");
other types of variables are possible. Structs are probably the most versatile:
variable meta = fits_read_table("sometable.fits"); set_dataset_metadata(id,meta);