Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuboudreau committed Oct 1, 2024
1 parent 28414b9 commit b01f645
Showing 1 changed file with 0 additions and 154 deletions.
154 changes: 0 additions & 154 deletions figures/2 T1 mapping/figure_2-2.ipynb
Original file line number Diff line number Diff line change
@@ -1,159 +1,5 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"jupytext:\n",
" formats: md:myst\n",
" text_representation:\n",
" extension: .md\n",
" format_name: myst\n",
"kernelspec:\n",
" display_name: Python 3\n",
" language: python\n",
" name: python3\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'repo2data'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrepo2data\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrepo2data\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Repo2Data\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m \n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpickle\u001b[39;00m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'repo2data'"
]
}
],
"source": [
"from repo2data.repo2data import Repo2Data\n",
"import os \n",
"import pickle\n",
"import matplotlib.pyplot as plt\n",
"import chart_studio.plotly as py\n",
"import plotly.graph_objs as go\n",
"import numpy as np\n",
"from plotly import __version__\n",
"from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n",
"from IPython.display import display, HTML\n",
"from plotly import tools\n",
"\n",
"data_req_path = os.path.join(\"..\",\"..\", \"binder\", \"data_requirement.json\")\n",
"repo2data = Repo2Data(data_req_path)\n",
"DATA_ROOT = os.path.join(repo2data.install()[0],\"t1-book-neurolibre\")\n",
"\n",
"filename = os.path.join(DATA_ROOT,\"01\",'figure_2.pkl')\n",
"\n",
"with open(filename, 'rb') as f:\n",
" params, signal_WM, signal_GM, signal_CSF = pickle.load(f)\n",
"\n",
"config={'showLink': False, 'displayModeBar': False}\n",
"\n",
"init_notebook_mode(connected=True)\n",
"\n",
"wm = go.Scatter(\n",
" x = params[\"TI\"],\n",
" y = signal_WM,\n",
" name = 'T<sub>1</sub> = 0.9 s (White Matter)',\n",
" text = 'T<sub>1</sub> = 0.9 s (White Matter)',\n",
" hoverinfo = 'x+y+text'\n",
")\n",
"\n",
"gm = go.Scatter(\n",
" x = params[\"TI\"],\n",
" y = signal_GM,\n",
" name = 'T<sub>1</sub> = 1.5 s (Grey Matter)',\n",
" text = 'T<sub>1</sub> = 1.5 s (Grey Matter)',\n",
" hoverinfo = 'x+y+text'\n",
")\n",
"\n",
"csf = go.Scatter(\n",
" x = params[\"TI\"],\n",
" y = signal_CSF,\n",
" name = 'T<sub>1</sub> = 4.0 s (Cerebrospinal Fluid)',\n",
" text = 'T<sub>1</sub> = 4.0 s (Cerebrospinal Fluid)',\n",
" hoverinfo = 'x+y+text'\n",
")\n",
"\n",
"data = [wm, gm, csf]\n",
"\n",
"layout = go.Layout(\n",
" width=600,\n",
" height=350,\n",
" margin=go.layout.Margin(\n",
" l=100,\n",
" r=50,\n",
" b=60,\n",
" t=0,\n",
" ),\n",
" annotations=[\n",
" dict(\n",
" x=0.5004254919715793,\n",
" y=-0.175,\n",
" showarrow=False,\n",
" text='Inversion Time – TI (ms)',\n",
" font=dict(\n",
" family='Times New Roman',\n",
" size=22\n",
" ),\n",
" xref='paper',\n",
" yref='paper'\n",
" ),\n",
" dict(\n",
" x=-0.15,\n",
" y=0.50,\n",
" showarrow=False,\n",
" text='Long. Magnetization (M<sub>z</sub>)',\n",
" font=dict(\n",
" family='Times New Roman',\n",
" size=22\n",
" ),\n",
" textangle=-90,\n",
" xref='paper',\n",
" yref='paper'\n",
" ),\n",
" ],\n",
" xaxis=dict(\n",
" showgrid=False,\n",
" linecolor='black',\n",
" linewidth=2\n",
" ),\n",
" yaxis=dict(\n",
" showgrid=False,\n",
" linecolor='black',\n",
" linewidth=2\n",
" ),\n",
" legend=dict(\n",
" x=0.55,\n",
" y=0.15,\n",
" traceorder='normal',\n",
" font=dict(\n",
" family='Times New Roman',\n",
" size=12,\n",
" color='#000'\n",
" ),\n",
" bordercolor='#000000',\n",
" borderwidth=2\n",
" ),\n",
" plot_bgcolor='white'\n",
")\n",
"\n",
"fig = dict(data=data, layout=layout)\n",
"\n",
"plot(fig, filename = 'ir_fig_2.html', config = config)\n",
"\n",
"display(HTML('ir_fig_2.html'))"
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand Down

0 comments on commit b01f645

Please sign in to comment.