1#ifndef __wooferTweeterReconstructor_hpp__
2#define __wooferTweeterReconstructor_hpp__
4#pragma GCC system_header
16template <
typename wooferReconT,
typename tweeterReconT>
17struct wooferTweeterReconstructorSpec
19 typename wooferReconT::specT woofer;
20 typename tweeterReconT::specT tweeter;
23template <
typename wooferReconT,
typename tweeterReconT>
24class wooferTweeterReconstructor
27 typedef typename wooferReconT::floatT floatT;
33 typedef Eigen::Array<floatT, -1, -1> imageT;
35 typedef wooferTweeterReconstructorSpec<wooferReconT, tweeterReconT> specT;
38 tweeterReconT _tweeter;
42 wooferTweeterReconstructor();
44 template <
typename AOSysT>
45 void initialize( AOSysT &AOSys, specT &spec )
47 _woofer.initialize( AOSys, spec.woofer );
48 _tweeter.initialize( AOSys, spec.tweeter );
52 std::vector<floatT> calAmp();
60 void calcMeasurement(measurementT & slopes, imageT & wfsImage);
64 template <
typename measurementT,
typename wfsImageT>
65 void reconstruct( measurementT &commandVect, wfsImageT &wfsImage );
75 void initializeRMat(
int nmodes, floatT calamp,
int detrows,
int detcols);
82 void accumulateRMat(
int i, measurementT &measureVec);
83 void accumulateRMat(
int i, measurementT &measureVec, imageT & wfsImage);
89 void saveRMat(std::string fname);
91 void saveRImages(std::string fname);
96template <
typename wooferReconT,
typename tweeterReconT>
97wooferTweeterReconstructor<wooferReconT, tweeterReconT>::wooferTweeterReconstructor()
101template <
typename wooferReconT,
typename tweeterReconT>
102std::vector<typename wooferReconT::floatT> wooferTweeterReconstructor<wooferReconT, tweeterReconT>::calAmp()
104 std::vector<typename wooferReconT::floatT> ca( 2 );
106 ca[0] = _woofer.calAmp();
107 ca[1] = _tweeter.calAmp();
113template<
typename wooferReconT,
typename tweeterReconT >
114void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::calcMeasurement(measurementT & slopes, imageT & wfsImage)
119template <
typename wooferReconT,
typename tweeterReconT>
120template <
typename measurementT,
typename wfsImageT>
121void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::reconstruct( measurementT &commandVect,
122 wfsImageT &wfsImage )
125 _woofer.reconstruct( woofV, wfsImage );
128 _tweeter.reconstruct( tweetV, wfsImage );
130 commandVect.measurement.resize( 1, woofV.measurement.cols() + tweetV.measurement.cols() );
132 for(
int i = 0; i < woofV.measurement.cols(); ++i )
134 commandVect.measurement( 0, i ) = woofV.measurement( 0, i );
137 for(
int i = 0; i < tweetV.measurement.cols(); ++i )
139 commandVect.measurement( 0, woofV.measurement.cols() + i ) = tweetV.measurement( 0, i );
144template<
typename wooferReconT,
typename tweeterReconT >
145void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::initializeRMat(
int nModes, floatT calamp,
int detRows,
int detCols)
149template<
typename wooferReconT,
typename tweeterReconT >
150void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::accumulateRMat(
int i, measurementT &measureVec)
155template<
typename wooferReconT,
typename tweeterReconT >
156void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::accumulateRMat(
int i, measurementT &measureVec, imageT & wfsImage)
161template<
typename wooferReconT,
typename tweeterReconT >
162void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::saveRMat(std::string fname)
167template<
typename wooferReconT,
typename tweeterReconT >
168void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::saveRImages(std::string fname)