python: add documentation
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
parent
42726ba22e
commit
1ebb7932c1
2
.gitignore
vendored
2
.gitignore
vendored
@ -26,3 +26,5 @@ localConfig.cmake
|
||||
*.pyc
|
||||
*.pyo
|
||||
python/**/*.cpp
|
||||
!python/doc
|
||||
python/doc/_build
|
||||
|
296
python/doc/conf.py
Normal file
296
python/doc/conf.py
Normal file
@ -0,0 +1,296 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# openEMS documentation build configuration file, created by
|
||||
# sphinx-quickstart on Thu Sep 8 20:42:18 2016.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sphinx_rtd_theme
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#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
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.mathjax',
|
||||
'numpydoc',
|
||||
'sphinx.ext.autosummary',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'openEMS'
|
||||
copyright = '2016, Thorsten Liebig'
|
||||
author = 'Thorsten Liebig'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.0.34'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.0.34'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#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
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#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 = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
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 = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (relative to this directory) to use as a favicon of
|
||||
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#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,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# 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 = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#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
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is 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 = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#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'
|
||||
|
||||
# A dictionary with options for the search language support, empty by default.
|
||||
# Now only 'ja' uses this config value
|
||||
#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'
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'openEMSdoc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'openEMS.tex', 'openEMS Documentation',
|
||||
'Thorsten Liebig', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'openems', 'openEMS Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'openEMS', 'openEMS Documentation',
|
||||
author, 'openEMS', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {'CSXCAD': ('http://openems.de/doc/CSXCAD/', None)}
|
22
python/doc/index.rst
Normal file
22
python/doc/index.rst
Normal file
@ -0,0 +1,22 @@
|
||||
.. openEMS documentation master file, created by
|
||||
sphinx-quickstart on Thu Sep 8 20:42:18 2016.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to openEMS's documentation!
|
||||
===================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
openEMS
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
59
python/doc/openEMS.rst
Normal file
59
python/doc/openEMS.rst
Normal file
@ -0,0 +1,59 @@
|
||||
openEMS Python Interface
|
||||
========================
|
||||
|
||||
openEMS
|
||||
-------
|
||||
|
||||
.. automodule:: openEMS.openEMS
|
||||
:members: openEMS
|
||||
:undoc-members:
|
||||
|
||||
Ports
|
||||
-----
|
||||
|
||||
.. automodule:: openEMS.ports
|
||||
|
||||
Port (Base Class)
|
||||
-----------------
|
||||
.. autoclass:: Port
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
Lumped Port
|
||||
-----------
|
||||
.. autoclass:: LumpedPort
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
MSL Port
|
||||
--------
|
||||
.. autoclass:: MSLPort
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
Waveguide Port
|
||||
--------------
|
||||
.. autoclass:: WaveguidePort
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
Rect Waveguide Port
|
||||
-------------------
|
||||
.. autoclass:: RectWGPort
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
NF2FF
|
||||
-----
|
||||
|
||||
.. automodule:: openEMS.nf2ff
|
||||
|
||||
NF2FF
|
||||
-----
|
||||
.. autoclass:: nf2ff
|
||||
:members:
|
||||
|
||||
NF2FF Results
|
||||
-----------------
|
||||
.. autoclass:: nf2ff_results
|
||||
:members:
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Dec 20 22:43:35 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from libcpp.string cimport string
|
||||
from libcpp.vector cimport vector
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Dec 20 22:42:19 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
cimport _nf2ff
|
||||
import numpy as np
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Dec 20 20:53:12 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Dec 14 00:12:43 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from libcpp.string cimport string
|
||||
from libcpp cimport bool
|
||||
@ -46,4 +57,4 @@ cdef extern from "openEMS/openems.h":
|
||||
|
||||
cdef class openEMS:
|
||||
cdef _openEMS *thisptr
|
||||
cdef readonly ContinuousStructure CSX # hold a C++ instance which we're wrapping
|
||||
cdef readonly ContinuousStructure __CSX # hold a C++ instance which we're wrapping
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sun Dec 13 23:50:24 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os, sys, shutil
|
||||
import numpy as np
|
||||
@ -26,11 +37,14 @@ cdef class openEMS:
|
||||
"""
|
||||
@staticmethod
|
||||
def WelcomeScreen():
|
||||
"""
|
||||
Show the openEMS welcome screen.
|
||||
"""
|
||||
_openEMS.WelcomeScreen()
|
||||
|
||||
def __cinit__(self, *args, **kw):
|
||||
self.thisptr = new _openEMS()
|
||||
self.CSX = None
|
||||
self.__CSX = None
|
||||
|
||||
if 'NrTS' in kw:
|
||||
self.SetNumberOfTimeSteps(kw['NrTS'])
|
||||
@ -66,71 +80,121 @@ cdef class openEMS:
|
||||
|
||||
def __dealloc__(self):
|
||||
del self.thisptr
|
||||
if self.CSX is not None:
|
||||
self.CSX.thisptr = NULL
|
||||
if self.__CSX is not None:
|
||||
self.__CSX.thisptr = NULL
|
||||
|
||||
def SetNumberOfTimeSteps(self, val):
|
||||
""" SetNumberOfTimeSteps(val)
|
||||
|
||||
Set the number of timesteps. E.g. 5e4 (default is 1e9)
|
||||
"""
|
||||
self.thisptr.SetNumberOfTimeSteps(val)
|
||||
|
||||
def SetEndCriteria(self, val):
|
||||
""" SetEndCriteria(val)
|
||||
|
||||
Set the end critera value. E.g. 1e-6 for -60dB
|
||||
"""
|
||||
self.thisptr.SetEndCriteria(val)
|
||||
|
||||
def SetOverSampling(self, val):
|
||||
""" SetOverSampling(val)
|
||||
|
||||
Set the time domain signal oversampling as multiple of the Nyquist-rate.
|
||||
"""
|
||||
self.thisptr.SetOverSampling(val)
|
||||
|
||||
def SetCellConstantMaterial(self, val):
|
||||
""" SetCellConstantMaterial(val)
|
||||
|
||||
Set cell material averaging to assume constant material inside each primary cell. (Advanced option)
|
||||
|
||||
:param val: bool -- Enable or Disable (default disabled)
|
||||
"""
|
||||
self.thisptr.SetCellConstantMaterial(val)
|
||||
|
||||
def SetCoordSystem(self, val):
|
||||
""" SetCoordSystem(val)
|
||||
|
||||
Set the coordinate system. 0 --> Cartesian (default), 1 --> cylindrical
|
||||
"""
|
||||
assert (val==0 or val==1), 'SetCoordSystem: Invalid coordinate system'
|
||||
if val==0:
|
||||
pass
|
||||
self.thisptr.SetCylinderCoords(False)
|
||||
elif val==1:
|
||||
self.SetCylinderCoords()
|
||||
self.thisptr.SetCylinderCoords(True)
|
||||
|
||||
def SetCylinderCoords(self):
|
||||
""" SetCylinderCoords()
|
||||
|
||||
Enable use of cylindircal coordinates.
|
||||
"""
|
||||
self.thisptr.SetCylinderCoords(True)
|
||||
|
||||
def SetTimeStepMethod(self, val):
|
||||
""" SetTimeStepMethod(val)
|
||||
|
||||
Set the time step calculation method. (Advanced option)
|
||||
|
||||
Options:
|
||||
|
||||
* 1: CFL criteria
|
||||
* 3: Advanced Rennings criteria (default)
|
||||
|
||||
:param val: int -- 1 or 3 (See above)
|
||||
"""
|
||||
self.thisptr.SetTimeStepMethod(val)
|
||||
|
||||
def SetTimeStep(self, val):
|
||||
""" SetTimeStep(val)
|
||||
|
||||
Set/force the timestep. (Advanced option)
|
||||
|
||||
It is highly recommended to not use this method! You may use the
|
||||
SetTimeStepFactor instead to reduce the time step if necessary!
|
||||
"""
|
||||
self.thisptr.SetTimeStep(val)
|
||||
|
||||
def SetTimeStepFactor(self, val):
|
||||
""" SetTimeStepFactor(val)
|
||||
|
||||
Set a time step factor (>0..1) to increase FDTD stability.
|
||||
|
||||
:param val: float -- >0..1
|
||||
"""
|
||||
self.thisptr.SetTimeStepFactor(val)
|
||||
|
||||
def SetMaxTime(self, val):
|
||||
""" SetMaxTime(val)
|
||||
|
||||
Set max simulation time for a max. number of timesteps.
|
||||
"""
|
||||
self.thisptr.SetMaxTime(val)
|
||||
|
||||
def SetGaussExcite(self, f0, fc):
|
||||
""" SetGaussExcite(f0, fc)
|
||||
|
||||
Set a Gaussian pulse as excitation signal.
|
||||
|
||||
:param f0: float -- Center frequency in Hz.
|
||||
:param fc: float -- -20dB bandwidth in Hz.
|
||||
"""
|
||||
self.thisptr.SetGaussExcite(f0, fc)
|
||||
|
||||
|
||||
def SetBoundaryCond(self, BC):
|
||||
""" SetBoundaryCond(BC)
|
||||
|
||||
Set the boundary conditions for all six FDTD directions.
|
||||
|
||||
Options:
|
||||
|
||||
* 0 or 'PEC' : perfect electric conductor (default)
|
||||
* 1 or 'PMC' : perfect magnetic conductor, useful for symmetries
|
||||
* 2 or 'MUR' : simple MUR absorbing boundary conditions
|
||||
* 3 or 'PML-8' : PML absorbing boundary conditions
|
||||
|
||||
:param BC: (8,) array or list -- see options above
|
||||
"""
|
||||
assert len(BC)==6
|
||||
for n in range(len(BC)):
|
||||
@ -148,26 +212,57 @@ cdef class openEMS:
|
||||
|
||||
def AddLumpedPort(self, port_nr, R, start, stop, p_dir, excite=0, **kw):
|
||||
""" AddLumpedPort(port_nr, R, start, stop, p_dir, excite=0, **kw)
|
||||
|
||||
Add a lumped port wit the given values and location.
|
||||
|
||||
See Also
|
||||
--------
|
||||
openEMS.ports.LumpedPort
|
||||
"""
|
||||
assert self.CSX is not None, 'AddLumpedPort: CSX is not set!'
|
||||
return ports.LumpedPort(self.CSX, port_nr, R, start, stop, p_dir, excite, **kw)
|
||||
assert self.__CSX is not None, 'AddLumpedPort: CSX is not set!'
|
||||
return ports.LumpedPort(self.__CSX, port_nr, R, start, stop, p_dir, excite, **kw)
|
||||
|
||||
def AddRectWaveGuidePort(self, port_nr, start, stop, p_dir, a, b, mode_name, excite=0, **kw):
|
||||
""" AddRectWaveGuidePort(port_nr, start, stop, p_dir, a, b, mode_name, excite=0, **kw)
|
||||
|
||||
Add a rectilinear waveguide port.
|
||||
|
||||
See Also
|
||||
--------
|
||||
openEMS.ports.RectWGPort
|
||||
"""
|
||||
assert self.CSX is not None, 'AddRectWaveGuidePort: CSX is not set!'
|
||||
return ports.RectWGPort(self.CSX, port_nr, start, stop, p_dir, a, b, mode_name, excite, **kw)
|
||||
assert self.__CSX is not None, 'AddRectWaveGuidePort: CSX is not set!'
|
||||
return ports.RectWGPort(self.__CSX, port_nr, start, stop, p_dir, a, b, mode_name, excite, **kw)
|
||||
|
||||
def AddMSLPort(self, port_nr, metal_prop, start, stop, prop_dir, exc_dir, excite=0, **kw):
|
||||
""" AddMSLPort(port_nr, metal_prop, start, stop, prop_dir, exc_dir, excite=0, **kw)
|
||||
|
||||
Add a microstrip transmission line port.
|
||||
|
||||
See Also
|
||||
--------
|
||||
openEMS.ports.MSLPort
|
||||
"""
|
||||
assert self.CSX is not None, 'AddMSLPort: CSX is not set!'
|
||||
return ports.MSLPort(self.CSX, port_nr, metal_prop, start, stop, prop_dir, exc_dir, excite, **kw)
|
||||
assert self.__CSX is not None, 'AddMSLPort: CSX is not set!'
|
||||
return ports.MSLPort(self.__CSX, port_nr, metal_prop, start, stop, prop_dir, exc_dir, excite, **kw)
|
||||
|
||||
def CreateNF2FFBox(self, name='nf2ff', start=None, stop=None, **kw):
|
||||
""" CreateNF2FFBox(name='nf2ff', start=None, stop=None, **kw)
|
||||
|
||||
Create a near-field to far-field box.
|
||||
|
||||
This method will automatically adept the recording box to the current
|
||||
FDTD grid and boundary conditions.
|
||||
|
||||
Notes
|
||||
-----
|
||||
* Make sure the mesh grid and all boundary conditions are finially defined.
|
||||
|
||||
See Also
|
||||
--------
|
||||
openEMS.nf2ff.nf2ff
|
||||
"""
|
||||
assert self.CSX is not None, 'CreateNF2FFBox: CSX is not set!'
|
||||
assert self.__CSX is not None, 'CreateNF2FFBox: CSX is not set!'
|
||||
directions = [True]*6
|
||||
mirror = [0]*6
|
||||
BC_size = [0]*6
|
||||
@ -186,7 +281,7 @@ cdef class openEMS:
|
||||
BC_size[n] = self.thisptr.Get_PML_Size(n)+1
|
||||
|
||||
if start is None or stop is None:
|
||||
grid = self.CSX.GetGrid()
|
||||
grid = self.__CSX.GetGrid()
|
||||
assert grid.IsValid(), 'Error::CreateNF2FFBox: Grid is invalid'
|
||||
start = np.zeros(3)
|
||||
stop = np.zeros(3)
|
||||
@ -196,16 +291,29 @@ cdef class openEMS:
|
||||
assert len(l)>(BC_size[2*n]+BC_size[2*n+1]), 'Error::CreateNF2FFBox: not enough lines in some direction'
|
||||
start[n] = l[BC_size[2*n]]
|
||||
stop[n] = l[-1*BC_size[2*n+1]-1]
|
||||
return nf2ff.nf2ff(self.CSX, name, start, stop, directions=directions, mirror=mirror, **kw)
|
||||
return nf2ff.nf2ff(self.__CSX, name, start, stop, directions=directions, mirror=mirror, **kw)
|
||||
|
||||
def SetCSX(self, ContinuousStructure CSX):
|
||||
""" SetCSX(CSX)
|
||||
|
||||
Set the CSXCAD Continuous Structure for CAD data handling.
|
||||
|
||||
See Also
|
||||
--------
|
||||
CSXCAD.CSXCAD.ContinuousStructure
|
||||
"""
|
||||
self.CSX = CSX
|
||||
self.__CSX = CSX
|
||||
self.thisptr.SetCSX(CSX.thisptr)
|
||||
|
||||
def Run(self, sim_path, cleanup=False, setup_only=False, verbose=None):
|
||||
""" Run(sim_path, cleanup=False, setup_only=False, verbose=None)
|
||||
|
||||
Run the openEMS FDTD simulation.
|
||||
|
||||
:param sim_path: str -- path to run in and create result data
|
||||
:param cleanup: bool -- remove exisiting sim_path to cleanup old results
|
||||
:param setup_only: bool -- only perform FDTD setup, do not run simulation
|
||||
:param verbose: int -- set the openEMS verbosity level 0..3
|
||||
"""
|
||||
if cleanup and os.path.exists(sim_path):
|
||||
shutil.rmtree(sim_path)
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Fri Dec 18 20:58:01 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Thu Dec 17 22:53:39 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
@ -108,8 +119,17 @@ class Port:
|
||||
# accepted power (incoming - reflected)
|
||||
self.P_acc = 0.5*np.real(self.uf_tot*np.conj(self.if_tot))
|
||||
|
||||
# Lumped-Port
|
||||
class LumpedPort(Port):
|
||||
"""
|
||||
The lumped port.
|
||||
|
||||
:param CSX: Continuous Structure
|
||||
:param port_nr: int -- port number
|
||||
:param R: float -- port reference impedance, e.g. 50 (Ohms)
|
||||
:param start, stop: (3,) array -- Start/Stop box coordinates
|
||||
:param p_dir: int -- port direction
|
||||
:param excite: float -- port excitation amplitude
|
||||
"""
|
||||
def __init__(self, CSX, port_nr, R, start, stop, exc_dir, excite=0, **kw):
|
||||
super(LumpedPort, self).__init__(CSX, port_nr=port_nr, start=start, stop=stop, excite=excite, **kw)
|
||||
self.R = R
|
||||
|
@ -1,9 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Fri Dec 18 19:21:19 2015
|
||||
|
||||
@author: thorsten
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2015,20016 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user