PRO cafe_notice, env, $ range, subgroup, group, $ help=help,shorthelp=shorthelp ;+ ; NAME: ; notice ; ; PURPOSE: ; explicitely allow data points for fit ; ; CATEGORY: ; cafe ; ; SYNTAX: ; notice, range [,subgroup][,group] ; ; INPUTS: ; range - Defines range of data points to notice. This can ; be either: ; - Data point range, denoted by the data ; point number: ; [-], while , are positive ; numbers. Data point numbers start from zero. ; Open intervals can be represented with a ; "*" instead of the number. ; If only one number is given, a single ; data point will be referenced. ; If is less than all but the ; interval .. are referenced. ; - X value range, denoted by float point numbers: ; -, while , ; represents X values defining the interval to ; reference. Open intervals can be represented ; with a * instead of the value. If is ; less than all but the interval ; .. is referenced. ; - Vector of data point indices. The vector is ; denoted with [val,val,...,val] (indgen may ; be used also). ; - Boolean expressions with X/Y values. All ; values for which this expression is true are ; referenced. The expression may contain ; algebraic formulas combined with comparison ; operators "lt", "le", "eq", "gt", "ge" as used in IDL ; comparisons. For each data point a keyword ; is defined which has meaning and can be used ; for the boolean expression: ; x - The x-column value. ; y - The y-column value. ; error - The error column value. ; selected - True when the data point is selected. ; def - True when the data point is defined. ; x1 - Multi column first column value. ; x2 - Multi column second column ; value. ; x3 - Multi column third column value. ; To avoid interference with functions which ; also can be used a lower/upper case ; distinction is made. IDL funktions should ; be upper case. ; ; Default are all data points. ; ; Examples: ; > notice, 2 ; -> notice data point 2 (the 3-rd) ; > notice, 5-22 ; -> notice data points 5..22 (starting from 0) ; > notice 46-* ; -> notice all data points upwards from point 47. ; > notice, 2.2-5.7 ; -> notice all data points from x=2.2 to 5.7 ; > notice, *-0.2 ; -> notice all data points up to x=0.2 ; > notice, 0.5-0.2 ; -> notice all data points except those in 0.2..0.5. ; > notice, Y LT 0.5 ; -> notice all data points with ; Y-values less than 0.5. ; ; subgroup - (optional) The data set (subgroup) for which the model ; should be applied. This can be either the ; subgroup number or the file name representing ; the data set. ; It is possible to set more than one subgroup, ; either with numbers in brackets ([]) or ; denoting filenames with wildcards ("*"). ; Default are all subgroups in current used ; group. ; ; group - (optional) The data group for which the model ; should be applied. ; Default is the primary group 0. Must be in ; range [0..29]. ; ; ; SIDE EFFECTS: ; Changes information about data points used for ; fitting. Data points are not excluded. ; ; EXAMPLE: ; > notice, 0.2-7.5, 3, "test.dat" ; -> notice all x values between 0.2 and 7.5 from ; group 3, subgroup represented by file "test.dat" ; ; HISTORY: ; $Id: cafe_notice.pro,v 1.12 2004/05/27 09:10:51 goehler Exp $ ;- ; ; $Log: cafe_notice.pro,v $ ; Revision 1.12 2004/05/27 09:10:51 goehler ; change: for proper undo function copy data in question before action. ; ; Revision 1.11 2003/12/01 07:53:00 goehler ; change: data sets contain "title" to store information in. ; files remain unmodified when applying modify,file=foo command. ; ; Revision 1.10 2003/11/05 15:10:44 goehler ; for debugging/manual handling: ; create environment if not existing ; ; Revision 1.9 2003/09/19 07:45:44 goehler ; update range selection documentation ; ; Revision 1.8 2003/05/23 12:46:49 goehler ; - moved range string expansion into caferange.pro ; - caferange now supports vector indices ; ; Revision 1.7 2003/03/17 14:11:32 goehler ; review/documentation updated. ; ; Revision 1.6 2003/03/03 11:18:23 goehler ; major change: environment struct has become a pointer -> support of wplot/command line ; in common. ; Branch to be able to maintain the former line also. ; ; Revision 1.5 2002/09/19 14:02:38 goehler ; documentized ; ; Revision 1.4 2002/09/09 17:36:07 goehler ; public version: updated help matching aitlib html structure. ; common version: 3.0 ; ; ; ;; command name of this source (needed for automatic help) name="notice" ;; create environment if not existing: IF n_elements(env) EQ 0 OR NOT PTR_VALID(env) THEN env = cafeenv__define() ;; ------------------------------------------------------------ ;; HELP ;; ------------------------------------------------------------ ;; if help given -> print the specification above (from this file) IF keyword_set(help) THEN BEGIN cafe_help,env, name return ENDIF ;; ------------------------------------------------------------ ;; SHORT HELP ;; ------------------------------------------------------------ IF keyword_set(shorthelp) THEN BEGIN cafereport,env, "notice - allow datapoints for fitting" return ENDIF ;; ------------------------------------------------------------ ;; SET GROUP/SUBGROUP ;; ------------------------------------------------------------ ;; define default group IF n_elements(group) EQ 0 THEN group = (*env).def_grp ;; check boundary: IF (group GE n_elements((*env).groups)) OR (group LT 0) THEN BEGIN cafereport,env, "Error: invalid group number" return ENDIF ;; define default subgroup -> first valid subgroup IF n_elements(subgroup) EQ 0 THEN BEGIN subgroup = where((*env).groups[group].data[*].file NE "") subgroup = subgroup[0] ENDIF ;; subgroup given as string -> look for matching file: IF ((SIZE(subgroup))[0] EQ 0 ) AND ((SIZE(subgroup))[1] EQ 7) THEN BEGIN ;; look for subgroups containing this string: subgroup = where(strmatch((*env).groups[group].data[*].title,subgroup)) IF subgroup[0] EQ -1 THEN BEGIN cafereport,env, "Error: Subgroup file not found" return ENDIF ENDIF ;; check boundary: IF (where(subgroup GE n_elements((*env).groups[group].data) $ OR (subgroup LT 0)))[0] NE -1 THEN BEGIN cafereport,env, "Error: invalid subgroup(s)" return ENDIF ;; ------------------------------------------------------------ ;; NOTICE DATAPOINTS FOR EACH SUBGROUP ;; ------------------------------------------------------------ ;; for each subgroup: FOR i =0,n_elements(subgroup)-1 DO BEGIN ;; select subgroup: sg = subgroup[i] ;; check data set existence: IF NOT PTR_VALID((*env).groups[group].data[sg].def) THEN CONTINUE ;; print subgroup information: cafereport,env, "Subgroup "+strtrim(string(sg),2)$ +" ["+(*env).groups[group].data[sg].title+"]:" index = caferange(env,range,group,sg) IF index[0] NE -1 THEN BEGIN cafereport,env, " Allowing " $ +strtrim(string(n_elements(index)),2) $ +" datapoints" cafereport,env, " from " $ +strtrim(string(index[0]),2) $ +" to " $ +strtrim(string(index[n_elements(index)-1]),2) ;; copy column for undo facility: (*env).groups[group].data[sg].def = ptr_new(*(*env).groups[group].data[sg].def) ;; set value: (*(*env).groups[group].data[sg].def)[index] = 1 ENDIF ELSE BEGIN cafereport,env, "No Datapoints found" ENDELSE ENDFOR END