Line data Source code
1 :
2 :
3 : #ifndef wavefront_hpp
4 : #define wavefront_hpp
5 :
6 : #pragma GCC system_header
7 : #include <Eigen/Dense>
8 :
9 : #include "../../wfp/imagingArray.hpp"
10 : #include "../../wfp/imagingUtils.hpp"
11 :
12 : namespace mx
13 : {
14 : namespace AO
15 : {
16 : namespace sim
17 : {
18 :
19 : /// Structure containing the phase and amplitude of a wavefront
20 : /** The phase and amplitude are stored separately in real valued arrays.
21 : */
22 : template <typename _realT>
23 : struct wavefront
24 : {
25 : /// The floating point type used for all calculations
26 : typedef _realT realT;
27 :
28 : /// The data type of the real image, used to hold the phase and amplitude
29 : typedef Eigen::Array<_realT, Eigen::Dynamic, Eigen::Dynamic> realImageT;
30 :
31 : /// The wavefront data type
32 : typedef improc::eigenImage<std::complex<realT>> complexAmplitudeT;
33 :
34 : /// The wavefront amplitude
35 : realImageT amplitude;
36 :
37 : /// The wavefront phase
38 : realImageT phase;
39 :
40 : /// The wavelength at which the wavefront is specified
41 : realT lambda;
42 :
43 : /// The iteration number of this wavefront
44 : realT iterNo;
45 :
46 : /// Zero the wavefront
47 0 : void setZero()
48 : {
49 0 : amplitude.setZero();
50 0 : phase.setZero();
51 0 : }
52 :
53 0 : void setAmplitude( const realImageT & )
54 : {
55 0 : amplitude = amp;
56 0 : }
57 :
58 0 : void setPhase( const realImageT &ph )
59 : {
60 0 : phase = ph;
61 0 : }
62 :
63 0 : void getWavefront( complexAmplitudeT &wf, int wfSz )
64 : {
65 0 : wfp::makeComplexPupil( wf, amplitude, phase, wfSz );
66 0 : }
67 :
68 0 : void getWavefront( complexAmplitudeT &wf, realT dlambda, int wfSz )
69 : {
70 0 : realImageT dphase = phase * ( lambda / dlambda );
71 0 : wfp::makeComplexPupil( wf, amplitude, dphase, wfSz );
72 0 : }
73 : };
74 :
75 : } // namespace sim
76 : } // namespace AO
77 : } // namespace mx
78 :
79 : #endif
|