The VisAO Camera
recmat.h
Go to the documentation of this file.
1 /************************************************************
2  * recmat.h
3  *
4  * Author: Jared R. Males (jrmales@email.arizona.edu)
5  *
6  * Declarations for a class to manage a reconstructor matrix.
7  *
8  * Developed as part of the Magellan Adaptive Optics system.
9  ************************************************************/
10 
11 /** \file recmat.h
12  * \author Jared R. Males
13  * \brief Declarations for a class to manage a reconstructor matrix.
14  *
15  *
16  */
17 
18 #ifndef __recmat_h__
19 #define __recmat_h__
20 
21 #include <string>
22 #include <iostream>
23 
24 #include <math.h>
25 
26 #include "svbksb.h"
27 #include "gsl/gsl_linalg.h"
28 #include "gsl/gsl_blas.h"
29 
30 #include "fitsio.h"
31 #include "visaoimutils.h"
32 
33 #ifdef REC_USE_GPU
34 #include "gpurecon.h"
35 #endif
36 
37 #define REC_ATLAS 0
38 #define REC_GPU 1
39 
40 class recmat
41 {
42  public:
43  recmat();
44  recmat(std::string fname);
45 
46  ~recmat();
47 
48  //protected:
49  public:
50  std::string filePath; ///<The full path to the reconstructor matrix
51  std::string fileName; ///<file name of the reconstructor matrix
52 
53  int gpu_inited; ///<Flag for whether the gpu globals are initialized.
54 
55  int n_modes; ///<The number of modes, and the rows in the reconstructor matrix.
56  //int n_deforms;
57  int n_slopes; ///<The number of slopes, and the columns in the reconstructor matrix
58 
59 
60 
61  float reflection_gain; ///< Factor to apply to reconstructed amplitudes to account for mirror reflection
62  float unit_conversion; ///< Factor to convert variances to nanometers.
63 
64  int rec_tech; ///<Which reconstructor technique to use, either REC_ATLAS or REC_CPU
65 
66  gsl_matrix_float *R;
67 
68  float *amp; ///<The reconstructed amplitudes, a vector of length n_modes
69 
70  double tel_diam;
71  double median_r0;
72  double median_r0_lam;
73  double fitting_A;
74  double fitting_B;
75 
76  double fitting_error_sq;
77 
78  public:
79  std::string get_filePath(){return filePath;}
80 
81  int get_n_modes(){return n_modes;}
82  int get_n_slopes(){return n_slopes;}
83 
84  int get_rec_tech(){return rec_tech;}
85 
86  int load_recmat_LBT(std::string fname);
87 
88  ///Given a new slopes vector, reconstruct the amplitudes
89  /** Upon exit the amp vector will be populated with the reconstructed modal amplitudes.
90  */
91  int reconstruct(float *slopes);
92 
93  ///Calculate the sum of the variances, e.g. the dot product of the amplitude vector.
94  /** Does not include the first 2 modes, since they are tip and tilt. This corresponds to the instantaneous Strehl ratio.
95  */
96  int calc_sumvar(float *sumvar, int m0 = 2, int m1 = -1, bool fiterr=true);
97 
98 
99 };
100 
101 
102 #endif //__recmat_h__
103 
std::string fileName
file name of the reconstructor matrix
Definition: recmat.h:51
int gpu_inited
Flag for whether the gpu globals are initialized.
Definition: recmat.h:53
int n_slopes
The number of slopes, and the columns in the reconstructor matrix.
Definition: recmat.h:57
Definition: recmat.h:40
int rec_tech
Which reconstructor technique to use, either REC_ATLAS or REC_CPU.
Definition: recmat.h:64
std::string filePath
The full path to the reconstructor matrix.
Definition: recmat.h:50
float unit_conversion
Factor to convert variances to nanometers.
Definition: recmat.h:62
float * amp
The reconstructed amplitudes, a vector of length n_modes.
Definition: recmat.h:68
int calc_sumvar(float *sumvar, int m0=2, int m1=-1, bool fiterr=true)
Calculate the sum of the variances, e.g. the dot product of the amplitude vector. ...
Definition: recmat.cpp:196
int n_modes
The number of modes, and the rows in the reconstructor matrix.
Definition: recmat.h:55
int reconstruct(float *slopes)
Given a new slopes vector, reconstruct the amplitudes.
Definition: recmat.cpp:177
float reflection_gain
Factor to apply to reconstructed amplitudes to account for mirror reflection.
Definition: recmat.h:61
Declarations for various image utility functions.