From 757c55c357e9e63df9bcc4949dd07cfe098d19c8 Mon Sep 17 00:00:00 2001 From: full-Strix Date: Tue, 26 Mar 2024 14:13:46 +0100 Subject: [PATCH] Refactor logging messages and update progress indicators --- commit/core.pyx | 8 ++++---- commit/trk2dictionary/trk2dictionary.pyx | 4 ++-- commit/trk2dictionary/trk2dictionary_c.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/commit/core.pyx b/commit/core.pyx index 4d893cb..56a6336 100755 --- a/commit/core.pyx +++ b/commit/core.pyx @@ -356,9 +356,9 @@ cdef class Evaluation : # Dispatch to the right handler for each model if self.get_config('doMergeB0') : - logger.subinfo( 'Merging multiple b0 volume(s) [-OK-]', indent_char='-', indent_lvl=1 ) + logger.subinfo( 'Merging multiple b0 volume(s)', indent_char='-', indent_lvl=1 ) else : - logger.subinfo( 'Keeping all b0 volume(s) [-OK-]', indent_char='-', indent_lvl=1 ) + logger.subinfo( 'Keeping all b0 volume(s)', indent_char='-', indent_lvl=1 ) # ensure contiguous arrays for C part self.KERNELS['wmr'] = np.ascontiguousarray( self.KERNELS['wmr'] ) @@ -367,7 +367,7 @@ cdef class Evaluation : # De-mean kernels if self.get_config('doDemean') : - logger.subinfo('Demeaning signal ', with_progress=True, indent_lvl=1, indent_char='-' ) + logger.subinfo('Demeaning signal', with_progress=True, indent_lvl=1, indent_char='-' ) with ProgressBar(disable=self.verbose < 3, hide_on_exit=True, subinfo=True) as pbar: for j in xrange(self.get_config('ndirs')) : for i in xrange(nIC) : @@ -379,7 +379,7 @@ cdef class Evaluation : # Normalize atoms if self.get_config('doNormalizeKernels') : - logger.subinfo('Normalizing kernels ', with_progress=True, indent_lvl=1, indent_char='-' ) + logger.subinfo('Normalizing kernels', with_progress=True, indent_lvl=1, indent_char='-' ) with ProgressBar(disable=self.verbose < 3, hide_on_exit=True, subinfo=True) as pbar: self.KERNELS['wmr_norm'] = np.zeros( nIC ) for i in xrange(nIC) : diff --git a/commit/trk2dictionary/trk2dictionary.pyx b/commit/trk2dictionary/trk2dictionary.pyx index fcfcc72..ceb995a 100755 --- a/commit/trk2dictionary/trk2dictionary.pyx +++ b/commit/trk2dictionary/trk2dictionary.pyx @@ -238,7 +238,7 @@ cpdef run( filename_tractogram=None, path_out=None, filename_peaks=None, filenam blurWeights[i] = np.exp( -(blurRho[i] - blur_core_extent)**2 / (2.0*blur_sigma**2) ) if nReplicas == 1 : - logger.subinfo( '\t- Do not blur streamlines', indent_lvl=1, indent_char='-' ) + logger.subinfo( 'Do not blur streamlines', indent_lvl=1, indent_char='-' ) else : logger.subinfo( 'Blur streamlines:', indent_lvl=1, indent_char='-' ) logger.subinfo( f'core extent = {blur_core_extent:.3f}', indent_lvl=2, indent_char='-' ) @@ -532,7 +532,7 @@ cpdef run( filename_tractogram=None, path_out=None, filename_peaks=None, filenam return None # Concatenate files together - logger.subinfo( 'Saving dictionaries', indent_lvl=1, indent_char='-', with_progress=True ) + logger.subinfo( '\nSaving dictionaries', indent_lvl=1, indent_char='-', with_progress=True ) cdef int discarded = 0 with ProgressBar(disable=verbose<3, hide_on_exit=True, subinfo=True) as pbar: for j in range(n_threads-1): diff --git a/commit/trk2dictionary/trk2dictionary_c.cpp b/commit/trk2dictionary/trk2dictionary_c.cpp index 9a78e53..6e6a566 100644 --- a/commit/trk2dictionary/trk2dictionary_c.cpp +++ b/commit/trk2dictionary/trk2dictionary_c.cpp @@ -233,7 +233,7 @@ int trk2dictionary( // Parallel IC compartments // ========================================== - printf( "\n \033[0;32m* Exporting IC compartments:\033[0m\n" ); + printf( "\n \033[38;5;10m* Exporting IC compartments:\033[0m\n" ); // unsigned int width = 25; // PROGRESS = new ProgressBar( (unsigned int) n_count, (unsigned int) width); if (verbosity > 0) @@ -264,7 +264,7 @@ int trk2dictionary( // Parallel EC compartments // ========================================== - printf( "\n \033[0;32m* Exporting EC compartments:\033[0m\n" ); + printf( "\n \033[38;5;10m* Exporting EC compartments:\033[0m\n" ); int EC = ECSegments( ptrPEAKS, Np, vf_THR, ECix, ECiy, ECiz, ptrTDI, ptrHashTable, path_out, ptrPeaksAffine, threads_count ); @@ -273,7 +273,7 @@ int trk2dictionary( /*=========================*/ /* Restricted ISO compartments */ /*=========================*/ - printf( "\n \033[0;32m* Exporting ISO compartments:\033[0m\n" ); + printf( "\n \033[38;5;10m* Exporting ISO compartments:\033[0m\n" ); int totISO = ISOcompartments(ptrTDI, path_out, threads_count);