Quick start#
Where scripts run#
| Where | Command | Notes |
|---|---|---|
| Terminal | te10 run script.py [args...] |
Uses TE10's own Python, with the API and solver ready. sys.argv holds the args |
| In the app | Tools › Run Script... | prj is the open project; changes can be undone |
| In the app | Tools › Python Console | Line by line; prj, em (the API) and app are defined |
| Your own Python | python script.py |
Only with the te10_studio package installed in that Python |
Importing te10_studio.api never loads the app's window, so scripts run on servers without a display.
License: release builds need an active license to edit, mesh, solve or submit, from the app or from
scripts. Enter the key once per computer (te10 account activate <key>, or Help › Account... in the
app). Without one, scripts can still open projects and read results. Jobs running on clusters or cloud
machines don't check a license.
Your first script#
Save this as wr90.py and run te10 run wr90.py:
"""WR-90 waveguide, 8-12 GHz: S-parameters to a Touchstone file."""
from te10_studio import api as em
prj = em.Project("wr90", units="mm") # numbers below are mm
prj.variables["L"] = "50mm" # a design variable
# A box of air; its outer faces are metal (PEC) unless something else is assigned.
air = prj.modeler.box("Air", size=(22.86, 10.16, "L"), origin=(-11.43, -5.08, 0))
# A wave port on each end face.
prj.excitations.wave_port("P1", air.face("-z"))
prj.excitations.wave_port("P2", air.face("+z"))
# A driven setup: 8 to 12 GHz in 0.5 GHz steps (numbers are GHz).
setup = prj.setups.driven("S1", start=8, stop=12, step=0.5)
print(prj.validate()) # [] when the model is ready
result = setup.solve(cores=4) # meshes, solves, waits
sp = result.s_parameters()
print(sp.frequencies_ghz) # numpy array, GHz
print(sp.get_db(2, 1)) # |S21| in dB at each frequency
result.write_touchstone("wr90.s2p")
prj.save("wr90.te10") # open it in the app afterwards
The objects#
Project em.Project(...), em.Project.open(path)
├── variables design variables and datasets
├── materials the project's materials
├── modeler creates Objects; looks them up by name
│ └── Object a solid, sheet or curve: faces, edits, booleans
├── boundaries PEC, PMC, radiation, conductivity, impedance, periodic
├── excitations wave, lumped, discrete and Floquet ports; plane waves
├── mesh mesh rules
├── setups driven and eigenmode setups
│ └── Setup .solve() -> Result, .submit() -> Job
├── picks, wcs picked points/edges/faces, the working coordinate system
└── jobs() saved jobs (from scripts and the app)
Result S-parameters, scikit-rf network, fields, far field, RCS, eigenmodes
Job status(), wait(), logs(), cancel(), results()
Rules every script follows#
- Lengths are in the project's units when given as plain numbers (
units="mm"by default). A string carries its own unit:"3mm","120mil","0.5in","25um". See Values and units. - Frequencies are GHz when given as plain numbers; strings carry units (
"2.4GHz","800MHz"). - Expressions of design variables (
"w/2 + 1mm") keep the geometry linked: changing the variable rebuilds it. - Names of objects, ports, boundaries and setups are unique in a project and are how you look things
up:
prj.modeler["Air"],prj.setups["S1"]. - Faces are chosen by side (
obj.face("+z")), by a nearby point, or by index. Assigned faces follow their object when the geometry is rebuilt. - Any outer face with nothing assigned is PEC. Open space needs a radiation boundary (or an air box with one).
- Every port is excited unless you pass
active=False; one solve per port gives the full S-matrix. - Results are SI except where a name says otherwise:
frequencies_ghzis GHz,get_dbis dB,get_phase_degis degrees. - Methods that change the model return the changed object, so calls can be chained:
prj.modeler.box(...).move((0, 0, 1)).rotate("z", 45). - Only names in
te10_studio.api(and the documented post-processing modules) are stable.prj.coreand other internal modules may change between versions.
Next#
- Project: create, open, save, variables, validation.
- Modeler: geometry.
- Setups and solving: sweeps, solving here, on clusters and in the cloud.
- Results: S-parameters, fields, far fields.
- Examples: complete scripts.