Skip to content

Commit

Permalink
Update tab_picker.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTranter committed Feb 7, 2024
1 parent 9866058 commit e43a6ba
Showing 1 changed file with 114 additions and 53 deletions.
167 changes: 114 additions & 53 deletions notebooks/tab_picker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,19 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 27,
"id": "9659c5b7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"wrk = op.Workspace()\n",
"save_root = os.path.join(ecm.OUTPUT_DIR, \"spiral\")\n",
"save_fig = os.path.join(save_root, 'tabs.png'),\n",
"config = configparser.ConfigParser()\n",
"config.read(os.path.join(save_root, 'config.txt'))"
"save_fig = os.path.join(save_root, 'tabs.png'),"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 28,
"id": "eecb02c1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -75,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 29,
"id": "94c98ea6",
"metadata": {},
"outputs": [],
Expand All @@ -99,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 30,
"id": "001c4004",
"metadata": {},
"outputs": [],
Expand All @@ -120,24 +107,68 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 54,
"id": "64ed98f1-9189-4521-a444-7775ce949ff1",
"metadata": {},
"outputs": [],
"source": [
"Npoints = 36\n",
"dtheta=int(360/Npoints)\n",
"spacing=200e-6\n",
"inner_r=1.5e-3\n",
"pos_tabs=[0]\n",
"neg_tabs=[-1]\n",
"tesla_tabs=False\n",
"Nlayers=5\n",
"length_3d=650e-3"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "4ee4159c",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "make_spiral_net() missing 7 required positional arguments: 'dtheta', 'spacing', 'inner_r', 'pos_tabs', 'neg_tabs', 'length_3d', and 'tesla_tabs'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[6], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m project, arc_edges \u001b[38;5;241m=\u001b[39m ecm\u001b[38;5;241m.\u001b[39mmake_spiral_net(config)\n\u001b[0;32m 2\u001b[0m net \u001b[38;5;241m=\u001b[39m project\u001b[38;5;241m.\u001b[39mnetwork\n\u001b[0;32m 3\u001b[0m Npcc \u001b[38;5;241m=\u001b[39m net\u001b[38;5;241m.\u001b[39mnum_pores(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpos_cc\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"\u001b[1;31mTypeError\u001b[0m: make_spiral_net() missing 7 required positional arguments: 'dtheta', 'spacing', 'inner_r', 'pos_tabs', 'neg_tabs', 'length_3d', and 'tesla_tabs'"
"name": "stderr",
"output_type": "stream",
"text": [
"------------------------------------------------------------\n",
"CRITICAL : front and back labels have been switched to obey the right-hand rule \n",
"SOURCE : openpnm.network.Cubic.__init__ \n",
"TIME STAMP : 2024-02-07 12:27:20,261\n",
"------------------------------------------------------------\n",
"------------------------------------------------------------\n",
"CRITICAL : front and back labels have been switched to obey the right-hand rule \n",
"SOURCE : openpnm.network.Cubic.__init__ \n",
"TIME STAMP : 2024-02-07 12:27:20,275\n",
"------------------------------------------------------------\n",
"------------------------------------------------------------\n",
"CRITICAL : front and back labels have been switched to obey the right-hand rule \n",
"SOURCE : openpnm.network.Cubic.__init__ \n",
"TIME STAMP : 2024-02-07 12:27:20,279\n",
"------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Num pos 180 Num neg 180\n"
]
}
],
"source": [
"project, arc_edges = ecm.make_spiral_net(config)\n",
"project, arc_edges = ecm.make_spiral_net(\n",
" dtheta=dtheta,\n",
" spacing=spacing,\n",
" inner_r=inner_r,\n",
" pos_tabs=pos_tabs,\n",
" neg_tabs=neg_tabs,\n",
" tesla_tabs=tesla_tabs,\n",
" Nlayers=Nlayers,\n",
" length_3d=length_3d\n",
")\n",
"net = project.network\n",
"Npcc = net.num_pores('pos_cc')\n",
"Nncc = net.num_pores('neg_cc')\n",
Expand All @@ -146,32 +177,39 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 61,
"id": "f5b70bf3",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, 36, 72, 108, 144] [162, 126, 90, 54, 18]\n"
]
}
],
"source": [
"init_pos = [0 + (4*36*i) for i in range(5)]\n",
"init_neg = [(Nncc-1) - (4*36*i) for i in range(5)]\n",
"init_pos = [0, 445]\n",
"init_neg = [445, 686]"
"init_pos = [0 + (Npoints*i) for i in range(5)]\n",
"init_neg = [(Nncc-int(Npoints/2)) - (Npoints*i) for i in range(5)]\n",
"print(init_pos, init_neg)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 62,
"id": "bd6d27ac",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d29a4f3668c5457cacebd4911a488b1d",
"model_id": "fc123837806443549f33838491c7fc3e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=0, description='p1', max=720), IntSlider(value=0, description='p2', max="
"interactive(children=(IntSlider(value=0, description='p1', max=180), IntSlider(value=36, description='p2', max…"
]
},
"metadata": {},
Expand All @@ -183,29 +221,29 @@
"<function __main__.update_plot(p1, p2, p3, p4, p5, n1, n2, n3, n4, n5, net)>"
]
},
"execution_count": 8,
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"interact_manual(update_plot,\n",
" p1=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[0]),\n",
" p2=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[0]),\n",
" p3=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[0]),\n",
" p4=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[0]),\n",
" p5=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[1]),\n",
" p2=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[1]),\n",
" p3=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[2]),\n",
" p4=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[3]),\n",
" p5=widgets.IntSlider(min=0, max=Npcc, step=1, value=init_pos[4]),\n",
" n1=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[0]),\n",
" n2=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[0]),\n",
" n3=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[0]),\n",
" n4=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[0]),\n",
" n5=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[1]),\n",
" n2=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[1]),\n",
" n3=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[2]),\n",
" n4=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[3]),\n",
" n5=widgets.IntSlider(min=0, max=Nncc, step=1, value=init_neg[4]),\n",
" net=fixed(net))"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 63,
"id": "bd0efeff",
"metadata": {},
"outputs": [],
Expand All @@ -217,7 +255,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 64,
"id": "37e5dfa5",
"metadata": {},
"outputs": [],
Expand All @@ -229,20 +267,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 65,
"id": "8e4127e2",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"106 106\n"
]
}
],
"source": [
"print(P_neg_tab, P_pos_tab)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 66,
"id": "ea812b3a",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"array([[ 1],\n",
" [ 73],\n",
" [145],\n",
" [217],\n",
" [289]], dtype=int64)"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.argwhere(net['pore.pos_tab'])"
]
Expand Down

0 comments on commit e43a6ba

Please sign in to comment.