OPICS Quickstart
Installing OPICS
Installing from pypi
The easiest way to install OPICS is using pip pypi:
pip install opics
Installing from source
Download the OPICS source code.
git clone https://github.com/jaspreetj/opics
Install the OPICS package using pip.
pip install -e ./opics
Once the package is installed, it can be imported using:
import opics as op
OPICS Libraries
Listing available libraries
The package does not come with any component libraries pre-installed. You can select and download available libraries from the library catalogue.
library_catalogue = op.libraries.library_catalogue
print(f"Available Libraries: {[_ for _ in library_catalogue.keys()]} ")
Downloading libraries
The OPICS libraries are downloaded by passing in library_name, library_url, and library_path to the libraries.download_library module. The module returns True if the library is downloaded successfully.
import os
installation_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop\\delete')
op.libraries.download_library("ebeam", installation_path)
# reload libraries
import importlib
importlib.reload(op.libraries)
List installed libraries
op.libraries.installed_libraries
List library components
op.libraries.ebeam.components_list
Remove libraries
Any of the installed libraries can be removed using the libraries.remove_library module.
op.libraries.remove_library("ebeam")
importlib.reload(op.libraries)
print(op.libraries.installed_libraries)
#reinstall ebeam library
op.libraries.download_library(
library_name="ebeam",
library_path=installation_path,
)
importlib.reload(op.libraries)
print(op.libraries.installed_libraries)
Library components
Let’s take a look at the library components.
ebeam_lib = op.libraries.ebeam
Listing library components
ebeam_lib.components_list
Let’s take a look inside a component for more information on its parameters and layout, such as port locations.
ebeam_lib.BDC?
Setting up a simulation
The network module is used to define a circuit, add and connect components. The network module takes network_id and f as inputs. If no f or frequency data points specified, the network module uses the default value specified in opics.globals.F.
from opics import Network
from opics.globals import C
import numpy as np
freq = np.linspace(C * 1e6 / 1.5, C * 1e6 / 1.6, 2000)
circuit = Network(network_id="circuit_name", f=freq)
Once an empty network is defined. We can start by adding components.
input_gc = circuit.add_component(ebeam_lib.GC)
y = circuit.add_component(ebeam_lib.Y)
wg2 = circuit.add_component(ebeam_lib.Waveguide, params=dict(length=0e-6))
wg1 = circuit.add_component(ebeam_lib.Waveguide, params={"length":15e-6})
y2 = circuit.add_component(ebeam_lib.Y)
output_gc = circuit.add_component(ebeam_lib.GC)
We can also define custom port names for components for easy reference.
input_gc.set_port_reference(0, "input_port")
output_gc.set_port_reference(0, "output_port")
Connect components using the Network.connect module.
circuit.connect(input_gc, 1, y, 0)
circuit.connect(y, 1, wg1, 0)
circuit.connect(y, 2, wg2, 0)
circuit.connect(y2, 0, output_gc, 1)
circuit.connect(wg1, 1, y2, 1)
circuit.connect(wg2, 1, y2, 2)
Simulate the network/circuit
circuit.simulate_network()
Plot the simulated response
circuit.sim_result.plot_sparameters(show_freq=False)
An interactive plot can be spawned by enabling the interactive option.
circuit.sim_result.plot_sparameters(show_freq=False, interactive=True)
Metadata
Release files for opics 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opics-0.3.3.tar.gz | 24.7 kB | Without provenance | Details for opics-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opics-0.3.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for opics-0.3.3-py2.py3-none-any.whl |
Total release size: 50.4 kB
Release files / opics-0.3.3.tar.gz
| Download URL | opics-0.3.3.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03ff5a12716811b50fdb85b2692f21d647c02e06fd3b5cd539aef54e3d0d1972
|
|
BLAKE2b-256 checksum How to use checksums |
706a832e5de89eb07f86dc0cfa31d275f11d339515873ac8dfadb342c880ca97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.59.0 importlib-metadata/4.11.2 keyring/22.3.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.8
|
Release files / opics-0.3.3-py2.py3-none-any.whl
| Download URL | opics-0.3.3-py2.py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a5c9becfd6f3c7a45319432d177f62eacd61a9a0cee053eba62dfb7805e33359
|
|
BLAKE2b-256 checksum How to use checksums |
b31e152ba2d04cf0efd2979a01e010232f65c9d94e3e0d9c9f32f46de029f755
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.59.0 importlib-metadata/4.11.2 keyring/22.3.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.8
|
Security for opics 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.