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 f5377e7c authored by Cyrill Mast's avatar Cyrill Mast
Browse files

added function to plot ARF

parent f2586baa
......@@ -27,7 +27,7 @@ class PlotGeneral:
self._fig_complex, self._ax_complex = plt.subplots()
self._ax_complex.plot(self.x_data, self.y_data, marker="o")
self._ax_complex.loglog(abs(self.x_data), abs(self.y_data), marker="o")
plt.style.use('ggplot')
"""
......@@ -51,6 +51,7 @@ class PlotGeneral:
@y_data.setter
def y_data(self, value):
self._y_data.value = value
print("e")
if len(self.x_data) == len(self.y_data):
self._update_data()
......
import matplotlib.pyplot as plt
import numpy as np
from .plot_General import PlotGeneral
......@@ -7,10 +6,23 @@ from .plot_General import PlotGeneral
class PlotARF(PlotGeneral):
def __init__(self, ARF) -> None:
PlotGeneral.__init__(self)
self.res = 1000
self.arf = ARF
self.wavetype = self.arf.field.wave_type
def plot_ARF(self, res=None) -> None:
"""
plots ARF with respect to time or position depending on the wavetype
"""
if res is not None:
self.rescale(res)
def plot_ARF(self):
self.R = np.linspace(0, )
self.arf.compute_acoustic_radiation_force()
plt.show()
self.title = "The radiation force over the position"
self.x_data = np.linspace(-1e-3, 1e-3, 1000)
self.x_label = "Position"
_ = []
for dpos in self.x_data:
self.arf.position = dpos
_.append(abs(self.arf.acoustic_radiation_force()))
self.y_data = _
self.figshow(self._fig_semilogy)
from plotting.plot_Acoustofluidics import PlotAcoustofluidics
from tests.basetest import BaseTestComposite
from gorkov import Gorkov1962
class TestPlotARF(BaseTestComposite):
def setUp(self) -> None:
super().setUp()
self.c_f = 1500
self.rho_f = 1000
self.rho_s = 1e3
self.c_s = 5968
self.f = 1e6
self.p0 = 1e3
self.pos = 1e-5
self.R0 = 1e-3
self.cls = Gorkov1962.ARF(self.f,
self.R0, self.rho_s, self.c_s,
self.rho_f, self.c_f,
'standing', self.p0, self.pos)
def randomly_change_parameters(self) -> None:
self.f = self.randomly_change_number(self.f)
self.c_f = self.randomly_change_number(self.c_f)
self.rho_f = self.randomly_change_number(self.rho_f)
self.rho_s = self.randomly_change_number(self.rho_s)
self.c_s = self.randomly_change_number(self.c_s)
self.p0 = self.randomly_change_number(self.p0)
self.pos = self.randomly_change_number(self.pos)
self.R0 = self.randomly_change_number(self.R0)
def assign_parameters(self) -> None:
# standing wave
self.cls.f = self.f
self.cls.c_f = self.c_f
self.cls.rho_f = self.rho_f
self.cls.rho_s = self.rho_s
self.cls.c_s = self.c_s
self.cls.p_0 = self.p0
self.cls.position = self.pos
self.cls.R_0 = self.R0
def test_plot_arf(self) -> None:
a = PlotAcoustofluidics(ARF=self.cls)
a.plot_ARF()
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