@@ -681,6 +681,7 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
681
681
{ // TESTING This runs when the vector of stars is empty (usually the first time)
682
682
while ( ( z_score > m_threshold ) && ( fwhm > m_fwhm_threshold ) && ( N_loops < m_max_loops ) )
683
683
{ // m_max_loops, m_fwhm_threshold, and m_threshold are configurable variables
684
+ try {
684
685
N_loops = N_loops + 1 ;
685
686
m_gfit.set_itmax ( 1000 );
686
687
// 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 )
771
772
m_image ( i, j ) = 0 ; // m_zero_area is defaulted to 20 to zero out a pixel array around the star
772
773
}
773
774
}
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
+ }
774
780
max = m_image.maxCoeff ( &x, &y );
775
781
z_score = ( max - mean ) / stddev;
776
782
}
@@ -781,6 +787,7 @@ inline int psfAcq::processImage( void *curr_src, const dev::shmimT &dummy )
781
787
// In here is where we track the stars using cross correlation between the first frame and subsequent frames
782
788
while ( ( z_score > m_threshold ) && ( fwhm > m_fwhm_threshold ) && ( N_loops < m_max_loops ) )
783
789
{
790
+ try {
784
791
N_loops = N_loops + 1 ;
785
792
m_gfit.set_itmax ( 1000 );
786
793
// 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 )
892
899
// m_indiDriver->sendSetProperty( m_detectedStars.back().prop );
893
900
}
894
901
}
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
+ }
896
907
max = m_image.maxCoeff ( &x, &y );
897
908
z_score = ( max - mean ) / stddev;
898
909
}
0 commit comments