Commit e567919c authored by Jonathan Perry's avatar Jonathan Perry
Browse files

catch up

parent 32108ecf
......@@ -7,8 +7,8 @@
# EOM parameters from https://logbook.virgo-gw.eu/virgo/?r=34898
# and https://logbook.virgo-gw.eu/virgo/?r=38123
# and https://logbook.virgo-gw.eu/virgo/?r=41551
laser l1 P=40.0
s s0 l1.p1 m1.p1 L=1m
laser l1 P=40.0
s s0 l1.p1 m1.p1
m m1 T=0.04835 L=30u Rc=-1430.0
s s1 m1.p2 m2.p1 L=5.9399
m m2 T=0.01377 L=27u Rc=-1424.6
......
This diff is collapsed.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"source": [
"import finesse\n",
"import numpy as np\n",
"\n",
"def color(check, against1 = None, against2 = None, colorless=False):\n",
" green = \"\\033[92m\" if not colorless else \"\"\n",
" red = \"\\033[91m\" if not colorless else \"\"\n",
" yellow = \"\\033[94m\" if not colorless else \"\"\n",
" endc = \"\\033[0m\" if not colorless else \"\"\n",
"\n",
" if isinstance(against1, np.ndarray):\n",
" color = green if np.array_equal(check, against1) else (yellow if not np.array_equal(check, against2) else red)\n",
" else:\n",
" color = \"\" if not against1 else (green if check == against1 else red)\n",
" \n",
" return f\"{color}{str(check).ljust(20)}{endc}\""
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"source": [
"# create base model\n",
"base = finesse.Model()\n",
"base.parse_file(\"coupled_cavity.kat\")\n",
"\n",
"base.parse(\"\"\"\n",
"# create cavities\n",
"# bug occurs only with coupled cavities\n",
"# remove either cav and there is no bug\n",
"cav cav1 m1.p2.o\n",
"cav cav2 m2.p2.o\n",
"\n",
"modes(even, maxtem=0)\n",
"knmd K_m1 m1 22\n",
"\n",
"pd pd_m1p1 m1.p1.o\n",
"\"\"\")\n",
"\n",
"# do base run with no change\n",
"print('No change (case1)')\n",
"out1 = base.run()\n",
"print('K_m1', color(out1['K_m1'], out1['K_m1']))\n",
"print('pd_m1p1', color(out1['pd_m1p1'], out1['pd_m1p1']), end='\\n\\n')\n",
"\n",
"# do change run with expected output\n",
"print('Change (case2)')\n",
"copy = base.deepcopy()\n",
"copy.m1.Rcx += 10\n",
"out2 = copy.run()\n",
"print('K_m1', color(out2['K_m1'], out2['K_m1']))\n",
"print('pd_m1p1', color(out2['pd_m1p1'], out2['pd_m1p1']), end='\\n\\n')\n",
"\n",
"# do bug run with unexpected output\n",
"print('Xaxis (unexpected, should be [case1 case2])')\n",
"bug = base.deepcopy()\n",
"\n",
"bug.parse('xaxis(m1.Rcx, lin, 0, 10, 1, relative=true)')\n",
"\n",
"out3 = bug.run()\n",
"print('K_m1', color(out3['K_m1'][0], out1['K_m1']), '\\n', color(out3['K_m1'][1], out2['K_m1']))\n",
"print('pd_m1p1', color(out3['pd_m1p1'][0], out1['pd_m1p1']), color(out3['pd_m1p1'][1], out2['pd_m1p1']))"
],
"outputs": [
{
"output_type": "error",
"ename": "ModuleNotFoundError",
"evalue": "No module named 'spellchecker'",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-20ea812ffe99>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# create base model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mbase\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfinesse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mbase\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparse_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"coupled_cavity.kat\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m base.parse(\"\"\"\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[0;34mf\"Model has been built for a simulation, cannot use {func} here\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 67\u001b[0m )\n\u001b[0;32m---> 68\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 69\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mparse_file\u001b[0;34m(self, path, spec)\u001b[0m\n\u001b[1;32m 1799\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mscript\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mparse_file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1800\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1801\u001b[0;31m \u001b[0mparse_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mspec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1802\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1803\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mlocked_when_built\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/__init__.py\u001b[0m in \u001b[0;36mparse_file\u001b[0;34m(path, model, spec)\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0mcompiler\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mKatCompiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mopened_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"r\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mfobj\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 56\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcompiler\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompile_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 57\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36mcompile_file\u001b[0;34m(self, fobj, model, resolve, build)\u001b[0m\n\u001b[1;32m 179\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbuild\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 181\u001b[0;31m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mROOT_NODE_NAME\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 182\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 183\u001b[0m \u001b[0;31m# Merge the compiled syntax graph into the model.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 695\u001b[0m \u001b[0;31m# Use the computed build order, not the argument order.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 696\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0margument_node\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build_order\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 697\u001b[0;31m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 698\u001b[0m \u001b[0mdirective_token\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnodes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 699\u001b[0m \u001b[0mdirective\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdirective_token\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 620\u001b[0m \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_built_arguments\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 621\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mnodetype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mKatNodeType\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mELEMENT\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 622\u001b[0;31m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_built_directive_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 623\u001b[0m \u001b[0madapter\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_element_adapter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 624\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_built_directive_params\u001b[0;34m(self, node, model)\u001b[0m\n\u001b[1;32m 810\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0margument_node\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msorted_dependent_argument_nodes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 811\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 812\u001b[0;31m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 813\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKatParameterSelfReferenceException\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 814\u001b[0m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mResolving\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 574\u001b[0m \u001b[0;31m# Copy existing model parameter by value.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 575\u001b[0m \u001b[0mtarget\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 576\u001b[0;31m \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreduce_get_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtarget\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 577\u001b[0m \u001b[0mLOGGER\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"parameter {node} targets {target} by value\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 578\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mnodetype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mKatNodeType\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPARAMETER_REFERENCE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mreduce_get_attr\u001b[0;34m(self, attr)\u001b[0m\n\u001b[1;32m 1467\u001b[0m \u001b[0;34m<\u001b[0m\u001b[0ml1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mP\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m \u001b[0;34m@\u001b[0m \u001b[0;36m0x11aa56588\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1468\u001b[0m \"\"\"\n\u001b[0;32m-> 1469\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_do_reduce_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mattr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\".\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1470\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1471\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mreduce_set_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36m_do_reduce_attr\u001b[0;34m(self, attrs)\u001b[0m\n\u001b[1;32m 1496\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1497\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1498\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mModelAttributeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattrs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1499\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1500\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mlocked_when_built\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/exceptions.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, model, pieces)\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpieces\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 116\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mspellchecker\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSpellChecker\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 117\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 118\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\".\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpieces\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'spellchecker'"
]
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"base.cav1.source"
],
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<OpticalNode m1.p2.o @ 0x7fd29b34ce50>"
]
},
"metadata": {},
"execution_count": 3
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [],
"outputs": [],
"metadata": {}
}
],
"metadata": {
"orig_nbformat": 4,
"language_info": {
"name": "python",
"version": "3.9.2",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.2 64-bit ('py39': conda)"
},
"interpreter": {
"hash": "6cc6a5f929f115ca158fdc14c6f49f61eee16b631596ece423c34a74e65da321"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
\ No newline at end of file
#--------------------------------------------------------------------------
# An Advanced Virgo Plus input file for Finesse 3
# Andreas Freise, 01.05.2021
# Laser and modulators
###########################################################################
# EOM parameters from https://logbook.virgo-gw.eu/virgo/?r=34898
# and https://logbook.virgo-gw.eu/virgo/?r=38123
# and https://logbook.virgo-gw.eu/virgo/?r=41551
laser l1 P=40.0
s s0 l1.p1 m1.p1
m m1 T=0.04835 L=30u Rc=-1430.0
s s1 m1.p2 m2.p1 L=5.9399
m m2 T=0.01377 L=27u Rc=-1424.6
s s2 m2.p2 m3.p1 L=2999.8
m m3 T=4.4u L=27u Rc=1695.0
\ No newline at end of file
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"source": [
"import finesse\n",
"import numpy as np\n",
"\n",
"from finesse.solutions import BaseSolution\n",
"from finesse.analysis.actions import Action"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
"source": [
"# Action which returns all detector outputs (including readouts)\n",
"# Returns {names, outputs, result}\n",
"class GetDetOutputs(Action):\n",
" def __init__(self, *args, name=\"get_det_outputs\"):\n",
" super().__init__(name)\n",
" \n",
" self.args = args\n",
"\n",
" def _do(self, state):\n",
" sol = GetDetOutputsSolution(self.name)\n",
"\n",
" # handle readout detectors\n",
" for ws in set(\n",
" (*state.sim.readout_workspaces, *state.sim.detector_workspaces)\n",
" ):\n",
" sol.result.update({ws.oinfo.name: ws.get_output()})\n",
" sol.names.append(ws.oinfo.name)\n",
" sol.outputs.append(ws.get_output())\n",
" \n",
" return sol\n",
"\n",
" def _requests(self, model, memo):\n",
" pass\n",
"\n",
"class GetDetOutputsSolution(BaseSolution):\n",
" def __init__(self, name, *args, **kwargs):\n",
" super().__init__(name, *args, **kwargs)\n",
" self.names = []\n",
" self.outputs = []\n",
" self.result = {}\n",
"\n",
"# --------------------Test actions----------------------\n",
"class TestNoChange(Action):\n",
" def __init__(self, name=\"testing\"):\n",
" super().__init__(name) \n",
" \n",
" def _do(self, state):\n",
" # solve carrier matrix\n",
" state.sim.run_carrier()\n",
"\n",
" # return the detector outputs\n",
" return state.apply(GetDetOutputs())\n",
"\n",
" def _requests(self, model, memo, first=True):\n",
" pass\n",
"\n",
"class TestChangeDirectly(Action):\n",
" def __init__(self, name=\"testing\"):\n",
" super().__init__(name) \n",
" \n",
" def _do(self, state):\n",
" # make the change directly\n",
" state.model.m1.Rcx += 10\n",
"\n",
" # solve carrier matrix\n",
" state.sim.run_carrier()\n",
"\n",
" # return the detector outputs\n",
" return state.apply(GetDetOutputs())\n",
"\n",
" def _requests(self, model, memo, first=True):\n",
" memo[\"changing_parameters\"].append(\"m1.Rcx\")\n",
"\n",
"# ----------------Utility-------------------\n",
"def color(check, against1 = None, against2 = None, colorless=False):\n",
" green = \"\\033[92m\" if not colorless else \"\"\n",
" red = \"\\033[91m\" if not colorless else \"\"\n",
" yellow = \"\\033[94m\" if not colorless else \"\"\n",
" endc = \"\\033[0m\" if not colorless else \"\"\n",
"\n",
" if isinstance(against1, np.ndarray):\n",
" color = green if np.array_equal(check, against1) else (yellow if not np.array_equal(check, against2) else red)\n",
" # check = 'removed for brevity'.center(40, '-')\n",
" print('')\n",
" else:\n",
" color = \"\" if not against1 else (green if check == against1 else (yellow if check != against2 else red))\n",
" \n",
" print(f\"{color}{str(check).ljust(20)}{endc}\", end=\" \")"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 4,
"source": [
"base = finesse.Model()\n",
"base.parse_file(\"virgo_f3_reduced.kat\")\n",
"\n",
"base.parse(\"\"\"\n",
"# create cavities\n",
"# bug occurs when both exist\n",
"# remove either and there is no bug\n",
"cav cav1 m1.p2.o via=m2.p1.i\n",
"cav cav2 m2.p2.o\n",
"\n",
"modes(x, maxtem=1)\n",
"knmd K_m1 m1 22\n",
"\n",
"# create photodiode\n",
"pd pd_m1p1 m1.p1.o\n",
"\"\"\")"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 5,
"source": [
"tests = []\n",
"\n",
"if True:\n",
"# from suppress import suppress_stdout\n",
"# with suppress_stdout():\n",
" print('normal'.center(40,'-'))\n",
" kat_no_change = base.deepcopy()\n",
" tests.append(TestNoChange().run(kat_no_change))\n",
" print('normal end'.center(40, '-'))\n",
"\n",
" print('expected'.center(40,'-'))\n",
" kat_no_action_w_change = base.deepcopy()\n",
" kat_no_action_w_change.m1.Rcx += 10\n",
" tests.append(TestNoChange().run(kat_no_action_w_change))\n",
" print('expected end'.center(40,'-'))\n",
"\n",
" print('unexpected'.center(40,'-'))\n",
" # kat_action_w_direct_change = base.deepcopy()\n",
" kat_action_w_direct_change = kat_no_change\n",
" tests.append(TestChangeDirectly().run(kat_action_w_direct_change))\n",
" print('unexpected end'.center(40,'-'))\n",
"\n",
"# loop dets (rows)\n",
"for det in sorted(tests[0].names):\n",
" print(str(det).ljust(10), end=\" \")\n",
"\n",
" # loop tests (cols)\n",
" for i,test in enumerate(tests):\n",
" color(test.result[det], against1=tests[1].result[det], against2=tests[0].result[det], colorless=(i==0))\n",
" \n",
" print(\"\")"
],
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"-----------------normal-----------------\n",
"\n",
"()\n",
"---------------normal end---------------\n",
"----------------expected----------------\n",
"\n",
"()\n",
"--------------expected end--------------\n",
"---------------unexpected---------------\n",
"\n",
"Dependency: cav1 [Cavity]\n",
"\n",
" o m1.p2.o\n",
" ╰──o m2.p1.i\n",
" ╰──o m2.p1.o\n",
" ╰──o m1.p2.i\n",
"\n",
" o m1.p2.i\n",
" ╰──o m1.p1.o\n",
" ╰──o l1.p1.i\n",
"\n",
"()\n",
"-------------unexpected end-------------\n",
"K_m1 \n",
"[[ 1.+0.00000000e+00j 0.+0.00000000e+00j]\n",
" [-0.+0.00000000e+00j -1.-1.33226763e-15j]] \n",
"\u001b[92m[[ 1.+0.0000000e+00j 0.+0.0000000e+00j]\n",
" [-0.+0.0000000e+00j -1.+4.4408921e-16j]]\u001b[0m \n",
"\u001b[91m[[ 1.+0.00000000e+00j 0.+0.00000000e+00j]\n",
" [-0.+0.00000000e+00j -1.-1.33226763e-15j]]\u001b[0m \n",
"pd_m1p1 39.939477432431765 \u001b[92m39.09784600908361 \u001b[0m \u001b[91m39.939477432431765 \u001b[0m \n"
]
}
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [],
"outputs": [],
"metadata": {}
}
],
"metadata": {
"orig_nbformat": 4,
"language_info": {
"name": "python",
"version": "3.9.2",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.2 64-bit ('py39': conda)"
},
"interpreter": {
"hash": "6cc6a5f929f115ca158fdc14c6f49f61eee16b631596ece423c34a74e65da321"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
\ No newline at end of file
import finesse
import numpy as np
from finesse.solutions import BaseSolution
from finesse.analysis.actions import Action
# Action which returns all detector outputs (including readouts) from the simulation.
# Returns dictionary detector_name->output
class GetDetOutputs(Action):
def __init__(self, *args, name="get_det_outputs"):
super().__init__(name)
self.args = args
def _do(self, state):
sol = GetDetOutputsSolution(self.name)
# handle readout detectors
for ws in set(
(*state.sim.readout_workspaces, *state.sim.detector_workspaces)
):
sol.result.update({ws.oinfo.name: ws.get_output()})
sol.names.append(ws.oinfo.name)
sol.outputs.append(ws.get_output())
return sol
def _requests(self, model, memo):
pass
class GetDetOutputsSolution(BaseSolution):
def __init__(self, name, *args, **kwargs):
super().__init__(name, *args, **kwargs)
self.names = []
self.outputs = []
self.result = {}
class TestNoChange(Action):
def __init__(self, name="testing"):
super().__init__(name)
def _do(self, state):
# solve carrier matrix
state.sim.run_carrier()
# return the detector outputs
return state.apply(GetDetOutputs())
def _requests(self, model, memo, first=True):
pass
class TestChangeDirectly(Action):
def __init__(self, name="testing"):
super().__init__(name)
def _do(self, state):
# make the change directly
state.model.m1.Rcx += 10
# solve carrier matrix
state.sim.run_carrier()
# return the detector outputs
return state.apply(GetDetOutputs())
def _requests(self, model, memo, first=True):
memo["changing_parameters"].append("m1.Rcx")
def color(check, against1 = None, against2 = None, colorless=False):
green = "\033[92m" if not colorless else ""
red = "\033[91m" if not colorless else ""
yellow = "\033[94m" if not colorless else ""
endc = "\033[0m" if not colorless else ""
if isinstance(against1, np.ndarray):
color = green if np.array_equal(check, against1) else (yellow if not np.array_equal(check, against2) else red)
# check = 'removed for brevity'.center(40, '-')
print('')
else:
color = "" if not against1 else (green if check == against1 else (yellow if check != against2 else red))
print(f"{color}{str(check).ljust(20)}{endc}", end=" ")
base = finesse.Model()
base.parse_file("virgo_f3_reduced.kat")
base.parse("""
# create cavities
# bug occurs with coupled cavities
# remove either and it goes away
cav cav1 m1.p2.o via=m2.p1.i
cav cav2 m2.p2.o
# manually setting is_mm_changing
# forces a recalculation
modes(x, maxtem=1)
knmd K_m1 m1 22
# create photodiode
pd pd_m1p1 m1.p1.o
""")
tests = []
if True:
# from suppress import suppress_stdout
# with suppress_stdout():
# print('normal'.center(40,'-'))
# kat_no_change = base.deepcopy()
# tests.append(TestNoChange().run(kat_no_change))
# print('normal end'.center(40, '-'))
# print('expected'.center(40,'-'))
# kat_no_action_w_change = base.deepcopy()
# kat_no_action_w_change.m1.Rcx += 10
# tests.append(TestNoChange().run(kat_no_action_w_change))
# print('expected end'.center(40,'-'))
print('unexpected'.center(40,'-'))
kat_action_w_direct_change = base.deepcopy()
# kat_action_w_direct_change = kat_no_change
tests.append(TestChangeDirectly().run(kat_action_w_direct_change))
print('unexpected end'.center(40,'-'))
# loop dets (rows)
for det in sorted(tests[0].names):
print(str(det).ljust(10), end=" ")
# loop tests (cols)
for i,test in enumerate(tests):
color(test.result[det], against1=tests[1].result[det], against2=tests[0].result[det], colorless=(i==0))
print("")
\ No newline at end of file
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"source": [
"import finesse\n",
"import numpy as np\n",
"\n",
"# create base model\n",
"base = finesse.Model()\n",
"base.parse(\"\"\"\n",
"l l1\n",
"bs bs1\n",
"link(l1, bs1)\n",
"\n",
"m ITMX T=0.04835 L=30u Rc=-1430.0\n",
"m ETMX T=0.01377 L=27u Rc=-1424.6\n",
"link(ITMX, ETMX)\n",
"\n",
"m ITMY T=0.04835 L=30u Rc=-1430.0\n",
"m ETMY T=0.01377 L=27u Rc=-1424.6\n",
"link(ITMY, ETMY)\n",
"\n",
"s bsY bs1.p2 ITMY.p1\n",
"s bsX bs1.p3 ITMX.p1\n",
"\n",
"cav cav1 ITMX.p2.o\n",
"cav cav2 ITMY.p2.o\n",
"\"\"\")\n",
"\n",
"base.run()\n"
],
"outputs": [
{
"output_type": "error",
"ename": "ModuleNotFoundError",
"evalue": "No module named 'spellchecker'",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-f545df82114b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m# create base model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mbase\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfinesse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mModel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m base.parse(\"\"\"\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0ml\u001b[0m \u001b[0ml1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mbs\u001b[0m \u001b[0mbs1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 68\u001b[0m \u001b[0;34mf\"Model has been built for a simulation, cannot use {func} here\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 69\u001b[0m )\n\u001b[0;32m---> 70\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 71\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 72\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mparse\u001b[0;34m(self, text, spec)\u001b[0m\n\u001b[1;32m 1778\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mscript\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mparse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1779\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1780\u001b[0;31m \u001b[0mparse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mspec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1781\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1782\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mlocked_when_built\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/__init__.py\u001b[0m in \u001b[0;36mparse\u001b[0;34m(text, model, spec)\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0mcompiler\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mKatCompiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 28\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcompiler\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 29\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36mcompile\u001b[0;34m(self, string, **kwargs)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[0mThe\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0mcompiled\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mreading\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mstring\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 122\u001b[0m \"\"\"\n\u001b[0;32m--> 123\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompile_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mStringIO\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstring\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 124\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 125\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mcompile_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresolve\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuild\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36mcompile_file\u001b[0;34m(self, fobj, model, resolve, build)\u001b[0m\n\u001b[1;32m 179\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbuild\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 181\u001b[0;31m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mROOT_NODE_NAME\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 182\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 183\u001b[0m \u001b[0;31m# Merge the compiled syntax graph into the model.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 695\u001b[0m \u001b[0;31m# Use the computed build order, not the argument order.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 696\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0margument_node\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build_order\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 697\u001b[0;31m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 698\u001b[0m \u001b[0mdirective_token\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnodes\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 699\u001b[0m \u001b[0mdirective\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdirective_token\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 620\u001b[0m \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_built_arguments\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 621\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mnodetype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mKatNodeType\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mELEMENT\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 622\u001b[0;31m \u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_built_directive_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 623\u001b[0m \u001b[0madapter\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_element_adapter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 624\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_built_directive_params\u001b[0;34m(self, node, model)\u001b[0m\n\u001b[1;32m 810\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0margument_node\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msorted_dependent_argument_nodes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 811\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 812\u001b[0;31m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_build\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 813\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKatParameterSelfReferenceException\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 814\u001b[0m \u001b[0mitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mResolving\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/script/compiler.py\u001b[0m in \u001b[0;36m_build\u001b[0;34m(self, node, model, kwarg_as_dict)\u001b[0m\n\u001b[1;32m 574\u001b[0m \u001b[0;31m# Copy existing model parameter by value.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 575\u001b[0m \u001b[0mtarget\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 576\u001b[0;31m \u001b[0mvalue\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreduce_get_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtarget\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 577\u001b[0m \u001b[0mLOGGER\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdebug\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"parameter {node} targets {target} by value\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 578\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mnodetype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mKatNodeType\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPARAMETER_REFERENCE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36mreduce_get_attr\u001b[0;34m(self, attr)\u001b[0m\n\u001b[1;32m 1471\u001b[0m \u001b[0;34m<\u001b[0m\u001b[0ml1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mP\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m \u001b[0;34m@\u001b[0m \u001b[0;36m0x11aa56588\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1472\u001b[0m \"\"\"\n\u001b[0;32m-> 1473\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_do_reduce_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mattr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\".\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mreduce_set_attr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/model.py\u001b[0m in \u001b[0;36m_do_reduce_attr\u001b[0;34m(self, attrs)\u001b[0m\n\u001b[1;32m 1500\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1501\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1502\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mModelAttributeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mattrs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1503\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1504\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mlocked_when_built\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/Projects/finesse/finesse3/src/finesse/exceptions.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, model, pieces)\u001b[0m\n\u001b[1;32m 122\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpieces\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 124\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mspellchecker\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSpellChecker\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 125\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 126\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\".\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpieces\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'spellchecker'"
]
}
],
"metadata": {}