Browse Source

examples: sort output of some cells to improve reproducibility

Fabian Peter Hammerle 3 years ago
parent
commit
3a60b015fe

+ 7 - 7
examples/ashs.ipynb

@@ -60,10 +60,10 @@
     {
      "data": {
       "text/plain": [
-       "['bert_right_corr_nogray_volumes.txt',\n",
-       " 'bert_left_heur_volumes.txt',\n",
+       "['bert_left_corr_nogray_volumes.txt',\n",
        " 'bert_left_corr_usegray_volumes.txt',\n",
-       " 'bert_left_corr_nogray_volumes.txt']"
+       " 'bert_left_heur_volumes.txt',\n",
+       " 'bert_right_corr_nogray_volumes.txt']"
       ]
      },
      "execution_count": 3,
@@ -77,7 +77,7 @@
     "\n",
     "volume_files = list(filter(lambda f: f.subject == SUBJECT, \n",
     "                           HippocampalSubfieldsVolumeFile.find(SUBJECTS_DIR)))\n",
-    "[os.path.basename(f.absolute_path) for f in volume_files]"
+    "sorted(os.path.basename(f.absolute_path) for f in volume_files)"
    ]
   },
   {
@@ -187,8 +187,8 @@
      "data": {
       "text/plain": [
        "nogray     14\n",
-       "usegray     7\n",
        "none        7\n",
+       "usegray     7\n",
        "Name: correction, dtype: int64"
       ]
      },
@@ -199,7 +199,7 @@
    ],
    "source": [
     "volume_frame['correction'].fillna('none', inplace=True)\n",
-    "volume_frame['correction'].value_counts()"
+    "volume_frame['correction'].value_counts().sort_index()"
    ]
   },
   {
@@ -1168,7 +1168,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.3"
+   "version": "3.7.10"
   }
  },
  "nbformat": 4,

+ 17 - 16
examples/compare_ashs_freesurfer_hipposf.ipynb

@@ -6,7 +6,7 @@
    "source": [
     "# Compare Hippocampal Subfield Volumes Computed By ASHS & Freesurfer\n",
     "\n",
-    "<font color='red'>CAUTION: Dummy data with pseudo volumes</font>"
+    "<font color='red'>NOTE: Dummy data with pseudo volumes</font>"
    ]
   },
   {
@@ -62,37 +62,37 @@
        "      <th>0</th>\n",
        "      <td>bert</td>\n",
        "      <td>ASHS</td>\n",
-       "      <td>bert_right_corr_nogray_volumes.txt</td>\n",
+       "      <td>bert_left_corr_nogray_volumes.txt</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>1</th>\n",
        "      <td>bert</td>\n",
        "      <td>ASHS</td>\n",
-       "      <td>bert_left_heur_volumes.txt</td>\n",
+       "      <td>bert_left_corr_usegray_volumes.txt</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>2</th>\n",
        "      <td>bert</td>\n",
        "      <td>ASHS</td>\n",
-       "      <td>bert_left_corr_usegray_volumes.txt</td>\n",
+       "      <td>bert_left_heur_volumes.txt</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>3</th>\n",
        "      <td>bert</td>\n",
        "      <td>ASHS</td>\n",
-       "      <td>bert_left_corr_nogray_volumes.txt</td>\n",
+       "      <td>bert_right_corr_nogray_volumes.txt</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>4</th>\n",
        "      <td>bert</td>\n",
        "      <td>Freesurfer</td>\n",
-       "      <td>lh.hippoSfVolumes-T1.v10.txt</td>\n",
+       "      <td>lh.hippoSfVolumes-T1-T2.v10.txt</td>\n",
        "    </tr>\n",
        "    <tr>\n",
        "      <th>5</th>\n",
        "      <td>bert</td>\n",
        "      <td>Freesurfer</td>\n",
-       "      <td>lh.hippoSfVolumes-T1-T2.v10.txt</td>\n",
+       "      <td>lh.hippoSfVolumes-T1.v10.txt</td>\n",
        "    </tr>\n",
        "  </tbody>\n",
        "</table>\n",
@@ -100,12 +100,12 @@
       ],
       "text/plain": [
        "  subject source_type                     source_basename\n",
-       "0    bert        ASHS  bert_right_corr_nogray_volumes.txt\n",
-       "1    bert        ASHS          bert_left_heur_volumes.txt\n",
-       "2    bert        ASHS  bert_left_corr_usegray_volumes.txt\n",
-       "3    bert        ASHS   bert_left_corr_nogray_volumes.txt\n",
-       "4    bert  Freesurfer        lh.hippoSfVolumes-T1.v10.txt\n",
-       "5    bert  Freesurfer     lh.hippoSfVolumes-T1-T2.v10.txt"
+       "0    bert        ASHS   bert_left_corr_nogray_volumes.txt\n",
+       "1    bert        ASHS  bert_left_corr_usegray_volumes.txt\n",
+       "2    bert        ASHS          bert_left_heur_volumes.txt\n",
+       "3    bert        ASHS  bert_right_corr_nogray_volumes.txt\n",
+       "4    bert  Freesurfer     lh.hippoSfVolumes-T1-T2.v10.txt\n",
+       "5    bert  Freesurfer        lh.hippoSfVolumes-T1.v10.txt"
       ]
      },
      "execution_count": 2,
@@ -131,7 +131,8 @@
     "volume_frame = pandas.concat([find_read_volume_files('ASHS', ashs.HippocampalSubfieldsVolumeFile),\n",
     "                              find_read_volume_files('Freesurfer', freesurfer.HippocampalSubfieldsVolumeFile)],\n",
     "                             sort=False)\n",
-    "volume_frame[['subject', 'source_type', 'source_basename']].drop_duplicates().reset_index(drop=True)"
+    "volume_frame[['subject', 'source_type', 'source_basename']].drop_duplicates() \\\n",
+    "    .sort_values(by='source_basename').reset_index(drop=True)"
    ]
   },
   {
@@ -466,7 +467,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "<font color='red'>CAUTION: Dummy data with pseudo volumes</font>"
+    "<font color='red'>NOTE: Dummy data with pseudo volumes</font>"
    ]
   },
   {
@@ -1308,7 +1309,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.7"
+   "version": "3.7.10"
   }
  },
  "nbformat": 4,

+ 2 - 2
examples/freesurfer_hipposf.ipynb

@@ -225,7 +225,7 @@
     "volume_frame['segmentation_mode'] = volume_frame.apply(generate_mode_label, axis=1)\n",
     "volume_frame.to_csv('freesurfer_hipposf_volumes_{}.csv'.format(SUBJECT),\n",
     "                    index=False)\n",
-    "volume_frame['segmentation_mode'].value_counts()"
+    "volume_frame['segmentation_mode'].value_counts().sort_index()"
    ]
   },
   {
@@ -2036,7 +2036,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.7"
+   "version": "3.7.10"
   }
  },
  "nbformat": 4,