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

removed while loop

parent 836c82f2
Pipeline #90678 passed with stages
in 6 minutes and 12 seconds
from __future__ import annotations
from typing import Union
from gorkov import (
......@@ -346,7 +347,6 @@ class BaseYosioka(BaseSphereFrequencyComposite):
def legendre_coeffs(
self,
lambda_function,
threshold: float = 0.001,
iterations: int = 10) -> list:
"""
Compute the coefficients in front of the Legendre-factors
......@@ -354,29 +354,16 @@ class BaseYosioka(BaseSphereFrequencyComposite):
:param lambda_function: the given lambda-function
:type lambda_function: n:int -> Complex
:param threshold: threshold for accuracy
:type threshold: float
:param iterations: number of iterations
:type iterations: int
:rtype: float
"""
out = []
n = 0
if self.n_max is None:
while True:
out.append(lambda_function(n))
if n >= 1:
error = abs((out[n] - out[n - 1]) /
out[n - 1])
if error < threshold:
break
if n >= iterations:
break
n += 1
else:
for n in range(self.n_max):
out.append(lambda_function(n))
self.n_max = 10
for n in range(iterations):
out.append(lambda_function(n))
return out
......
......@@ -86,7 +86,6 @@ class TestScatteringField(BaseTest):
plt.ion()
plt.show()
t = np.linspace(5e-7, 5e-5, acc)
for dt in t:
vel = np.zeros([acc, acc])
theta = np.linspace(0, 2 * pi, acc)
......@@ -96,8 +95,8 @@ class TestScatteringField(BaseTest):
vel[i_r][i_t] = self.cls.radial_particle_velocity(
r=val_r, theta=val_t, t=dt)
angle, radius = np.meshgrid(theta, r)
ax.plot_surface(angle, radius, vel)
ax.plot_surface(angle, radius, vel)
plt.pause(0.00000001)
ax.clear()
......
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