sfs-python icon indicating copy to clipboard operation
sfs-python copied to clipboard

add point source with far-field directivity of circular piston

Open fietew opened this issue 6 years ago • 1 comments

Adds new source type with far-field directivity of circular piston radiator

import sfs
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 8, 4.5  # inch

x0 = 1.5, 1, 0
n0 = 0, -1, 0
R = 1.0  # meters
f = 500  # Hz
omega = 2 * np.pi * f

normalization_point = 4 * np.pi

grid = sfs.util.xyz_grid([-2, 3], [-1, 2], 0, spacing=0.02)

p = sfs.fd.source.point_circular_piston(omega, x0, n0, grid, R)
sfs.plot2d.amplitude(p * normalization_point, grid)
plt.title("Circular Piston Radiator at {} m".format(x0))

fietew avatar Nov 21 '19 16:11 fietew

The machine is complaining:

$ python3 -m pycodestyle sfs/fd/source.py
sfs/fd/source.py:227:1: E302 expected 2 blank lines, found 1
sfs/fd/source.py:254:39: W291 trailing whitespace
sfs/fd/source.py:257:9: W291 trailing whitespace
$ python3 -m pycodestyle sfs/util.py
sfs/util.py:580:1: E302 expected 2 blank lines, found 1

And https://travis-ci.org/sfstoolbox/sfs-python/jobs/615577318 contains:

/home/travis/build/sfstoolbox/sfs-python/sfs/fd/source.py:docstring of sfs.fd.source.point_circular_piston:20: WARNING: Explicit markup ends without a blank line; unexpected unindent.

Note that the line number is meant within the docstring. I guess the problem is a missing blank line before Returns.

mgeier avatar Dec 16 '19 16:12 mgeier