From 87f0b576279ba442b9897dca2faaed0b0ed25fa5 Mon Sep 17 00:00:00 2001 From: nightwnvol Date: Tue, 24 Sep 2024 11:26:34 +0200 Subject: [PATCH 1/6] fix: revert changes when save results --- commit/core.pyx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/commit/core.pyx b/commit/core.pyx index 2765676..727c88f 100644 --- a/commit/core.pyx +++ b/commit/core.pyx @@ -1595,14 +1595,10 @@ cdef class Evaluation : log_list = [] ret_subinfo = logger.subinfo('results.pickle', indent_char='-', indent_lvl=2, with_progress=True) with ProgressBar(disable=self.verbose < 3, hide_on_exit=True, subinfo=ret_subinfo, log_list=log_list): - xic, xec, xiso = self.get_coeffs() - x = self.x - if self.get_config('doNormalizeKernels') : - x = x * np.hstack( (norm1*norm_fib,norm2,norm3) ) with open( pjoin(RESULTS_path,'results.pickle'), 'wb+' ) as fid : self.CONFIG['optimization']['regularisation'].pop('omega', None) self.CONFIG['optimization']['regularisation'].pop('prox', None) - pickle.dump( [self.CONFIG, x, self.x], fid, protocol=2 ) + pickle.dump( [self.CONFIG, self.x, x], fid, protocol=2 ) if save_est_dwi: log_list = [] From 0762e9cde994ffb017348874c51d24691631eab2 Mon Sep 17 00:00:00 2001 From: nightwnvol Date: Tue, 24 Sep 2024 11:28:13 +0200 Subject: [PATCH 2/6] docs: update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8fb89..65e8751 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log ### All notable changes to `COMMIT` will be documented in this file. +## `v2.3.1`
_2024-09-24_ +### 🐛Fixed +- Revert changes when save results in `results.pickle` + +--- +--- + ## `v2.3.0`
_2024-07-04_ ### ✨Added - Added support for Windows (requires the `pthread-win32` library) From 33ed96b7a24f6d320322ca80944f8b0adac02ef7 Mon Sep 17 00:00:00 2001 From: nightwnvol Date: Tue, 24 Sep 2024 11:28:52 +0200 Subject: [PATCH 3/6] build: bump version to v2.3.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 46c095b..32d2a54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "dmri-commit" -version = "2.3.0" +version = "2.3.1" dependencies = [ "dmri-amico>=2.0.1", "dmri-dicelib>=1.1.0", From 8ceaea8ec32bd9de9cab6ecae969912f2c8cef98 Mon Sep 17 00:00:00 2001 From: nightwnvol Date: Tue, 24 Sep 2024 12:10:27 +0200 Subject: [PATCH 4/6] fix: add checks on group_weights_extra --- commit/core.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commit/core.pyx b/commit/core.pyx index 727c88f..f06168e 100644 --- a/commit/core.pyx +++ b/commit/core.pyx @@ -986,6 +986,9 @@ cdef class Evaluation : # check if group_weights_extra is consistent with the number of groups if (regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso') and 'group_weights_extra' in dictIC_params: + if type(dictIC_params['group_weights_extra']) not in [list, np.ndarray]: + logger.error('"group_weights_extra" must be a list or a numpy array') + dictIC_params['group_weights_extra'] = np.array(dictIC_params['group_weights_extra'], dtype=np.float64) if np.any(dictIC_params['group_weights_extra'] < 0): logger.error('All group weights must be non-negative') if dictIC_params['group_weights_extra'].size != dictIC_params['group_idx'].size: @@ -1074,7 +1077,7 @@ cdef class Evaluation : logger.debug( f'Lambda used: {regularisation["lambdaIC"]}' ) if regularisation['regIC'] == 'group_lasso' or regularisation['regIC'] == 'sparse_group_lasso': logger.debug( f'Number of groups: {len(dictIC_params["group_idx_kept"])}' ) - if dictIC_params['group_weights_cardinality']==False and dictIC_params['group_weights_adaptive']==False and dictIC_params['group_weights_extra'] is None: + if dictIC_params['group_weights_cardinality']==False and dictIC_params['group_weights_adaptive']==False and not ('group_weights_extra' in dictIC_params): logger.debug( 'Group weights are not considered (all ones)' ) else: str_weights = 'Group weights computed using ' From 34a7ac9ce6a1840ce1758ddcb84abb29f71229be Mon Sep 17 00:00:00 2001 From: nightwnvol Date: Tue, 24 Sep 2024 12:10:54 +0200 Subject: [PATCH 5/6] docs: update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e8751..ffff790 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## `v2.3.1`
_2024-09-24_ ### 🐛Fixed - Revert changes when save results in `results.pickle` +- Add checks on `group_weights_extra` --- --- From 7a7b2a2f70c87968744ac40edec36a5281259dcb Mon Sep 17 00:00:00 2001 From: fullbat Date: Tue, 24 Sep 2024 16:59:51 +0200 Subject: [PATCH 6/6] Fix internal clustering --- commit/trk2dictionary/trk2dictionary.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commit/trk2dictionary/trk2dictionary.pyx b/commit/trk2dictionary/trk2dictionary.pyx index db35f4a..861e79b 100644 --- a/commit/trk2dictionary/trk2dictionary.pyx +++ b/commit/trk2dictionary/trk2dictionary.pyx @@ -324,14 +324,14 @@ cpdef run( filename_tractogram=None, path_out=None, filename_peaks=None, filenam log_list = [] ret_subinfo = logger.subinfo(f'Clustering with threshold = {blur_clust_thr[0]}', indent_lvl=2, indent_char='-', with_progress=verbose>2) with ProgressBar(disable=verbose<3, hide_on_exit=True, subinfo=ret_subinfo, log_list=log_list): - idx_centroids = run_clustering(tractogram_in=filename_tractogram, tractogram_out=filename_out, + idx_centroids, _ = run_clustering(tractogram_in=filename_tractogram, tractogram_out=filename_out, temp_folder=path_temp, atlas=blur_clust_groupby, clust_thr=blur_clust_thr[0], n_threads=n_threads, keep_temp_files=True, force=True, verbose=1, log_list=log_list) else: log_list = [] ret_subinfo = logger.subinfo(f'Clustering with threshold = {blur_clust_thr[0]}', indent_lvl=2, indent_char='-', with_progress=verbose>2) with ProgressBar(disable=verbose<3, hide_on_exit=True, subinfo=ret_subinfo, log_list=log_list): - idx_centroids = run_clustering(tractogram_in=filename_tractogram, tractogram_out=filename_out, + idx_centroids, _ = run_clustering(tractogram_in=filename_tractogram, tractogram_out=filename_out, temp_folder=path_temp, clust_thr=blur_clust_thr[0], keep_temp_files=True, force=True, verbose=1) filename_tractogram = filename_out