Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELEASE] v2.3.1 #140

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Change Log
### All notable changes to `COMMIT` will be documented in this file.

## `v2.3.1`<br>_2024-09-24_
### 🐛Fixed
- Revert changes when save results in `results.pickle`
- Add checks on `group_weights_extra`

---
---

## `v2.3.0`<br>_2024-07-04_
### ✨Added
- Added support for Windows (requires the `pthread-win32` library)
Expand Down
11 changes: 5 additions & 6 deletions commit/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 '
Expand Down Expand Up @@ -1595,14 +1598,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 = []
Expand Down
4 changes: 2 additions & 2 deletions commit/trk2dictionary/trk2dictionary.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading