Skip to content

Commit

Permalink
Run nbs to generate out files to use as examples
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBordiga committed Jul 24, 2024
1 parent f0a43a1 commit d0157fe
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 89 deletions.
48 changes: 25 additions & 23 deletions notebooks/quads_energy_splitting_3dp_pla_shims.ipynb

Large diffs are not rendered by default.

82 changes: 65 additions & 17 deletions notebooks/quads_focusing_3dp_pla_shims.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions notebooks/quads_focusing_multi_input_3dp_pla_shims.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -399,14 +399,14 @@
" <Axes: xlabel='$x$ [mm]', ylabel='$y$ [mm]'>)"
]
},
"execution_count": 17,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "068d9c8ba5d5443ba2d54aeda4b504ff",
"model_id": "03c9a95ebd3847008559e407929a0ef9",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -479,13 +479,13 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "499ca48c22024b839e29866b729e0d23",
"model_id": "47e6f806e99e4baaab9b649cd1b8212d",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -510,7 +510,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ff426cc7b39e4db99e3de48b1227d23b",
"model_id": "33b07b5b3dda41cf9578973c1bb8fa95",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -535,7 +535,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "28a7ea2f1bdc44d49b0d93c5e8fd2abd",
"model_id": "05c7babc38ac4275b56b62142909b67c",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -591,13 +591,13 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8f131bd1ebd6474e9941690db3dcbf8e",
"model_id": "a16b49f78c3343248b199d420bf23398",
"version_major": 2,
"version_minor": 0
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -66,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -676,7 +676,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -771,9 +771,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "OSError",
"evalue": "[Errno 36] File name too long: '../data/quads_focusing_switching_static_tuning_3dp_pla_shims/opt_with_angle_30_and_length_3_constraints_quads_24x18_excited_blocks_2_amplitude_7.50_loading_rate_30.00_input_shift_0_initial_angle_20.0_target_sizes_((2, 2), (2, 2))_target_shifts_((5, 3), (-3, -3))_compressive_strains_(0.02, 0.05)_weights_(0.5, 0.5).pkl'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m optimization \u001b[38;5;241m=\u001b[39m OptimizationProblem\u001b[38;5;241m.\u001b[39mfrom_dict(\n\u001b[0;32m----> 2\u001b[0m \u001b[43mload_data\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m../data/\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43moptimization\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m/\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43moptimization_filename\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m.pkl\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 5\u001b[0m )\n",
"File \u001b[0;32m~/research/DifFlexMM/difflexmm/utils.py:193\u001b[0m, in \u001b[0;36mload_data\u001b[0;34m(path_or_filename)\u001b[0m\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mload_data\u001b[39m(path_or_filename: Union[\u001b[38;5;28mstr\u001b[39m, Path]):\n\u001b[1;32m 184\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Loads data object via `pickle`.\u001b[39;00m\n\u001b[1;32m 185\u001b[0m \n\u001b[1;32m 186\u001b[0m \u001b[38;5;124;03m Args:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 190\u001b[0m \u001b[38;5;124;03m object: The data object.\u001b[39;00m\n\u001b[1;32m 191\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 193\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mpath_or_filename\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrb\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m file:\n\u001b[1;32m 194\u001b[0m data \u001b[38;5;241m=\u001b[39m pickle\u001b[38;5;241m.\u001b[39mload(file)\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(data, (SolutionData, EigenmodeData)):\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# Cast arrays to jax arrays\u001b[39;00m\n",
"\u001b[0;31mOSError\u001b[0m: [Errno 36] File name too long: '../data/quads_focusing_switching_static_tuning_3dp_pla_shims/opt_with_angle_30_and_length_3_constraints_quads_24x18_excited_blocks_2_amplitude_7.50_loading_rate_30.00_input_shift_0_initial_angle_20.0_target_sizes_((2, 2), (2, 2))_target_shifts_((5, 3), (-3, -3))_compressive_strains_(0.02, 0.05)_weights_(0.5, 0.5).pkl'"
]
}
],
"source": [
"optimization = OptimizationProblem.from_dict(\n",
" load_data(\n",
Expand Down Expand Up @@ -926,7 +939,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "13e49d7086464658baa0d6e60c482dc3",
"model_id": "67982ea5d8574adb98519035a0b57e72",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -964,8 +977,10 @@
"for spine in axes.spines.values():\n",
" spine.set_linewidth(1)\n",
"axes.locator_params(axis=\"both\", integer=True)\n",
"out_path = Path(f\"../out/{optimization.name}/pareto/{pareto_folder}/pareto_front.png\")\n",
"out_path.parent.mkdir(parents=True, exist_ok=True)\n",
"fig.savefig(\n",
" f\"../out/{optimization.name}/pareto/{pareto_folder}/pareto_front.png\",\n",
" out_path,\n",
" dpi=300,\n",
")"
]
Expand Down Expand Up @@ -1033,7 +1048,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2718f70915b345e992e0514a9a512248",
"model_id": "25a44480d9b34441b50fdb1da602f165",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1081,13 +1096,13 @@
},
{
"cell_type": "code",
"execution_count": 62,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "990f84bb476c423aa8fde6682166795a",
"model_id": "e7a6e6910f4a46d187c15c29f794988e",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1145,13 +1160,13 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4249bfe587c7477eb212195b083e3578",
"model_id": "d99f12ad314946e78b61d9c1bcb3983b",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1245,13 +1260,13 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "88ec9483d1384da8b7292cd6ed9af503",
"model_id": "48dd09bebb344cbbad2fbc5b0fb902f1",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1673,7 +1688,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1865,20 +1880,9 @@
"14 261.486044 541.154594 1.133666 "
]
},
"execution_count": 9,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
},
{
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
"\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
"\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
]
}
],
"source": [
Expand All @@ -1892,13 +1896,13 @@
},
{
"cell_type": "code",
"execution_count": 115,
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a82eda776cde4acc85659f32b93f8e89",
"model_id": "93f540be30ac468594ec17b3e49e7b71",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -1979,7 +1983,7 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -2026,13 +2030,13 @@
},
{
"cell_type": "code",
"execution_count": 91,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2feece7e795945649c4b561a0535ceb6",
"model_id": "43af67af991a4df1b2cec4380c7dc06a",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -2088,13 +2092,13 @@
},
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f68d2b133ed24220a154ea7f1ecf9bb4",
"model_id": "cdb4c97f5fad4d42b2a7150181f67991",
"version_major": 2,
"version_minor": 0
},
Expand Down
64 changes: 58 additions & 6 deletions notebooks/quads_spin_3dp_pla_shims.ipynb

Large diffs are not rendered by default.

0 comments on commit d0157fe

Please sign in to comment.