From 56d1e84a1a7730bdef4d62cfcf6cb8287ed8f383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9line=20Provins?= Date: Fri, 17 May 2024 21:09:00 +0200 Subject: [PATCH] sty: ruff --- docs/notebooks/Tutorial.ipynb | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/notebooks/Tutorial.ipynb b/docs/notebooks/Tutorial.ipynb index af9ebe68..29840f9b 100644 --- a/docs/notebooks/Tutorial.ipynb +++ b/docs/notebooks/Tutorial.ipynb @@ -22,7 +22,8 @@ "source": [ "# Silence warnings\n", "import warnings\n", - "warnings.simplefilter(action='ignore', category=UserWarning)\n", + "\n", + "warnings.simplefilter(action=\"ignore\", category=UserWarning)\n", "\n", "# Load data\n", "import glob\n", @@ -40,7 +41,7 @@ "\n", "# Load functional connectivity matrices\n", "fc_matrices = []\n", - "connectivity_files = glob.glob(op.join(output, '**', '*connectivity.tsv'), recursive=True)\n", + "connectivity_files = glob.glob(op.join(output, \"**\", \"*connectivity.tsv\"), recursive=True)\n", "for idx, connectivity_file in enumerate(connectivity_files):\n", " fc_matrix = np.loadtxt(connectivity_file, delimiter=\"\\t\")\n", " flattened = fc_matrix.reshape(-1)\n", @@ -73,7 +74,8 @@ "source": [ "# Silence futureWarnings\n", "import warnings\n", - "warnings.simplefilter(action='ignore', category=FutureWarning)\n", + "\n", + "warnings.simplefilter(action=\"ignore\", category=FutureWarning)\n", "\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt\n", @@ -84,6 +86,7 @@ "FC_FIGURE_SIZE: tuple = (70, 45)\n", "LABELSIZE: int = 60\n", "\n", + "\n", "def group_reportlet_fc_dist(fc_matrices: list[np.ndarray], output: str) -> None:\n", " \"\"\"Plot and save the functional connectivity density distributions.\n", "\n", @@ -96,7 +99,7 @@ " \"\"\"\n", " _, ax = plt.subplots(figsize=FC_FIGURE_SIZE)\n", " ax.tick_params(labelsize=LABELSIZE)\n", - " mpl.rcParams['legend.fontsize'] = LABELSIZE\n", + " mpl.rcParams[\"legend.fontsize\"] = LABELSIZE\n", "\n", " fc_df = pd.DataFrame(fc_matrices, columns=[\"value\", \"session\"])\n", "\n", @@ -111,8 +114,8 @@ " )\n", "\n", " plt.tick_params(labelsize=LABELSIZE)\n", - " plt.xlabel('Value', fontsize=LABELSIZE+4)\n", - " plt.ylabel('Density', fontsize=LABELSIZE+4)\n", + " plt.xlabel(\"Value\", fontsize=LABELSIZE + 4)\n", + " plt.ylabel(\"Density\", fontsize=LABELSIZE + 4)\n", "\n", " # Ensure the labels are within the figure\n", " plt.tight_layout()\n", @@ -122,6 +125,8 @@ "\n", " plt.savefig(op.join(output, savename))\n", " plt.close()\n", + "\n", + "\n", "group_reportlet_fc_dist(fc_matrices, output)" ] }, @@ -157,6 +162,8 @@ "\n", "# The literature indicates that less than 5 minutes of fMRI signal after censoring is not enough to reliably estimate functional connectivity.\n", "DURATION_CUT_OFF = 300\n", + "\n", + "\n", "# Generate each reportlets\n", "def group_report_censoring(good_timepoints_df, output) -> None:\n", " \"\"\"\n", @@ -233,6 +240,8 @@ " filename=op.join(output, \"reportlets\", \"group_desc-censoring_bold.html\"),\n", " auto_open=False,\n", " )\n", + "\n", + "\n", "group_report_censoring(good_timepoints_df, output)" ] }, @@ -356,7 +365,7 @@ " out_filename=\"group_report.html\",\n", " bootstrap_file=op.join(\"data\", \"reports-spec.yml\"),\n", ")\n", - "robj.generate_report()\n" + "robj.generate_report()" ] }, {