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

Drop AFNI dependency #19

Merged
merged 38 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8317348
First version of pythonic HRF generator
eurunuela Jun 22, 2022
5b5c6bc
Renamed all instances of hrf_norm to hrf
eurunuela Jun 22, 2022
ee43546
Fix bug on calling hrf_generator
eurunuela Jun 22, 2022
d5dfa2a
Fix bug
eurunuela Jun 22, 2022
d60c73c
Merge branch 'main' into afni
eurunuela Jun 23, 2022
a261c84
Added option for custom HRF
eurunuela Jun 23, 2022
9b2de76
Lars wron naming fix
eurunuela Jun 23, 2022
0a472de
CLI bug fix
eurunuela Jun 23, 2022
183779d
Merge branch 'main' into afni
eurunuela Jul 21, 2022
c8d68eb
Add BIDS and custom HRF compatibility
eurunuela Jul 22, 2022
715d38d
Added error messages
eurunuela Jul 22, 2022
30297ae
Clarified arg help
eurunuela Jul 22, 2022
6274257
Actually update the arg help
eurunuela Jul 22, 2022
4718ebb
Merge branch 'main' into afni
eurunuela Jul 22, 2022
7e1e0e5
Make it clear AFNI is used if bids is not
eurunuela Jul 27, 2022
a05d58d
Add spaces to help strings and change is_bids for use_bids
eurunuela Jul 27, 2022
7ffe415
Remove leading zero from multi-echo outputs
eurunuela Jul 27, 2022
55a280c
Remove missing leading zeros
eurunuela Jul 27, 2022
d4973d7
Add suggestions by Taylor
eurunuela Aug 22, 2022
ac60811
Fix styling error
eurunuela Aug 22, 2022
bd35681
Higher scipy version to avoid issues with MAD naming
eurunuela Aug 22, 2022
dda6423
Fixes
eurunuela Aug 22, 2022
3797643
Fixed json keyword matching
eurunuela Aug 22, 2022
a595913
Update integration test output filenames
eurunuela Aug 22, 2022
80e3981
Revert MAD naming and constrain scipy version
eurunuela Aug 22, 2022
0613301
Add units
eurunuela Aug 22, 2022
3bf223c
Fix error
eurunuela Aug 22, 2022
d9ce0bb
Merge branch 'main' into afni
eurunuela Oct 5, 2022
4449428
Fixed an error from the previous merge
eurunuela Oct 5, 2022
a0f35b5
Fixed the debiasing n_jobs error from previous merge
eurunuela Oct 5, 2022
14981b5
Update naming of AUC file
eurunuela Oct 11, 2022
ba09fb1
Added TE values check and updated test
eurunuela Oct 11, 2022
43acbb4
Removed breakpoint
eurunuela Oct 11, 2022
352f507
Updated cache key
eurunuela Oct 13, 2022
6471998
print nilearn version
eurunuela Oct 13, 2022
57a40c4
Trigger tests
eurunuela Oct 13, 2022
7b6525c
Fix nilearn version
eurunuela Oct 13, 2022
6d58475
Removed print from test
eurunuela Oct 13, 2022
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
12 changes: 6 additions & 6 deletions pySPFM/deconvolution/debiasing.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,26 @@ def debiasing_block(hrf, y, estimates_matrix, dist=2, progress_bar=True, jobs=1)
beta_out : ndarray
Debiased activity-inducing signal obtained from estimated innovation signal.
"""
nscans = estimates_matrix.shape[0]
nvoxels = estimates_matrix.shape[1]
n_scans = estimates_matrix.shape[0]
n_voxels = estimates_matrix.shape[1]

# Initiates beta matrix
beta_out = np.zeros((nscans, nvoxels))
beta_out = np.zeros((n_scans, n_voxels))

LGR.info("Starting debiasing step...")
# Performs debiasing
if progress_bar:
debiased = Parallel(n_jobs=jobs, backend="multiprocessing")(
delayed(do_debias_block)(hrf, y[:, voxidx], estimates_matrix[:, voxidx])
for voxidx in tqdm(range(nvoxels))
for voxidx in tqdm(range(n_voxels))
)
else:
debiased = Parallel(n_jobs=jobs, backend="multiprocessing")(
delayed(do_debias_block)(hrf, y[:, voxidx], estimates_matrix[:, voxidx])
for voxidx in range(nvoxels)
for voxidx in range(n_voxels)
)

for vox_idx in range(nvoxels):
for vox_idx in range(n_voxels):
beta_out[:, vox_idx] = debiased[vox_idx]

LGR.info("Debiasing step finished")
Expand Down
14 changes: 7 additions & 7 deletions pySPFM/deconvolution/fista.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ def fista(
Selected regularization parameter lambda
"""
if len(y.shape) == 1:
nvoxels = 1
n_voxels = 1
y = y[:, np.newaxis]
else:
nvoxels = y.shape[1]
nscans = hrf.shape[1]
n_voxels = y.shape[1]
n_scans = hrf.shape[1]

# Select lambda
lambda_, update_lambda, noise_estimate = select_lambda(
Expand Down Expand Up @@ -161,8 +161,8 @@ def fista(
l2,
prox,
tau=c_ist,
x0=np.zeros((nscans, nvoxels)),
epsg=np.ones(nvoxels),
x0=np.zeros((n_scans, n_voxels)),
epsg=np.ones(n_voxels),
niter=max_iter,
acceleration="fista",
show=False,
Expand All @@ -173,7 +173,7 @@ def fista(
hrf_cov = np.dot(hrf_trans, hrf)
v = np.dot(hrf_trans, y)

y_fista_S = np.zeros((nscans, nvoxels), dtype=np.float32)
y_fista_S = np.zeros((n_scans, n_voxels), dtype=np.float32)
S = y_fista_S.copy()

t_fista = 1
Expand Down Expand Up @@ -221,7 +221,7 @@ def fista(

# Update lambda
if update_lambda:
nv = np.sqrt(np.sum((np.dot(hrf, S) - y) ** 2, axis=0) / nscans)
nv = np.sqrt(np.sum((np.dot(hrf, S) - y) ** 2, axis=0) / n_scans)
if abs(nv - noise_estimate) > precision:
lambda_ = np.nan_to_num(lambda_ * noise_estimate / nv)

Expand Down
Loading