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

[FIX] Sort comptable by varex before identifying outlier components #261

Closed
wants to merge 3 commits into from
Closed
Changes from 2 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
22 changes: 13 additions & 9 deletions tedana/selection/select_comps.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,20 @@ def selcomps(seldict, comptable, mmix, manacc, n_echos):
varex_upper_p = np.median(
comptable.loc[comptable['kappa'] > getelbow(comptable['kappa'], return_val=True),
'variance explained'])

# Sort component table by variance explained and find outlier components by
# change in variance explained from one component to the next.
# Remove variance-explained outliers from list of components to consider
# for acceptance. These components will have another chance to be accepted
# later on.
# NOTE: We're not sure why this is done this way, nor why it's specifically
# done three times.
ncls = acc.copy()
# NOTE: We're not sure why this is done, nor why it's specifically done
# three times. Need to look into this deeper, esp. to make sure the 3
# isn't a hard-coded reference to the number of echoes.
# Reduce components to investigate as "good" to ones in which change in
# variance explained is less than the limit defined above.... What?
for nn in range(3):
ncls = comptable.loc[ncls].loc[
comptable.loc[
ncls, 'variance explained'].diff() < varex_upper_p].index.values
for i_loop in range(3):
temp_comptable = comptable.loc[ncls].sort_values(by=['variance explained'],
ascending=False)
ncls = temp_comptable.loc[
temp_comptable['variance explained'].diff() < varex_upper_p].index.values

# Compute elbows from other elbows
kappas_under_f01 = (comptable.loc[comptable['kappa'] <
Expand Down