Skip to content

Commit

Permalink
Started prototype for creating figure of B1+ along cord
Browse files Browse the repository at this point in the history
  • Loading branch information
jcohenadad committed Dec 23, 2023
1 parent 6b78852 commit ec36eed
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion data_processing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,42 @@
"outputs": [],
"source": [
"# Make figure of B1+ values along the spinal cord across shim methods\n",
"# WIP\n",
"\n",
"# TODO"
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import glob\n",
"\n",
"subject='sub-01'\n",
"os.chdir(os.path.join(path_data, subject, \"fmap\"))\n",
"\n",
"# Pattern to match all files starting with 'TB1TFL_' and ending with '.csv'\n",
"file_pattern = f\"TB1TFL_*.csv\"\n",
"\n",
"\n",
"# Initialize a matplotlib figure\n",
"plt.figure(figsize=(10, 6))\n",
"\n",
"# Iterate over all files that match the pattern\n",
"for file_path in glob.glob(file_pattern):\n",
" # Read the CSV file\n",
" df = pd.read_csv(file_path)\n",
"\n",
" # Assuming 'WA()' is the column name, extract data from this column\n",
" wa_data = df['WA()']\n",
" \n",
" # Plot the data\n",
" plt.plot(wa_data, label=file_path.split('/')[-1]) # Using file name as label\n",
"\n",
"# Adding title, labels, and legend\n",
"plt.title('Data from Column WA() Across Multiple Files')\n",
"plt.xlabel('Index')\n",
"plt.ylabel('Values')\n",
"plt.legend()\n",
"plt.grid(True)\n",
"\n",
"# Display the plot\n",
"plt.show()"
]
}
],
Expand Down

0 comments on commit ec36eed

Please sign in to comment.