Skip to content

Commit

Permalink
fix several flaek8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Mar 19, 2024
1 parent e2a3bd7 commit d36e47e
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 25 deletions.
8 changes: 2 additions & 6 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ ignore =
E401,
F401,
F811,
F841,
F821,
FS001
W503,
W504,
W605,
F541,
E902


# for compatibility with black
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
extend-ignore = E203
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ repos:
rev: 7.0.0
hooks:
- id: flake8
args: [--config, .flake8, --verbose, pydfc, rest_dFC, task_dFC]
args: [--config, .flake8, --verbose, pydfc, HCP_resting_state_analysis, task_dFC]
additional_dependencies: [flake8-use-fstring]
11 changes: 4 additions & 7 deletions HCP_resting_state_analysis/functions/dFC_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ def visualize_conn_mat_dict(
cb_ax = fig.add_axes([0.91, b, 0.007, h])
else:
cb_ax = fig.add_axes([0.91, b, 0.01, h])
cbar = fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??
fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??

if save_image:
folder = output_root[: output_root.rfind("/")]
Expand Down Expand Up @@ -880,12 +880,12 @@ def visualize_conn_mat_2D_dict(
if not node_networks is None:
fig.subplots_adjust(wspace=0.45, hspace=0.50)

l, b, w, h = axs[-1][-1].get_position().bounds
_, _, _, h = axs[-1][-1].get_position().bounds
if node_networks is None:
cb_ax = fig.add_axes([0.91, 0.5 - h / 2, 0.007, h])
else:
cb_ax = fig.add_axes([0.91, 0.5 - h / 2, 0.015, h])
cbar = fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??
fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??

if save_image:
folder = output_root[: output_root.rfind("/")]
Expand Down Expand Up @@ -1415,9 +1415,6 @@ def estimate_group_FCS(self, time_series_dict):
def group_dFCM_assess(self, time_series_dict):

# time_series_dict is a dict of time_series

SUBJ_s_dFCM_dict = {}

SUBJECTs = common_subj_lst(time_series_dict)

if self.params["n_jobs"] is None:
Expand Down Expand Up @@ -2103,7 +2100,7 @@ def visualize_TPM(self, normalize=True, save_image=False, output_root=None):

plt.figure(figsize=(5, 5))
plt.imshow(np.squeeze(C), interpolation="nearest", aspect="equal", cmap="jet")
cb = plt.colorbar(shrink=0.8)
plt.colorbar(shrink=0.8)
plt.title(self.measure_name + " TPM")

if save_image:
Expand Down
4 changes: 2 additions & 2 deletions HCP_resting_state_analysis/functions/post_analysis_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def plot_rois(node_networks, nodes_locs, save_image=False, output_root=None):
axes=axes[i],
)

title = f"Resting State Networks"
title = "Resting State Networks"
# set subplot titles
for i, network in enumerate(networks):
axes[i].title.set_text(f"{network} network")
Expand Down Expand Up @@ -1123,7 +1123,7 @@ def plot_TSNE(
ax = fig.add_subplot(projection="3d")
sample_measure_array = np.array(sample_measure_lst)
for measure in measures_lst:
scatter = ax.scatter(
ax.scatter(
X_embedded[sample_measure_array == measure, 0],
X_embedded[sample_measure_array == measure, 1],
X_embedded[sample_measure_array == measure, 2],
Expand Down
2 changes: 1 addition & 1 deletion HCP_resting_state_analysis/post_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

if not num_subj2include is None:
ALL_RECORDS = ALL_RECORDS[:num_subj2include]
print("*** %d subjects were included." % (num_subj2include))
print(f"*** {num_subj2include} subjects were included.")

FILTERS = [key for key in output]
print(FILTERS)
Expand Down
2 changes: 1 addition & 1 deletion pydfc/comparison/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def plot_TSNE(
ax = fig.add_subplot(projection="3d")
sample_measure_array = np.array(sample_measure_lst)
for measure in measures_lst:
scatter = ax.scatter(
ax.scatter(
X_embedded[sample_measure_array == measure, 0],
X_embedded[sample_measure_array == measure, 1],
X_embedded[sample_measure_array == measure, 2],
Expand Down
4 changes: 2 additions & 2 deletions pydfc/dfc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def visualize_conn_mat_dict(
cb_ax = fig.add_axes([0.91, b, 0.007, h])
else:
cb_ax = fig.add_axes([0.91, b, 0.01, h])
cbar = fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??
fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??

if save_image:
folder = output_root[: output_root.rfind("/")]
Expand Down Expand Up @@ -919,7 +919,7 @@ def visualize_conn_mat_2D_dict(
cb_ax = fig.add_axes([0.91, 0.5 - h / 2, 0.007, h])
else:
cb_ax = fig.add_axes([0.91, 0.5 - h / 2, 0.015, h])
cbar = fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??
fig.colorbar(im, cax=cb_ax, shrink=0.8) # shrink=0.8??

if save_image:
folder = output_root[: output_root.rfind("/")]
Expand Down
3 changes: 0 additions & 3 deletions pydfc/multi_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ def estimate_group_FCS(self, time_series_dict):
def group_dFC_assess(self, time_series_dict):

# time_series_dict is a dict of time_series

SUBJ_s_dFC_dict = {}

SUBJECTs = common_subj_lst(time_series_dict)

if self.params["n_jobs"] is None:
Expand Down
2 changes: 1 addition & 1 deletion pydfc/task_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def plot_task_dFC(task_labels, dFC_lst, event_types, Fs_mri, TR_step=12):
scale_task_plot = 20

# plot task_data['event_labels']
fig = plt.figure(figsize=(50, 200))
plt.figure(figsize=(50, 200))

ax = plt.gca()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def simulated_bold_data(tmp_path):


def test_load(simulated_bold_data):
timeseries = nifti2timeseries(
nifti2timeseries(
nifti_file=str(simulated_bold_data),
n_rois=100,
Fs=1 / 0.75,
Expand Down

0 comments on commit d36e47e

Please sign in to comment.