updated code in a few files to make it more understandable, also used .join method at a place to increase the speed.

这个提交包含在:
Sai-Suraj-27
2023-06-23 20:08:13 +05:30
父节点 c0762cc112
当前提交 7e4a4fff34
共有 7 个文件被更改,包括 30 次插入40 次删除

查看文件

@@ -79,11 +79,10 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False, save=False):
time = np.linspace(0, (iterations - 1) * dt, num=iterations)
# Check for single output component when doing a FFT
if fft:
if not len(outputs) == 1:
logger.exception('A single output must be specified when using ' +
'the -fft option')
raise ValueError
if fft and not len(outputs) == 1:
logger.exception('A single output must be specified when using ' +
'the -fft option')
raise ValueError
# New plot for each receiver
for rx in range(1, nrx + 1):

查看文件

@@ -86,14 +86,14 @@ def mpl_plot(w, timewindow, dt, iterations, fft=False, save=False):
logging.info(f'Type: {w.type}')
logging.info(f'Maximum (absolute) amplitude: {np.max(np.abs(waveform)):g}')
if w.freq and not w.type == 'gaussian' and not w.type == 'impulse':
if w.freq and w.type != 'gaussian' and w.type != 'impulse':
logging.info(f'Centre frequency: {w.freq:g} Hz')
if (w.type == 'gaussian' or w.type == 'gaussiandot' or w.type == 'gaussiandotnorm'
or w.type == 'gaussianprime' or w.type == 'gaussiandoubleprime'):
if w.type in ['gaussian', 'gaussiandot', 'gaussiandotnorm',
'gaussianprime', 'gaussiandoubleprime']:
delay = 1 / w.freq
logging.info(f'Time to centre of pulse: {delay:g} s')
elif w.type == 'gaussiandotdot' or w.type == 'gaussiandotdotnorm' or w.type == 'ricker':
elif w.type in ['gaussiandotdot', 'gaussiandotdotnorm', 'ricker']:
delay = np.sqrt(2) / w.freq
logging.info(f'Time to centre of pulse: {delay:g} s')