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

changed plot for ARF

parent e53aca80
......@@ -28,6 +28,13 @@ class PlotGeneral:
self._fig_complex, self._ax_complex = plt.subplots()
self._ax_complex.loglog(abs(self.x_data), abs(self.y_data), marker="o")
self._fig_line, self._ax_line = plt.subplots()
self._ax_line.plot(self.x_data, self.y_data)
self._axes = [self._ax_line, self._ax_complex, self._ax_semilogy]
plt.style.use('ggplot')
"""
......@@ -51,19 +58,15 @@ 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()
def _update_data(self) -> None:
self._ax_complex.lines[0].set_data(self.x_data, self.y_data)
self._ax_semilogy.lines[0].set_data(self.x_data, self.y_data)
self._ax_complex.relim()
self._ax_semilogy.relim()
self._ax_complex.autoscale_view()
self._ax_semilogy.autoscale_view()
self._fig_semilogy.canvas.draw()
self._fig_complex.canvas.draw()
for ax in self._axes:
ax.lines[0].set_data(self.x_data, self.y_data)
ax.relim()
ax.autoscale_view()
ax.canvas.draw()
@property
def x_label(self) -> str:
......
......@@ -10,19 +10,20 @@ class PlotARF(PlotGeneral):
self.arf = ARF
self.wavetype = self.arf.field.wave_type
def plot_ARF(self, res=None) -> None:
def plot_ARF(self, wavelength=None, res=None) -> None:
"""
plots ARF with respect to time or position depending on the wavetype
"""
if res is not None:
self.rescale(res)
if res is None:
self.resolution = 1000
if wavelength is None:
wavelength = 0.015
self.title = "The radiation force over the position"
self.x_data = np.linspace(-1e-3, 1e-3, 1000)
self.x_data = np.linspace(-wavelength, wavelength, self.resolution)
self.x_label = "Position"
_ = []
for dpos in self.x_data:
self.arf.position = dpos
_.append(abs(self.arf.acoustic_radiation_force()))
_.append((self.arf.acoustic_radiation_force()))
self.y_data = _
self.figshow(self._fig_semilogy)
self.figshow(self._fig_line)
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