Skip to content

Commit 9962a39

Browse files
committed
Initial version is ready
1 parent facd6fd commit 9962a39

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ classifiers =
2525
python_requires = >= 3.6
2626
install_requires =
2727
pandas
28+
numpy
2829
packages = find:
2930
include_package_data = False
3031

tedana_regressors/tedana_regressors.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import argparse
22
import sys
33

4+
import numpy as np
45
import pandas as pd
56

67
from tedana_regressors import __version__
@@ -40,32 +41,38 @@ def _get_parser():
4041
def tedana_regressors(ctab, mix, prefix):
4142

4243
# Load component table and mixing matrix into pandas dataframes
44+
np.print("Loading component table and mixing matrix...")
4345
ctab_df = pd.read_csv(ctab, sep="\t", index_col=0)
4446
mix_df = pd.read_csv(mix, sep="\t", index_col=None)
4547

4648
# Extract the indices of the components that have "accepted" in the "classification" column of
4749
# ctab_df
50+
print("Extracting and saving accepted components...")
4851
accepted_components = ctab_df.loc[ctab_df["classification"] == "accepted"].index
4952

5053
# Create matrix with the columns of the mixing matrix corresponding to keys in
5154
# accepted_components and save it
52-
df_to_matrix(mix_df, accepted_components).to_csv(prefix + "_accepted.1D", sep=" ", index=False)
55+
np.savetxt(prefix + "_accepted.1D", df_to_matrix(mix_df, accepted_components), delimiter=" ")
5356

5457
# Extract the indices of the components that have "rejected" in the "classification" column of
5558
# ctab_df
59+
print("Extracting and saving rejected components...")
5660
rejected_components = ctab_df.loc[ctab_df["classification"] == "rejected"].index
57-
61+
5862
# Create matrix with the columns of the mixing matrix corresponding to keys in
5963
# rejected_components and save it
60-
df_to_matrix(mix_df, rejected_components).to_csv(prefix + "_rejected.1D", sep=" ", index=False)
64+
np.savetxt(prefix + "_rejected.1D", df_to_matrix(mix_df, rejected_components), delimiter=" ")
6165

6266
# Extract the indices of the components that have "ignored" in the "classification" column of
6367
# ctab_df
68+
print("Extracting and saving ignored components...")
6469
ignored_components = ctab_df.loc[ctab_df["classification"] == "ignored"].index
6570

6671
# Create matrix with the columns of the mixing matrix corresponding to keys in
6772
# ignored_components and save it
68-
df_to_matrix(mix_df, ignored_components).to_csv(prefix + "_ignored.1D", sep=" ", index=False)
73+
np.savetxt(prefix + "_ignored.1D", df_to_matrix(mix_df, ignored_components), delimiter=" ")
74+
75+
print("Done.")
6976

7077

7178
def _main(argv=None):

0 commit comments

Comments
 (0)