From efccff7ff195147171003c922be0cf5f8814c640 Mon Sep 17 00:00:00 2001
From: Luke Naylor <l.naylor@sms.ed.ac.uk>
Date: Tue, 25 Jul 2023 17:06:28 +0100
Subject: [PATCH] Adjust Makefile to create correct python library

---
 .gitignore                  |   4 +-
 Makefile                    |  14 ++--
 plots_and_expressions.ipynb | 162 ++++++++++++++++++------------------
 3 files changed, 93 insertions(+), 87 deletions(-)

diff --git a/.gitignore b/.gitignore
index 31abfef..3cecb67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,11 @@
 main.*
 !main.tex
+plots_and_expressions.*
+!plots_and_expressions.ipynb
 filtered_sage.txt
 _minted-main/*
 sage-plots-for-main.tex
 .vscode/*
 sagetex.sty
-plots_and_expressions.py
 .ipynb_checkpoints
+__pycache__
diff --git a/Makefile b/Makefile
index 1a65c88..928e47c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,17 +5,21 @@ MAINTEXFILE = main.tex
 TEXFILES = ${MAINTEXFILE}
 SAGETEXSCRIPT = main.sagetex.sage
 
-main.pdf: ${TEXFILES}  main.sagetex.sout.tmp filtered_sage.txt
+main.pdf: ${TEXFILES}  main.sagetex.sout.tmp
 	latexmk
 
-main.sagetex.sout.tmp: ${SAGETEXSCRIPT}
+main.sagetex.sout.tmp: ${SAGETEXSCRIPT} plots_and_expressions.py
 	PYTHONPATH=./sagetexscripts/ sage ${SAGETEXSCRIPT}
 
-${SAGETEXSCRIPT}: ${TEXFILES} filtered_sage.txt
+${SAGETEXSCRIPT}: ${TEXFILES}
 	latexmk || echo this shoud fail
 
-filtered_sage.txt: ${MAINTEXFILE} filter_sage.sed
-	./filter_sage.sed ${MAINTEXFILE} > $@
+plots_and_expressions.py: plots_and_expressions.ipynb
+	jupyter nbconvert --to script plots_and_expressions.ipynb
+	mv plots_and_expressions.py plots_and_expressions.sage
+	sed -e "/get_ipython/d" -i plots_and_expressions.sage
+	sage --preparse plots_and_expressions.sage
+	mv plots_and_expressions.sage.py plots_and_expressions.py
 
 .PHONY: clean nosage noappendix
 clean:
diff --git a/plots_and_expressions.ipynb b/plots_and_expressions.ipynb
index d013705..75a2af6 100644
--- a/plots_and_expressions.ipynb
+++ b/plots_and_expressions.ipynb
@@ -3,7 +3,7 @@
   {
    "cell_type": "code",
    "execution_count": 2,
-   "id": "f850478f",
+   "id": "b87a49bc",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -29,7 +29,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "fb986edc",
+   "id": "bdce1afd",
    "metadata": {},
    "source": [
     "# SECTION: Introduction"
@@ -37,7 +37,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "31ec4f26",
+   "id": "e8391b31",
    "metadata": {},
    "source": [
     "# SECTION: Setting and Definitions: Clarifying \"pseudo\""
@@ -45,7 +45,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "1268eff8",
+   "id": "5da7dba0",
    "metadata": {},
    "source": [
     "## SUBSECTION: Relevance of the Vertical Line $V_v$"
@@ -54,7 +54,7 @@
   {
    "cell_type": "code",
    "execution_count": 60,
-   "id": "3f9a81c3",
+   "id": "5e309df3",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -88,7 +88,7 @@
   {
    "cell_type": "code",
    "execution_count": 78,
-   "id": "d5e3b4a4",
+   "id": "00428146",
    "metadata": {},
    "outputs": [
     {
@@ -111,7 +111,7 @@
   {
    "cell_type": "code",
    "execution_count": 79,
-   "id": "64ba63bd",
+   "id": "51d49b55",
    "metadata": {},
    "outputs": [
     {
@@ -133,7 +133,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "c54ea25c",
+   "id": "d12d4511",
    "metadata": {},
    "source": [
     "## SUBSECTION: Relevance of the Hyperbola $\\Theta_v$"
@@ -141,7 +141,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "5637dc2d",
+   "id": "b1ef2650",
    "metadata": {},
    "source": [
     "## SUBSECTION: Bertram's Nested Wall Theorem"
@@ -149,7 +149,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "abfa7657",
+   "id": "4f77e7d6",
    "metadata": {},
    "source": [
     "## SUBSECTION: Characteristic Curves for Pseudo-semistabilizers"
@@ -158,7 +158,7 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "id": "39ea1e5c",
+   "id": "87b4eeeb",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -253,7 +253,7 @@
   {
    "cell_type": "code",
    "execution_count": 66,
-   "id": "36c99d93",
+   "id": "ff33752c",
    "metadata": {},
    "outputs": [
     {
@@ -275,7 +275,7 @@
   {
    "cell_type": "code",
    "execution_count": 68,
-   "id": "92b0bf72",
+   "id": "6068850f",
    "metadata": {},
    "outputs": [
     {
@@ -296,7 +296,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "2f32af89",
+   "id": "c9348fd3",
    "metadata": {},
    "source": [
     "# SECTION: The Problem: Finding Pseudo-walls"
@@ -304,7 +304,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "3d130e15",
+   "id": "1f414cfb",
    "metadata": {},
    "source": [
     "## SUBSECTION: Problem statements"
@@ -312,7 +312,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "7f59911a",
+   "id": "1c779178",
    "metadata": {},
    "source": [
     "## SUBSECTION: Numerical Formulations of the Problems"
@@ -320,7 +320,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "947aa49e",
+   "id": "b0b54ece",
    "metadata": {},
    "source": [
     "# SECTION: B.Schmidt's Solutions to the Problems"
@@ -328,7 +328,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "281f660a",
+   "id": "72e5b556",
    "metadata": {},
    "source": [
     "## SUBSECTION: Bound on $\\operatorname{ch}_0(u)$ for Semistabilizers"
@@ -337,7 +337,7 @@
   {
    "cell_type": "code",
    "execution_count": 5,
-   "id": "ca40c676",
+   "id": "2b641339",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -373,7 +373,7 @@
   {
    "cell_type": "code",
    "execution_count": 6,
-   "id": "ffec69bb",
+   "id": "f38c4896",
    "metadata": {},
    "outputs": [
     {
@@ -400,7 +400,7 @@
   {
    "cell_type": "code",
    "execution_count": 7,
-   "id": "09f4b644",
+   "id": "c2e307ec",
    "metadata": {},
    "outputs": [
     {
@@ -426,7 +426,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "dd466e7b",
+   "id": "4982f084",
    "metadata": {},
    "source": [
     "## SUBSECTION: Pseudo-Wall Finding Method"
@@ -434,7 +434,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "5fb5b847",
+   "id": "05d5916c",
    "metadata": {},
    "source": [
     "## SUBSECTION: Limitations"
@@ -442,7 +442,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "ee8e809d",
+   "id": "cb9c11e7",
    "metadata": {},
    "source": [
     "# SECTION: Tighter Bounds"
@@ -451,7 +451,7 @@
   {
    "cell_type": "code",
    "execution_count": 8,
-   "id": "9e86e098",
+   "id": "4cacebc7",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -479,7 +479,7 @@
   {
    "cell_type": "code",
    "execution_count": 9,
-   "id": "ce36862e",
+   "id": "f53cee90",
    "metadata": {},
    "outputs": [
     {
@@ -505,7 +505,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "6de2ec83",
+   "id": "932838f4",
    "metadata": {},
    "source": [
     "## SUBSECTION: Numerical Inequalities"
@@ -514,7 +514,7 @@
   {
    "cell_type": "code",
    "execution_count": 10,
-   "id": "707fb585",
+   "id": "6ae4f2e7",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -538,7 +538,7 @@
   {
    "cell_type": "code",
    "execution_count": 11,
-   "id": "5e98d475",
+   "id": "c0c12e43",
    "metadata": {},
    "outputs": [
     {
@@ -565,7 +565,7 @@
   {
    "cell_type": "code",
    "execution_count": 12,
-   "id": "f5470ecd",
+   "id": "653a3340",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -595,7 +595,7 @@
   {
    "cell_type": "code",
    "execution_count": 13,
-   "id": "c01388f8",
+   "id": "326bb656",
    "metadata": {},
    "outputs": [
     {
@@ -622,7 +622,7 @@
   {
    "cell_type": "code",
    "execution_count": 14,
-   "id": "463658f6",
+   "id": "fcd9fa2a",
    "metadata": {},
    "outputs": [
     {
@@ -649,7 +649,7 @@
   {
    "cell_type": "code",
    "execution_count": 15,
-   "id": "944b171d",
+   "id": "ade0f7b2",
    "metadata": {},
    "outputs": [
     {
@@ -676,7 +676,7 @@
   {
    "cell_type": "code",
    "execution_count": 16,
-   "id": "c6d30cf9",
+   "id": "b7799156",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -777,7 +777,7 @@
   {
    "cell_type": "code",
    "execution_count": 17,
-   "id": "aa58ae14",
+   "id": "38bbbcd2",
    "metadata": {},
    "outputs": [
     {
@@ -804,7 +804,7 @@
   {
    "cell_type": "code",
    "execution_count": 18,
-   "id": "a40e129d",
+   "id": "6701d8a7",
    "metadata": {},
    "outputs": [
     {
@@ -831,7 +831,7 @@
   {
    "cell_type": "code",
    "execution_count": 19,
-   "id": "bf038caf",
+   "id": "7a82d747",
    "metadata": {},
    "outputs": [
     {
@@ -858,7 +858,7 @@
   {
    "cell_type": "code",
    "execution_count": 20,
-   "id": "4a9a65b4",
+   "id": "927e6929",
    "metadata": {},
    "outputs": [
     {
@@ -885,7 +885,7 @@
   {
    "cell_type": "code",
    "execution_count": 21,
-   "id": "1bc98c32",
+   "id": "ff25eea1",
    "metadata": {},
    "outputs": [
     {
@@ -912,7 +912,7 @@
   {
    "cell_type": "code",
    "execution_count": 22,
-   "id": "bee8dd0e",
+   "id": "e8359c0f",
    "metadata": {},
    "outputs": [
     {
@@ -939,7 +939,7 @@
   {
    "cell_type": "code",
    "execution_count": 23,
-   "id": "4e0d3a6d",
+   "id": "6823c5b8",
    "metadata": {},
    "outputs": [
     {
@@ -966,7 +966,7 @@
   {
    "cell_type": "code",
    "execution_count": 25,
-   "id": "8136e11f",
+   "id": "160871f2",
    "metadata": {},
    "outputs": [
     {
@@ -993,7 +993,7 @@
   {
    "cell_type": "code",
    "execution_count": 26,
-   "id": "8db2f0f3",
+   "id": "1da23b29",
    "metadata": {},
    "outputs": [
     {
@@ -1020,7 +1020,7 @@
   {
    "cell_type": "code",
    "execution_count": 27,
-   "id": "fd088827",
+   "id": "d7235dc3",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1118,7 +1118,7 @@
   {
    "cell_type": "code",
    "execution_count": 76,
-   "id": "ffce7c54",
+   "id": "f5b1d9bf",
    "metadata": {},
    "outputs": [
     {
@@ -1141,7 +1141,7 @@
   {
    "cell_type": "code",
    "execution_count": 77,
-   "id": "5705797f",
+   "id": "47b30d7e",
    "metadata": {},
    "outputs": [
     {
@@ -1164,7 +1164,7 @@
   {
    "cell_type": "code",
    "execution_count": 75,
-   "id": "a400613f",
+   "id": "25e4850b",
    "metadata": {},
    "outputs": [
     {
@@ -1186,7 +1186,7 @@
   },
   {
    "cell_type": "markdown",
-   "id": "8d22c4dc",
+   "id": "1c6f5622",
    "metadata": {},
    "source": [
     "## SUBSECTION: Bounds on Semistabilizer Rank"
@@ -1195,7 +1195,7 @@
   {
    "cell_type": "code",
    "execution_count": 28,
-   "id": "577978f6",
+   "id": "553bba31",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1227,7 +1227,7 @@
   {
    "cell_type": "code",
    "execution_count": 29,
-   "id": "c98adf43",
+   "id": "990a2840",
    "metadata": {},
    "outputs": [
     {
@@ -1254,7 +1254,7 @@
   {
    "cell_type": "code",
    "execution_count": 30,
-   "id": "e64ec69e",
+   "id": "5a3c7037",
    "metadata": {},
    "outputs": [
     {
@@ -1281,7 +1281,7 @@
   {
    "cell_type": "code",
    "execution_count": 31,
-   "id": "c7aa652a",
+   "id": "82add957",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1304,7 +1304,7 @@
   {
    "cell_type": "code",
    "execution_count": 32,
-   "id": "c48cf08d",
+   "id": "d33e3459",
    "metadata": {},
    "outputs": [
     {
@@ -1331,7 +1331,7 @@
   {
    "cell_type": "code",
    "execution_count": 33,
-   "id": "c2caf6a1",
+   "id": "3728c192",
    "metadata": {},
    "outputs": [
     {
@@ -1358,7 +1358,7 @@
   {
    "cell_type": "code",
    "execution_count": 34,
-   "id": "300ebb72",
+   "id": "90149eb2",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1380,7 +1380,7 @@
   {
    "cell_type": "code",
    "execution_count": 35,
-   "id": "ae1b719d",
+   "id": "8b0b0bf4",
    "metadata": {},
    "outputs": [
     {
@@ -1407,7 +1407,7 @@
   {
    "cell_type": "code",
    "execution_count": 36,
-   "id": "b9087521",
+   "id": "53bd2a9c",
    "metadata": {},
    "outputs": [
     {
@@ -1434,7 +1434,7 @@
   {
    "cell_type": "code",
    "execution_count": 37,
-   "id": "66405649",
+   "id": "cfa6e1af",
    "metadata": {},
    "outputs": [
     {
@@ -1461,7 +1461,7 @@
   {
    "cell_type": "code",
    "execution_count": 38,
-   "id": "6b4e23af",
+   "id": "801a348a",
    "metadata": {},
    "outputs": [
     {
@@ -1488,7 +1488,7 @@
   {
    "cell_type": "code",
    "execution_count": 39,
-   "id": "7c6f401c",
+   "id": "d4bf7486",
    "metadata": {},
    "outputs": [
     {
@@ -1515,7 +1515,7 @@
   {
    "cell_type": "code",
    "execution_count": 40,
-   "id": "756b7b4a",
+   "id": "8ba2ed91",
    "metadata": {},
    "outputs": [
     {
@@ -1542,7 +1542,7 @@
   {
    "cell_type": "code",
    "execution_count": 41,
-   "id": "98626769",
+   "id": "fcfae8a1",
    "metadata": {},
    "outputs": [
     {
@@ -1569,7 +1569,7 @@
   {
    "cell_type": "code",
    "execution_count": 42,
-   "id": "f67a5f02",
+   "id": "36d896f4",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1587,7 +1587,7 @@
   {
    "cell_type": "code",
    "execution_count": 43,
-   "id": "3fee274a",
+   "id": "b3f47ade",
    "metadata": {},
    "outputs": [
     {
@@ -1614,7 +1614,7 @@
   {
    "cell_type": "code",
    "execution_count": 44,
-   "id": "ffc4921b",
+   "id": "b52a3a56",
    "metadata": {},
    "outputs": [
     {
@@ -1641,7 +1641,7 @@
   {
    "cell_type": "code",
    "execution_count": 45,
-   "id": "a64e31b9",
+   "id": "cdf1726c",
    "metadata": {},
    "outputs": [
     {
@@ -1668,7 +1668,7 @@
   {
    "cell_type": "code",
    "execution_count": 46,
-   "id": "1f4c185a",
+   "id": "8f5ea43e",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1686,7 +1686,7 @@
   {
    "cell_type": "code",
    "execution_count": 47,
-   "id": "e93f2a58",
+   "id": "bc7f5e56",
    "metadata": {},
    "outputs": [
     {
@@ -1713,7 +1713,7 @@
   {
    "cell_type": "code",
    "execution_count": 48,
-   "id": "791769aa",
+   "id": "00a2355a",
    "metadata": {},
    "outputs": [
     {
@@ -1740,7 +1740,7 @@
   {
    "cell_type": "code",
    "execution_count": 49,
-   "id": "db6ff317",
+   "id": "896d26dd",
    "metadata": {},
    "outputs": [
     {
@@ -1767,7 +1767,7 @@
   {
    "cell_type": "code",
    "execution_count": 50,
-   "id": "a19ff44e",
+   "id": "51f22f7d",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1783,7 +1783,7 @@
   {
    "cell_type": "code",
    "execution_count": 51,
-   "id": "e57aaeee",
+   "id": "8148f5cd",
    "metadata": {},
    "outputs": [
     {
@@ -1810,7 +1810,7 @@
   {
    "cell_type": "code",
    "execution_count": 52,
-   "id": "fc5e89f9",
+   "id": "af5315c8",
    "metadata": {},
    "outputs": [
     {
@@ -1837,7 +1837,7 @@
   {
    "cell_type": "code",
    "execution_count": 53,
-   "id": "f568076e",
+   "id": "e3e75309",
    "metadata": {},
    "outputs": [
     {
@@ -1864,7 +1864,7 @@
   {
    "cell_type": "code",
    "execution_count": 54,
-   "id": "2a46c82f",
+   "id": "203b216b",
    "metadata": {},
    "outputs": [
     {
@@ -1891,7 +1891,7 @@
   {
    "cell_type": "code",
    "execution_count": 55,
-   "id": "74c5b9a4",
+   "id": "50a94cf4",
    "metadata": {},
    "outputs": [
     {
@@ -1918,7 +1918,7 @@
   {
    "cell_type": "code",
    "execution_count": 56,
-   "id": "9d21e775",
+   "id": "3171ad07",
    "metadata": {},
    "outputs": [
     {
@@ -1945,7 +1945,7 @@
   {
    "cell_type": "code",
    "execution_count": 57,
-   "id": "6969b492",
+   "id": "16b28a02",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1989,7 +1989,7 @@
   {
    "cell_type": "code",
    "execution_count": 58,
-   "id": "7809d371",
+   "id": "bb236b7b",
    "metadata": {},
    "outputs": [
     {
@@ -2016,7 +2016,7 @@
   {
    "cell_type": "code",
    "execution_count": 59,
-   "id": "ba81c30f",
+   "id": "7205efcd",
    "metadata": {},
    "outputs": [
     {
@@ -2043,7 +2043,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "b0c08816",
+   "id": "5dc0cc87",
    "metadata": {},
    "outputs": [],
    "source": []
-- 
GitLab