diff --git a/src/fitting/xyfit/xyfit.sl b/src/fitting/xyfit/xyfit.sl index 9ab240f6dd09f3abe6b38cde2cbb88f7c8d6ddee..eebb00ff2829d8ff5dd10e32d9a70957716ddb06 100644 --- a/src/fitting/xyfit/xyfit.sl +++ b/src/fitting/xyfit/xyfit.sl @@ -754,6 +754,84 @@ define define_xydata() } %}}} +%%%%%%%%%%%%%%%% +define ignore_xy () +%%%%%%%%%%%%%%%% +%!%+ +%\function{ignore_xy} +%\synopsis{ignore points from xy-dataset} +%c#%{{{ +%\usage{ignore_xy (index [, low, high]);} +%\description +% Wraper function of the ignore function for datasets defined with +% define_xydata. Ignores data points of dataset \code{index} +% (in the range low to high) for fitting. +%\seealso{notice_xy, ignore, ignore_en, define_xydata} +%!%- +{ + variable id, lo=NULL, hi; + switch (_NARGS) + { case 1: id = (); } + { case 3: (id, lo, hi) = (); } + { return help(_function_name()); } + + variable i,n,nlist, md; + _for i (0, length(id)-1, 1) { + if (_isnull(lo)) { + ignore(id[i]); + } else { + md = get_dataset_metadata(id[i]); + if (typeof(md) != Struct_Type) { + vmessage("No metadata associated with dataset %d, have you defined it via 'define_xydata'?", id[i]); + return; + } + variable xn = get_data_info(id[i]).notice; + n = (md.xy_data.x>=lo and md.xy_data.x<=hi); + _isis->_set_notice_using_mask(int((xn-n)>0), id[i]); + } + } +} +%}}} + +%%%%%%%%%%%%%%%% +define notice_xy () +%%%%%%%%%%%%%%%% +%!%+ +%\function{notice_xy} +%\synopsis{notice points from xy-dataset} +%#c%{{{ +%\usage{notice_xy (index [, low, high]);} +%\description +% Wraper function of the notice function for datasets defined with +% define_xydata. Include data points of dataset \code{index} +% (in the range low to high) for fitting. +%\seealso{ignore_xy, notice, notice_en, define_xydata} +%!%- +{ + variable id, lo=NULL, hi; + switch (_NARGS) + { case 1: id = (); } + { case 3: (id, lo, hi) = (); } + { return help(_function_name()); } + + variable i,n,nlist, md; + _for i (0, length(id)-1, 1) { + if (_isnull(lo)) { + notice(id[i]); + } else { + md = get_dataset_metadata(id[i]); + if (typeof(md) != Struct_Type) { + vmessage("No metadata associated with dataset %d, have you defined it via 'define_xydata'?", id[i]); + return; + } + variable xn = get_data_info(id[i]).notice; + n = (md.xy_data.x>=lo and md.xy_data.x<=hi); + _isis->_set_notice_using_mask(int((n+xn)>0), id[i]); + } + } +} +%}}} + private define get_xyfit_metadata(data_id) %{{{ { variable md = get_dataset_metadata(data_id);