7#ifndef strehlEstimator_hpp
8#define strehlEstimator_hpp
10#include <mx/ao/analysis/aoSystem.hpp>
11using namespace mx::math;
13#include "../../libMagAOX/libMagAOX.hpp"
14#include "../../magaox_git_version.h"
51 return "wfsmaskShmim";
131 mx::AO::analysis::aoSystem<float, mx::AO::analysis::vonKarmanSpectrum<float>>
m_aosys;
157 mx::app::appConfigurator &
_config );
235 config.add(
"loop.number",
243 "The number of the loop. Used to set shmim names, as in aolN_mgainfact." );
245 config.add(
"phot.qe_6535",
253 "The WFS QE in the 65-35 B/S." );
255 config.add(
"phot.qe_HaIR",
263 "The WFS QE in the Ha-IR B/S." );
310 m_indiP_mag.add( pcf::IndiElement(
"current", 0 ) );
317 m_indiP_wfe.add( pcf::IndiElement(
"measurement", 0 ) );
318 m_indiP_wfe.add( pcf::IndiElement(
"time_delay", 0 ) );
319 m_indiP_wfe.add( pcf::IndiElement(
"fitting", 0 ) );
338 m_aosys.ron_wfs( std::vector<float>( { 245.0f /
m_emg } ) );
340 m_aosys.minTauWFS( std::vector<float>( { 1.0f /
m_fps } ) );
347 {
"total",
"measurement",
"time_delay",
"fitting" },
365 static_cast<void>(
dummy );
373 static_cast<void>(
dummy );
375 m_wfsavg = mx::improc::eigenMap<float>(
382 std::cerr <<
"counts: " <<
m_counts <<
'\n';
392 static_cast<void>(
dummy );
400 static_cast<void>(
dummy );
432 if(
ipRecv.find(
"current" ) )
434 float fps =
ipRecv[
"current"].get<
float>();
439 std::cerr <<
"Got FPS: " << m_fps <<
'\n';
451 if(
ipRecv.find(
"current" ) )
453 float emg =
ipRecv[
"current"].get<
float>();
458 std::cerr <<
"Got EMG: " << m_emg <<
'\n';
472 std::string preset =
"none";
474 for(
auto &&el :
ipRecv.getElements() )
476 if( el.second.getSwitchState() == pcf::IndiElement::On )
483 std::cerr <<
"Got stage bs: " << preset <<
'\n';
485 if( preset ==
"ha-ir" )
488 m_lam0 = m_lam0_HaIR;
494 m_lam0 = m_lam0_6535;
508 if(
ipRecv.find(
"dimm_fwhm" ) )
510 float seeing =
ipRecv[
"dimm_fwhm"].get<
float>();
512 if( seeing != m_seeing )
515 std::cerr <<
"Got seeing: " << m_seeing <<
'\n';
517 m_r0 = 0.2063 * 0.5 / m_seeing;
529 float elevation =
ipRecv[
"el"].get<
float>();
531 if( elevation != m_elevation )
533 m_elevation = elevation;
534 std::cerr <<
"Got elevation: " << m_elevation <<
'\n';
The base-class for MagAO-X applications.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
stateCodes::stateCodeT state()
Get the current state code.
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
uint32_t m_width
The width of the images in the stream.
uint32_t m_height
The height of the images in the stream.
virtual int appShutdown()
Shutdown the app.
INDI_SETCALLBACK_DECL(strehlEstimator, m_indiP_tcsi_telpos)
INDI_SETCALLBACK_DECL(strehlEstimator, m_indiP_tcsi_seeing)
double m_dimm_fwhm_corr
DIMM elevation corrected FWHM.
friend class strehlEstimator_test
virtual int appStartup()
Startup function.
mx::AO::analysis::aoSystem< float, mx::AO::analysis::vonKarmanSpectrum< float > > m_aosys
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
~strehlEstimator() noexcept
D'tor, declared and defined for noexcept.
pcf::IndiProperty m_indiP_fps
virtual void setupConfig()
INDI_SETCALLBACK_DECL(strehlEstimator, m_indiP_stage)
virtual int appLogic()
Implementation of the FSM for strehlEstimator.
double m_mag1_fwhm_corr
MAG1 elevation corrected FWHM.
pcf::IndiProperty m_indiP_stage
pcf::IndiProperty m_indiP_tcsi_seeing
int m_mag1_time
Seconds since midnight of MAG1 measurement.
std::string m_stagebsDevice
int allocate(const wfsavgShmimT &)
pcf::IndiProperty m_indiP_wfe
dev::shmimMonitor< strehlEstimator, wfsmaskShmimT > wfsmaskShmimMonitorT
int m_loopNum
The number of the loop. Used to set shmim names, as in aolN_wfsmask.
int processImage(void *curr_src, const wfsavgShmimT &)
int m_dimm_time
Seconds since midnight of DIMM measurement.
strehlEstimator()
Default c'tor.
INDI_SETCALLBACK_DECL(strehlEstimator, m_indiP_emg)
dev::shmimMonitor< strehlEstimator, wfsavgShmimT > wfsavgShmimMonitorT
mx::improc::eigenImage< float > m_wfsavg
pcf::IndiProperty m_indiP_strehl
mx::improc::eigenImage< float > m_wfsmask
pcf::IndiProperty m_indiP_mag
double m_mag2_fwhm_corr
MAG2 elevation corrected FWHM.
INDI_SETCALLBACK_DECL(strehlEstimator, m_indiP_fps)
int m_mag2_time
Seconds since midnight of MAG2 measurement.
pcf::IndiProperty m_indiP_seeing_magaox
virtual void loadConfig()
pcf::IndiProperty m_indiP_emg
pcf::IndiProperty m_indiP_tcsi_telpos
#define INDI_SETCALLBACK_DEFN(class, prop)
Define the callback for a set property request.
#define REG_INDI_SETPROP(prop, devName, propName)
Register a SET INDI property with the class, using the standard callback name.
#define CREATE_REG_INDI_RO_NUMBER(prop, name, label, group)
Create and register a RO INDI property as a number, using the standard callback name.
@ OPERATING
The device is operating, other than homing.
#define INDI_VALIDATE_CALLBACK_PROPS(prop1, prop2)
Standard check for matching INDI properties in a callback.
const pcf::IndiProperty & ipRecv
#define SHMIMMONITORT_APP_STARTUP(SHMIMMONITORT)
Call shmimMonitorT::appStartup with error checking for a typedef-ed shmimMonitor.
#define SHMIMMONITORT_UPDATE_INDI(SHMIMMONITORT)
Call shmimMonitorT::updateINDI with error checking for a typedef-ed shmimMonitor.
#define SHMIMMONITORT_SETUP_CONFIG(SHMIMMONITORT, cfig)
Call shmimMonitorT::setupConfig with error checking for a typedef-ed shmimMonitor.
#define SHMIMMONITORT_APP_LOGIC(SHMIMMONITORT)
Call shmimMonitorT::appLogic with error checking for a typedef-ed shmimMonitor.
#define SHMIMMONITORT_APP_SHUTDOWN(SHMIMMONITORT)
Call shmimMonitorT::appShutodwn with error checking for a typedef-ed shmimMonitor.
#define SHMIMMONITORT_LOAD_CONFIG(SHMIMMONITORT, cfig)
Call shmimMonitorT::loadConfig with error checking for a typedef-ed shmimMonitor.
static std::string configSection()
static std::string indiPrefix()
static std::string indiPrefix()
static std::string configSection()