COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
sutra_centroider_pyr.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 // This file is part of COMPASS <https://anr-compass.github.io/compass/>
3 //
4 // Copyright (C) 2011-2019 COMPASS Team <https://github.com/ANR-COMPASS>
5 // All rights reserved.
6 // Distributed under GNU - LGPL
7 //
8 // COMPASS is free software: you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License as published by the Free
10 // Software Foundation, either version 3 of the License, or any later version.
11 //
12 // COMPASS: End-to-end AO simulation tool using GPU acceleration
13 // The COMPASS platform was designed to meet the need of high-performance for
14 // the simulation of AO systems.
15 //
16 // The final product includes a software package for simulating all the
17 // critical subcomponents of AO, particularly in the context of the ELT and a
18 // real-time core based on several control approaches, with performances
19 // consistent with its integration into an instrument. Taking advantage of the
20 // specific hardware architecture of the GPU, the COMPASS tool allows to
21 // achieve adequate execution speeds to conduct large simulation campaigns
22 // called to the ELT.
23 //
24 // The COMPASS platform can be used to carry a wide variety of simulations to
25 // both testspecific components of AO of the E-ELT (such as wavefront analysis
26 // device with a pyramid or elongated Laser star), and various systems
27 // configurations such as multi-conjugate AO.
28 //
29 // COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY
30 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
31 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
32 // details.
33 //
34 // You should have received a copy of the GNU Lesser General Public License
35 // along with COMPASS. If not, see <https://www.gnu.org/licenses/lgpl-3.0.txt>.
36 // -----------------------------------------------------------------------------
37 
46 
47 #ifndef _SUTRA_CENTROIDER_PYR_H_
48 #define _SUTRA_CENTROIDER_PYR_H_
49 
50 #include <sutra_centroider.h>
51 
52 struct Method_CoG {
53  bool is_local = false;
54  bool is_sinus = true;
55 
56  Method_CoG(bool isLocal_ = false, bool isSinus_ = true)
57  : is_local(isLocal_), is_sinus(isSinus_) {}
58 
66  Method_CoG(uint8_t method) : is_local(method > 1), is_sinus(!(method % 2)) {}
67 
68  static const char *str(const struct Method_CoG &method) {
69  if (method.is_sinus && !method.is_local) return "sinus global"; // 0
70  if (!method.is_sinus && !method.is_local) return "nosinus global"; // 1
71  if (method.is_sinus && method.is_local) return "sinus local"; // 2
72  if (!method.is_sinus && method.is_local) return "nosinus local"; // 3
73  throw "method unknown";
74  };
75 };
76 
77 template <class Tin, class T>
78 class SutraCentroiderPyr : public SutraCentroider<Tin, T> {
79  private:
80  string pyr_type;
81 
82  public:
84  float offset, float scale, bool filter_TT, int device);
87 
88  string get_type();
89  int set_valid_thresh(T valid_thresh);
91 
92  int set_method(Method_CoG method);
94  string get_method_str();
95 
96  int get_pyr(float *cube, float *intensities, T *centroids, int *subindx,
97  int *subindy, int nvalid, int ns, int nim);
98  int get_cog(float *cube, float *intensities, T *centroids, int nvalid,
99  int npix, int ntot, cudaStream_t stream=0);
100  int get_cog(float *intensities, T *slopes, bool noise);
101  int get_cog();
102 
103  private:
104  T valid_thresh;
105  Method_CoG method;
106 };
107 
108 template <class T>
109 void pyr_slopes(T *d_odata, T *d_idata, int *subindx, int *subindy,
110  float *intensities, int ns, int nvalid, int nim,
111  CarmaDevice *device);
112 
113 template <class T>
114 void pyr2_slopes(T *d_odata, T *ref, T *d_idata, int *subindx, int *subindy,
115  float *intensities, int ns, int nvalid, float scale,
116  T valid_thresh, int do_sin, CarmaDevice *device);
117 #endif // _SUTRA_CENTROIDER_PYR_H_
sutra_centroider.h
pyr_slopes
void pyr_slopes(T *d_odata, T *d_idata, int *subindx, int *subindy, float *intensities, int ns, int nvalid, int nim, CarmaDevice *device)
CarmaDevice
Definition: carma_context.h:57
SutraCentroider< Tin, T >::wfs
SutraWfs * wfs
Definition: sutra_centroider.h:54
SutraCentroiderPyr::get_cog
int get_cog()
SutraCentroiderPyr::get_cog
int get_cog(float *cube, float *intensities, T *centroids, int nvalid, int npix, int ntot, cudaStream_t stream=0)
SutraCentroiderPyr::get_cog
int get_cog(float *intensities, T *slopes, bool noise)
Method_CoG
Definition: sutra_centroider_pyr.h:52
SutraCentroiderPyr::get_type
string get_type()
SutraCentroiderPyr::SutraCentroiderPyr
SutraCentroiderPyr(CarmaContext *context, SutraWfs *wfs, long nvalid, float offset, float scale, bool filter_TT, int device)
pyr2_slopes
void pyr2_slopes(T *d_odata, T *ref, T *d_idata, int *subindx, int *subindy, float *intensities, int ns, int nvalid, float scale, T valid_thresh, int do_sin, CarmaDevice *device)
SutraCentroider< Tin, T >::filter_TT
bool filter_TT
Definition: sutra_centroider.h:59
SutraCentroider< Tin, T >::offset
float offset
Definition: sutra_centroider.h:61
SutraCentroiderPyr::get_valid_thresh
T get_valid_thresh()
Method_CoG::is_sinus
bool is_sinus
Definition: sutra_centroider_pyr.h:54
SutraCentroiderPyr::SutraCentroiderPyr
SutraCentroiderPyr(const SutraCentroiderPyr &centroider)
SutraWfs
this class provides the wfs features to COMPASS
Definition: sutra_wfs.h:60
SutraCentroiderPyr
this class provides the centroider_pyr features to COMPASS
Definition: sutra_centroider_pyr.h:78
SutraCentroiderPyr::set_valid_thresh
int set_valid_thresh(T valid_thresh)
SutraCentroiderPyr::~SutraCentroiderPyr
~SutraCentroiderPyr()
SutraCentroider< Tin, T >::npix
int npix
Definition: sutra_centroider.h:57
Method_CoG::str
static const char * str(const struct Method_CoG &method)
Definition: sutra_centroider_pyr.h:68
Method_CoG::Method_CoG
Method_CoG(uint8_t method)
Definition: sutra_centroider_pyr.h:66
CarmaContext
this class provides the context in which CarmaObj are created
Definition: carma_context.h:104
Method_CoG::is_local
bool is_local
Definition: sutra_centroider_pyr.h:53
SutraCentroider
this class provides the centroider features to COMPASS
Definition: sutra_centroider.h:51
SutraCentroiderPyr::set_method
int set_method(Method_CoG method)
SutraCentroider< Tin, T >::scale
float scale
Definition: sutra_centroider.h:62
SutraCentroiderPyr::get_method
Method_CoG get_method()
SutraCentroider< Tin, T >::nvalid
int nvalid
Definition: sutra_centroider.h:55
SutraCentroiderPyr::get_method_str
string get_method_str()
Method_CoG::Method_CoG
Method_CoG(bool isLocal_=false, bool isSinus_=true)
Definition: sutra_centroider_pyr.h:56
SutraCentroider< Tin, T >::device
int device
Definition: sutra_centroider.h:53
SutraCentroiderPyr::get_pyr
int get_pyr(float *cube, float *intensities, T *centroids, int *subindx, int *subindy, int nvalid, int ns, int nim)