Commit 58bbf53c8e376a2261ef90369dbae66234771408

Authored by Benjamin Renard
2 parents 524e472e c03f1231

Merge branch 'master' into amdadev

config/xsd/parser/plugins.xml 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<plugins xml:id="plugins"><requestProcess type="paramGet" name="CONSTANT"><plugin>./../build/Debug/plugin//libConstantInterface.so</plugin></requestProcess><requestProcess type="paramGet" name="DDBASE"><plugin>./../build/Debug/plugin//libDDServerInterface.so</plugin></requestProcess><requestProcess type="paramGet" name="LOCALFILE"><plugin>./../build/Debug/plugin//libLocalFileInterface.so</plugin></requestProcess><requestProcess type="paramOutputs" name="dataMining"><plugin>./../build/Debug/plugin//libParamOutputDataMiningImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="download"><plugin>./../build/Debug/plugin//libParamOutputImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="intervalTrue"><plugin>./../build/Debug/plugin//libParamOutputIntervalTrueImpl.so</plugin></requestProcess><requestProcess type="paramOutputs" name="plot"><plugin>./../build/Debug/plugin//libPlot.so</plugin></requestProcess><requestProcess type="paramOutputs" name="statistic"><plugin>./../build/Debug/plugin//libParamOutputStatisticImpl.so</plugin></requestProcess><requestProcess type="process" name="bowshock"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="bowshock_farris"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="boxcar"><plugin>./../build/Debug/plugin//libBoxcar.so</plugin></requestProcess><requestProcess type="process" name="circle"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="deriv"><plugin>./../build/Debug/plugin//libDeriv.so</plugin></requestProcess><requestProcess type="process" name="energy_bounds"><plugin>./../build/Debug/plugin//libEnergy_Bounds.so</plugin></requestProcess><requestProcess type="process" name="framesTransformation"><plugin>./../build/Debug/plugin//libFramesTransformation.so</plugin></requestProcess><requestProcess type="process" name="getClbInfo"><plugin>./../build/Debug/plugin//libGetClbInfo.so</plugin></requestProcess><requestProcess type="process" name="getClbInfoByIndex"><plugin>./../build/Debug/plugin//libGetClbInfoByIndex.so</plugin></requestProcess><requestProcess type="process" name="getJunoJediUpperEnergy"><plugin>./../build/Debug/plugin//libGetJunoJediEnergy.so</plugin></requestProcess><requestProcess type="process" name="getMavenStaticEnergy"><plugin>./../build/Debug/plugin//libGetMavenStaticEnergy.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bcart"><plugin>./../build/Debug/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bmag"><plugin>./../build/Debug/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_JRM09_CAN81_bsphr"><plugin>./../build/Debug/plugin//libJupeter_JRM09_CAN_81Process.so</plugin></requestProcess><requestProcess type="process" name="jupiter_bowshock_high"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_bowshock_low"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_magnetopause_high"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="jupiter_magnetopause_low"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="magnetopause_shue"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_bowshock"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_bowshock_hall"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mars_magnetopause"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="max"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="max_sm"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="median"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="mercury_bowshock"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="mercury_magnetopause"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="merge"><plugin>./../build/Debug/plugin//libMerge.so</plugin></requestProcess><requestProcess type="process" name="mex_els_decode"><plugin>./../build/Debug/plugin//libmexvex_els_decode.so</plugin></requestProcess><requestProcess type="process" name="min"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="min_sm"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="morschhauser_bfield"><plugin>./../build/Debug/plugin//libMorschhauserProcess.so</plugin></requestProcess><requestProcess type="process" name="morschhauser_bmag"><plugin>./../build/Debug/plugin//libMorschhauserProcess.so</plugin></requestProcess><requestProcess type="process" name="rms"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="rms_sm"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="sampling_classic"><plugin>./../build/Debug/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="sampling_under_refparam"><plugin>./../build/Debug/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="saturn_bowshock_went"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="saturn_magnetopause"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="skew"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="skew_sm"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="sliding_average"><plugin>./../build/Debug/plugin//libSlidingAverage.so</plugin></requestProcess><requestProcess type="process" name="standard"><plugin>./../build/Debug/plugin//libInternLib.so</plugin></requestProcess><requestProcess type="process" name="sum_into_table_indexes"><plugin>./../build/Debug/plugin//libsum_into_table_indexes.so</plugin></requestProcess><requestProcess type="process" name="sum_into_table_range"><plugin>./../build/Debug/plugin//libsum_into_table_range.so</plugin></requestProcess><requestProcess type="process" name="tilt_angle"><plugin>./../build/Debug/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="timeShift"><plugin>./../build/Debug/plugin//libTime_Shifted.so</plugin></requestProcess><requestProcess type="process" name="tsyganenko_96"><plugin>./../build/Debug/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="tsyganenko_96_gse"><plugin>./../build/Debug/plugin//libtsyganenko96.so</plugin></requestProcess><requestProcess type="process" name="ttcat_to_param"><plugin>./../build/Debug/plugin//libTTCatToParam.so</plugin></requestProcess><requestProcess type="process" name="var"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="var_sm"><plugin>./../build/Debug/plugin//libStatisticFunctions.so</plugin></requestProcess><requestProcess type="process" name="venus_bowshock"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="venus_magnetopause"><plugin>./../build/Debug/plugin//libPlot_Curves.so</plugin></requestProcess><requestProcess type="process" name="vex_els_decode"><plugin>./../build/Debug/plugin//libmexvex_els_decode.so</plugin></requestProcess><requestProcess type="statisticProcess" name="RMS"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="count"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="countNotNan"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="countTrue"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="kurtosis"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="max"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="mean"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="median"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="min"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="minvar"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="skewness"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess><requestProcess type="statisticProcess" name="variance"><plugin>./../build/Debug/plugin//libStatisticProcesses.so</plugin></requestProcess></plugins>
... ...
config/xsd/request/plot.xsd
... ... @@ -873,6 +873,17 @@ Note : This attribute may be unecessary since kind of line may be deduce from Pl
873 873 <xs:attribute name="min" type="xs:double" use="optional"></xs:attribute>
874 874 <xs:attribute name="max" type="xs:double" use="optional"></xs:attribute>
875 875 <xs:attribute name="uselog0asmin" type="xs:boolean" use="optional"></xs:attribute>
  876 +
  877 + <xs:attribute name="normalization">
  878 + <xs:simpleType>
  879 + <xs:restriction base="xs:string">
  880 + <xs:enumeration value="none"></xs:enumeration>
  881 + <xs:enumeration value="log"></xs:enumeration>
  882 + <xs:enumeration value="linear"></xs:enumeration>
  883 + </xs:restriction>
  884 + </xs:simpleType>
  885 + </xs:attribute>
  886 +
876 887 </xs:complexType>
877 888  
878 889 <xs:complexType name="ParameterColorSeriePropertiesType">
... ...
src/ExternLib/Maglib/Posmag.hh
... ... @@ -73,7 +73,7 @@ namespace AMDA {
73 73 struct tm *tmp;
74 74 tmp = gmtime(&timestamp);
75 75 double rrmag = std::sqrt(in[0]*in[0]+in[1]*in[1]+in[2]*in[2]);
76   - double thetr = std::acos(in[3]/rrmag);
  76 + double thetr = std::acos(in[2]/rrmag);
77 77 double phir = std::atan2(in[1] , in[0]);
78 78  
79 79  
... ... @@ -141,7 +141,6 @@ namespace AMDA {
141 141 double tgl = 1.0;
142 142 int ifail=10;
143 143  
144   -
145 144 maglib::maglibWarpper::getPosmag(1900 + tmp->tm_year, 1 + tmp->tm_mon, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec,
146 145 rrmag, thetr, phir,
147 146 _isatex, _magout,
... ...
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... ... @@ -2912,7 +2912,7 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2912 2912 }
2913 2913 }
2914 2914 }
2915   -
  2915 +
2916 2916 //Add used parameter to parameters list
2917 2917 if (std::find (usedParametersId_.begin(),usedParametersId_.end(),usedParam->getId()) == usedParametersId_.end())
2918 2918 usedParametersId_.push_back(usedParam->getId());
... ... @@ -2925,6 +2925,7 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2925 2925 if (std::find (usedParametersId_.begin(),usedParametersId_.end(),tableParamId) == usedParametersId_.end())
2926 2926 usedParametersId_.push_back(tableParamId);
2927 2927 }
  2928 +
2928 2929 }
2929 2930  
2930 2931 //For intervals if defined
... ...
src/ParamOutputImpl/Plot/SpectroNode.hh
... ... @@ -80,8 +80,14 @@ public:
80 80 spectroPropsPtr->setUseLog0AsMin(uselog0asmin);
81 81 xmlFree(value);
82 82 }
  83 +
  84 + // normalization
  85 + value = xmlGetProp(pNode_, (const xmlChar*) "normalization");
  86 + if (value) {
  87 + spectroPropsPtr->setNormalization((const char*) value);
  88 + xmlFree(value);
  89 + }
83 90  
84   -
85 91 // add spectro definition to parameter
86 92 plotOutput->getParameter((const char*)name).addSpectroProperties(spectroPropsPtr);
87 93 }
... ...
src/ParamOutputImpl/Plot/SpectroProperties.hh
... ... @@ -15,7 +15,7 @@
15 15 #include "DrawingProperties.hh"
16 16  
17 17 namespace plot {
18   -
  18 +
19 19 /**
20 20 * Drawing properties for a parameter spectro.
21 21 */
... ... @@ -152,6 +152,15 @@ public:
152 152 {
153 153 _useLog0AsMin = useLog0AsMin;
154 154 }
  155 +
  156 + std::string getNormalization(){
  157 + return _normalization;
  158 +
  159 + }
  160 +
  161 + void setNormalization(std::string normalization){
  162 + _normalization = normalization;
  163 + }
155 164  
156 165 private:
157 166 /**
... ... @@ -198,6 +207,10 @@ private:
198 207 * @brief Flag to know if 0 values must shown as Min Values in log. scale
199 208 */
200 209 bool _useLog0AsMin;
  210 +
  211 + std::string _normalization;
  212 +
  213 +
201 214 };
202 215  
203 216 } /* namespace plot */
... ...
src/ParamOutputImpl/Plot/Time/TimePlot.cc
... ... @@ -17,6 +17,8 @@
17 17 #include "ShadesTools.hh"
18 18 #include "AxisLegendManager.hh"
19 19 #include <fstream>
  20 +#include <limits>
  21 +#include <cstddef>
20 22  
21 23 #include "DefaultTimeAxisDecorator.hh"
22 24 #include "TickMarkDecorator.hh"
... ... @@ -367,8 +369,13 @@ void TimePlot::configureSpectroAxis() {
367 369 Range lParamRange = lZAxis->Axis::getRange();
368 370 if (isnan(lParamRange.getMin()) && isnan(lParamRange.getMax()))
369 371 {
370   - //auto range
371   - for(auto index : spectroPropertiesPtr->getIndexes()) {
  372 + std::string normalization = spectroPropertiesPtr->getNormalization();
  373 + if(normalization == "log" || normalization == "linear" ){
  374 + lParamRange.setMin(0);
  375 + lParamRange.setMax(1);
  376 + }else{
  377 + //auto range
  378 + for(auto index : spectroPropertiesPtr->getIndexes()) {
372 379 //compute global range for all indexes
373 380 double minVal, maxVal;
374 381 if (lZAxis->_scale == Axis::Scale::LOGARITHMIC)
... ... @@ -389,6 +396,7 @@ void TimePlot::configureSpectroAxis() {
389 396 lParamRange.setMin(0);
390 397 if (isnan(lParamRange.getMax()))
391 398 lParamRange.setMax(10);
  399 + }
392 400 }
393 401 else
394 402 lParamRange._extend = false;
... ... @@ -961,7 +969,7 @@ void TimePlot::drawSpectro(double startDate, double stopDate, std::string pParam
961 969 continue;
962 970 }
963 971 }
964   -
  972 +
965 973 for (int i = 0; i < nbValues - 1; ++i)
966 974 {
967 975 part.x[0] = data.getTimes()[startIndex+i];
... ... @@ -973,6 +981,9 @@ void TimePlot::drawSpectro(double startDate, double stopDate, std::string pParam
973 981  
974 982 //draw spectro
975 983 LOG4CXX_DEBUG(gLogger, "TimePlot::drawSpectro - Draw data grid - " << matrixGrid.size());
  984 + std::string normalization = pSpectro.getNormalization();
  985 + if (!normalization.empty())
  986 + normalize(matrixGrid, normalization);
976 987 drawMatrix(matrixGrid, pSpectro.getMin(), pSpectro.getMax(),
977 988 minValColor, maxValColor, lZAxis->_color._colorMapIndex, pSpectro.getUseLog0AsMin());
978 989 matrixGrid.clear();
... ... @@ -1036,12 +1047,60 @@ void TimePlot::drawSpectro(double startDate, double stopDate, std::string pParam
1036 1047 }
1037 1048 //draw spectro
1038 1049 LOG4CXX_DEBUG(gLogger, "TimePlot::drawSpectro - Draw data grid - " << matrixGrid.size());
  1050 + std::string normalization = pSpectro.getNormalization();
  1051 + if (!normalization.empty())
  1052 + normalize(matrixGrid, normalization);
  1053 +
1039 1054 drawMatrix(matrixGrid, pSpectro.getMin(), pSpectro.getMax(),
1040 1055 minValColor, maxValColor, lZAxis->_color._colorMapIndex, pSpectro.getUseLog0AsMin());
1041 1056 matrixGrid.clear();
1042 1057 }
1043 1058 }
1044 1059 }
  1060 +void TimePlot::normalize(MatrixGrid & matrixGrid, std::string normalizationType){
  1061 + if(normalizationType == "none")
  1062 + return;
  1063 + double min = DBL_MAX;
  1064 + double max = DBL_MIN;
  1065 + int len = matrixGrid.size();
  1066 + if(normalizationType == "log"){
  1067 + for(auto val :matrixGrid){
  1068 + if(val.value <min && val.value > 0 )
  1069 + min = val.value;
  1070 + if(val.value > max)
  1071 + max = val.value;
  1072 + }
  1073 + }else{
  1074 + for(auto val :matrixGrid){
  1075 + if(val.value <min)
  1076 + min = val.value;
  1077 + if(val.value > max)
  1078 + max = val.value;
  1079 + }
  1080 + }
  1081 + if(std::isnan(min) || std::isnan(max)){
  1082 + return;
  1083 + }else if(min == max){
  1084 + for (int i =0; i < len; i++)
  1085 + matrixGrid[i].value= matrixGrid[i].value/max;
  1086 + }else{
  1087 + if(normalizationType == "log"){
  1088 + for (int i =0; i < len; i++)
  1089 + matrixGrid[i].value = (std::log10(matrixGrid[i].value)-std::log10(min))/(std::log10(max)-std::log10(min));
  1090 + return;
  1091 + }else if (normalizationType == "linear"){
  1092 + for (int i =0; i < len; i++)
  1093 + matrixGrid[i].value = (matrixGrid[i].value-min)/(max-min);
  1094 + return;
  1095 + }else{
  1096 + std::stringstream lError;
  1097 + lError << "Unknwon normalization " << normalizationType;
  1098 + BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
  1099 + }
  1100 +
  1101 + }
  1102 +
  1103 +}
1045 1104  
1046 1105 Color TimePlot::getStatusColor(AMDA::Info::ParamInfoSPtr& paramInfo, double value) {
1047 1106 Color color;
... ...
src/ParamOutputImpl/Plot/Time/TimePlot.hh
... ... @@ -68,6 +68,8 @@ public:
68 68 std::shared_ptr<TimeAxisDecorator> getTimeAxisDecorator(){
69 69 return _xdecoratorPtr;
70 70 }
  71 +
  72 + void normalize(MatrixGrid & matrixGrid, std::string normalizationType);
71 73  
72 74 /**
73 75 * @brief QSAS time configuration for time formatting
... ...
src/Parameters/Parameter.hh
... ... @@ -203,7 +203,7 @@ namespace AMDA {
203 203 double getTimeRestriction() {
204 204 return _timeRestriction;
205 205 }
206   -
  206 +
207 207 protected:
208 208  
209 209 typedef std::map<DataClient *, ParamInterval*> DataClientList;
... ...