From 4151d2489f6638041a6facba382f7d452e971d34 Mon Sep 17 00:00:00 2001 From: Daniel Mevec Date: Sat, 11 Feb 2023 22:38:51 +0100 Subject: [PATCH] allow for movement of sun along theta --- torus.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/torus.py b/torus.py index 40b8471..bf4cc82 100644 --- a/torus.py +++ b/torus.py @@ -226,14 +226,13 @@ class NoInamge(): def _sunpath_top(self, n=1000): phi = np.linspace(0, np.pi, n) - x = self.torus.r_maj + self.torus.r_maj*np.cos(phi) - y = np.zeros_like(phi) + _, theta = self.torus.sun_r + x = (self.torus.r_maj + self.torus.r_maj*np.cos(phi)) * np.cos(theta) + y = (self.torus.r_maj + self.torus.r_maj*np.cos(phi)) * np.sin(theta) return np.array([x, y]) def _sunpos_top(self): - phi, theta = self.torus.sun_r - x = self.torus.r_maj - self.torus.r_maj*np.cos(phi) - y = 0 + x, y, _ = self.torus.sun return x, y def _crossection(self, n=1000): @@ -249,15 +248,14 @@ class NoInamge(): def _sunpath_side(self, n=1000): phi = np.linspace(0, 2*np.pi, n) - x = self.torus.r_maj + self.torus.r_maj*np.cos(phi) + _, theta = self.torus.sun_r + x = (self.torus.r_maj + self.torus.r_maj*np.cos(phi)) * np.cos(theta) y = self.torus.r_maj*np.sin(phi) return np.array([x, y+self._offset_side()]) def _sunpos_side(self): - phi, theta = self.torus.sun_r - x = self.torus.r_maj - self.torus.r_maj*np.cos(phi) - y = self.torus.r_maj*np.sin(phi) - return x, y+self._offset_side() + x, _, z = self.torus.sun + return x, z+self._offset_side() def redraw_plot(self, line, func): x, y = func()