To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit e5a3c26a authored by Cyrill Mast's avatar Cyrill Mast
Browse files

improve plotting lib: adressing Issue 16 and Issue 17

parent 548681c6
Pipeline #88378 failed with stages
in 1 minute and 54 seconds
......@@ -16,8 +16,10 @@ class PlotGeneral:
self.plot()
self.update_labels("x_label", "y_label", "title")
plt.style.use('ggplot')
"""
implement design options here
Define style options here
"""
def rescale(self, resolution=None):
......@@ -25,6 +27,13 @@ class PlotGeneral:
Implement this function
"""
def normalize_data(self, d_in):
"""
Implement this function
"""
d_out = d_in
return d_out
def plot(self):
self.ax.plot(self.x_data, self.y_data)
......
......@@ -9,19 +9,52 @@ from .plot_General import PlotGeneral
class PlotScatteringField(PlotGeneral):
def __init__(self, scatteringfield) -> None:
PlotGeneral.__init__(self)
self.sf = scatteringfield
self.gridpoints = 100
# init axes, create meshgrid
self.R = np.linspace(0, 1e-4, self.gridpoints)
self.Theta = np.linspace(0, 2 * pi, self.gridpoints)
self.R, self.Theta = np.meshgrid(self.R, self.Theta)
# init potentials
self.Phi = np.zeros((len(self.R), len(self.Theta)))
self.Phi_1 = np.zeros((len(self.R), len(self.Theta)))
self.Phi_i = np.zeros((len(self.R), len(self.Theta)))
self.Phi_s = np.zeros((len(self.R), len(self.Theta)))
self.Phi_star = np.zeros((len(self.R), len(self.Theta)))
# init velocities
self.radial_particle_velocities = np.zeros(
(len(self.R), len(self.Theta)))
self.tangential_particle_velocities = np.zeros(
(len(self.R), len(self.Theta)))
self.radial_acoustic_fluid_velocities = np.zeros(
(len(self.R), len(self.Theta)))
self.tangential_acoustic_fluid_velocities = np.zeros(
(len(self.R), len(self.Theta)))
def compute_velocities(self) -> None:
"""
implement this method
"""
def compute_potentials(self):
"""
implement this method
"""
for theta in self.Theta:
for r in self.R:
if r > self.sf.R_0:
self.Phi[r][theta] = self.sf.Phi_1(r, theta)
else:
self.Phi[r][theta] = self.sf.Phi_star(r, theta)
def plot_Phi_1(self) -> None:
phi = np.zeros((self.gridpoints, self.gridpoints))
for r in self.R:
for theta in self.Theta:
phi[r][theta] = self.sf.Phi_1()
plt.plot(self.R, self.Theta, phi)
plt.plot(self.R, self.Theta, self.Phi_1)
plt.show()
def plot_Phi_i(self) -> None:
......
......@@ -6,10 +6,10 @@ from .plot_General import PlotGeneral
class PlotVarious(PlotGeneral):
def __init__(self, baseclass, resolution) -> None:
def __init__(self, baseclass) -> None:
PlotGeneral.__init__(self)
self.b = baseclass
self.res = resolution
self.res = 10
def plot_A_n(self, res=None) -> None:
"""
......
......@@ -57,4 +57,5 @@ class TestPlotVarious(BaseTest):
def test_plot_various(self) -> None:
a = PlotAcoustofluidics(baseclass=self.cls, ARF=self.cls)
a.plot_A_n(10)
print(a.x_data)
# a.plot_A_n(10)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment