mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
wooferTweeterReconstructor.hpp
1#ifndef __wooferTweeterReconstructor_hpp__
2#define __wooferTweeterReconstructor_hpp__
3
4#pragma GCC system_header
5#include <Eigen/Dense>
6
7#include "wooferTweeterDM.hpp"
8
9namespace mx
10{
11namespace AO
12{
13namespace sim
14{
15
16template <typename wooferReconT, typename tweeterReconT>
17struct wooferTweeterReconstructorSpec
18{
19 typename wooferReconT::specT woofer;
20 typename tweeterReconT::specT tweeter;
21};
22
23template <typename wooferReconT, typename tweeterReconT>
24class wooferTweeterReconstructor
25{
26 public:
27 typedef typename wooferReconT::floatT floatT;
28
29 /// The type of the measurement (i.e. the slope vector)
30 // typedef wooferTweeterCommand<floatT> measurementT;
31
32 /// The type of the WFS image
33 typedef Eigen::Array<floatT, -1, -1> imageT;
34
35 typedef wooferTweeterReconstructorSpec<wooferReconT, tweeterReconT> specT;
36
37 wooferReconT _woofer;
38 tweeterReconT _tweeter;
39
40 public:
41 /// Default c'tor
42 wooferTweeterReconstructor();
43
44 template <typename AOSysT>
45 void initialize( AOSysT &AOSys, specT &spec )
46 {
47 _woofer.initialize( AOSys, spec.woofer );
48 _tweeter.initialize( AOSys, spec.tweeter );
49 }
50
51 /// Get the calibration amplitude used in response matrix acquisition (_calAmp)
52 std::vector<floatT> calAmp();
53
54#if 0
55 ///Calculate the slope measurement
56 /**
57 * \param slopes [out] a (_measurementSize X 2) array of slopes
58 * \param wfsImage [in] the WFS image from which to measure the slopes
59 */
60 void calcMeasurement(measurementT & slopes, imageT & wfsImage);
61#endif
62
63 /// Reconstruct the wavefront from the input image, producing the modal amplitude vector
64 template <typename measurementT, typename wfsImageT>
65 void reconstruct( measurementT &commandVect, wfsImageT &wfsImage );
66
67#if 0
68 ///Initialize the response matrix for acquisition
69 /**
70 * \param nmodes the number of modes
71 * \param calamp the calibration amplitude
72 * \param detrows the number of detector rows
73 * \param detcols the number of detector columns
74 */
75 void initializeRMat(int nmodes, floatT calamp, int detrows,int detcols);
76
77 ///Accumalte the next measurement in the response matrix
78 /**
79 * \param i the measurement index
80 * \param measureVec is the i-th measurement vector
81 */
82 void accumulateRMat(int i, measurementT &measureVec);
83 void accumulateRMat(int i, measurementT &measureVec, imageT & wfsImage);
84
85 ///Write the accumulated response matrix to disk
86 /**
87 * \param fname the name, including path, of the response matrix
88 */
89 void saveRMat(std::string fname);
90
91 void saveRImages(std::string fname);
92
93#endif
94};
95
96template <typename wooferReconT, typename tweeterReconT>
97wooferTweeterReconstructor<wooferReconT, tweeterReconT>::wooferTweeterReconstructor()
98{
99}
100
101template <typename wooferReconT, typename tweeterReconT>
102std::vector<typename wooferReconT::floatT> wooferTweeterReconstructor<wooferReconT, tweeterReconT>::calAmp()
103{
104 std::vector<typename wooferReconT::floatT> ca( 2 );
105
106 ca[0] = _woofer.calAmp();
107 ca[1] = _tweeter.calAmp();
108
109 return ca;
110}
111
112#if 0
113template< typename wooferReconT, typename tweeterReconT >
114void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::calcMeasurement(measurementT & slopes, imageT & wfsImage)
115{
116}
117#endif
118
119template <typename wooferReconT, typename tweeterReconT>
120template <typename measurementT, typename wfsImageT>
121void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::reconstruct( measurementT &commandVect,
122 wfsImageT &wfsImage )
123{
124 measurementT woofV;
125 _woofer.reconstruct( woofV, wfsImage );
126
127 measurementT tweetV;
128 _tweeter.reconstruct( tweetV, wfsImage );
129
130 commandVect.measurement.resize( 1, woofV.measurement.cols() + tweetV.measurement.cols() );
131
132 for( int i = 0; i < woofV.measurement.cols(); ++i )
133 {
134 commandVect.measurement( 0, i ) = woofV.measurement( 0, i );
135 }
136
137 for( int i = 0; i < tweetV.measurement.cols(); ++i )
138 {
139 commandVect.measurement( 0, woofV.measurement.cols() + i ) = tweetV.measurement( 0, i );
140 }
141}
142
143#if 0
144template< typename wooferReconT, typename tweeterReconT >
145void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::initializeRMat(int nModes, floatT calamp, int detRows, int detCols)
146{
147}
148
149template< typename wooferReconT, typename tweeterReconT >
150void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::accumulateRMat(int i, measurementT &measureVec)
151{
152
153}
154
155template< typename wooferReconT, typename tweeterReconT >
156void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::accumulateRMat(int i, measurementT &measureVec, imageT & wfsImage)
157{
158
159}
160
161template< typename wooferReconT, typename tweeterReconT >
162void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::saveRMat(std::string fname)
163{
164
165}
166
167template< typename wooferReconT, typename tweeterReconT >
168void wooferTweeterReconstructor<wooferReconT, tweeterReconT>::saveRImages(std::string fname)
169{
170}
171#endif
172
173} // namespace sim
174} // namespace AO
175} // namespace mx
176
177#endif //__wooferTweeterReconstructor_hpp__
The mxlib c++ namespace.
Definition mxError.hpp:106