Skip to content

Commit 0136d37

Browse files
authored
Merge pull request #6 from sequoiap/scripted-component-models
Simphony rebuild to enable scripting component models
2 parents dab84e4 + c068ed5 commit 0136d37

File tree

94 files changed

+18340
-1639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+18340
-1639
lines changed

README.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
# Simphony
22
A Simulator for Photonic circuits
33

4+
![Text](./docs/source/_static/images/simphony_logo.jpg)
5+
46
Authors: [Sequoia Ploeg](https://github.com/sequoiap),
57
[Hyrum Gunther](https://github.com/rumbonium/)
68

79
Developed by [CamachoLab](https://camacholab.byu.edu/) at
810
[Brigham Young University](https://www.byu.edu/).
911

12+
# About this branch
13+
14+
Previous development branches required the component models (from which instances
15+
are created) to be instantiated first. This attempt tries to keep them as simple
16+
classes, removing the requirement to instantiate. It also tries to keep the
17+
s-parameters with the classes, without so many file i/o and parsing algorithms.
18+
19+
# Description
20+
1021
This package is still under development. It initially began as an extension to
1122
[SiEPIC-Tools](https://github.com/lukasc-ubc/SiEPIC-Tools), but was ported here
1223
once it became large enough to be considered its own stand-alone project. There
13-
is a repository, [SiEPIC-Simphony](https://github.com/sequoiap/SiEPIC-Simphony),
24+
is a repository forked from lukasc-ubc/SiEPIC-Tools,
25+
[SiEPIC-Tools](https://github.com/sequoiap/SiEPIC-Tools),
1426
that integrates Simphony with SiEPIC-Tools and KLayout in order to perform
1527
photonic circuit simulations using a layout-driven design methodology.
1628

@@ -26,7 +38,7 @@ Python 2 (January 1, 2020), no future compatability is planned.
2638
## Documentation
2739

2840
Documentation is built on Sphinx. They can be built using the default files by
29-
navigation to the docs directory and running:
41+
navigating to the docs directory and running:
3042

3143
```
3244
make html
@@ -36,9 +48,9 @@ The docs are written in reST. There is a nice syntax guide with guidelines that
3648
we follow in the documentation
3749
[here](https://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html). The
3850
majority of the documentation is generated from python docstrings written using
39-
NumPy documentation format.
51+
the NumPy documentation format.
4052

41-
The changelogs can be found in docs/changelog/. There is a changelog file for
53+
Changelogs can be found in docs/changelog/. There is a changelog file for
4254
each released version of the software.
4355

4456
## Tests
@@ -55,7 +67,7 @@ from the toplevel directory.
5567
## Developers
5668

5769
This package is available on PyPI and updates are regularly pushed as "minor"
58-
or "micro" versions. Before submitting any pull requests, however, you should
70+
or "micro" (patch) versions. Before submitting any pull requests, however, you should
5971
ensure that a pip installation of your updated package installs and functions
6072
properly. To test this, try installing your package locally by removing all
6173
installed versions of Simphony (by running ```pip uninstall simphony```
@@ -83,16 +95,17 @@ is released on PyPI, the package should have a pull request opened to its
8395
corresponding release branch (release-MAJOR.MINOR.x). The hierarchy is then
8496
as follows:
8597

86-
- release.* (stable branch)
98+
- release-*.*.x (stable branch)
8799
- master (integration and final testing)
88100
- feature-name (feature development and bug fixes)
89101

90102
Even if you are the lone developer, we follow the methodology [here](https://softwareengineering.stackexchange.com/a/294048).
91103

92104
Be sure to update the version number manually before pushing each new version
93105
to PyPI. Also be sure to amend the changelog. Versions can be pushed to PyPI
94-
using the command:
106+
using the commands:
95107

96108
```
109+
python3 setup.py sdist bdist_wheel
97110
python3 -m twine upload dist/*
98111
```

demo/demo.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import simphony
2-
import matplotlib.pyplot as plt
1+
# import simphony
2+
# import matplotlib.pyplot as plt
33

4-
model = simphony.netlist.ObjectModelNetlist.load('demo/output.json')
5-
sim = simphony.simulation.Simulation(model)
4+
# model = simphony.netlist.ObjectModelNetlist.load('demo/output.json')
5+
# sim = simphony.simulation.Simulation(model)
66

7-
x, y = sim.getMagnitudeByFrequencyTHz(2, 3)
8-
plt.plot(x, y)
9-
plt.show()
7+
# x, y = sim.getMagnitudeByFrequencyTHz(2, 3)
8+
# plt.plot(x, y)
9+
# plt.show()
1010

11-
multi = simphony.simulation.MultiInputSimulation(model)
12-
multi.multi_input_simulation(inputs=[2])
11+
# multi = simphony.simulation.MultiInputSimulation(model)
12+
# multi.multi_input_simulation(inputs=[2])
13+
14+
import simphony.core as core
15+
16+
ring_resonator = core.Component("ring_resonator_radius_5", [1500,1550,1600], [0,0,0], True)
17+
waveguide = core.Component("waveguide_length_10", [1500,1550,1600], [0,0,0], False)

docs/changelog/0.1.5-changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## [0.1.5] - 2019-06-2 (Scheduled)
1+
## [0.1.5] - 2019-06-2
22

33
### Added
44
- Waveguide parameters now calculated based off new regression model provided by Easton Potokar.

docs/changelog/0.2.0-changelog.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## [0.2.0] - 2019-08-7
2+
3+
Due to a complete code overhaul, this version is incompatible with previous
4+
versions of Simphony. Typically, when a release is incompatible, the MAJOR
5+
version number is bumped. However, since this software is still in the first
6+
stages of development, bumping the MINOR version symbolizes major changes
7+
until the version 1 is officially released.
8+
9+
### Added
10+
- Since we only need two of the 'connect' algorithms from scikit-rf, they were
11+
brought over into this library to reduce the number of dependencies.
12+
- Added test cases using the pytest framework
13+
- Models are now cached during simulation to avoid repeating calculations
14+
- Logging is now the method of choice for getting info messages from the program
15+
- Simulation runtime is now logged at the INFO level
16+
- Documentation! Built using Sphinx.
17+
18+
### Changed
19+
- Simphony is now segmented into three modules: core, simulation, and DeviceLibrary
20+
- New component implementation methods (simphony.core.base.ComponentModel)
21+
- Rebuilt device library to match new component implementations
22+
- Device library no long reads data files for s-parameters, as they've been
23+
converted and are now stored as .npz files.
24+
- [#6](https://github.com/sequoiap/simphony/pull/6): ENHANCEMENT: Framework
25+
rebuild, allows for easier implementation of custom component models and
26+
libraries.
27+
28+
### Removed
29+
- Dependencies on scikit-rf, jsons, and matplotlib have been removed.
30+
- Netlist export functionality no longer exists since netlists can be
31+
scripted in Python.
172 KB
Loading

docs/source/architecture.rst

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
####################
2+
Program Architecture
3+
####################
4+
5+
**********************************
6+
Components (and Simulation Models)
7+
**********************************
8+
9+
Simphony attempts to be as agnostic as possible in the implementation of
10+
optical components. This allows for greater flexibility and extensibility.
11+
It is for this reason that Simphony separates the idea of a "component" and
12+
a "simulation model," sometimes simply called a "model."
13+
14+
Components
15+
==========
16+
17+
A "Component" represents some discrete component that exists in a layout.
18+
If we consider it from the layout driven design methodology's perspective,
19+
a component is an object such as a y-branch or a bidirectional coupler that
20+
has already been designed and simulated on its own. It has a definite shape
21+
and predefined characteristics that allow it to be simply dropped into
22+
a layout and operate in a predictable fashion.
23+
24+
Simphony treats components as though they were physical objects stored in a
25+
library. In other words, it is expected that they will not change shape, that
26+
they have a pre-specified port numbering system, etc.
27+
28+
Simulation Models
29+
=================
30+
31+
Simphony does, however,
32+
separate the concept of a component and a simulation model. A single component
33+
may have several simulation models associated with it; this allows a single
34+
component to be simulated with different models; perhaps different fabs create
35+
the same component in different ways, leading to different results. Perhaps
36+
there exists a model with data points interpolated from test devices and another
37+
model based on a neural net. To Simphony, it doesn't matter.
38+
39+
Simulation Models ought to have a nested class called Metadata. It should, at
40+
a minimum, contain the following fields:
41+
- simulation_models
42+
- ports
43+
44+
It has the following format:
45+
46+
class Metadata:
47+
simulation_models = [
48+
('containing_module', 'simulation_class_name', 'human_readable_name'),
49+
...
50+
]
51+
ports = [INT]
52+
53+
********
54+
Elements
55+
********
56+
57+
Now that we understand what Components and Models are, "elements" are Simphony's
58+
default implementation of some commonly used components. These models are taken
59+
from SiEPIC's `EBeam PDK <https://github.com/lukasc-ubc/SiEPIC_EBeam_PDK>`_.
60+
61+
New elements can be created and loaded programatically into Simphony. These settings,
62+
however, are not persistent, and should be loaded each time Simphony is imported.
63+
Since element names are required to be unique, you might consider creating a library
64+
of elements with a prefix to the component name (e.g. in 'ebeam_bdc_te1550', 'ebeam'
65+
prefixes what the component actually is).
66+
67+
Design Pattern
68+
==============
69+
70+
Each element is contained within its own Python module (i.e. in a folder). The
71+
folder bears the component's name. Within the folder is an empty '__init__.py'
72+
file, a 'models.py' file where simulation models are defined, and a 'component.py'
73+
file that describes the physical features of the component.
74+
75+
********
76+
Netlists
77+
********
78+
79+
**********
80+
Simulators
81+
**********
82+
83+
Single Port Simulator
84+
=====================
85+
86+
Multi Port Simulator
87+
====================
88+
89+
Monte Carlo Simulator
90+
=====================

docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
# The theme to use for HTML and HTML Help pages. See the documentation for
108108
# a list of builtin themes.
109109
#
110-
# html_theme = 'sphinxdoc'
111-
html_theme = 'sphinx_rtd_theme'
110+
html_theme = 'sphinxdoc'
111+
# html_theme = 'sphinx_rtd_theme'
112112

113113
# Theme options are theme-specific and customize the look and feel of a theme
114114
# further. For a list of options available for each theme, see the

docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Welcome to Simphony's documentation!
1212

1313
reference
1414
components
15-
15+
architecture
1616

1717
Indices and tables
1818
==================

docs/source/modules.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
simphony
2+
========
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
simphony

docs/source/reference.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1+
.. H1
2+
13
###
24
API
35
###
46

7+
.. H2
8+
59
*******
610
Netlist
711
*******
812

13+
.. H3
14+
915
ObjectModelNetlist
1016
==================
1117

12-
.. autoclass:: simphony.netlist.ObjectModelNetlist
18+
.. automodule:: simphony
19+
:members:
20+
:inherited-members:
21+
:show-inheritance:
22+
23+
.. automodule:: simphony.core
24+
:members:
25+
:inherited-members:
26+
:show-inheritance:
27+
28+
.. automodule:: simphony.simulation
1329
:members:
1430
:inherited-members:
1531
:show-inheritance:
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
simphony.DeviceLibrary.ann package
2+
==================================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: simphony.DeviceLibrary.ann
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
simphony.DeviceLibrary.ebeam package
2+
====================================
3+
4+
Module contents
5+
---------------
6+
7+
.. automodule:: simphony.DeviceLibrary.ebeam
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
simphony.DeviceLibrary package
2+
==============================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
9+
simphony.DeviceLibrary.ann
10+
simphony.DeviceLibrary.ebeam
11+
12+
Module contents
13+
---------------
14+
15+
.. automodule:: simphony.DeviceLibrary
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:

docs/source/simphony.core.rst

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
simphony.core package
2+
=====================
3+
4+
Submodules
5+
----------
6+
7+
simphony.core.base module
8+
-------------------------
9+
10+
.. automodule:: simphony.core.base
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
simphony.core.connect module
15+
----------------------------
16+
17+
.. automodule:: simphony.core.connect
18+
:members:
19+
:undoc-members:
20+
:show-inheritance:
21+
simphony.core.netlist module
22+
----------------------------
23+
24+
.. automodule:: simphony.core.netlist
25+
:members:
26+
:undoc-members:
27+
:show-inheritance:
28+
29+
30+
Module contents
31+
---------------
32+
33+
.. automodule:: simphony.core
34+
:members:
35+
:undoc-members:
36+
:show-inheritance:

0 commit comments

Comments
 (0)