8 #ifndef _wooferTweeterDM_hpp__
9 #define _wooferTweeterDM_hpp__
22 struct wooferTweeterDMSpec
25 std::string basisName;
27 deformableMirrorSpec woofer;
28 deformableMirrorSpec tweeter;
48 template<
typename _
floatT>
53 typedef _floatT floatT;
55 typedef std::complex<floatT> complexT;
58 typedef wavefront<floatT> wavefrontT;
61 typedef Eigen::Array< floatT, Eigen::Dynamic, Eigen::Dynamic> imageT;
63 typedef wooferTweeterDMSpec specT;
68 deformableMirror<floatT> woofer;
69 deformableMirror<floatT> tweeter;
74 std::string _basisName;
81 int initialize( specT & spec,
82 const std::string & pupil);
88 void calAmp(floatT ca);
90 void applyMode( wavefrontT & wf,
95 template<
typename commandT>
96 void setShape( commandT & commandV );
98 void applyShape(wavefrontT & wf, floatT lambda);
102 return woofer.nModes() + tweeter.nModes();
105 double t0, t1, t_mm, t_sum;
107 std::string name() {
return _name;}
108 std::string basisName() {
return _basisName;}
113 template<
typename _
floatT>
114 wooferTweeterDM<_floatT>::wooferTweeterDM()
116 ds9_interface_set_title(&woofer.ds9i_shape,
"Woofer_Shape");
117 ds9_interface_set_title(&woofer.ds9i_phase,
"Woofer_Phase");
118 ds9_interface_set_title(&woofer.ds9i_acts,
"Woofer_Acts");
119 ds9_interface_set_title(&tweeter.ds9i_shape,
"Tweeter_Shape");
120 ds9_interface_set_title(&tweeter.ds9i_phase,
"Tweeter_Phase");
121 ds9_interface_set_title(&tweeter.ds9i_acts,
"Tweeter_Acts");
127 template<
typename _
floatT>
128 int wooferTweeterDM<_floatT>::initialize( specT & spec,
129 const std::string & pupil )
133 _basisName = spec.basisName;
135 woofer.initialize(spec.woofer, pupil);
137 tweeter.initialize(spec.tweeter, pupil);
139 _wooferModes = spec.wooferModes;
153 template<
typename _
floatT>
154 void wooferTweeterDM<_floatT>::calAmp(_floatT ca)
161 template<
typename _
floatT>
162 void wooferTweeterDM<_floatT>::applyMode( wavefrontT & wf,
168 if(modeNo < _wooferModes)
170 woofer.applyMode(wf, modeNo, amp, lambda);
174 tweeter.applyMode(wf, modeNo - _wooferModes, amp, lambda);
179 template<
typename _
floatT>
180 template<
typename commandT>
181 void wooferTweeterDM<_floatT>::setShape( commandT & commandV )
184 static commandT avgWoofV;
186 commandT woofV, tweetV;
189 woofV.measurement = commandV.measurement.block(0, 0, 1, _wooferModes);
190 woofV.iterNo = commandV.iterNo;
196 tweetV.measurement = commandV.measurement.block(0, _wooferModes, 1,commandV.measurement.cols()-_wooferModes);
197 tweetV.iterNo = commandV.iterNo;
201 woofer.setShape(woofV);
219 tweeter.setShape(tweetV);
242 template<
typename _
floatT>
243 void wooferTweeterDM<_floatT>::applyShape(wavefrontT & wf, floatT lambda)
246 woofer.applyShape(wf, lambda);
247 tweeter.applyShape(wf, lambda);