Skip to content

Commit c275a00

Browse files
author
Parker Johnson
committed
add psfAcq to dev
1 parent afe44da commit c275a00

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/psfAcq/psfAcq.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
681681
{ // TESTING This runs when the vector of stars is empty (usually the first time)
682682
while( ( z_score > m_threshold ) && ( fwhm > m_fwhm_threshold ) && ( N_loops < m_max_loops ) )
683683
{ // m_max_loops, m_fwhm_threshold, and m_threshold are configurable variables
684+
try {
684685
N_loops = N_loops + 1;
685686
m_gfit.set_itmax( 1000 );
686687
// m_zero_area is used to zero out the pixel array once a star is detected but can also be used to set up a
@@ -771,6 +772,11 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
771772
m_image( i, j ) = 0; // m_zero_area is defaulted to 20 to zero out a pixel array around the star
772773
}
773774
}
775+
}
776+
catch (const std::exception& e) {
777+
std::cerr << "Exception during Gaussian fitting: " << e.what() << std::endl;
778+
break; // Handle the exception, possibly skipping this frame
779+
}
774780
max = m_image.maxCoeff( &x, &y );
775781
z_score = ( max - mean ) / stddev;
776782
}
@@ -781,6 +787,7 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
781787
// In here is where we track the stars using cross correlation between the first frame and subsequent frames
782788
while( ( z_score > m_threshold ) && ( fwhm > m_fwhm_threshold ) && ( N_loops < m_max_loops ) )
783789
{
790+
try {
784791
N_loops = N_loops + 1;
785792
m_gfit.set_itmax( 1000 );
786793
// m_zero_area is used to zero out the pixel array once a star is detected but can also be used to set up a
@@ -892,7 +899,11 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
892899
// m_indiDriver->sendSetProperty( m_detectedStars.back().prop );
893900
}
894901
}
895-
902+
}
903+
catch (const std::exception& e) {
904+
std::cerr << "Exception during Gaussian fitting: " << e.what() << std::endl;
905+
break; // Handle the exception, possibly skipping this frame
906+
}
896907
max = m_image.maxCoeff( &x, &y );
897908
z_score = ( max - mean ) / stddev;
898909
}

0 commit comments

Comments
 (0)