two sinewave variants
This commit is contained in:
@@ -19,11 +19,18 @@ def write_file(args, geom):
|
||||
|
||||
def sinewave(args):
|
||||
INTERVAL = 0.1
|
||||
TAIL_LEN = 7
|
||||
SINE_LEN = 7
|
||||
TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
|
||||
sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL)
|
||||
amplitude = (np.sin(sin_range * pi / 2) + 1)*2
|
||||
|
||||
if args.numwaves == 2:
|
||||
TAIL_LEN, SINE_LEN = 7, 7
|
||||
TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
|
||||
sin_range = np.arange(-pi/4, SINE_LEN, INTERVAL) * pi / 2
|
||||
amplitude = (np.sin(sin_range)+1)*2
|
||||
else:
|
||||
TAIL_LEN, SINE_LEN = 3.5, 3.5
|
||||
TAILS = np.zeros(int(TAIL_LEN / INTERVAL))
|
||||
sin_range = np.arange(-pi/4, SINE_LEN - pi/8, INTERVAL) * pi / 2
|
||||
amplitude = np.sin(sin_range) + 1
|
||||
|
||||
y = np.concatenate([TAILS, amplitude, TAILS])
|
||||
x = np.arange(-TAIL_LEN - pi/4, SINE_LEN + TAIL_LEN, INTERVAL)
|
||||
lines = LineString(zip(x*10, y*10))
|
||||
@@ -47,6 +54,7 @@ def parse_args():
|
||||
parser.add_argument('-o', '--outfile', metavar='<file>', required=True)
|
||||
subparsers = parser.add_subparsers()
|
||||
sine = subparsers.add_parser('sine', help='Sine wave')
|
||||
sine.add_argument('--numwaves', choices=[1, 2], type=int, help='Number of waves')
|
||||
sine.set_defaults(func=sinewave)
|
||||
rect = subparsers.add_parser('rect', help='Rectangle')
|
||||
rect.add_argument('--bounds', type=float, nargs=4, metavar=BOUNDS)
|
||||
|
||||
Reference in New Issue
Block a user