Changeset 242 for trunk/SRC/ToBeReviewed
- Timestamp:
- 04/06/07 10:35:17 (17 years ago)
- Location:
- trunk/SRC/ToBeReviewed
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ToBeReviewed/STATISTICS/a_correlate2d.pro
r163 r242 28 28 ; 29 29 ;- 30 31 FUNCTION auto_cov2d, X, Lag, D ouble = Double, zero2nan= zero2nan30 ; 31 FUNCTION auto_cov2d, X, Lag, DOUBLE = Double, ZERO2NAN = zero2nan 32 32 ; 33 33 compile_opt idl2, strictarrsubs … … 95 95 ny = XDim[1] 96 96 if XNDim NE 2 then $ 97 MESSAGE, "X array must contain 2 dimensions."97 ras = report("X array must contain 2 dimensions.") 98 98 ;Check length. 99 99 if nx lt 2 then $ 100 MESSAGE, "first dimension of X array must contain 2 or more elements."100 ras = report("first dimension of X array must contain 2 or more elements.") 101 101 if ny lt 2 then $ 102 MESSAGE, "second dimension of X array must contain 2 or more elements."102 ras = report("second dimension of X array must contain 2 or more elements.") 103 103 if n_elements(Lag) NE 2 THEN $ 104 MESSAGE, "Lag array must contain 2 elements."104 ras = report("Lag array must contain 2 elements.") 105 105 106 106 ;If the DOUBLE keyword is not set then the internal precision and -
trunk/SRC/ToBeReviewed/STATISTICS/a_timecorrelate.pro
r232 r242 2 2 ; 3 3 ; @file_comments 4 ;5 4 ; 6 5 ; @categories … … 8 7 ; 9 8 ; @param X {in}{required}{type=array} 10 ; An Array which last dimension is the time dimension so9 ; An array which last dimension is the time dimension so 11 10 ; size n. 12 11 ; 13 12 ; @param M 14 13 ; 15 ;16 14 ; @param NT 17 15 ; 18 ;19 16 ; @keyword ZERO2NAN 20 ;21 17 ; 22 18 ; @keyword DOUBLE … … 26 22 ; @examples 27 23 ; 28 ;29 24 ; @history 30 ;31 25 ; 32 26 ; @version … … 35 29 ;- 36 30 FUNCTION timeauto_cov, X, M, nT, Double = Double, zero2nan = zero2nan 37 ;Sample autocovariance function38 31 ; 39 32 compile_opt idl2, strictarrsubs 40 33 ; 34 ;Sample autocovariance function 41 35 TimeDim = size(X, /n_dimensions) 42 36 Xmean = TOTAL(X, TimeDim, Double = Double) / nT … … 66 60 END 67 61 ;+ 62 ; 68 63 ; @file_comments 69 64 ; Same function as A_CORRELATE but accept array (until 4 … … 79 74 ; 80 75 ; @param X {in}{required}{type=array} 81 ; An Array which last dimension is the time dimension so76 ; An array which last dimension is the time dimension so 82 77 ; size n. 83 78 ; 84 79 ; @param LAG {in}{required}{type=scalar or vector} 85 ; A scalar or n-element vector, in the interval [-(n-2),(n-2)],86 ; of type integer that specifies the absolute distance(s) between 80 ; A scalar or n-elements vector, in the interval [-(n-2),(n-2)], 81 ; of type integer that specifies the absolute distance(s) between 87 82 ; indexed elements of X. 88 83 ; … … 96 91 ; 97 92 ; @examples 98 ; Define an n-elementsample population.99 ; 93 ; Define an n-elements sample population. 94 ; IDL> x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] 100 95 ; 101 ; 102 ; 103 ; 96 ; Compute the autocorrelation of X for LAG = -3, 0, 1, 3, 4, 8 97 ; IDL> lag = [-3, 0, 1, 3, 4, 8] 98 ; IDL> result = a_correlate(x, lag) 104 99 ; 105 ; 106 ; 100 ; The result should be: 101 ; [0.0146185, 1.00000, 0.810879, 0.0146185, -0.325279, -0.151684] 107 102 ; 108 103 ; @history … … 118 113 ; 119 114 ;- 120 115 ; 121 116 FUNCTION a_timecorrelate, X, Lag, COVARIANCE = Covariance, DOUBLE = Double 122 117 ; … … 134 129 ;Check length. 135 130 if nT lt 2 then $ 136 MESSAGE, "Time axis of X array must contain 2 or more elements."137 131 ras= report("Time axis of X array must contain 2 or more elements.") 132 138 133 ;If the DOUBLE keyword is not set then the internal precision and 139 134 ;result are identical to the type of input. … … 141 136 Double = (SIZE(X, /type) eq 5) 142 137 143 138 144 139 if n_elements(lag) EQ 0 then lag = 0 145 140 nLag = N_ELEMENTS(Lag) … … 169 164 endcase 170 165 endif else begin ;Compute Autocovariance. 171 for k = 0, nLag-1 do $ 166 for k = 0, nLag-1 do $ 172 167 case XNDim of 173 168 1:Auto[k] = TimeAuto_Cov(X, ABS(Lag[k]), nT, Double = Double) / nT -
trunk/SRC/ToBeReviewed/STATISTICS/c_timecorrelate.pro
r232 r242 8 8 ; @param XD 9 9 ; 10 ;11 10 ; @param YD 12 11 ; 13 ;14 12 ; @param M 15 13 ; 16 ;17 14 ; @param NT 18 15 ; 19 ;20 16 ; @param NDIM 21 17 ; 22 ;23 18 ; @keyword ZERO2NAN 24 ;25 19 ; 26 20 ; @keyword DOUBLE … … 30 24 ; @examples 31 25 ; 32 ;33 26 ; @history 34 ;35 27 ; 36 28 ; @version … … 38 30 ; 39 31 ;- 32 ; 40 33 FUNCTION timecross_cov, Xd, Yd, M, nT, Ndim, Double = Double, ZERO2NAN = zero2nan 41 ;Sample cross covariance function. 42 34 ; 43 35 compile_opt hidden 44 36 ; 37 ;Sample cross covariance function. 45 38 case Ndim OF 46 39 1:res = TOTAL(Xd[0:nT - M - 1L] * Yd[M:nT - 1L] $ … … 61 54 62 55 END 56 ; 63 57 ;+ 58 ; 64 59 ; @file_comments 65 60 ; This function computes the "time cross correlation" Pxy(L) or … … 71 66 ; Statistics 72 67 ; 73 ; @param X {in}{required} {type=array}74 ; An Array which last dimension is the time dimension of68 ; @param X {in}{required} {type=array} 69 ; An array which last dimension is the time dimension of 75 70 ; size n, float or double. 76 71 ; 77 ; @param Y {in}{required} {type=array}78 ; An Array which last dimension is the time dimension of72 ; @param Y {in}{required} {type=array} 73 ; An array which last dimension is the time dimension of 79 74 ; size n, float or double. 80 75 ; 81 76 ; @param LAG {in}{required}{type=scalar or vector} 82 ; A scalar or n-element vector, in the interval [-(n-2),(n-2)],77 ; A scalar or n-elements vector, in the interval [-(n-2),(n-2)], 83 78 ; of type integer that specifies the absolute distance(s) between 84 79 ; indexed elements of X. … … 94 89 ; @examples 95 90 ; 96 ; Define two n-elementsample populations.97 ; 98 ; 99 ; 100 ; 101 ; 102 ; 103 ; 104 ; 105 ; 91 ; Define two n-elements sample populations. 92 ; IDL> x = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57] 93 ; IDL> y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95] 94 ; 95 ; Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 7 96 ; IDL> lag = [-5, 0, 1, 5, 6, 7] 97 ; IDL> result = c_timecorrelate(x, y, lag) 98 ; 99 ; The result should be: 100 ; [-0.428246, 0.914755, 0.674547, -0.405140, -0.403100, -0.339685] 106 101 ; 107 102 ; @history … … 120 115 ; 121 116 ;- 117 ; 122 118 FUNCTION c_timecorrelate, X, Y, Lag, Covariance = Covariance, Double = Double 119 ; 123 120 124 121 ;Compute the sample cross correlation or cross covariance of … … 133 130 134 131 if total(xsize[0:xsize[0]] NE ysize[0:ysize[0]]) NE 0 then $ 135 MESSAGE, "X and Y arrays must have the same size and the same dimensions"132 ras = report("X and Y arrays must have the same size and the same dimensions") 136 133 137 134 ;Check length. 138 135 if nt lt 2 then $ 139 MESSAGE, "Time dimension of X and Y arrays must contain 2 or more elements."136 ras = report("Time dimension of X and Y arrays must contain 2 or more elements.") 140 137 141 138 ;If the DOUBLE keyword is not set then the internal precision and … … 210 207 211 208 END 212 -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_bgroup.pro
r231 r242 26 26 ; 27 27 PRO cw_bgroup_setv, id, value 28 ; 28 29 compile_opt hidden, idl2, strictarrsubs 29 30 ; 30 31 ON_ERROR, 2 ;return to caller 31 32 … … 350 351 351 352 352 IF (N_PARAMS() ne 2) THEN MESSAGE, 'Incorrect number of arguments'353 IF (N_PARAMS() ne 2) THEN ras = report('Incorrect number of arguments') 353 354 354 355 ON_ERROR, 2 ;return to caller -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_combobox_pm.pro
r232 r242 1 ; testwid, value=strtrim(indgen(10),2) 2 ; PRO testwid_event, event 3 ; ; help, event, /STRUCT 4 ; ComboboxId = widget_info(event.top,find_by_uname = 'c''est lui') 5 ; widget_control, event.id, get_uvalue=uval 6 ; if n_elements(uval) EQ 0 then return 7 ; case uval of 8 ; 'done':widget_control, event.top, /destroy 9 ; 'dynamic_resize':BEGIN 10 ; widget_control, event.id, get_value = value 11 ; widget_control, ComboboxId, set_value = {dynamic_resize:value} 12 ; END 13 ; 'combobox_select':BEGIN 14 ; widget_control, event.id, get_value = value 15 ; widget_control, ComboboxId, set_value = {combobox_select:value} 16 ; END 17 ; 'value':BEGIN 18 ; widget_control, event.id, get_value = value 19 ; widget_control, ComboboxId, set_value = value 20 ; END 21 ; 'get':BEGIN 22 ; widget_control, ComboboxId, get_value = value 23 ; help, value, /struct 24 ; END 25 ; ELSE: 26 ; endcase 27 ; return 28 ; end 29 ; PRO testwid, _extra = ex 30 ; base=widget_base(/COLUMN) 31 ; print, 'base=', base 32 ; nothing = widget_label(base, value = 'beginning of the test') 33 ; ; 34 ; nothing = cw_combobox_pm(base, _extra = ex, uname = 'c''est lui', uvalue = 'c''est lui') 35 ; print, 'cw_combobox_pm ID =', nothing 36 ; ; 37 ; nothing = widget_label(base, value = 'end of the test') 38 ; nothing = widget_text(base, value = '0', uvalue = 'dynamic_resize', /editable) 39 ; nothing = widget_text(base, value = '10', uvalue = 'combobox_select', /editable) 40 ; nothing = widget_text(base, value = '5', uvalue = 'value', /editable) 41 ; nothing = widget_button(base, value = 'get', uvalue = 'get') 42 ; nothing = widget_button(base, value = 'done', uvalue = 'done') 43 ; widget_control, base, /REALIZE 44 ; xmanager,'testwid', base 45 ; return 46 ; end 47 ;+ 48 ; 49 ; @file_comments 50 ; 1 ;+ 2 ; 3 ; @file_comments 51 4 ; 52 5 ; @categories … … 300 253 ; 301 254 302 IF (N_PARAMS() NE 1) THEN MESSAGE, 'Incorrect number of arguments'255 IF (N_PARAMS() NE 1) THEN ras = report('Incorrect number of arguments') 303 256 ON_ERROR, 2 ;return to caller 304 257 ; checking for row and column keywords -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_droplist_pm.pro
r232 r242 1 ; PRO testwid_event, event2 ; ; help, event, /STRUCT3 ; DroplistId = widget_info(event.top,find_by_uname = 'c''est lui')4 ; widget_control, event.id, get_uvalue=uval5 ; if n_elements(uval) EQ 0 then return6 ; case uval of7 ; 'done':widget_control, event.top, /destroy8 ; 'dynamic_resize':BEGIN9 ; widget_control, event.id, get_value = value10 ; widget_control, DroplistId, set_value = {dynamic_resize:value}11 ; END12 ; 'droplist_select':BEGIN13 ; widget_control, event.id, get_value = value14 ; widget_control, DroplistId, set_value = {droplist_select:value}15 ; END16 ; 'value':BEGIN17 ; widget_control, event.id, get_value = value18 ; widget_control, DroplistId, set_value = value19 ; END20 ; 'get':BEGIN21 ; widget_control, DroplistId, get_value = value22 ; help, value, /struct23 ; END24 ; ELSE:25 ; endcase26 ; return27 ; end28 ; PRO testwid, _extra = ex29 ; base=widget_base(/COLUMN)30 ; print, 'base=', base31 ; nothing = widget_label(base, value = 'beginning of the test')32 ; ;33 ; nothing = cw_droplist_pm(base, _extra = ex, uname = 'c''est lui', uvalue = 'c''est lui')34 ; print, 'cw_droplist_pm ID =', nothing35 ; ;36 ; nothing = widget_label(base, value = 'end of the test')37 ; nothing = widget_text(base, value = '0', uvalue = 'dynamic_resize', /editable)38 ; nothing = widget_text(base, value = '10', uvalue = 'droplist_select', /editable)39 ; nothing = widget_text(base, value = '5', uvalue = 'value', /editable)40 ; nothing = widget_button(base, value = 'get', uvalue = 'get')41 ; nothing = widget_button(base, value = 'done', uvalue = 'done')42 ; widget_control, base, /REALIZE43 ; xmanager,'testwid', base44 ; return45 ; end46 ;47 1 ;+ 48 2 ; … … 286 240 ; 287 241 288 IF (N_PARAMS() NE 1) THEN MESSAGE, 'Incorrect number of arguments'242 IF (N_PARAMS() NE 1) THEN ras = report('Incorrect number of arguments') 289 243 ON_ERROR, 2 ;return to caller 290 244 ; checking for row and column keywords -
trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slider_pm.pro
r232 r242 1 ; PRO testwid_event, event2 ; ; help, event, /STRUCT3 ; SliderBarId = widget_info(event.top,find_by_uname = 'c''est lui')4 ; widget_control, event.id, get_uvalue=uval5 ; if n_elements(uval) EQ 0 then return6 ; case uval of7 ; 'done':widget_control, event.top, /destroy8 ; 'slider_min':BEGIN9 ; widget_control, event.id, get_value = value10 ; widget_control, SliderBarId, set_value = {slider_min:value}11 ; END12 ; 'slider_max':BEGIN13 ; widget_control, event.id, get_value = value14 ; widget_control, SliderBarId, set_value = {slider_max:value}15 ; END16 ; 'slider_value':BEGIN17 ; widget_control, event.id, get_value = value18 ; widget_control, SliderBarId, set_value = value19 ; END20 ; 'get':BEGIN21 ; widget_control, SliderBarId, get_value = value22 ; help, value, /struct23 ; print, value.slider_min_max24 ; END25 ; ELSE:26 ; endcase27 ; return28 ; end29 ; PRO testwid, _extra = ex30 ; base=widget_base(/COLUMN)31 ; print, 'base=', base32 ; nothing = widget_label(base, value = 'beginning of the test')33 ; ;34 ; nothing = cw_slider_pm(base, _extra = ex, uname = 'c''est lui', uvalue = 'c''est lui')35 ; print, 'cw_slider_pm ID =', nothing36 ; ;37 ; nothing = widget_label(base, value = 'end of the test')38 ; nothing = widget_text(base, value = '0', uvalue = 'slider_min', /editable)39 ; nothing = widget_text(base, value = '10', uvalue = 'slider_max', /editable)40 ; nothing = widget_text(base, value = '5', uvalue = 'slider_value', /editable)41 ; nothing = widget_button(base, value = 'get', uvalue = 'get')42 ; nothing = widget_button(base, value = 'done', uvalue = 'done')43 ; widget_control, base, /REALIZE44 ; xmanager,'testwid', base45 ; return46 ; end47 1 ;+ 48 2 ; … … 389 343 ; 390 344 391 IF (N_PARAMS() NE 1) THEN MESSAGE, 'Incorrect number of arguments'345 IF (N_PARAMS() NE 1) THEN ras = report('Incorrect number of arguments') 392 346 ON_ERROR, 2 ;return to caller 393 347 ; -
trunk/SRC/ToBeReviewed/WIDGET/xquestion.pro
r232 r242 40 40 ; @file_comments 41 41 ; A small widget who ask a question and give an answer. 42 ; WARNING: For a binary question with yes/no answer use43 ; DIALOG_MESSAGE.42 ; WARNING: For a binary question with yes/no, answer use 43 ; <proidl>DIALOG_MESSAGE</proidl>. 44 44 ; 45 45 ; @categories 46 46 ; Widget 47 47 ; 48 ; @param QUESTION 49 ; A scalar string or a array of string. If this 50 ; argument is set to : 51 ; + an array of strings: each array element is 48 ; @param QUESTION {type=A scalar string or a array of string} 49 ; If this argument is set to : 50 ; - an array of strings: each array element is 52 51 ; displayed as a separate line of text. 53 ; +a scalar string: we are looking for the "separate line52 ; - a scalar string: we are looking for the "separate line 54 53 ; character" '!C' 55 54 ; 56 55 ; @param PROPOSEDANSWER {type=string} 57 ; A stringproposing a answer56 ; proposing a answer 58 57 ; 59 58 ; @keyword CHKWIDGET 60 ; Active this keyword if you want that xquestion61 ; check if managed widget are present. If not, xquestiondo not59 ; Active this keyword if you want that <pro>xquestion</pro> 60 ; check if managed widget are present. If not, <pro>xquestion</pro> do not 62 61 ; open a widget but print the question in the IDL window. 63 62 ;
Note: See TracChangeset
for help on using the changeset viewer.