7 #ifndef openLoopPSDs_hpp
8 #define openLoopPSDs_hpp
11 #include "../../libMagAOX/libMagAOX.hpp"
12 #include "../../magaox_git_version.h"
14 #include <mx/sigproc/circularBuffer.hpp>
15 #include <mx/sigproc/signalWindows.hpp>
17 #include <mx/math/fft/fftwEnvironment.hpp>
18 #include <mx/math/fft/fft.hpp>
55 typedef mx::sigproc::circularBufferIndex<float *, unsigned>
ampCircBuffT;
146 config.add(
"psds.clPSDSource",
"",
"psds.clPSDSource", argType::Required,
"psds",
"clPSDSource",
false,
"string",
"Device name for getting the C.L. PSDs. This is used as the shmim name (unless overriden) and this INDI device should have *.fps.current.");
184 log<software_error>({__FILE__,__LINE__});
209 log<software_error>({__FILE__, __LINE__});
224 static_cast<void>(dummy);
241 ImageStreamIO_createIm_gpu(
m_olpsdStream, (
m_configName +
"_olpsds").c_str(), 3, imsize,
IMAGESTRUCT_FLOAT, -1, 1, IMAGE_NB_SEMAPHORE, 0, CIRCULAR_BUFFER | ZAXIS_TEMPORAL, 0);
250 static_cast<void>(dummy);
252 float * src =
static_cast<float *
>(curr_src);
265 clock_gettime(CLOCK_REALTIME, &
m_olpsdStream->md->writetime);
282 if(
ipRecv.getName() != m_indiP_clPSDSource.getName())
284 log<software_error>({__FILE__, __LINE__,
"Invalid INDI property."});
288 if(
ipRecv.find(
"current") !=
true )
290 log<software_error>({__FILE__, __LINE__,
"No current property in fps source."});
294 std::lock_guard<std::mutex> guard(m_indiMutex);
303 shmimMonitorT::m_restart =
true;
#define IMAGESTRUCT_FLOAT
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.
int createROIndiNumber(pcf::IndiProperty &prop, const std::string &propName, const std::string &propLabel="", const std::string &propGroup="")
Create a ReadOnly INDI Number property.
int registerIndiPropertyReadOnly(pcf::IndiProperty &prop)
Register an INDI property which is read only.
std::mutex m_indiMutex
Mutex for locking INDI communications.
int appStartup()
Startup function.
uint32_t m_width
The width of the images in the stream.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int updateINDI()
Update the INDI properties for this device controller.
int appLogic()
Checks the shmimMonitor thread.
uint32_t m_height
The height of the images in the stream.
std::string m_shmimName
The name of the shared memory image, is used in /tmp/<shmimName>.im.shm. Derived classes should set a...
int appShutdown()
Shuts down the shmimMonitor thread.
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
Class for application to calculate rolling PSDs of modal amplitudes.
pcf::IndiProperty m_indiP_clPSDSource
std::string m_clPSDSource
Device name for getting the C.L. PSDs. This is used as the shmim name (unless overriden) and this IND...
virtual void setupConfig()
dev::shmimMonitor< openLoopPSDs > shmimMonitorT
The base shmimMonitor type.
pcf::IndiProperty m_indiP_fps
int m_nModes
the number of modes to calculate PSDs for.
virtual int appStartup()
Startup function.
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
~openLoopPSDs() noexcept
D'tor, declared and defined for noexcept.
virtual int appShutdown()
Shutdown the app.
std::vector< realT > m_freq
INDI_SETCALLBACK_DECL(openLoopPSDs, m_indiP_clPSDSource)
int allocate(const dev::shmimT &dummy)
int processImage(void *curr_src, const dev::shmimT &dummy)
mx::sigproc::circularBufferIndex< float *, unsigned > ampCircBuffT
The amplitude circular buffer type.
virtual void loadConfig()
std::complex< realT > complexT
openLoopPSDs()
Default c'tor.
virtual int appLogic()
Implementation of the FSM for openLoopPSDs.
#define REG_INDI_SETPROP(prop, devName, propName)
Register a SET INDI property with the class, using the standard callback name.
@ OPERATING
The device is operating, other than homing.
const pcf::IndiProperty & ipRecv
INDI_SETCALLBACK_DEFN(adcTracker, m_indiP_teldata)(const pcf
updateIfChanged(m_indiP_angle, "target", m_angle)
std::unique_lock< std::mutex > lock(m_indiMutex)
constexpr static logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
constexpr static logPrioT LOG_NOTICE
A normal but significant condition.