Commit f4803ed9aa9c4f849f93e008c92ae0bd8a9f025d

Authored by Hacene SI HADJ MOHAND
2 parents 86179a7f 9521cade

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

generic_data/Functions/functions.xml
1 1 <?xml version="1.0"?>
2 2 <functions xml:id="functions">
3   - <function name="mean_(,)" args="1" kind="time">
  3 + <function name="mean_(,)" args="1" kind="time" group="stat">
4 4 <prompt>input averaging time in secs</prompt>
5 5 <info_brief>average</info_brief>
6 6 <new_kernel>#sampling_classic</new_kernel>
7 7 </function>
8   - <function name="median_(,)" args="1" kind="time">
  8 + <function name="median_(,)" args="1" kind="time" group="stat">
9 9 <prompt>input averaging time in secs</prompt>
10 10 <info_brief>median average</info_brief>
11 11 <new_kernel>#median</new_kernel>
12 12 </function>
13   - <function name="rms_(,)" args="1" kind="time">
  13 + <function name="rms_(,)" args="1" kind="time" group="stat">
14 14 <prompt>input averaging time in secs</prompt>
15 15 <info_brief>root mean square</info_brief>
16 16 <new_kernel>#rms</new_kernel>
17 17 </function>
18   - <function name="min_(,)" args="1" kind="time">
  18 + <function name="min_(,)" args="1" kind="time" group="stat">
19 19 <prompt>input window time in secs</prompt>
20 20 <info_brief>min() function</info_brief>
21 21 <new_kernel>#min</new_kernel>
22 22 </function>
23   - <function name="max_(,)" args="1" kind="time">
  23 + <function name="max_(,)" args="1" kind="time" group="stat">
24 24 <prompt>input window time in secs</prompt>
25 25 <info_brief>max() function</info_brief>
26 26 <new_kernel>#max</new_kernel>
27 27 </function>
28   - <function name="var_(,)" args="1" kind="time">
  28 + <function name="var_(,)" args="1" kind="time" group="stat">
29 29 <prompt>input window time in secs</prompt>
30 30 <info_brief>variance() function</info_brief>
31 31 <new_kernel>#var</new_kernel>
32 32 </function>
33   - <function name="skew_(,)" args="1" kind="time">
  33 + <function name="skew_(,)" args="1" kind="time" group="stat">
34 34 <prompt>input window time in secs</prompt>
35 35 <info_brief>skewness() function</info_brief>
36 36 <new_kernel>#skew</new_kernel>
37 37 </function>
38   - <function name="mean_sm_(,)" args="1" kind="sliding">
  38 + <function name="mean_sm_(,)" args="1" kind="sliding" group="stat">
39 39 <prompt>input averaging time in secs</prompt>
40 40 <info_brief>average</info_brief>
41 41 <new_kernel>#sliding_average</new_kernel>
42 42 </function>
43   - <function name="rms_sm_(,)" args="1" kind="sliding">
  43 + <function name="rms_sm_(,)" args="1" kind="sliding" group="stat">
44 44 <prompt>input averaging time in secs</prompt>
45 45 <info_brief>root mean square</info_brief>
46 46 <new_kernel>#rms_sm</new_kernel>
47 47 </function>
48   - <function name="min_sm_(,)" args="1" kind="sliding">
  48 + <function name="min_sm_(,)" args="1" kind="sliding" group="stat">
49 49 <prompt>input window time in secs</prompt>
50 50 <info_brief>min() function</info_brief>
51 51 <new_kernel>#min_sm</new_kernel>
52 52 </function>
53   - <function name="max_sm_(,)" args="1" kind="sliding">
  53 + <function name="max_sm_(,)" args="1" kind="sliding" group="stat">
54 54 <prompt>input window time in secs</prompt>
55 55 <info_brief>max() function</info_brief>
56 56 <new_kernel>#max_sm</new_kernel>
57 57 </function>
58   - <function name="var_sm_(,)" args="1" kind="sliding">
  58 + <function name="var_sm_(,)" args="1" kind="sliding" group="stat">
59 59 <prompt>input window time in secs</prompt>
60 60 <info_brief>variance() function</info_brief>
61 61 <new_kernel>#var_sm</new_kernel>
62 62 </function>
63   - <function name="skew_sm_(,)" args="1" kind="sliding">
  63 + <function name="skew_sm_(,)" args="1" kind="sliding" group="stat">
64 64 <prompt>input window time in secs</prompt>
65 65 <info_brief>skewness() function</info_brief>
66 66 <new_kernel>#skew_sm</new_kernel>
67 67 </function>
68   - <function name="smooth_(,)" args="1" kind="sliding">
  68 + <function name="smooth_(,)" args="1" kind="sliding" group="stat">
69 69 <prompt>input averaging time in secs</prompt>
70 70 <info_brief>smooths with a boxcar average</info_brief>
71 71 <new_kernel>#boxcar</new_kernel>
... ... @@ -74,29 +74,29 @@
74 74 <prompt>input number of points N to delay by</prompt>
75 75 <info_brief>Delays array by N points back (N &lt; 0) and forth (N &gt; 0)</info_brief>
76 76 </function>-->
77   - <function name="shiftT_(,)" args="1" kind="amda">
  77 + <function name="shiftT_(,)" args="1" kind="amda" group="space">
78 78 <prompt>input time interval T in secs to delay by</prompt>
79 79 <info_brief>Shifts parameter by T secs back (T &lt; 0) and forth (T &gt; 0))</info_brief>
80 80 <new_kernel>#timeShift</new_kernel>
81 81 </function>
82 82  
83   - <function name="vAlfven(,)" args="2" kind="physics">
  83 + <function name="vAlfven(,)" args="2" kind="physics" group="space">
84 84 <prompt_param>density[cm^โป3], b_magnitude[nT]</prompt_param>
85 85 <info_brief>Alfven velocity Valfven(density[cm^โป3], b_magnitude[nT])</info_brief>
86 86 <new_kernel>alfvenVelocity</new_kernel>
87 87 </function>
88 88  
89   - <function name="perreault78(,,)" args="3" kind="physics">
  89 + <function name="perreault78(,,)" args="3" kind="model" group="space">
90 90 <info_brief>Perreault and Akasofu 1978 model u = perreault78(E_mag, B_mag, theta_p)</info_brief>
91 91 <new_kernel>perreault78</new_kernel>
92 92 </function>
93 93  
94   - <function name="newell2007(,)" args="3" kind="physics">
  94 + <function name="newell2007(,)" args="3" kind="model" group="space">
95 95 <info_brief>NEWELL et al 2007 solar wind-magnetosphere coupling function d_phi/d_t = newell2007(mu, B_mag, theta) </info_brief>
96 96 <new_kernel>newell2007</new_kernel>
97 97 </function>
98 98  
99   - <function name="fairfield70(,tilt_angle_60)" args="2" kind="physics">
  99 + <function name="fairfield70(,tilt_angle_60)" args="2" kind="model" group="space">
100 100 <prompt_param>xyz_sm (Re), dipole tilt angle (deg)</prompt_param>
101 101 <default_args>,tilt_angle_60</default_args>
102 102 <info_brief>Distance (Re) from s/c location to Fairfield1970 model neutral sheet position.&lt;br/&gt;
... ... @@ -104,14 +104,14 @@
104 104 <new_kernel>fairfield70</new_kernel>
105 105 </function>
106 106  
107   - <function name="fairfield80(,tilt_angle_60)" args="2" kind="physics">
  107 + <function name="fairfield80(,tilt_angle_60)" args="2" kind="model" group="space">
108 108 <prompt_param>xyz_sm (Re), dipole tilt angle (deg)</prompt_param>
109 109 <default_args>,tilt_angle_60</default_args>
110 110 <info_brief>Distance (Re) from s/c location to Fairfield1980 model neutral sheet position.&lt;br/&gt;
111 111 dZ = fairfield80(xyz_sm, tilt_angle),&lt;br/&gt; xyz_sm is the s/c SM coordinates (Re) and tilt angle is in degrees.&lt;br/&gt;</info_brief>
112 112 <new_kernel>fairfield80</new_kernel>
113 113 </function>
114   - <function name="lopez90(omni_kp,,,tilt_angle_60)" args="4" kind="physics">
  114 + <function name="lopez90(omni_kp,,,tilt_angle_60)" args="4" kind="model" group="space">
115 115 <prompt_param>Kp, MLT (deg), R (Re), dipole tilt angle (deg)</prompt_param>
116 116 <default_args>omni_kp,,,tilt_angle_60</default_args>
117 117 <info_brief>
... ... @@ -127,108 +127,108 @@
127 127 <info_brief>frame transformation</info_brief>
128 128 <new_kernel>#framesTransformation</new_kernel>
129 129 </function>-->
130   - <function name="angle(,)" args="2" kind="vectors">
  130 + <function name="angle(,)" args="2" kind="vectors" group="math">
131 131 <info_brief>Angle between two vectors</info_brief>
132 132 <new_kernel>angle</new_kernel>
133 133 </function>
134 134  
135   - <function name="cross(,)" args="2" kind="vectors">
  135 + <function name="cross(,)" args="2" kind="vectors" group="math">
136 136 <info_brief>Cross product</info_brief>
137 137 <new_kernel>cross</new_kernel>
138 138 </function>
139 139  
140   - <function name="dot(,)" args="2" kind="vectors">
  140 + <function name="dot(,)" args="2" kind="vectors" group="math">
141 141 <info_brief>Dot product</info_brief>
142 142 <new_kernel>dot</new_kernel>
143 143 </function>
144 144  
145   - <function name="vector(,,)" args="3" kind="vectors">
  145 + <function name="vector(,,)" args="3" kind="vectors" group="math">
146 146 <info_brief>Build vector from components</info_brief>
147 147 <new_kernel>vector_</new_kernel>
148 148 </function>
149 149  
150   - <function name="module()" kind="vectors">
  150 + <function name="module()" kind="vectors" group="math">
151 151 <info_brief>Magnitude</info_brief>
152 152 <new_kernel>magnitude</new_kernel>
153 153 </function>
154 154  
155   - <function name="abs()" kind="math">
  155 + <function name="abs()" kind="math" group="math">
156 156 <info_brief>Absolute value</info_brief>
157 157 <new_kernel>abs</new_kernel>
158 158 </function>
159   - <function name="acos()" kind="math">
  159 + <function name="acos()" kind="math" group="math">
160 160 <info_brief>Arc-cosine</info_brief>
161 161 <new_kernel>acos</new_kernel>
162 162 </function>
163   - <function name="alog()" kind="math">
  163 + <function name="alog()" kind="math" group="math">
164 164 <info_brief>Natural logarithm</info_brief>
165 165 <new_kernel>log</new_kernel>
166 166 </function>
167   - <function name="alog10()" kind="math">
  167 + <function name="alog10()" kind="math" group="math">
168 168 <info_brief>Logarithm to the base 10</info_brief>
169 169 <new_kernel>log10</new_kernel>
170 170 </function>
171   - <function name="asin()" kind="math">
  171 + <function name="asin()" kind="math" group="math">
172 172 <info_brief>Arc-sine</info_brief>
173 173 <new_kernel>asin</new_kernel>
174 174 </function>
175   - <function name="atan()" kind="math">
  175 + <function name="atan()" kind="math" group="math">
176 176 <info_brief>Arc-tangent</info_brief>
177 177 <new_kernel>atan</new_kernel>
178 178 </function>
179   - <function name="atan2(,)" args="2" kind="math">
  179 + <function name="atan2(,)" args="2" kind="math" group="math">
180 180 <info_brief>Arc-tangent</info_brief>
181 181 <new_kernel>atan2</new_kernel>
182 182 </function>
183   - <function name="ceil()" kind="math">
  183 + <function name="ceil()" kind="math" group="math">
184 184 <info_brief>Closest integer greater than or equal to its argument</info_brief>
185 185 <new_kernel>Ceil</new_kernel>
186 186 </function>
187   - <function name="cos()" kind="math">
  187 + <function name="cos()" kind="math" group="math">
188 188 <info_brief>cosine</info_brief>
189 189 <new_kernel>cos</new_kernel>
190 190 </function>
191   - <function name="cosh()" kind="math">
  191 + <function name="cosh()" kind="math" group="math">
192 192 <info_brief>Hyperbolic cosine</info_brief>
193 193 <new_kernel>cosh</new_kernel>
194 194 </function>
195   - <function name="deriv_()" kind="math">
  195 + <function name="deriv_()" kind="math" group="math">
196 196 <info_brief>deriv() function with possibly unequal point spacing</info_brief>
197 197 <new_kernel>#deriv</new_kernel>
198 198 </function>
199   - <function name="exp()" kind="math">
  199 + <function name="exp()" kind="math" group="math">
200 200 <info_brief>Natural exponential function</info_brief>
201 201 <new_kernel>exp</new_kernel>
202 202 </function>
203   - <function name="fix()" kind="math">
  203 + <function name="fix()" kind="math" group="math">
204 204 <info_brief>Integer</info_brief>
205 205 <new_kernel>Fix</new_kernel>
206 206 </function>
207   - <function name="floor()" kind="math">
  207 + <function name="floor()" kind="math" group="math">
208 208 <info_brief>Closest integer less than or equal to its argument</info_brief>
209 209 <new_kernel>Floor</new_kernel>
210 210 </function>
211   - <function name="sign()" kind="math">
  211 + <function name="sign()" kind="math" group="math">
212 212 <info_brief>Sign</info_brief>
213 213 <new_kernel>Sign</new_kernel>
214 214 </function>
215   - <function name="sin()" kind="math">
  215 + <function name="sin()" kind="math" group="math">
216 216 <info_brief>Sine</info_brief>
217 217 <new_kernel>sin</new_kernel>
218 218 </function>
219   - <function name="sinh()" kind="math">
  219 + <function name="sinh()" kind="math" group="math">
220 220 <info_brief>Hyperbolic sine</info_brief>
221 221 <new_kernel>sinh</new_kernel>
222 222 </function>
223   - <function name="tan()" kind="math">
  223 + <function name="tan()" kind="math" group="math">
224 224 <info_brief>Tangent</info_brief>
225 225 <new_kernel>tan</new_kernel>
226 226 </function>
227   - <function name="tanh()" kind="math">
  227 + <function name="tanh()" kind="math" group="math">
228 228 <info_brief>Hyperbolic tangent</info_brief>
229 229 <new_kernel>tanh</new_kernel>
230 230 </function>
231   - <function name="sqrt()" kind="math">
  231 + <function name="sqrt()" kind="math" group="math">
232 232 <info_brief>Square root</info_brief>
233 233 <new_kernel>sqrt</new_kernel>
234 234 </function>
... ...
js/app/models/Function.js
... ... @@ -15,6 +15,7 @@ Ext.define(&#39;amdaModel.Function&#39;, {
15 15 fields : [
16 16 {name: 'name', mapping: '@name', type:'string'},
17 17 {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'},
  18 + {name: 'group', mapping: '@group', type: 'string', defaultValue: 'space'},
18 19 {name: 'args', mapping: '@args', type: 'int', defaultValue: 1},
19 20 {name: 'argv', mapping: '@argv', type: 'string'},
20 21 {name: 'prompt', type: 'string', defaultValue: ''},
... ... @@ -26,7 +27,8 @@ Ext.define(&#39;amdaModel.Function&#39;, {
26 27 validations: [
27 28 {type: 'presence', field: 'name'},
28 29 {type: 'presence', field: 'kind'},
29   - {type: 'inclusion', field: 'kind', list: ['math','amda','time','sliding']}
  30 + {type: 'presence', field: 'group'}/*,
  31 + {type: 'inclusion', field: 'kind', list: ['amda','time']}*/
30 32 ],
31 33  
32 34 proxy: {
... ...
js/app/views/CalculatorUI.js
... ... @@ -107,11 +107,12 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
107 107 scope: this,
108 108 callback: function (records, operation, success)
109 109 {
110   - this.createAllFunctionBtns();
  110 + this.createAllBtns();
111 111 }
112 112 });
113 113 } else
114   - this.createAllFunctionBtns();
  114 + this.createAllBtns();
  115 +
115 116  
116 117 },
117 118  
... ... @@ -152,12 +153,27 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
152 153 activeTab: 0,
153 154 id: 'calc_tab_const_id'
154 155 }, {
155   - title: 'Functions', xtype: 'tabpanel', //iconCls: 'tabs',
  156 + title: 'Math', xtype: 'tabpanel', //iconCls: 'tabs',
  157 + enableTabScroll: true, tabPosition: 'bottom',
  158 + defaults: {frame: true, border: false, plain: true, layout: 'column', autoScroll: true},
  159 + activeTab: 0,
  160 + id: 'calc_tab_math_id'
  161 + },
  162 + {
  163 + title: 'Statistics', xtype: 'tabpanel', //iconCls: 'tabs',
  164 + enableTabScroll: true, tabPosition: 'bottom',
  165 + defaults: {frame: true, border: false, plain: true, layout: 'column', autoScroll: true},
  166 + activeTab: 0,
  167 + id: 'calc_tab_stat_id'
  168 + },
  169 + {
  170 + title: 'Space', xtype: 'tabpanel', //iconCls: 'tabs',
156 171 enableTabScroll: true, tabPosition: 'bottom',
157 172 defaults: {frame: true, border: false, plain: true, layout: 'column', autoScroll: true},
158 173 activeTab: 0,
159 174 id: 'calc_tab_func_id'
160   - }]
  175 + }
  176 + ]
161 177 };
162 178 },
163 179  
... ... @@ -180,7 +196,6 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
180 196 }, this);
181 197 } else {
182 198 if ( currentBtn.initialConfig.prompt_param != "" ) {
183   - console.log(currentBtn.initialConfig);
184 199 Ext.Msg.alert('Input Parameters', currentBtn.initialConfig.prompt_param);
185 200 }
186 201 this.processFormula(sel, currentBtn, params, ")");
... ... @@ -361,16 +376,28 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
361 376 return btns;
362 377 },
363 378  
364   - createAllFunctionBtns: function ()
365   - {
366   - this.createFunctionBtns('MathFunctions', 'Simple Maths');
367   - this.createFunctionBtns('VectorFunctions', 'Vector Functions');
368   - this.createFunctionBtns('TimeFunctions', 'Statistics');
369   - this.createFunctionBtns('FunctionsSliding', 'Statistics/Sliding');
370   - this.createFunctionBtns('PhysicsFunctions', 'Physics');
371   - this.createFunctionBtns('AmdaFunctions', 'Special');
  379 + createAllBtns: function ()
  380 + {
  381 + // group math
  382 + amdaUI.CalculatorUI.functionStore.filter('group', 'math');
  383 + this.createFunctionBtns('MathFunctions', 'Simple Maths','#calc_tab_math_id');
  384 + this.createFunctionBtns('VectorFunctions', 'Vector Functions', '#calc_tab_math_id');
  385 + amdaUI.CalculatorUI.functionStore.clearFilter();
  386 +
  387 + // group space
  388 + amdaUI.CalculatorUI.functionStore.filter('group', 'space');
  389 + this.createFunctionBtns('PhysicsFunctions', 'Derived', '#calc_tab_func_id');
  390 + this.createFunctionBtns('ModelFunctions', 'Models', '#calc_tab_func_id');
  391 + this.createFunctionBtns('AmdaFunctions', 'TimeShift', '#calc_tab_func_id');
  392 + amdaUI.CalculatorUI.functionStore.clearFilter();
  393 +
  394 + // group stat
  395 + amdaUI.CalculatorUI.functionStore.filter('group', 'stat');
  396 + this.createFunctionBtns('TimeFunctions', 'Statistics', '#calc_tab_stat_id');
  397 + this.createFunctionBtns('FunctionsSliding', 'Statistics/Sliding','#calc_tab_stat_id');
  398 + amdaUI.CalculatorUI.functionStore.clearFilter();
372 399 },
373   -
  400 +
374 401 createAllConstantBtns: function ()
375 402 {
376 403 this.createConstantBtns('Space', 'Planets Constants');
... ... @@ -431,9 +458,9 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
431 458 amdaUI.CalculatorUI.constantStore.clearFilter();
432 459 },
433 460  
434   - createFunctionBtns: function (item, tabTitle)
  461 + createFunctionBtns: function (item, tabTitle, tabID)
435 462 {
436   - var funcTab = this.win.query('#calc_tab_func_id');
  463 + var funcTab = this.win.query(tabID);
437 464  
438 465 if (funcTab.length < 1)
439 466 return;
... ... @@ -449,16 +476,20 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
449 476 amdaUI.CalculatorUI.functionStore.filter('kind', 'amda');
450 477 break;
451 478 case 'TimeFunctions' :
452   - amdaUI.CalculatorUI.functionStore.filter('kind', 'time');
  479 + amdaUI.CalculatorUI.functionStore.filter('kind', 'time');
453 480 break;
454 481 case 'FunctionsSliding' :
455   - amdaUI.CalculatorUI.functionStore.filter('kind', 'sliding');
  482 + amdaUI.CalculatorUI.functionStore.filter('kind', 'sliding');
456 483 break;
457 484 case 'VectorFunctions' :
458   - amdaUI.CalculatorUI.functionStore.filter('kind', 'vector');
  485 + amdaUI.CalculatorUI.functionStore.filter('kind', 'vector');
459 486 break;
  487 + case 'ModelFunctions' :
  488 + amdaUI.CalculatorUI.functionStore.filter('kind', 'model');
  489 + width = .45;
  490 + break;
460 491 case 'PhysicsFunctions' :
461   - amdaUI.CalculatorUI.functionStore.filter('kind', 'physics');
  492 + amdaUI.CalculatorUI.functionStore.filter('kind', 'physics');
462 493 width = .25;
463 494 break;
464 495 }
... ... @@ -469,6 +500,7 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
469 500 defaults: {xtype: 'button', columnWidth: width}
470 501 });
471 502  
  503 +
472 504 amdaUI.CalculatorUI.functionStore.each(function (f) {
473 505 crtTab.add(
474 506 {
... ... @@ -494,8 +526,8 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
494 526 params = b.initialConfig.defaultArgs.split(',');
495 527 }
496 528 // Formula Parsing for arguments
497   - //var params = this.parseArgsInFormula(selectedText, 0);
498   -// var params = selectedText ? selectedText.split(',') : [];
  529 +// var params = this.parseArgsInFormula(selectedText, 0);
  530 +// var params = selectedText ? selectedText.split(',') : [];
499 531  
500 532 if (params === -1) {
501 533 Ext.Msg.alert("Invalid Selection", "Action aborted");
... ... @@ -533,8 +565,8 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
533 565 },
534 566 this
535 567 );
536   - //clear filter
537   - amdaUI.CalculatorUI.functionStore.clearFilter();
  568 + //clear filter
  569 + amdaUI.CalculatorUI.functionStore.clearFilter();
538 570 },
539 571  
540 572 getItems: function (item)
... ...