autopep8 code cleanups.

这个提交包含在:
Craig Warren
2017-02-22 10:37:30 +00:00
父节点 40576db389
当前提交 db4fdb167c
共有 14 个文件被更改,包括 228 次插入232 次删除

查看文件

@@ -25,7 +25,7 @@ sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -35,7 +35,7 @@ extensions = [
]
# autodoc mock imports
#autodoc_mock_imports = ['h5py', 'matplotlib', 'pyfiglet', 'cython', 'psutil']
# autodoc_mock_imports = ['h5py', 'matplotlib', 'pyfiglet', 'cython', 'psutil']
# Options for autodoc
autodoc_default_flags = ['members']
@@ -57,7 +57,7 @@ templates_path = ['_templates']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
@@ -87,9 +87,9 @@ language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@@ -97,27 +97,27 @@ exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
@@ -132,26 +132,26 @@ html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = 'gprMax User Guide'
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = 'images/gprMax_FB_logo.png'
# html_logo = 'images/gprMax_FB_logo.png'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -162,7 +162,7 @@ html_style = 'css/my_theme.css'
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
@@ -170,54 +170,54 @@ html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False
# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'gprMaxdoc'
@@ -229,13 +229,13 @@ latex_elements = {
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# 'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
@@ -252,19 +252,19 @@ latex_logo = 'images/gprMax_logo.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
latex_show_urls = 'inline'
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
@@ -277,7 +277,7 @@ man_pages = [
]
# If true, show URL addresses after external links.
#man_show_urls = False
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
@@ -292,16 +292,16 @@ texinfo_documents = [
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# texinfo_no_detailmenu = False
# -- Options for Epub output ----------------------------------------------
@@ -319,11 +319,11 @@ epub_basename = 'gprMax User Guide'
# for small screen space, using the same theme for HTML and epub output is
# usually not wise. This defaults to 'epub', a theme designed to save visual
# space.
#epub_theme = 'epub'
# epub_theme = 'epub'
# The language of the text. It defaults to the language option
# or 'en' if the language is not set.
#epub_language = ''
# epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
epub_scheme = 'URL'
@@ -333,42 +333,42 @@ epub_scheme = 'URL'
epub_identifier = 'www.gprmax.com'
# A unique identification for the text.
#epub_uid = ''
# epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# epub_cover = ()
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()
# epub_guide = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# epub_post_files = []
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# epub_tocdup = True
# Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default'
# epub_tocscope = 'default'
# Fix unsupported image types using the Pillow.
#epub_fix_images = False
# epub_fix_images = False
# Scale large images.
#epub_max_image_width = 0
# epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline'
# epub_show_urls = 'inline'
# If false, no index is generated.
#epub_use_index = True
# epub_use_index = True

查看文件

@@ -67,10 +67,10 @@ if args.otherresults is not None:
for i, result in enumerate(otherresults):
ax.plot(result['threads'], result['benchtimes'], color=colors[1], marker='.', ms=10, lw=2, ls=lines[i], label=otherplotlabels[i] + ' (v' + version + ')')
#ax.plot(results['threads'], results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
#ax.plot(results['threads'], results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
#ax.plot(results['threads'], results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
#ax.plot(results['threads'], results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
# ax.plot(results['threads'], results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
# ax.plot(results['threads'], results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
# ax.plot(results['threads'], results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
# ax.plot(results['threads'], results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
ax.set_xlabel('Number of threads')
ax.set_ylabel('Time [s]')
@@ -91,10 +91,10 @@ if args.otherresults is not None:
for i, result in enumerate(otherresults):
ax.plot(result['threads'], result['benchtimes'][-1] / result['benchtimes'], color=colors[1], marker='.', ms=10, lw=2, ls=lines[i], label=otherplotlabels[i] + ' (v' + version + ')')
#ax.plot(results['threads'], results['bench1'][0] / results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
#ax.plot(results['threads'], results['bench1c'][1] / results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
#ax.plot(results['threads'], results['bench2'][0] / results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
#ax.plot(results['threads'], results['bench2c'][1] / results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
# ax.plot(results['threads'], results['bench1'][0] / results['bench1'], color=colors[1], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v3.0.0b21)')
# ax.plot(results['threads'], results['bench1c'][1] / results['bench1c'], color=colors[0], marker='.', ms=10, lw=2, label='bench_100x100x100.in (v2)')
# ax.plot(results['threads'], results['bench2'][0] / results['bench2'], color=colors[1], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v3.0.0b21)')
# ax.plot(results['threads'], results['bench2c'][1] / results['bench2c'], color=colors[0], marker='.', ms=10, lw=2, ls='--', label='bench_150x150x150.in (v2)')
ax.set_xlabel('Number of threads')
ax.set_ylabel('Speed-up factor')

查看文件

@@ -84,7 +84,7 @@ ax.grid()
# Save a PDF/PNG of the figure
savename = os.path.abspath(os.path.dirname(args.modelfile)) + os.sep + os.path.splitext(os.path.split(args.modelfile)[1])[0] + '_vs_' + os.path.splitext(os.path.split(args.realfile)[1])[0]
#fig.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig((savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
plt.show()

查看文件

@@ -47,11 +47,6 @@ class My_input_cmd_funcs_test(unittest.TestCase):
rx(2, 1, 0, 'id', ['Ex', 'Ez'])
self.assert_output(out, '#rx: 2 1 0 id Ex Ez')
def test_rx4(self):
with captured_output() as (out, err):
rx(2, 1, 0, 'id', ['Ex', 'Ez'])
self.assert_output(out, '#rx: 2 1 0 id Ex Ez')
def test_rx_rotate_exception(self):
with self.assertRaises(ValueError):
rx(2, 1, 0, 'id', ['Ex', 'Ez'], polarisation='x', rotate90origin=(1, 1)) # no dxdy given

查看文件

@@ -41,17 +41,17 @@ from tests.analytical_solutions import hertzian_dipole_fs
basepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'models_')
basepath += 'basic'
#basepath += 'advanced'
# basepath += 'advanced'
# List of available basic test models
testmodels = ['hertzian_dipole_fs_analytical', '2D_ExHyHz', '2D_EyHxHz', '2D_EzHxHy', 'cylinder_Ascan_2D', 'hertzian_dipole_fs', 'hertzian_dipole_hs', 'hertzian_dipole_dispersive', 'magnetic_dipole_fs']
# List of available advanced test models
#testmodels = ['antenna_GSSI_1500_fs', 'antenna_MALA_1200_fs']
# testmodels = ['antenna_GSSI_1500_fs', 'antenna_MALA_1200_fs']
# Select a specific model if desired
#testmodels = [testmodels[0], testmodels[5], testmodels[7]]
#testmodels = [testmodels[5]]
# testmodels = [testmodels[0], testmodels[5], testmodels[7]]
# testmodels = [testmodels[5]]
testresults = dict.fromkeys(testmodels)
path = '/rxs/rx1/'
@@ -138,9 +138,9 @@ for i, model in enumerate(testmodels):
datadiffs = np.zeros(datatest.shape, dtype=np.float64)
for i in range(len(outputstest)):
max = np.amax(np.abs(dataref[:, i]))
datadiffs[:, i] = np.divide(np.abs(dataref[:, i] - datatest[:, i]), max, out=np.zeros_like(dataref[:, i]), where=max!=0) # Replace any division by zero with zero
datadiffs[:, i] = np.divide(np.abs(dataref[:, i] - datatest[:, i]), max, out=np.zeros_like(dataref[:, i]), where=max != 0) # Replace any division by zero with zero
with np.errstate(divide='ignore'):
datadiffs[:, i] = 20 * np.log10(datadiffs[:, i]) # Ignore any zero division in log10
datadiffs[:, i] = 20 * np.log10(datadiffs[:, i]) # Ignore any zero division in log10
# Store max difference
maxdiff = np.amax(np.amax(datadiffs))
@@ -184,8 +184,8 @@ for i, model in enumerate(testmodels):
# Save a PDF/PNG of the figure
savename = os.path.join(basepath, model + os.path.sep + model)
#fig1.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#fig2.savefig(savename + '_diffs.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig1.savefig(savename + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig2.savefig(savename + '_diffs.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
fig1.savefig(savename + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
fig2.savefig(savename + '_diffs.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)

查看文件

@@ -111,7 +111,8 @@ if rxs:
thresholddisplay = Show(threshold, renderview)
thresholddisplay.ColorArrayName = 'Receivers'
#renderview.CameraParallelProjection = 1
# renderview.CameraParallelProjection = 1
RenderAllViews()
# Show color bar/color legend
#thresholdDisplay.SetScalarBarVisibility(renderview, False)
# thresholdDisplay.SetScalarBarVisibility(renderview, False)

查看文件

@@ -93,7 +93,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
# Set plotting range to -60dB from maximum power
pltrange = np.where((np.amax(power[1::]) - power[1::]) > 60)[0][0] + 1
# To a maximum frequency
#pltrange = np.where(freqs > 2e9)[0][0]
# pltrange = np.where(freqs > 2e9)[0][0]
pltrange = np.s_[0:pltrange]
# Plot time history of output component
@@ -135,7 +135,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
fig, ax = plt.subplots(subplot_kw=dict(xlabel='Time [s]', ylabel=outputtext + ' field strength [V/m]'), num='rx' + str(rx), figsize=(20, 10), facecolor='w', edgecolor='w')
line = ax.plot(time, outputdata, 'r', lw=2, label=outputtext)
ax.set_xlim([0, np.amax(time)])
#ax.set_ylim([-15, 20])
# ax.set_ylim([-15, 20])
ax.grid()
if 'H' in output:
@@ -152,7 +152,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
gs = gridspec.GridSpec(3, 3, hspace=0.3, wspace=0.3)
else:
gs = gridspec.GridSpec(3, 2, hspace=0.3, wspace=0.3)
for output in outputs:
# Check for polarity of output and if requested output is in file
if output[-1] == 'm':
@@ -173,51 +173,51 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False):
ax = plt.subplot(gs[0, 0])
ax.plot(time, outputdata, 'r', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [V/m]')
#ax.set_ylim([-15, 20])
# ax.set_ylim([-15, 20])
elif output == 'Ey':
ax = plt.subplot(gs[1, 0])
ax.plot(time, outputdata, 'r', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [V/m]')
#ax.set_ylim([-15, 20])
# ax.set_ylim([-15, 20])
elif output == 'Ez':
ax = plt.subplot(gs[2, 0])
ax.plot(time, outputdata, 'r', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [V/m]')
#ax.set_ylim([-15, 20])
# ax.set_ylim([-15, 20])
elif output == 'Hx':
ax = plt.subplot(gs[0, 1])
ax.plot(time, outputdata, 'g', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [A/m]')
#ax.set_ylim([-0.03, 0.03])
# ax.set_ylim([-0.03, 0.03])
elif output == 'Hy':
ax = plt.subplot(gs[1, 1])
ax.plot(time, outputdata, 'g', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [A/m]')
#ax.set_ylim([-0.03, 0.03])
# ax.set_ylim([-0.03, 0.03])
elif output == 'Hz':
ax = plt.subplot(gs[2, 1])
ax.plot(time, outputdata, 'g', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', field strength [A/m]')
#ax.set_ylim([-0.03, 0.03])
# ax.set_ylim([-0.03, 0.03])
elif output == 'Ix':
ax = plt.subplot(gs[0, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.plot(time, outputdata, 'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
elif output == 'Iy':
ax = plt.subplot(gs[1, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.plot(time, outputdata, 'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
elif output == 'Iz':
ax = plt.subplot(gs[2, 2])
ax.plot(time, outputdata,'b', lw=2, label=outputtext)
ax.plot(time, outputdata, 'b', lw=2, label=outputtext)
ax.set_ylabel(outputtext + ', current [A]')
for ax in fig.axes:
ax.set_xlim([0, np.amax(time)])
ax.grid()
# Save a PDF/PNG of the figure
# fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
return plt

查看文件

@@ -93,8 +93,8 @@ def mpl_plot(outputdata, dt, rxnumber, rxcomponent):
cb.set_label('Current [A]')
# Save a PDF/PNG of the figure
#fig.savefig('Bscan' + str(rxnumber) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#fig.savefig('Bscan' + str(rxnumber) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# fig.savefig('Bscan' + str(rxnumber) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig('Bscan' + str(rxnumber) + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
return plt

查看文件

@@ -155,7 +155,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
# To a certain drop from maximum power
pltrangemax = np.where((np.amax(Vincp[1::]) - Vincp[1::]) > 60)[0][0] + 1
# To a maximum frequency
#pltrangemax = np.where(freqs > 6e9)[0][0]
# pltrangemax = np.where(freqs > 6e9)[0][0]
pltrange = np.s_[pltrangemin:pltrangemax]
# Print some useful values from s11, and input impedance
@@ -163,8 +163,8 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
print('s11 minimum: {:g} dB at {:g} Hz'.format(np.amin(s11[pltrange]), freqs[s11minfreq + pltrangemin]))
print('At {:g} Hz...'.format(freqs[s11minfreq + pltrangemin]))
print('Input impedance: {:.1f}{:+.1f}j Ohms'.format(np.abs(zin[s11minfreq + pltrangemin]), zin[s11minfreq + pltrangemin].imag))
#print('Input admittance (mag): {:g} S'.format(np.abs(yin[s11minfreq + pltrangemin])))
#print('Input admittance (phase): {:.1f} deg'.format(np.angle(yin[s11minfreq + pltrangemin], deg=True)))
# print('Input admittance (mag): {:g} S'.format(np.abs(yin[s11minfreq + pltrangemin])))
# print('Input admittance (phase): {:.1f} deg'.format(np.angle(yin[s11minfreq + pltrangemin], deg=True)))
# Figure 1
# Plot incident voltage
@@ -254,45 +254,45 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
ax.grid()
# Plot reflected (reflected) voltage
#ax = plt.subplot(gs1[4, 0])
#ax.plot(time, Vref, 'r', lw=2, label='Vref')
#ax.set_title('Reflected voltage')
#ax.set_xlabel('Time [s]')
#ax.set_ylabel('Voltage [V]')
#ax.set_xlim([0, np.amax(time)])
# ax = plt.subplot(gs1[4, 0])
# ax.plot(time, Vref, 'r', lw=2, label='Vref')
# ax.set_title('Reflected voltage')
# ax.set_xlabel('Time [s]')
# ax.set_ylabel('Voltage [V]')
# ax.set_xlim([0, np.amax(time)])
# ax.grid()
#
# Plot frequency spectra of reflected voltage
#ax = plt.subplot(gs1[4, 1])
#markerline, stemlines, baseline = ax.stem(freqs[pltrange], Vrefp[pltrange], '-.')
#plt.setp(baseline, 'linewidth', 0)
#plt.setp(stemlines, 'color', 'r')
#plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
#ax.plot(freqs[pltrange], Vrefp[pltrange], 'r', lw=2)
#ax.set_title('Reflected voltage')
#ax.set_xlabel('Frequency [Hz]')
#ax.set_ylabel('Power [dB]')
# ax = plt.subplot(gs1[4, 1])
# markerline, stemlines, baseline = ax.stem(freqs[pltrange], Vrefp[pltrange], '-.')
# plt.setp(baseline, 'linewidth', 0)
# plt.setp(stemlines, 'color', 'r')
# plt.setp(markerline, 'markerfacecolor', 'r', 'markeredgecolor', 'r')
# ax.plot(freqs[pltrange], Vrefp[pltrange], 'r', lw=2)
# ax.set_title('Reflected voltage')
# ax.set_xlabel('Frequency [Hz]')
# ax.set_ylabel('Power [dB]')
# ax.grid()
#
# Plot reflected (reflected) current
#ax = plt.subplot(gs1[5, 0])
#ax.plot(time, Iref, 'b', lw=2, label='Iref')
#ax.set_title('Reflected current')
#ax.set_xlabel('Time [s]')
#ax.set_ylabel('Current [A]')
#ax.set_xlim([0, np.amax(time)])
# ax = plt.subplot(gs1[5, 0])
# ax.plot(time, Iref, 'b', lw=2, label='Iref')
# ax.set_title('Reflected current')
# ax.set_xlabel('Time [s]')
# ax.set_ylabel('Current [A]')
# ax.set_xlim([0, np.amax(time)])
# ax.grid()
#
# Plot frequency spectra of reflected current
#ax = plt.subplot(gs1[5, 1])
#markerline, stemlines, baseline = ax.stem(freqs[pltrange], Irefp[pltrange], '-.')
#plt.setp(baseline, 'linewidth', 0)
#plt.setp(stemlines, 'color', 'b')
#plt.setp(markerline, 'markerfacecolor', 'b', 'markeredgecolor', 'b')
#ax.plot(freqs[pltrange], Irefp[pltrange], 'b', lw=2)
#ax.set_title('Reflected current')
#ax.set_xlabel('Frequency [Hz]')
#ax.set_ylabel('Power [dB]')
# ax = plt.subplot(gs1[5, 1])
# markerline, stemlines, baseline = ax.stem(freqs[pltrange], Irefp[pltrange], '-.')
# plt.setp(baseline, 'linewidth', 0)
# plt.setp(stemlines, 'color', 'b')
# plt.setp(markerline, 'markerfacecolor', 'b', 'markeredgecolor', 'b')
# ax.plot(freqs[pltrange], Irefp[pltrange], 'b', lw=2)
# ax.set_title('Reflected current')
# ax.set_xlabel('Frequency [Hz]')
# ax.set_ylabel('Power [dB]')
# ax.grid()
# Figure 2
@@ -308,8 +308,8 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
ax.set_title('s11')
ax.set_xlabel('Frequency [Hz]')
ax.set_ylabel('Power [dB]')
#ax.set_xlim([0, 5e9])
#ax.set_ylim([-25, 0])
# ax.set_xlim([0, 5e9])
# ax.set_ylim([-25, 0])
ax.grid()
# Plot frequency spectra of s21
@@ -323,8 +323,8 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
ax.set_title('s21')
ax.set_xlabel('Frequency [Hz]')
ax.set_ylabel('Power [dB]')
#ax.set_xlim([0.88e9, 1.02e9])
#ax.set_ylim([-25, 50])
# ax.set_xlim([0.88e9, 1.02e9])
# ax.set_ylim([-25, 50])
ax.grid()
# Plot input resistance (real part of impedance)
@@ -337,9 +337,9 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
ax.set_title('Input impedance (resistive)')
ax.set_xlabel('Frequency [Hz]')
ax.set_ylabel('Resistance [Ohms]')
#ax.set_xlim([0.88e9, 1.02e9])
# ax.set_xlim([0.88e9, 1.02e9])
ax.set_ylim(bottom=0)
#ax.set_ylim([0, 300])
# ax.set_ylim([0, 300])
ax.grid()
# Plot input reactance (imaginery part of impedance)
@@ -352,43 +352,43 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref,
ax.set_title('Input impedance (reactive)')
ax.set_xlabel('Frequency [Hz]')
ax.set_ylabel('Reactance [Ohms]')
#ax.set_xlim([0.88e9, 1.02e9])
#ax.set_ylim([-300, 300])
# ax.set_xlim([0.88e9, 1.02e9])
# ax.set_ylim([-300, 300])
ax.grid()
# Plot input admittance (magnitude)
#ax = plt.subplot(gs2[2, 0])
#markerline, stemlines, baseline = ax.stem(freqs[pltrange], np.abs(yin[pltrange]), '-.')
#plt.setp(baseline, 'linewidth', 0)
#plt.setp(stemlines, 'color', 'g')
#plt.setp(markerline, 'markerfacecolor', 'g', 'markeredgecolor', 'g')
#ax.plot(freqs[pltrange], np.abs(yin[pltrange]), 'g', lw=2)
#ax.set_title('Input admittance (magnitude)')
#ax.set_xlabel('Frequency [Hz]')
#ax.set_ylabel('Admittance [Siemens]')
##ax.set_xlim([0.88e9, 1.02e9])
##ax.set_ylim([0, 0.035])
# ax = plt.subplot(gs2[2, 0])
# markerline, stemlines, baseline = ax.stem(freqs[pltrange], np.abs(yin[pltrange]), '-.')
# plt.setp(baseline, 'linewidth', 0)
# plt.setp(stemlines, 'color', 'g')
# plt.setp(markerline, 'markerfacecolor', 'g', 'markeredgecolor', 'g')
# ax.plot(freqs[pltrange], np.abs(yin[pltrange]), 'g', lw=2)
# ax.set_title('Input admittance (magnitude)')
# ax.set_xlabel('Frequency [Hz]')
# ax.set_ylabel('Admittance [Siemens]')
# ax.set_xlim([0.88e9, 1.02e9])
# ax.set_ylim([0, 0.035])
# ax.grid()
#
# Plot input admittance (phase)
#ax = plt.subplot(gs2[2, 1])
#markerline, stemlines, baseline = ax.stem(freqs[pltrange], np.angle(yin[pltrange], deg=True), '-.')
#plt.setp(baseline, 'linewidth', 0)
#plt.setp(stemlines, 'color', 'g')
#plt.setp(markerline, 'markerfacecolor', 'g', 'markeredgecolor', 'g')
#ax.plot(freqs[pltrange], np.angle(yin[pltrange], deg=True), 'g', lw=2)
#ax.set_title('Input admittance (phase)')
#ax.set_xlabel('Frequency [Hz]')
#ax.set_ylabel('Phase [degrees]')
##ax.set_xlim([0.88e9, 1.02e9])
##ax.set_ylim([-40, 100])
# ax = plt.subplot(gs2[2, 1])
# markerline, stemlines, baseline = ax.stem(freqs[pltrange], np.angle(yin[pltrange], deg=True), '-.')
# plt.setp(baseline, 'linewidth', 0)
# plt.setp(stemlines, 'color', 'g')
# plt.setp(markerline, 'markerfacecolor', 'g', 'markeredgecolor', 'g')
# ax.plot(freqs[pltrange], np.angle(yin[pltrange], deg=True), 'g', lw=2)
# ax.set_title('Input admittance (phase)')
# ax.set_xlabel('Frequency [Hz]')
# ax.set_ylabel('Phase [degrees]')
# ax.set_xlim([0.88e9, 1.02e9])
# ax.set_ylim([-40, 100])
# ax.grid()
# Save a PDF/PNG of the figure
#fig1.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_tl_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
#fig2.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_ant_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
#fig1.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_tl_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#fig2.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_ant_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig1.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_tl_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# fig2.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_ant_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# fig1.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_tl_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig2.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_ant_params.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
return plt

查看文件

@@ -156,8 +156,8 @@ def mpl_plot(w, timewindow, dt, iterations, fft=False):
[ax.grid() for ax in fig.axes] # Turn on grid
# Save a PDF/PNG of the figure
#fig.savefig(os.path.dirname(os.path.abspath(__file__)) + os.sep + w.type + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#fig.savefig(os.path.dirname(os.path.abspath(__file__)) + os.sep + w.type + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(os.path.dirname(os.path.abspath(__file__)) + os.sep + w.type + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
# fig.savefig(os.path.dirname(os.path.abspath(__file__)) + os.sep + w.type + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
return plt

查看文件

@@ -25,7 +25,7 @@ outputfile = args.outputfile
########################################
# User configurable parameters
# Pattern type (E or H)
# Pattern type (E or H)
type = 'H'
# Antenna (true if using full antenna model; false for a theoretical Hertzian dipole
@@ -116,21 +116,21 @@ for rx in range(0, nrx):
f.close()
# Plot traces for sanity checking
#fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(num=outputfile, nrows=3, ncols=2, sharex=False, sharey='col', subplot_kw=dict(xlabel='Time [ns]'), figsize=(20, 10), facecolor='w', edgecolor='w')
#ax1.plot(time, Ex[:, traceno],'r', lw=2)
#ax1.set_ylabel('$E_x$, field strength [V/m]')
#ax3.plot(time, Ey[:, traceno],'r', lw=2)
#ax3.set_ylabel('$E_y$, field strength [V/m]')
#ax5.plot(time, Ez[:, traceno],'r', lw=2)
#ax5.set_ylabel('$E_z$, field strength [V/m]')
#ax2.plot(time, Hx[:, traceno],'b', lw=2)
#ax2.set_ylabel('$H_x$, field strength [A/m]')
#ax4.plot(time, Hy[:, traceno],'b', lw=2)
#ax4.set_ylabel('$H_y$, field strength [A/m]')
#ax6.plot(time, Hz[:, traceno],'b', lw=2)
#ax6.set_ylabel('$H_z$, field strength [A/m]')
# fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(num=outputfile, nrows=3, ncols=2, sharex=False, sharey='col', subplot_kw=dict(xlabel='Time [ns]'), figsize=(20, 10), facecolor='w', edgecolor='w')
# ax1.plot(time, Ex[:, traceno],'r', lw=2)
# ax1.set_ylabel('$E_x$, field strength [V/m]')
# ax3.plot(time, Ey[:, traceno],'r', lw=2)
# ax3.set_ylabel('$E_y$, field strength [V/m]')
# ax5.plot(time, Ez[:, traceno],'r', lw=2)
# ax5.set_ylabel('$E_z$, field strength [V/m]')
# ax2.plot(time, Hx[:, traceno],'b', lw=2)
# ax2.set_ylabel('$H_x$, field strength [A/m]')
# ax4.plot(time, Hy[:, traceno],'b', lw=2)
# ax4.set_ylabel('$H_y$, field strength [A/m]')
# ax6.plot(time, Hz[:, traceno],'b', lw=2)
# ax6.set_ylabel('$H_z$, field strength [A/m]')
# Turn on grid
#[ax.grid() for ax in fig.axes]
# [ax.grid() for ax in fig.axes]
# plt.show()
# Calculate fields for patterns

查看文件

@@ -18,15 +18,15 @@ from gprMax.constants import c, z0
# Parse command line arguments
parser = argparse.ArgumentParser(description='Plot field patterns from a simulation with receivers positioned in circles around an antenna. This module should be used after the field pattern data has been processed and stored using the initial_save.py module.', usage='cd gprMax; python -m user_libs.antenna_patterns.plot_fields numpyfile')
parser.add_argument('numpyfile', help='name of numpy file including path')
#parser.add_argument('hertzian', help='name of numpy file including path')
# parser.add_argument('hertzian', help='name of numpy file including path')
args = parser.parse_args()
patterns = np.load(args.numpyfile)
#hertzian = np.load(args.hertzian)
# hertzian = np.load(args.hertzian)
########################################
# User configurable parameters
# Pattern type (E or H)
# Pattern type (E or H)
type = 'H'
# Relative permittivity of half-space for homogeneous materials (set to None for inhomogeneous)
@@ -87,11 +87,11 @@ for patt in range(0, len(radii)):
# Add Hertzian dipole plot
# hertzplot1 = np.append(hertzian[0, :], hertzian[0, 0]) # Append start value to close circle
#hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
#ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot1 = hertzplot1 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot1), label='Inf. dipole, 0.1m', color='black', ls='-.', lw=3)
# hertzplot2 = np.append(hertzian[-1, :], hertzian[-1, 0]) # Append start value to close circle
#hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
#ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)
# hertzplot2 = hertzplot2 / np.max(np.max(hertzian))
# ax.plot(theta, 10 * np.log10(hertzplot2), label='Inf. dipole, 0.58m', color='black', ls='--', lw=3)
# Theta axis options
ax.set_theta_zero_location('N')
@@ -110,13 +110,13 @@ ax.set_yticklabels(yticks)
ax.grid(True)
handles, existlabels = ax.get_legend_handles_labels()
leg = ax.legend([handles[0], handles[-1]], [existlabels[0], existlabels[-1]], ncol=2, loc=(0.27, -0.12), frameon=False) # Plot just first and last legend entries
#leg = ax.legend([handles[0], handles[-3], handles[-2], handles[-1]], [existlabels[0], existlabels[-3], existlabels[-2], existlabels[-1]], ncol=4, loc=(-0.13,-0.12), frameon=False)
# leg = ax.legend([handles[0], handles[-3], handles[-2], handles[-1]], [existlabels[0], existlabels[-3], existlabels[-2], existlabels[-1]], ncol=4, loc=(-0.13,-0.12), frameon=False)
[legobj.set_linewidth(2) for legobj in leg.legendHandles]
# Save a pdf of the plot
savename = os.path.splitext(args.numpyfile)[0] + '.pdf'
fig.savefig(savename, dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)
#savename = os.path.splitext(args.numpyfile)[0] + '.png'
#fig.savefig(savename, dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
# savename = os.path.splitext(args.numpyfile)[0] + '.png'
# fig.savefig(savename, dpi=150, format='png', bbox_inches='tight', pad_inches=0.1)
plt.show()

查看文件

@@ -52,13 +52,13 @@ def antenna_like_GSSI_1500(x, y, z, resolution=0.001, rotate90=False, **kwargs):
else:
# excitationfreq = 1.5e9 # GHz
# sourceresistance = 50 # Ohms
#absorberEr = 1.7
#absorbersig = 0.59
# absorberEr = 1.7
# absorbersig = 0.59
# Values from http://hdl.handle.net/1842/4074
excitationfreq = 1.71e9
#sourceresistance = 4
sourceresistance = 230 #  Correction for old (< 123) GprMax3D bug
# sourceresistance = 4
sourceresistance = 230 # Correction for old (< 123) GprMax3D bug
absorberEr = 1.58
absorbersig = 0.428
rxres = 925 # Resistance at Rx bowtie
@@ -157,8 +157,8 @@ def antenna_like_GSSI_1500(x, y, z, resolution=0.001, rotate90=False, **kwargs):
box(x, y, z, x + casesize[0], y + casesize[1], z + skidthickness, 'hdpe', rotate90origin=rotate90origin)
# Geometry views
#geometry_view(x - dx, y - dy, z - dz, x + casesize[0] + dx, y + casesize[1] + dy, z + skidthickness + casesize[2] + dz, dx, dy, dz, 'antenna_like_GSSI_1500')
#geometry_view(x, y, z, x + casesize[0], y + casesize[1], z + 0.010, dx, dy, dz, 'antenna_like_GSSI_1500_pcb', type='f')
# geometry_view(x - dx, y - dy, z - dz, x + casesize[0] + dx, y + casesize[1] + dy, z + skidthickness + casesize[2] + dz, dx, dy, dz, 'antenna_like_GSSI_1500')
# geometry_view(x, y, z, x + casesize[0], y + casesize[1], z + 0.010, dx, dy, dz, 'antenna_like_GSSI_1500_pcb', type='f')
# Excitation - custom pulse
# print('#excitation_file: {}'.format(os.path.join(moduledirectory, 'GSSIgausspulse1.txt')))
@@ -395,8 +395,8 @@ def antenna_like_MALA_1200(x, y, z, resolution=0.001, rotate90=False, **kwargs):
box(x, y, z + polypropylenethickness, x + casesize[0], y + casesize[1], z + polypropylenethickness + hdpethickness, 'hdpe', rotate90origin=rotate90origin)
# Geometry views
#geometry_view(x - dx, y - dy, z - dz, x + casesize[0] + dx, y + casesize[1] + dy, z + casesize[2] + skidthickness + dz, dx, dy, dz, 'antenna_like_MALA_1200')
#geometry_view(x, y, z, x + casesize[0], y + casesize[1], z + 0.010, dx, dy, dz, 'antenna_like_MALA_1200_pcb', type='f')
# geometry_view(x - dx, y - dy, z - dz, x + casesize[0] + dx, y + casesize[1] + dy, z + casesize[2] + skidthickness + dz, dx, dy, dz, 'antenna_like_MALA_1200')
# geometry_view(x, y, z, x + casesize[0], y + casesize[1], z + 0.010, dx, dy, dz, 'antenna_like_MALA_1200_pcb', type='f')
# Excitation
print('#waveform: gaussian 1.0 {} myGaussian'.format(excitationfreq))

查看文件

@@ -107,31 +107,31 @@ def xcorr(filename, args):
raise GeneralError('No outputs matching {} were found'.format(args['outputs']))
# Normalise reference respose and response from output file
# refresp /= np.amax(np.abs(refresp))
# modelresp /= np.amax(np.abs(modelresp))
# refresp /= np.amax(np.abs(refresp))
# modelresp /= np.amax(np.abs(modelresp))
# Make both responses the same length in time
# if reftime[-1] > modeltime[-1]:
# reftime = np.arange(0, f.attrs['dt'] * f.attrs['Iterations'], reftime[-1] / len(reftime))
# refresp = refresp[0:len(reftime)]
# elif modeltime[-1] > reftime[-1]:
# modeltime = np.arange(0, reftime[-1], f.attrs['dt'])
# modelresp = modelresp[0:len(modeltime)]
#
# # Downsample the response with the higher sampling rate
# if len(modeltime) < len(reftime):
# refresp = signal.resample(refresp, len(modelresp))
# elif len(reftime) < len(modeltime):
# modelresp = signal.resample(modelresp, len(refresp))
# if reftime[-1] > modeltime[-1]:
# reftime = np.arange(0, f.attrs['dt'] * f.attrs['Iterations'], reftime[-1] / len(reftime))
# refresp = refresp[0:len(reftime)]
# elif modeltime[-1] > reftime[-1]:
# modeltime = np.arange(0, reftime[-1], f.attrs['dt'])
# modelresp = modelresp[0:len(modeltime)]
# Downsample the response with the higher sampling rate
# if len(modeltime) < len(reftime):
# refresp = signal.resample(refresp, len(modelresp))
# elif len(reftime) < len(modeltime):
# modelresp = signal.resample(modelresp, len(refresp))
# Prepare data for normalized cross-correlation
refresp = (refresp - np.mean(refresp)) / (np.std(refresp) * len(refresp))
modelresp = (modelresp - np.mean(modelresp)) / np.std(modelresp)
# Plots responses for checking
#fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Voltage [V]'), figsize=(20, 10), facecolor='w', edgecolor='w')
#ax.plot(refresp,'r', lw=2, label='refresp')
#ax.plot(modelresp,'b', lw=2, label='modelresp')
# fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Voltage [V]'), figsize=(20, 10), facecolor='w', edgecolor='w')
# ax.plot(refresp,'r', lw=2, label='refresp')
# ax.plot(modelresp,'b', lw=2, label='modelresp')
# ax.grid()
# plt.show()
@@ -142,10 +142,10 @@ def xcorr(filename, args):
xcorr = np.nan_to_num(xcorr)
# Plot cross-correlation for checking
# fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Voltage [V]'), figsize=(20, 10), facecolor='w', edgecolor='w')
# ax.plot(xcorr,'r', lw=2, label='xcorr')
# ax.grid()
# plt.show()
# fig, ax = plt.subplots(subplot_kw=dict(xlabel='Iterations', ylabel='Voltage [V]'), figsize=(20, 10), facecolor='w', edgecolor='w')
# ax.plot(xcorr,'r', lw=2, label='xcorr')
# ax.grid()
# plt.show()
xcorrmax = np.amax(xcorr)
@@ -237,15 +237,15 @@ def compactness(filename, args):
# Amplitude ratio of the 1st to 3rd peak - hopefully be a measure of a compact envelope
compactness = np.abs(outputdata[peaks[0]]) / np.abs(outputdata[peaks[2]])
# # Percentage of maximum value to measure compactness of signal
# durationthreshold = 2
# # Check if there is a peak/trough smaller than threshold
# durationthresholdexist = np.where(np.abs(outputdata[peaks]) < (peak * (durationthreshold / 100)))[0]
# if durationthresholdexist.size == 0:
# compactness = time[peaks[-1]]
# else:
# time2threshold = time[peaks[durationthresholdexist[0]]]
# compactness = time2threshold - time[min(peaks)]
# Percentage of maximum value to measure compactness of signal
# durationthreshold = 2
# Check if there is a peak/trough smaller than threshold
# durationthresholdexist = np.where(np.abs(outputdata[peaks]) < (peak * (durationthreshold / 100)))[0]
# if durationthresholdexist.size == 0:
# compactness = time[peaks[-1]]
# else:
# time2threshold = time[peaks[durationthresholdexist[0]]]
# compactness = time2threshold - time[min(peaks)]
# Check in case no outputs where found
if not outputsused: