From 900b7fc33bcd6fc3a9a6cd3be8b5624ab6877d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vegard=20Falm=C3=A5r?= Date: Tue, 24 Sep 2024 19:59:15 +0200 Subject: [PATCH 1/2] Add packages to setup.py on which braketlab explicitly depends --- setup.py | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index ee089ed..4020e0e 100644 --- a/setup.py +++ b/setup.py @@ -5,19 +5,27 @@ setuptools.setup( - name='BraketLab', - version='1.8.0', - author="Audun Skau Hansen", - author_email="audunsh4@gmail.com", - description="Educational tool for learning quantum theory with Jupyter Notebooks", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.uio.no/audunsh/braketlab", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - install_requires = ["sympy", "numba", "evince", "bubblebox"], - ) + name='BraketLab', + version='1.8.0', + author="Audun Skau Hansen", + author_email="audunsh4@gmail.com", + description="Educational tool for learning quantum theory with Jupyter Notebooks", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.uio.no/audunsh/braketlab", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + install_requires = [ + "sympy", + "numba", + "numpy", + "matplotlib", + "scipy", + "evince", + "bubblebox" + ], +) From e2c148ffc1ac40fd60fd8989622891236914230d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vegard=20Falm=C3=A5r?= Date: Tue, 24 Sep 2024 20:01:22 +0200 Subject: [PATCH 2/2] Prepend strings with math commands with r (raw strings) to avoid SyntaxWarning --- braketlab/animate.py | 8 ++++---- braketlab/core.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/braketlab/animate.py b/braketlab/animate.py index be2946b..4bc0b81 100644 --- a/braketlab/animate.py +++ b/braketlab/animate.py @@ -59,10 +59,10 @@ def setup_plot(self): c1,c2,c3 = colorscheme().getcol(np.random.uniform(0,1,3)) - self.bubbles = self.ax.plot(x, p, "-", color = (0,0,0), markersize = 1, label = "$\\vert \Psi \\vert^2$")[0] + self.bubbles = self.ax.plot(x, p, "-", color = (0,0,0), markersize = 1, label = r"$\\vert \Psi \\vert^2$")[0] - self.wf_imag = self.ax.plot(x, w.imag, "-", color = c1**.5, markersize = 1, label = "Im($\Psi$)")[0] - self.wf_real = self.ax.plot(x, w.real, "-", color = c2**.5, markersize = 1, label = "Re($\Psi$)")[0] + self.wf_imag = self.ax.plot(x, w.imag, "-", color = c1**.5, markersize = 1, label = r"Im($\Psi$)")[0] + self.wf_real = self.ax.plot(x, w.real, "-", color = c2**.5, markersize = 1, label = r"Re($\Psi$)")[0] self.ax.legend() @@ -117,4 +117,4 @@ def advance(self): def run(self,n_steps_per_vis=1, interval = 10): run_system = animated_system(system = self, n_steps_per_vis=n_steps_per_vis, interval = interval) - plt.show() \ No newline at end of file + plt.show() diff --git a/braketlab/core.py b/braketlab/core.py index 3557d63..01828e2 100644 --- a/braketlab/core.py +++ b/braketlab/core.py @@ -363,7 +363,7 @@ def construct_basis(p): class basisfunction: - """ + r""" # A general class for a basis function in $\mathbb{R}^n$ ## Keyword arguments: @@ -400,9 +400,9 @@ class basisfunction: position = None normalization = 1 domain = None - __name__ = "\chi" + __name__ = r"\chi" - def __init__(self, sympy_expression, position=None, domain=None, name="\chi"): + def __init__(self, sympy_expression, position=None, domain=None, name=r"\chi"): self.__name__ = name self.dimension = len(sympy_expression.free_symbols) @@ -440,7 +440,7 @@ def __init__(self, sympy_expression, position=None, domain=None, name="\chi"): self.decay = 1.0 def normalize(self, domain=None): - """ + r""" Set normalization factor $N$ of self ($\chi$) so that $\langle \chi \\vert \chi \\rangle = 1$. """ s_12 = inner_product(self, self) @@ -483,7 +483,7 @@ def get_domain(self, other=None): return domain def __call__(self, *r): - """ + r""" Evaluate function in coordinates ```*r``` (arbitrary dimensions). ## Returns @@ -494,7 +494,7 @@ def __call__(self, *r): return self.normalization * self.ket_numeric_expression(*r) def __mul__(self, other): - """ + r""" Returns a basisfunction $\chi_{a*b}(\mathbf{r})$, where $\chi_{a*b}(\mathbf{r}) = \chi_a(\mathbf{r}) \chi_b(\mathbf{r})$ """ @@ -514,7 +514,7 @@ def __rmul__(self, other): ) def __add__(self, other): - """ + r""" Returns a basisfunction $\chi_{a+b}(\mathbf{r})$, where $\chi_{a+b}(\mathbf{r}) = \chi_a(\mathbf{r}) + \chi_b(\mathbf{r})$ """ @@ -525,7 +525,7 @@ def __add__(self, other): ) def __sub__(self, other): - """ + r""" Returns a basisfunction $\chi_{a-b}(\mathbf{r})$, where $\chi_{a-b}(\mathbf{r}) = \chi_a(\mathbf{r}) - \chi_b(\mathbf{r})$ """ @@ -617,7 +617,7 @@ def flatten(self): return operator_expression(new_ops, new_coeffs) def apply(self, other_ket): - """ + r""" # Apply operator to ket $\hat{\Omega} \vert a \rangle = \vert a' \rangle $ @@ -965,7 +965,7 @@ def get_standard_basis(n): class ket(object): - """ + r""" A class for vectors defined on general vector spaces Author: Audun Skau Hansen (a.s.hansen@kjemi.uio.no)