diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d4d7d9..b3d76ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") add_subdirectory(src/ExternLib/SlidingAverage) add_subdirectory(src/ExternLib/Merge) add_subdirectory(src/ExternLib/els_calculate) + add_subdirectory(src/ExternLib/mexvex_els_decode) + add_subdirectory(src/ExternLib/mexvex_els_calculate) add_subdirectory(src/ExternLib/PlotCurves) add_subdirectory(src/ExternLib/StatisticProcesses) add_subdirectory(src/ExternLib/FramesTransformation) diff --git a/src/ExternLib/GetClbInfo/GetClbInfo.hh b/src/ExternLib/GetClbInfo/GetClbInfo.hh index 578f295..bf9528b 100644 --- a/src/ExternLib/GetClbInfo/GetClbInfo.hh +++ b/src/ExternLib/GetClbInfo/GetClbInfo.hh @@ -69,7 +69,7 @@ public: * @details Create the ParamData type of the input ParamData. */ GetClbInfo(Process& pProcess, TParamData& paramInput) - : Base::GetClbInfo(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DDouble()) { + : Base::GetClbInfo(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DDouble()), _maxSize(0) { _paramDataOutput=_paramOutput; } @@ -92,6 +92,7 @@ public: BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("GetClbInfo calibration info: '") + fields[1] + "' not found.")); } _calibrationInfoList[atoi(fields[0].c_str())]=lIt->second.get(); + _maxSize = std::max(_maxSize, (int)_calibrationInfoList[atoi(fields[0].c_str())]->size()); } } @@ -102,7 +103,19 @@ public: unsigned int index = pParamDataIndexInfo._startIndex; for (; index< pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) { _paramOutput->pushTime(_paramInput.getTime(index)); - _paramOutput->getDataList().push_back(*(_calibrationInfoList[(int)floor(_paramInput.getDataList()[index])])); + + float value = _paramInput.getDataList()[index]; + Parameter::InfoValues* info = _calibrationInfoList[(int)floor(value)]; + + std::vector calib; + calib.resize(_maxSize, std::nan("")); + int i = 0; + for (std::vector::iterator it = info->begin(); it != info->end(); ++it) { + calib[i] = (*it); + ++i; + } + + _paramOutput->getDataList().push_back(calib); } } @@ -125,6 +138,8 @@ private: * the value of map is the value of attributes ImaEner[0] respectively and ImaEner[0] */ std::map _calibrationInfoList; + + int _maxSize; }; } /* namespace GetClbInfo */ diff --git a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh b/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh index 1263774..e7b239b 100644 --- a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh +++ b/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh @@ -75,23 +75,30 @@ public: } } } - + template void pushDataForMode1(Type& elt, int index) { _paramOutput->getDataList().push_back(elt); } - + template void pushDataForMode1(std::vector& elt, int index) { typename std::vector::const_iterator first = elt.begin() + 31 * index; typename std::vector::const_iterator last = elt.begin() + 31 * (index + 1); - std::vector splitVec(first, last); + std::vector splitVec; + splitVec.resize(128, std::nan("")); + + int i = 0; + for (typename std::vector::const_iterator it = first; it != last; ++it) { + splitVec[i] = (*it); + ++i; + } + _paramOutput->getDataList().push_back(splitVec); } template void pushDataForMode1(Tab2DData& elt, int index) { - Tab2DData newElt(elt.getDim1Size(),32); for(int i = 0; i < elt.getDim1Size(); ++i) { std::vector eltVector = elt[i].toVector(); diff --git a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.ben b/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.ben deleted file mode 100644 index a747581..0000000 --- a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.ben +++ /dev/null @@ -1,96 +0,0 @@ -/* - * MexVexElsDecode.hh - * - * Created on: Oct 13, 2016 - * Author: elena / benjamin - */ - -#ifndef MEXVEXELSDECODE_HH_ -#define MEXVEXELSDECODE_HH_ - -#include "Parameter.hh" -#include "ParamData.hh" -#include "DataTypeMath.hh" -#include "Operation.hh" - -namespace AMDA { -namespace Parameters { -namespace MexVexElsDecode { - -/** - * @class MexVexElsDecode - * @brief - * @details This class implement the interface Operation. - */ - -template -class MexVexElsDecode : public Operation { - -public: - /** - * @brief Constructor. - * @details Create the ParamData type of the input ParamData. - */ - MexVexElsDecode(Process& pProcess, ParamDataSpec >& paramInput) - : Operation(pProcess), - _paramInput(paramInput), - _paramOutput(new ParamDataSpec>()){ - _paramDataOutput=_paramOutput; - } - - virtual ~MexVexElsDecode() { - - } - - /** - * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) - */ - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - - ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); - ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); - - for (unsigned int _index = pParamDataIndexInfo._startIndex ; - _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; - ++_index) - { - double crtTime = _paramInput.getTime(_index); - std::vector inputElt = _paramInput.get(_index); - - int mode = (dynamic_cast(lModeParamInput))->get(_index); - - if (mode == 1) { - for (int i = 0; i < 4; ++i){ - typename std::vector::const_iterator first = inputElt.begin() + 31 * i; - typename std::vector::const_iterator last = inputElt.begin() + 31 * (i + 1); - std::vector splitVec(first, last); - _paramOutput->pushTime(crtTime+i); - _paramOutput->getDataList().push_back(splitVec); - } - } - else - { - _paramOutput->pushTime(crtTime); - _paramOutput->getDataList().push_back(inputElt); - } - } - } - - -private: - /**< - * @brief It is the channel of data derived - */ - ParamDataSpec > &_paramInput; - - /**< - * @brief It is the channel of the data derived - */ - ParamDataSpec> *_paramOutput; - -}; - -} /* namespace MexVexElsDecode */ -} /* namespace Parameters */ -} /* namespace AMDA */ -#endif /* MEXVEXELSDECODE_HH_ */ diff --git a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.my b/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.my deleted file mode 100644 index 26bcae8..0000000 --- a/src/ExternLib/mexvex_els_decode/MexVexElsDecode.hh.my +++ /dev/null @@ -1,165 +0,0 @@ -/* - * MexVexElsDecode.hh - * - * Created on: Oct 13, 2016 - * Author: elena / benjamin - */ - -#ifndef MEXVEXELSDECODE_HH_ -#define MEXVEXELSDECODE_HH_ - -#include "Parameter.hh" -#include "ParamData.hh" -#include "DataTypeMath.hh" -#include "Operation.hh" - -namespace AMDA { -namespace Parameters { -namespace MexVexElsDecode { - -/** - * @class MexVexElsDecode - * @brief - * @details This class implement the interface Operation. - */ - -template -class MexVexElsDecode : public Operation {}; - -template <> -class MexVexElsDecode : public Operation { - -public: - /** - * @brief Constructor. - * @details Create the ParamData type of the input ParamData. - */ - MexVexElsDecode(Process& pProcess, ParamDataTab1DFloat& paramInput) - : Operation(pProcess), - _paramInput(paramInput), - _paramOutput(new ParamDataTab1DFloat()){ - _paramDataOutput=_paramOutput; - } - - virtual ~MexVexElsDecode() { - - } - - /** - * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) - */ - - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - - ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); - ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); - - for (unsigned int _index = pParamDataIndexInfo._startIndex ; - _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; - ++_index) - { - double crtTime = _paramInput.getTime(_index); - std::vector inputElt = _paramInput.get(_index); - - int mode = (dynamic_cast(lModeParamInput))->get(_index); - - if (mode == 1) { - for (int i = 0; i < 4; ++i){ - std::vector::const_iterator first = inputElt.begin() + 31 * i; - std::vector::const_iterator last = inputElt.begin() + 31 * (i + 1); - std::vector splitVec(first, last); - _paramOutput->pushTime(crtTime+i); - _paramOutput->getDataList().push_back(splitVec); - } - } - else - { - _paramOutput->pushTime(crtTime); - _paramOutput->getDataList().push_back(inputElt); - } - } - } - - -private: - /**< - * @brief It is the channel of data derived - */ - ParamDataTab1DFloat &_paramInput; - - /**< - * @brief It is the channel of the data derived - */ - ParamDataTab1DFloat *_paramOutput; - -}; - -template <> -class MexVexElsDecode : public Operation { - -public: - /** - * @brief Constructor. - * @details Create the ParamData type of the input ParamData. - */ - MexVexElsDecode(Process& pProcess, ParamDataScalaireShort& paramInput) - : Operation(pProcess), - _paramInput(paramInput), - _paramOutput(new ParamDataScalaireShort()){ - _paramDataOutput=_paramOutput; - } - - virtual ~MexVexElsDecode() { - - } - - /** - * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) - */ - - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - - ParameterSPtr crtParam = _process.getParameterManager().getParameter("EnergyTable"); - ParamData* lModeParamInput = crtParam->getParamData(&_process).get(); - - - for (unsigned int _index = pParamDataIndexInfo._startIndex ; - _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; - ++_index) - { - double crtTime = _paramInput.getTime(_index); - short inputElt = _paramInput.get(_index); - short mode = (dynamic_cast(lModeParamInput))->get(_index); - - if (mode == 1) { - for (int i = 0; i < 4; ++i){ - _paramOutput->pushTime(crtTime+i); - _paramOutput->getDataList().push_back(inputElt); - } - } - else - { - _paramOutput->pushTime(crtTime); - _paramOutput->getDataList().push_back(inputElt); - } - } - } - - -private: - /**< - * @brief It is the channel of data derived - */ - ParamDataScalaireShort &_paramInput; - - /**< - * @brief It is the channel of the data derived - */ - ParamDataScalaireShort *_paramOutput; - -}; - -} /* namespace MexVexElsDecode */ -} /* namespace Parameters */ -} /* namespace AMDA */ -#endif /* MEXVEXELSDECODE_HH_ */ -- libgit2 0.21.2