% -*- mode: Noweb; noweb-code-mode: python-mode -*-
\section{PXD file}
\label{sec:pxd-file}
<<aaStats.pxd>>=
from utilities cimport cuFloatArray
from atmosphere cimport atmosphere, AtmosphereAbstract
from source cimport source, Source
# aaStats
cdef extern from "aaStats.h":
cdef cppclass aaStats:
int NU, N_SRC2
float *d__cov
void setup(int, atmosphere *, float, source *, int)
void cleanup()
# paStats
cdef extern from "aaStats.h":
cdef cppclass paStats:
int NU2, N_SRC2
int *M_LAYER
float *d__cov
void setup(int, int, int , atmosphere *, float,
source *, int, source *, int)
void setup(int, int, int , atmosphere *, float,
source *, int, float)
void cleanup()
<<class definitions>>
@
\subsection{Class definitions}
\label{sec:class-definitions}
<<class definitions>>=
cdef class AaStatsMatrix:
cdef aaStats *_c_aaStats
cdef public cuFloatArray cov
cdef class AaStats:
cdef aaStats *_c_aaStats
cdef public cuFloatArray cov
cdef init(AaStats, aaStats *)
cdef class PaStats:
cdef paStats *_c_paStats
cdef public cuFloatArray cov
cdef class APaStats:
cdef paStats *_c_paStats
cdef public cuFloatArray cov
@
\section{PYX file}
\label{sec:pyx-file}
\subsection{AaStats}
\label{sec:aastats-1}
\index{aaStats!python!AaStats}
<<aaStats.pyx>>=
# aaStats
cdef class AaStatsMatrix:
"""
Slopes covariance matrix class
Parameters
----------
N_SIDE_LENSLET : int
The size of the lenslet array
atm : Atmosphere
The atmosphere model
lenslet pitch : float
The lenslet array pitch
src : Source
The guide stars
"""
def __cinit__(self,int N_SIDE_LENSLET, AtmosphereAbstract atm, float lenslet_pitch, Source src):
self._c_aaStats = new aaStats()
self._c_aaStats.setup(N_SIDE_LENSLET, atm._c_atmosphere, lenslet_pitch, src._c_source, src.N_SRC)
self.cov = cuFloatArray(shape=(self._c_aaStats.N_SRC2*4*self._c_aaStats.NU,self._c_aaStats.NU))
self.cov._c_gpu.dev_data = self._c_aaStats.d__cov
def __dealloc__(self):
self._c_aaStats.cleanup()
cdef class AaStats:
"""
Slopes covariance matrix class
Parameters
----------
N_SIDE_LENSLET : int
The size of the lenslet array
atm : Atmosphere
The atmosphere model
lenslet pitch : float
The lenslet array pitch
src : Source
The guide stars
"""
def __cinit__(self):
self._c_aaStats = new aaStats()
cdef init(self, aaStats *aa):
self._c_aaStats = aa
self.cov = cuFloatArray(shape=(self._c_aaStats.N_SRC2*4*self._c_aaStats.NU,self._c_aaStats.NU))
self.cov._c_gpu.dev_data = aa.d__cov
@
\subsection{PaStats}
\label{sec:aastats-1}
\index{aaStats!python!PaStats}
<<aaStats.pyx>>=
# paStats
cdef class PaStats:
"""
Phase/Slope covariance matrix class
"""
def __cinit__(self, int M, int N, int osf,
AtmosphereAbstract atm, float lenslet_pitch,
Source phase_src, Source slopes_src,
float average_z_radius=-1.0):
self._c_paStats = new paStats()
self._c_paStats.setup(M, N, osf, atm._c_atmosphere, lenslet_pitch,
phase_src._c_source, phase_src._c_source.N_SRC,
slopes_src._c_source, slopes_src._c_source.N_SRC )
self.cov = cuFloatArray(shape=(self._c_paStats.N_SRC2*2*self._c_paStats.NU2,1))
self.cov._c_gpu.dev_data = self._c_paStats.d__cov
def __dealloc__(self):
self._c_paStats.cleanup()
cdef class APaStats:
"""
Phase/Slope covariance matrix class
"""
def __cinit__(self, int M, int N, int osf,
AtmosphereAbstract atm, float lenslet_pitch,
Source slopes_src,
float average_z_radius):
self._c_paStats = new paStats()
self._c_paStats.setup(M, N, osf, atm._c_atmosphere, lenslet_pitch,
slopes_src._c_source, slopes_src._c_source.N_SRC,
average_z_radius)
self.cov = cuFloatArray(shape=(self._c_paStats.N_SRC2*2*self._c_paStats.NU2,1))
self.cov._c_gpu.dev_data = self._c_paStats.d__cov
def __dealloc__(self):
self._c_paStats.cleanup()