7 #ifndef dmPokeXCorr_hpp
8 #define dmPokeXCorr_hpp
10 #include <mx/improc/imageFilters.hpp>
11 #include <mx/improc/imageXCorrFFT.hpp>
12 using namespace mx::improc;
14 #include <mx/math/fit/fitGaussian.hpp>
16 #include "../../libMagAOX/libMagAOX.hpp"
17 #include "../../magaox_git_version.h"
61 friend class dmPokeXCorr_test;
71 friend class
dev::shmimMonitor<dmPokeXCorr, dev::dmPokeWFS<dmPokeXCorr>::darkShmimT>;
88 std::string m_zRespMFile;
92 mx::improc::imageXCorrFFT<eigenImage<float>> m_xcorr;
94 mx::improc::milkImage<float> m_refIm;
110 virtual void setupConfig();
115 int loadConfigImpl(mx::app::appConfigurator &_config );
117 virtual void loadConfig();
123 virtual int appStartup();
130 virtual int appLogic();
136 virtual int appShutdown();
156 int processImage(
void * curr_src,
160 using dmPokeWFST::allocate;
162 using dmPokeWFST::processImage;
178 int runSensor(
bool firstRun );
200 int checkRecordTimes();
207 dmPokeXCorr::dmPokeXCorr() :
MagAOXApp(MAGAOX_CURRENT_SHA1, MAGAOX_REPO_MODIFIED)
249 mx::improc::milkImage<float> mdm;
254 catch(
const std::exception& e)
256 return log<
software_error,-1>({__FILE__, __LINE__, std::string(
"exception opening DM: ") + e.what()});
292 static_cast<void>(dummy);
306 static_cast<void>(dummy);
310 mx::improc::milkImage<float> mdm;
315 catch(
const std::exception& e)
317 return log<
software_error,-1>({__FILE__, __LINE__, std::string(
"exception opening DM: ") + e.what()});
322 mx::improc::eigenImage<float> refIm;
323 refIm.resize(zRespM.rows(), zRespM.cols());
326 for(
size_t n = 0; n <
m_poke_x.size(); ++n)
330 refIm += zRespM.image(actno);
342 static_cast<void>(firstRun);
352 log<software_error>({__FILE__, __LINE__});
370 std::cerr <<
"dmPokeXCorr::analyzeSensor: " << xs <<
" " << ys <<
"\n";
374 return log<
software_error,-1>({__FILE__, __LINE__,
"error from dmPokeWFS::updateMeasurement"});
The base-class for MagAO-X applications.
std::string m_configName
The name of the configuration file (minus .conf).
stateCodes::stateCodeT state()
Get the current state code.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
A base class to coordinate poking a deformable mirror's actuators and synchronizedreads of a camera i...
int updateMeasurement(float deltaX, float deltaY)
std::vector< int > m_poke_y
mx::improc::milkImage< float > m_pokeImage
int basicRunSensor()
Run the basic +/- poke sensor steps.
std::vector< int > m_poke_x
uint32_t m_depth
The depth of the circular buffer in the stream.
uint32_t m_width
The width of the images in the stream.
uint32_t m_height
The height of the images in the stream.
The MagAO-X DM to PWFS alignment Application.
int processImage(void *curr_src, const zrespShmimT &dummy)
mx::improc::milkImage< float > m_refIm
mx::improc::imageXCorrFFT< eigenImage< float > > m_xcorr
int runSensor(bool firstRun)
Run the sensor steps.
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
virtual int appShutdown()
Shutdown the app.
virtual void loadConfig()
virtual void setupConfig()
int allocate(const zrespShmimT &dummy)
shmimMonitorT & shmimMonitor()
int analyzeSensor()
Analyze the poke image.
virtual int appLogic()
Implementation of the FSM for dmPokeXCorr.
darkShmimMonitorT & darkShmimMonitor()
virtual int appStartup()
Startup function.
#define DMPOKEWFS_APP_SHUTDOWN
Call dmPokeWFS::appShutdown with error checking.
#define DMPOKEWFS_APP_STARTUP
Call dmPokeWFS::appStartup with error checking.
#define DMPOKEWFS_SETUP_CONFIG(cfig)
Call dmPokeWFS::setupConfig with error checking.
#define DMPOKEWFS_LOAD_CONFIG(cfig)
Call dmPokeWFS::loadConfig with error checking.
#define DMPOKEWFS_APP_LOGIC
Call dmPokeWFS::appLogic with error checking.
@ READY
The device is ready for operation, but is not operating.
#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.
A device base class which saves telemetry.
int checkRecordTimes(const telT &tel, telTs... tels)
Check the time of the last record for each telemetry type and make an entry if needed.
static std::string configSection()
static std::string indiPrefix()
Log entry recording DM poke centering results.
#define TELEMETER_APP_LOGIC
Call telemeter::appLogic with error checking.
#define TELEMETER_LOAD_CONFIG(cfig)
Call telemeter::loadConfig with error checking.
#define TELEMETER_APP_STARTUP
Call telemeter::appStartup with error checking.
#define TELEMETER_SETUP_CONFIG(cfig)
Call telemeter::setupConfig with error checking.
#define TELEMETER_APP_SHUTDOWN
Call telemeter::appShutdown with error checking.