8#ifndef _wooferTweeterDM_hpp__
9#define _wooferTweeterDM_hpp__
22struct wooferTweeterDMSpec
25 std::string basisName;
27 deformableMirrorSpec woofer;
28 deformableMirrorSpec tweeter;
48template <
typename _
floatT>
52 typedef _floatT floatT;
54 typedef std::complex<floatT> complexT;
57 typedef wavefront<floatT> wavefrontT;
60 typedef Eigen::Array<floatT, Eigen::Dynamic, Eigen::Dynamic> imageT;
62 typedef wooferTweeterDMSpec specT;
67 deformableMirror<floatT> woofer;
68 deformableMirror<floatT> tweeter;
73 std::string _basisName;
79 int initialize( specT &spec,
const std::string &pupil );
83 void calAmp( floatT ca );
85 void applyMode( wavefrontT &wf,
int modeNo, floatT amp, floatT lambda );
87 template <
typename commandT>
88 void setShape( commandT &commandV );
90 void applyShape( wavefrontT &wf, floatT lambda );
94 return woofer.nModes() + tweeter.nModes();
97 double t0, t1, t_mm, t_sum;
103 std::string basisName()
109template <
typename _
floatT>
110wooferTweeterDM<_floatT>::wooferTweeterDM()
112 ds9_interface_set_title( &woofer.ds9i_shape,
"Woofer_Shape" );
113 ds9_interface_set_title( &woofer.ds9i_phase,
"Woofer_Phase" );
114 ds9_interface_set_title( &woofer.ds9i_acts,
"Woofer_Acts" );
115 ds9_interface_set_title( &tweeter.ds9i_shape,
"Tweeter_Shape" );
116 ds9_interface_set_title( &tweeter.ds9i_phase,
"Tweeter_Phase" );
117 ds9_interface_set_title( &tweeter.ds9i_acts,
"Tweeter_Acts" );
123template <
typename _
floatT>
124int wooferTweeterDM<_floatT>::initialize( specT &spec,
const std::string &pupil )
128 _basisName = spec.basisName;
130 woofer.initialize( spec.woofer, pupil );
132 tweeter.initialize( spec.tweeter, pupil );
134 _wooferModes = spec.wooferModes;
144template <
typename _
floatT>
145void wooferTweeterDM<_floatT>::calAmp( _floatT ca )
148 tweeter.calAmp( ca );
151template <
typename _
floatT>
152void wooferTweeterDM<_floatT>::applyMode( wavefrontT &wf,
int modeNo, floatT amp, floatT lambda )
155 if( modeNo < _wooferModes )
157 woofer.applyMode( wf, modeNo, amp, lambda );
161 tweeter.applyMode( wf, modeNo - _wooferModes, amp, lambda );
165template <
typename _
floatT>
166template <
typename commandT>
167void wooferTweeterDM<_floatT>::setShape( commandT &commandV )
170 static commandT avgWoofV;
172 commandT woofV, tweetV;
175 woofV.measurement = commandV.measurement.block( 0, 0, 1, _wooferModes );
176 woofV.iterNo = commandV.iterNo;
182 tweetV.measurement = commandV.measurement.block( 0, _wooferModes, 1, commandV.measurement.cols() - _wooferModes );
183 tweetV.iterNo = commandV.iterNo;
187 woofer.setShape( woofV );
204 tweeter.setShape( tweetV );
224template <
typename _
floatT>
225void wooferTweeterDM<_floatT>::applyShape( wavefrontT &wf, floatT lambda )
228 woofer.applyShape( wf, lambda );
229 tweeter.applyShape( wf, lambda );