# TE10 Studio documentation # 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 `, 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`: ```python """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 ```text 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 1. **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](/docs/api/values-units). 2. **Frequencies** are GHz when given as plain numbers; strings carry units (`"2.4GHz"`, `"800MHz"`). 3. **Expressions** of design variables (`"w/2 + 1mm"`) keep the geometry linked: changing the variable rebuilds it. 4. **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"]`. 5. **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. 6. **Any outer face with nothing assigned is PEC.** Open space needs a radiation boundary (or an air box with one). 7. **Every port is excited** unless you pass `active=False`; one solve per port gives the full S-matrix. 8. **Results are SI** except where a name says otherwise: `frequencies_ghz` is GHz, `get_db` is dB, `get_phase_deg` is degrees. 9. Methods that change the model return the changed object, so calls can be chained: `prj.modeler.box(...).move((0, 0, 1)).rotate("z", 45)`. 10. Only names in `te10_studio.api` (and the documented post-processing modules) are stable. `prj.core` and other internal modules may change between versions. ## Next - [Project](/docs/api/project): create, open, save, variables, validation. - [Modeler](/docs/api/modeler): geometry. - [Setups and solving](/docs/api/setups-solving): sweeps, solving here, on clusters and in the cloud. - [Results](/docs/api/results): S-parameters, fields, far fields. - [Examples](/docs/api/examples): complete scripts. --- # Values and units ## Input values Every length, frequency, angle or count parameter accepts a number or a string. | You pass | Read as | |---|---| | `3` or `3.0` (a length) | 3 in the project's unit (`em.Project(..., units="mm")`) | | `"3"` (a length) | the same as `3` | | `"3mm"`, `"120mil"`, `"0.5in"`, `"25um"`, `"1.2cm"`, `"0.002m"`, `"500nm"` | that length in its own unit | | `3` (a frequency) | 3 GHz | | `"2.4GHz"`, `"800MHz"`, `"50kHz"`, `"1e9Hz"` | that frequency | | `"w/2 + 1mm"` | an expression of design variables, evaluated in SI | | `45` (an angle) | 45 degrees | Length units: `m`, `cm`, `mm`, `um`, `nm`, `in`, `mil`. ### Expressions Expressions are evaluated in SI (metres, hertz), so **give units on the numbers inside them**: `"w/2 + 1mm"`, not `"w/2 + 1"` (which would add 1 metre). Variables hold SI values: ```python prj.variables["w"] = "3mm" prj.variables["w"] # 0.003 (metres) prj.variables.expression("w") # "3mm" ``` Expressions may use `+ - * / **`, parentheses, comparisons, the functions `sin cos tan asin acos atan atan2 sinh cosh tanh sqrt log log10 exp abs min max floor ceil`, the constants `pi` and `e`, `if(condition, a, b)`, and `pwl(dataset, x)` for [datasets](/docs/api/project#variables). Trigonometric functions take radians. A value given as an expression stays **linked**: when a variable it uses changes, every object built from it is rebuilt, and ports and boundaries on its faces follow. ```python prj.variables["L"] = "50mm" air = prj.modeler.box("Air", size=(22.86, 10.16, "L")) prj.variables["L"] = "60mm" # the box is now 60 mm long ``` ## Output values | Returned by | Unit | |---|---| | `prj.variables[name]` | SI (metres, hertz, plain numbers) | | `Object.bounding_box()` | project units | | `Object.volume`, `Object.area` | project units cubed / squared | | `FaceRef.centroid`, `FaceRef.area` | metres, m² (a face reference's own fields) | | `Object.shape` | a build123d shape in metres | | `prj.picks.distance()` | project units | | `SParameterResult.frequencies_ghz` | GHz | | `SParameterResult.get_db(i, j)` / `get_phase_deg(i, j)` | dB / degrees | | `Result.network()` | scikit-rf `Network` (frequencies in Hz inside) | | `Result.eigenmodes()` | `[(frequency_GHz, Q), ...]` | | `te10_studio.postprocess.networks` functions | `f_GHz`, `t_ns`, ohms, as named | | RF tool functions (`te10_studio.rftools`) | SI: metres, hertz, ohms | --- # Project ```python from te10_studio import api as em ``` ## Creating and opening ### `em.Project(name="Project", units="mm")` A new, empty project. `units` is the length unit for plain numbers: `"m"`, `"cm"`, `"mm"`, `"um"`, `"nm"`, `"in"` or `"mil"`. ### `em.Project.open(path) -> Project` Opens a `.te10` file (older `.openem` / `.emfem` / `.te10json` files open too). Its results folder (`.te10results/`) is found beside it. ### `em.Project.from_palace(config_path, name=None) -> Project` Builds a project from a Palace configuration file (`.json`) and its mesh: the mesh becomes geometry, with materials, boundaries, lumped ports (multi-element too), wave ports and the solver setup. `prj.import_notes` lists what wasn't carried over (post-processing blocks, periodic and Floquet boundaries...). Faces Palace leaves unassigned get a PMC boundary, Palace's default. TE10 meshes the model again, so results match Palace's to mesh accuracy. ### `em.Project.attach(core, on_change=None) -> Project` Wraps a project that is open in the app. The Python Console's `prj` is made this way; you rarely need it. ## Saving and checking ### `prj.save(path) -> str` Saves the project as a `.te10` file (JSON) and returns the path. Later solves keep their results in `.te10results/` beside it. ### `prj.validate() -> list[str]` The validation errors that would stop a solve, each as `"Category: message"` (for example `"Boundaries: No port excitations defined in project."`). An empty list means the model is ready. ```python problems = prj.validate() if problems: raise SystemExit("\n".join(problems)) ``` ## Attributes | Attribute | Type | | |---|---|---| | `prj.name` | `str` | The project name | | `prj.units` | `str` | The length unit for plain numbers | | `prj.variables` | `Variables` | [Design variables](#variables) | | `prj.materials` | `Materials` | [Materials](#materials) | | `prj.modeler` | `Modeler` | [Geometry](/docs/api/modeler) | | `prj.boundaries` | `Boundaries` | [Boundaries](/docs/api/excitations-boundaries#boundaries-prjboundaries) | | `prj.excitations` | `Excitations` | [Ports and sources](/docs/api/excitations-boundaries) | | `prj.mesh` | `MeshOperations` | [Mesh rules](/docs/api/mesh) | | `prj.setups` | `Setups` | [Solver setups](/docs/api/setups-solving) | | `prj.picks` | `Picks` | [Picks](/docs/api/modeler#picks) | | `prj.wcs` | `WCS` | [Working coordinate system](/docs/api/modeler#working-coordinate-system) | | `prj.compute` | `Compute` | Cluster profiles by name: `prj.compute.names()`, `prj.compute["big"]` | | `prj.overlap_rule` | `str`, settable | `"earlier"` (default) or `"later"`: see [Overlaps](/docs/api/modeler#overlaps) | | `prj.core` | internal | The internal project object. Not part of the stable API | ## Variables `prj.variables` holds design variables. Values are expressions with units; reading one gives its SI value. | Call | Does | |---|---| | `prj.variables["w"] = "3mm"` | Creates or changes a variable. Objects that use it are rebuilt | | `prj.variables["$h"] = "1.6mm"` | A **project** variable (name starts with `$`) | | `prj.variables["w"]` | The SI value: `0.003` | | `prj.variables.expression("w")` | The expression as typed: `"3mm"` | | `"w" in prj.variables` | Whether it exists | | `del prj.variables["w"]` | Removes it | | `prj.variables.items()` | `(name, expression)` pairs | | `prj.variables.dataset("er", [(1e9, 4.4), (10e9, 4.2)])` | A dataset of (x, y) points in SI, used in expressions as `pwl(er, x)` (piecewise linear) | ```python prj.variables["f0"] = "2.4GHz" prj.variables["er"] = "4.4" prj.variables["lambda_g"] = "3e8 / (f0 * sqrt(er))" # metres ``` ## Materials `prj.materials` holds the project's materials. Names are not case-sensitive. Built-in materials include `vacuum`, `air`, `PEC`, `copper`, `aluminum`, `FR4`, `FR4_DjordjevicSarkar`, `Rogers_RO4350B`, `Teflon_PTFE`, `Alumina_99`, `Silicon`, `Sapphire`, `Quartz`, `LithiumNiobate`, `Niobium`, `Aluminum_Cryo` and `YBCO`. The [material library](/docs/api/rftools-materials#material-library) has about 2,400 more. ### `prj.materials.add(name, permittivity=1.0, permeability=1.0, conductivity=0.0, loss_tangent=0.0, is_pec=False, djordjevic_sarkar_at=None, ds_f_low=1e3, ds_f_high=1e12, ds_sigma_dc=0.0)` A new material. `conductivity` is in S/m. With `djordjevic_sarkar_at` (a frequency, e.g. `"1GHz"`), the material is frequency-dependent (Djordjevic–Sarkar wideband Debye model): `permittivity` and `loss_tangent` are its values at that frequency, `ds_f_low` / `ds_f_high` the model's corner frequencies in Hz and `ds_sigma_dc` its DC conductivity. Driven solves of such projects run in sub-bands. ```python prj.materials.add("Substrate", permittivity=3.66, loss_tangent=0.0037) prj.materials.add("FR4ds", permittivity=4.4, loss_tangent=0.02, djordjevic_sarkar_at="1GHz") ``` ### `prj.materials.set_roughness(name, model, radius=None, surface_ratio=None, area_ratio=1.0, rms=None)` Gives a metal surface roughness; every conductor surface made from it gets it. `model` is `"huray"` (nodule `radius`, `surface_ratio`, optional `area_ratio`), `"hammerstad"` or `"groisse"` (`rms`), or `None` for smooth. See [Surface roughness](/docs/app/roughness). ```python prj.materials.set_roughness("copper", "huray", radius="0.5um", surface_ratio=2.26) ``` ### Other members | Call | Returns | |---|---| | `prj.materials["copper"]` | The material (an internal `Material` with `permittivity`, `conductivity`, `loss_tangent`, ...) | | `prj.materials.names()` | `list[str]` | | `prj.materials.import_amat(path)` | Names added from an Ansys `.amat` library | | `prj.materials.export_amat(path, names=None)` | Names written | | `prj.materials.import_mtd(*paths)` | Names added from CST `.mtd` files | | `prj.materials.export_mtd(folder, names=None)` | Names written | ## Parametric sweeps ### `prj.sweep(values, setup=None, backend="local", cores=None, **resources) -> Job` Solves every combination of the given variable values as one job (an array job on a cluster), one result per variation. `values` maps variable names to lists of values (strings with units, or plain numbers, which get the project's length unit); `setup` is a setup name or `Setup` (default: the active setup). `backend` and `resources` are as for [`Setup.submit`](/docs/api/setups-solving#setupsubmit). ```python job = prj.sweep({"w": ["2mm", "3mm", "4mm"], "h": ["0.8mm", "1.6mm"]}, "S1", cores=4) job.wait() for res in job.results(): # 6 results print(res.variables, res.s_parameters().get_db(1, 1).min()) ``` ## Jobs ### `prj.jobs() -> list[Job]` Every job saved with the project, including ones started from the app. See [Jobs](/docs/api/setups-solving#jobs). --- # Modeler `prj.modeler` creates and finds objects. Each creating method returns an [`Object`](#object). Positions and sizes follow the [value rules](/docs/api/values-units): plain numbers are project units, strings carry units or are expressions. `material` is a material name (default `"vacuum"`); `priority` is the mesh priority where objects overlap (higher wins). ## Solids | Method | Shape | |---|---| | `box(name, size, origin=(0, 0, 0), material="vacuum", priority=0)` | `size = (dx, dy, dz)`; `origin` is the lowest corner | | `cylinder(name, radius, height, origin=(0, 0, 0), axis="z", material="vacuum", priority=0)` | Base circle centred at `origin`, along `axis` (`"x"`, `"y"`, `"z"`) | | `sphere(name, radius, center=(0, 0, 0), material="vacuum", priority=0)` | | | `cone(name, bottom_radius, top_radius, height, origin=(0, 0, 0), axis="z", material="vacuum", priority=0)` | Base centred at `origin`; `top_radius=0` for a point | | `torus(name, major_radius, minor_radius, center=(0, 0, 0), axis="z", material="vacuum", priority=0)` | A ring around `axis` | | `loft(name, profiles, ruled=False, material="vacuum", priority=0)` | A solid through sheets or closed curves, in order; `ruled=True` for straight sections | | `add(name, shape, material="vacuum", priority=0, kind=None)` | Any [build123d](https://build123d.readthedocs.io) shape, drawn in project units | ```python sub = prj.modeler.box("Substrate", size=(30, 20, 1.6), origin=(-15, -10, 0), material="FR4") via = prj.modeler.cylinder("Via", radius=0.15, height=1.6, origin=(5, 0, 0), material="copper", priority=1) ``` ## Sheets and curves | Method | Shape | |---|---| | `rectangle(name, size, origin=(0, 0, 0), plane="xy", material="vacuum")` | `size = (du, dv)` in `plane` (`"xy"`, `"yz"`, `"xz"`); `origin` is a corner | | `circle(name, radius, center=(0, 0, 0), plane="xy", material="vacuum")` | | | `polyline(name, points, closed=False, cover=False, material="vacuum")` | A curve through `points` (each `(x, y, z)`, may use variables); `cover=True` fills a closed one into a sheet | Sheets have `kind == "sheet"`, curves `kind == "wire"`. ## Imports | Method | Returns | |---|---| | `import_step(path, material=None, heal=True, unit="mm")` | `list[Object]`. STEP and IGES keep their own units; BREP and STL have none, so `unit` is used. Flat STL triangles are merged into faces | | `import_cad(path, material=None, heal=True, unit="mm")` | The same (any of `.step .stp .iges .igs .brep .brp .stl`) | | `import_gds(path, layers, cell=None, substrates=(("Silicon", "525um"),), vacuum_above="500um", vacuum_below=0, margin=0, min_edge="1um")` | `list[Object]` of a GDSII / OASIS chip (below) | | `import_mesh(path, unit="mm")` | `list[Object]`: a solid per region of a volume mesh (`.msh`, `.vtu`, Exodus, Nastran...), sheets for inner tagged surfaces, a named selection per tagged surface | ### `import_gds` layers `layers` maps a layer (`"L1/0"` or `(1, 0)`) to a dict: | Key | Values | Default | |---|---|---| | `role` | `"metal"`, `"solid"`, `"outline"`, `"ignore"` | | | `negative` | `True`: the polygons are gaps; metal = chip outline minus them | `False` | | `z` | height of the layer's bottom | `0` | | `thickness` | `0` makes a sheet | `0` | | `material` | material name | `"PEC"` | | `boundary` | for sheets: `"PEC"`, `"Conductivity"`, `"None"` | `"PEC"` | ```python objs = prj.modeler.import_gds("qubit.gds", { "1/0": {"role": "metal", "negative": True}, # ground plane with the circuit cut out "10/0": {"role": "outline"}, }, substrates=[("Silicon", "525um")], vacuum_above="500um") ``` ## Finding objects | Call | Returns | |---|---| | `prj.modeler["Trace"]` | The `Object` (also `"folder/sub:Trace"`) | | `"Trace" in prj.modeler` | `bool` | | `for obj in prj.modeler: ...` | Every object | | `prj.modeler.names()` | `list[str]` | ## Object | Property | Type | | |---|---|---| | `name` | `str`, settable | Renaming updates ports, boundaries and everything else that refers to it | | `kind` | `str` | `"solid"`, `"sheet"` or `"wire"` | | `material` | `str`, settable | Setting it resets `solve_inside` to the default | | `priority` | `int`, settable | Mesh priority where objects overlap | | `model` | `bool`, settable | `False` = construction geometry the solver doesn't see (a non-model solid can be a mesh refinement region) | | `solve_inside` | `bool` or `None`, settable | Whether the field is solved inside. Default (`None`): off for PEC and conductors (σ ≥ 1e5 S/m: a surface impedance on their faces instead), on for everything else | | `folder` | `str`, settable | The model folder, e.g. `"feed/connector"` (created if needed) | | `qualified_name` | `str` | `"feed/connector:pin"` | | `volume`, `area` | `float` | In project units³ / units² | | `history` | `list[str]` | The steps that built it, e.g. `['CreateBox [3 mmx2 mmx1.6 mm]']` | | `shape` | build123d shape | In metres | | Method | | |---|---| | `bounding_box()` | `((xmin, ymin, zmin), (xmax, ymax, zmax))` in project units | | `face(selector=None, nearest=None, index=None)` | One face: `face("+z")` (the face on the +z side), `face(nearest=(x, y, z))`, `face(index=i)` | | `faces(normal=None)` | All faces, or the planar faces whose normal points along an axis: `"x"` (both sides), `"+x"`, `"-y"`... | ### Edits Every edit changes the object in place and returns it, so calls chain. | Method | | |---|---| | `move(vector)` | Translate by `(dx, dy, dz)` | | `rotate(axis, angle_deg)` | About the global `"x"`, `"y"` or `"z"` axis, in degrees | | `mirror(origin, normal)` | Mirror in a plane | | `subtract(*tools, keep_tools=False)` | Cut the tools out | | `unite(*tools)` | Join the tools into this object | | `intersect(*tools)` | Keep the common volume | | `insert()` | Cut this solid out of every solid it overlaps; it stays whole. Returns the changed objects (a list) | | `shell(thickness, inside=True, open_faces=())` | Hollow it; `open_faces=[obj.face("+z")]` leaves faces open | | `delete()` | Remove it | Sheets and curves also have: | Method | | |---|---| | `sweep_along_vector(vector)` | Extrude | | `sweep_around_axis(axis, angle_deg=360)` | Revolve | | `sweep_along_path(curve)` | Sweep along a curve (mitred at corners) | | `thicken(thickness)` | Sheets: a solid of that thickness | | `cover()` | Closed planar curves: a sheet | | `trace(name, width, thickness, material="copper")` | Curves: a new rectangular trace along the curve that follows later curve edits | ```python box = prj.modeler.box("Block", size=(10, 10, 10)) hole = prj.modeler.cylinder("Hole", radius=2, height=10, origin=(5, 5, 0)) box.subtract(hole).move((0, 0, 1)).rotate("z", 45) ``` ## Faces Faces are `FaceRef` values, passed to ports, boundaries and mesh rules. A list of faces is accepted wherever faces are. Assigned faces follow their object when it is rebuilt. ```python end = air.face("-z") # the face on the -z side sides = air.faces(normal="x") # both x faces top = sub.face(nearest=(0, 0, 1.6)) # the face nearest a point ``` ## Folders | Call | | |---|---| | `obj.folder = "feed/connector"` | Move an object (creates the folder) | | `prj.modeler.folders()` | All folder paths | | `prj.modeler.new_folder(path)` | Returns the path | | `prj.modeler.rename_folder(old, new)` | | | `prj.modeler.delete_folder(path, delete_objects=False)` | Objects move up unless deleted; returns their names | | `prj.modeler.in_folder(path, recursive=True)` | `list[Object]` | ## Overlaps Where objects overlap, the higher `priority` wins. At equal priority an object lying wholly inside another wins (an air box drawn first never swallows the model). Only partial overlaps go further: a conductor wins over a dielectric, then `prj.overlap_rule` decides: `"earlier"` (default, the object created first) or `"later"`. `prj.validate()` doesn't fail on overlaps; the app's Check Model lists them. ## Picks `prj.picks` collects points, edges and faces for commands that use them (as in the app). | Call | Adds | |---|---| | `point((x, y, z))` | A point | | `vertex(obj, i)`, `edge_center(obj, i)`, `circle_center(obj, i)` | A point on an object (by vertex or edge index) | | `face_center(face)` | The centre of a face | | `edge(obj, i)`, `face(face)` | An edge or face pick | | `distance()` | Between the last two points, in project units | | `clear()` | Empties the list | ## Working coordinate system `prj.wcs` is the movable local coordinate system. **While it is on, positions given to the modeler are in its axes.** Objects keep their place when it moves later. | Call | | |---|---| | `on()`, `off()`, `active` | Switch it, or read whether it is on | | `align_to_face(face)` | XY plane on the face, Z along its outward normal | | `align_to_points(p0, p1=None, p2=None)` | One point: move the origin there (axes kept). Two: origin at `p0`, X towards `p1`. Three: also `p2` in the XY plane on the +Y side | | `align()` | To the newest picks (a face, a straight edge, or 1–3 points); clears them | | `move(u=0, v=0, w=0)`, `rotate(u=0, v=0, w=0)` | Along / about its own axes (degrees) | | `store(name=None)` | A named fixed copy; returns its name | | `reset()` | Back to the global axes | | `origin`, `matrix` | Its placement | ```python prj.wcs.align_to_face(sub.face("+z")) # draw on top of the substrate prj.modeler.box("Patch", size=(10, 12, 0.035), origin=(-5, -6, 0), material="copper") prj.wcs.off() ``` --- # Excitations and boundaries `faces` arguments take one face or a list of faces (from `obj.face(...)` / `obj.faces(...)`). Boundaries also accept `object=` to use every face of an object (for example an air box). **Any outer face with nothing assigned is PEC.** Every port is **excited by default** (one solve per port, giving the full S-matrix); pass `active=False` to make a port a matched load only. ## Ports and sources: `prj.excitations` ### `wave_port` ```python prj.excitations.wave_port(name, faces, modes=1, active=None, impedance=50.0, ground=(), signal=(), deembed=None, renormalize=None, line=None, terminals=None, results="modal") ``` A port that solves the cross-section's own modes. Put it on the model's outer boundary. | Parameter | Meaning | |---|---| | `faces` | One face, or several that make up the cross-section (for microstrip: the substrate face and the air face above it) | | `modes` | Number of modes; one per signal conductor for a multi-conductor port | | `active` | `None`/`True` excited, `False` a matched load only | | `impedance` | Reference impedance in Ω (used for terminal results) | | `line` | `[signal_point, ground_point]`: the integration line. Palace then reports the port impedance Z_PV (`port-Z.csv`) and the mode's sign is fixed | | `ground`, `signal` | Conductor names, instead of `line` | | `deembed` | A length (`"5mm"`): moves the reference plane into the model, with the mode's own propagation constant | | `renormalize` | An impedance in Ω: results referenced to it (needs the integration line) | | `results` | `"modal"` (default): one S-parameter port per mode (`P1:1`, `P1:2`...). `"terminal"`: one per terminal, referenced to `impedance` (or `renormalize`), numbered port by port (`P1_T1`, `P1_T2`, `P2_T1`...) | | `terminals` | For `"terminal"`: one `[signal_point, ground_point]` per mode; or use `signal` / `ground` | De-embedding and renormalisation apply wherever S-parameters are read (`result.network()`; `network(raw=True)` skips them), shown or exported. ```python p1 = prj.excitations.wave_port("P1", [sub.face("-y"), air.face("-y")], line=[(0, 0, "h"), (0, 0, 0)]) # trace -> ground diff = prj.excitations.wave_port("D1", end_faces, modes=2, results="terminal", signal=["TraceP", "TraceN"], ground=["Ground"]) ``` ### `lumped_port` ```python prj.excitations.lumped_port(name, faces, resistance=50.0, direction="+X", active=None, renormalize=None) ``` A port on a sheet between two conductors. `direction` is the current direction: `"+X"`, `"-Y"`... or a vector string `"x, y, z"`. Keep it small compared with the wavelength. ### `discrete_port` ```python prj.excitations.discrete_port(name, start, end, width=None, resistance=50.0, active=None) ``` A lumped port on a narrow strip between two points; current flows from `start` to `end`. Default width: a tenth of the gap. ### `floquet_port` ```python prj.excitations.floquet_port(name, face, active=None, polarization="TE", max_order=1, theta=0.0, phi=0.0, reference_frequency=0) ``` A plane-wave port on the top or bottom of a periodic unit cell (needs periodic boundaries). The excited port's incidence (θ, φ in degrees) holds at `reference_frequency` (default: the sweep centre). Results are per diffraction order (`port-floquet-S.csv`). ### `plane_wave` ```python prj.excitations.plane_wave(name, theta=0.0, phi=0.0, polarization="theta", amplitude=1.0, direction=None) ``` A uniform plane wave arriving from (θ, φ) in degrees (θ from +Z, φ from +X). `polarization` is `"theta"`, `"phi"`, an angle from θ̂ towards φ̂, or a vector; or give `direction=[kx, ky, kz]` (the propagation direction) with a polarisation vector. Needs a radiation boundary round the model at least λ/2 away (1 λ for RCS within about 0.5 dB). Ports act as receivers. Results: [`result.rcs()`](/docs/api/results#radar-cross-section). ## Boundaries: `prj.boundaries` | Method | Boundary | |---|---| | `pec(name, faces=None, object=None)` | Perfect electric conductor | | `pmc(name, faces=None, object=None)` | Perfect magnetic conductor | | `radiation(name, faces=None, object=None)` | First-order absorbing boundary (open space) | | `conductivity(name, conductivity, faces=None, object=None, thickness=None, roughness=None, radius=None, surface_ratio=None, area_ratio=1.0, rms=None)` | Lossy metal; `conductivity` in S/m | | `impedance(name, rs=0.0, ls=0.0, cs=0.0, faces=None, object=None)` | Surface impedance: Rs (Ω/sq), Ls (H/sq), Cs (F/sq) | | `periodic(name, primary, secondary, phase_deg=0.0)` | `secondary` is a translated copy of `primary` (e.g. `cell.face("-x")`, `cell.face("+x")`); the phase is the delay of the secondary face | **Roughness** on `conductivity`: `roughness="huray"` with nodule `radius` and `surface_ratio` (SR = N·4πa²/A_hex) and optional `area_ratio` (A_matte/A_flat); or `"hammerstad"` / `"groisse"` with `rms`. See [Surface roughness](/docs/app/roughness). ```python air = prj.modeler.box("AirBox", size=(60, 60, 30), origin=(-30, -30, -10)) prj.boundaries.radiation("Open", object=air) prj.boundaries.conductivity("Cu", 5.8e7, faces=trace.faces(), roughness="huray", radius="0.5um", surface_ratio=2.26) ``` ## Monitors and probes Monitors are in `te10_studio.core.monitors` (positions in **metres**, frequencies in **Hz**): ```python from te10_studio.core import monitors monitors.add(prj.core, monitors.field_monitor("E10G", "E", 10e9)) # save fields at 10 GHz monitors.add(prj.core, monitors.probe("Pt", "E", (0, 0, 0.002))) monitors.add(prj.core, monitors.voltage_line("V1", (0, 0, 0.0016), (0, 0, 0))) monitors.add(prj.core, monitors.current_loop("I1", (0, 0, 0.0008), (0, 1, 0), 0.002)) ``` | Function | Records | |---|---| | `field_monitor(name, kind, frequency_hz)` | `kind`: `"E"`, `"H"`, `"Surface Current"`, `"Power Flow"`; saved at the nearest sweep frequency | | `probe(name, kind, point)` | `"E"` or `"H"` at a point, every frequency | | `voltage_line(name, start, end, segments_=20)` | ∫E·dl from start to end | | `current_loop(name, center, normal, radius, segments_=36)` | ∮H·dl (keep it in non-magnetic material) | After a solve, `te10_studio.postprocess.monitors.results_for(prj.core, setup_name=None, excitation=None)` returns `{monitor name: result}` (`None` if not solved). Current monitors need element order 3 (or a finer mesh) for about 1 % accuracy; voltages and E probes are within about 0.5 % at order 2. --- # Mesh rules `prj.mesh` adds rules that make the starting mesh finer on a selection. The solver's adaptive refinement does the rest (see [Adaptive meshing](/docs/api/setups-solving#adaptive-meshing)). Rules only refine: a rule never makes the mesh coarser, and one whose object was deleted is skipped with a warning. Each method takes `faces=` (one face or a list) or `objects=` (an `Object` or a list), and an optional `name` (default `Length1`, `SkinDepth1`, ...). | Method | Does | |---|---| | `length_on(max_length, faces=None, objects=None, name=None)` | Caps the surface triangles on the faces (or every face of the objects) | | `length_inside(max_length, objects, name=None)` | Caps the elements inside the objects; a non-model object is a refinement region | | `skin_depth(faces=None, objects=None, layers=2, max_length=None, skin_depth=None, name=None)` | Layers of elements under conductor surfaces, sized by the skin depth (given, or from the material at the solution frequency); only for conductors meshed inside | | `surface_approximation(faces=None, objects=None, max_deviation=None, normal_deviation_deg=15.0, max_length=None, name=None)` | How closely the mesh follows curved faces | | Call | | |---|---| | `prj.mesh.names()` | `list[str]` | | `prj.mesh["Length1"]` | The rule | | `del prj.mesh["Length1"]` | Remove it | ```python prj.mesh.length_on("0.2mm", objects=[trace], name="TraceEdges") region = prj.modeler.box("Refine", size=(4, 4, 2), origin=(-2, -2, 0)) region.model = False prj.mesh.length_inside("0.3mm", objects=[region]) ``` Global settings (elements per wavelength, size limits, uniform refinements) are on the setup: see [Setups and solving](/docs/api/setups-solving#setup-attributes). --- # Setups and solving ## Creating setups ### `prj.setups.driven` ```python prj.setups.driven(name, start, stop, step=None, points=None, sweep="uniform", order=2, cores=4, linear_tol=None, save_fields="solution", far_field="solution", min_solved=None) -> Setup ``` A frequency-domain sweep. Frequencies are GHz as numbers, or strings with units. | Parameter | Meaning | |---|---| | `start`, `stop` | The band. `start=0` adds a fitted DC point: the solver solves down to `min_solved` (default: chosen from the model) and the 0 Hz S-matrix is fitted from the lowest solves | | `step` or `points` | A frequency step, or a number of points | | `sweep` | `"uniform"`, `"adaptive"` or `"interpolating"` ([below](#frequency-sweeps)) | | `order` | Element order: 1 fast, 2 accurate (default), 3 high accuracy | | `cores` | Solver processes for local solves | | `linear_tol` | The iterative solver's tolerance (default 1e-8). It bounds a preconditioned residual, not the S-parameter error | | `save_fields`, `far_field` | `"solution"` (default: at the solution frequency, from the last adaptive pass), `"all"` (every sweep point: slow, and a full field set per point and excitation) or `"none"` | ### `prj.setups.eigenmode` ```python prj.setups.eigenmode(name, modes=5, target="1GHz", order=2, cores=4) -> Setup ``` The `modes` resonances nearest `target`. Results: [`result.eigenmodes()`](/docs/api/results#eigenmodes). ### Looking up setups `prj.setups["S1"]` returns a `Setup`; `prj.setups.names()` lists them. ## Setup | Member | | |---|---| | `name` | The setup name | | `solve(...)` | Run and wait; returns a [`Result`](/docs/api/results) | | `submit(...)` | Start without waiting; returns a [`Job`](#jobs) | | `estimate(backend="skypilot")` | What a cloud solve would run on and cost at most, without starting it | | `palace_overrides` | Raw Palace JSON deep-merged into the generated configuration (still schema-checked) | | `core` | The internal setup object, for the [settings below](#setup-attributes) | ### `Setup.solve` ```python setup.solve(backend="local", cores=None, timeout=None, poll=2.0, max_cost=None, over_budget=False, **resources) -> Result ``` Meshes, solves and waits. `timeout` (seconds) raises if the job isn't done by then. Other parameters as for `submit`. ### `Setup.submit` ```python setup.submit(backend="local", cores=None, name=None, variations=None, max_cost=None, over_budget=False, **resources) -> Job ``` | Parameter | Meaning | |---|---| | `backend` | Where it runs ([backends](#backends)) | | `cores` | Solver processes (MPI ranks) | | `name` | The job's name (default: from the project and setup) | | `variations` | A list of `{variable: value}` dicts: one case per dict (as `prj.sweep` builds) | | `max_cost` | Cloud only: dollars. A job whose cost cap (price per hour × time limit) is above it isn't started | | `over_budget` | Cloud only: start even when this month's AWS spend is over the account's AWS Budget | | `**resources` | Override the cluster profile's defaults: `nodes`, `walltime` (`"01:00:00"`), `partition`, `account`, `modules`, `container`, `memory_gb`, `threads_per_rank`, `extra_directives` | ### Backends | `backend=` | Runs | |---|---| | `"local"` | On this computer | | a cluster profile name (or a `ClusterProfile`) | On that cluster, over SSH: Slurm, PBS, LSF, Grid Engine, HTCondor, Flux, or a plain host. See [Clusters and cloud](/docs/api/clusters-cloud) | | `"here"` | On the cluster whose login node the script runs on (finds the scheduler itself) | | `"skypilot"` | On an AWS machine sized and priced from the mesh, with the project's cloud settings | | `("export", "slurm", "/folder")` | Writes a zip with the mesh, settings and a job script to submit by hand | ### Setup attributes Set these on `setup.core` (they are what the app's Solver Setup window edits): | Attribute | Default | Meaning | |---|---|---| | `amr_enabled` | `True` | Adaptive meshing | | `max_delta_s` | `0.02` | Stop when the largest \|ΔS\| between passes is below this | | `amr_converged_passes` | `1` | Passes in a row that must meet the target | | `amr_min_passes` | `1` | Never stop before this many passes | | `amr_max_levels` | `5` | Maximum refinements (passes − 1) | | `amr_max_elements` | `0` | Maximum unknowns (0 = from this computer's memory) | | `amr_solution_freq` | `0.0` | Hz; 0 = the highest sweep frequency | | `amr_max_delta_freq_pct` | `1.0` | Eigenmode convergence: frequency change per pass, % | | `amr_error_tol` | `0.01` | The solver's own error target (advanced) | | `amr_uniform_levels` | `0` | Uniform refinements before adapting | | `reuse_adapted_mesh` | `True` | Skip the passes when nothing that affects the mesh changed | | `mesh_per_wavelength` | `0.0` | Elements per wavelength (0 = the default for the order) | | `mesh_min_size`, `mesh_max_size` | `0.0` | Element size limits in metres (0 = none) | | `linear_ksp_type`, `linear_tol`, `linear_max_its`, `linear_preconditioner` | `"GMRES"`, `1e-8`, `200`, `"Default"` | Linear solver | | `frequency_sweep.fit_tol`, `frequency_sweep.fit_max_samples` | `1e-3`, `150` | Interpolating sweep | | `eigen_num_modes`, `eigen_target_freq`, `eigen_tol`, `eigen_max_its` | | Eigenmode settings | ```python setup = prj.setups.driven("S1", 0.1, 2, step=0.05) setup.core.max_delta_s = 0.005 # electrically small: tighter target setup.core.amr_min_passes = 3 ``` ### Raw Palace settings ```python setup.palace_overrides = {"Solver": {"Linear": {"Tol": 1e-8, "MaxIts": 400}}} ``` The dict is deep-merged into the configuration TE10 generates for Palace, then checked against Palace's schema. Use it for solver options TE10 has no setting for. ## Frequency sweeps | `sweep=` | How | Use for | |---|---|---| | `"uniform"` | A full solve at every point | Few points, or a reference | | `"adaptive"` | The solver's reduced-order model, evaluated at every point (wave-port modes too, with exact solves as a fallback) | Most sweeps, including sharply resonant designs | | `"interpolating"` | About 40 solved points; every Sij fitted with one rational model (vector fitting), checked with extra solves until two rounds agree within `fit_tol` (\|ΔS\| ≤ 1e-3, or 0.01 dB / 0.1°) | Smooth broadband responses with many points | The interpolating sweep writes `port-S.csv` at every requested point and `port-S-fit.json` (which points were solved and which fitted, the final check error, the pole count, and whether the fit is passive). If it doesn't converge within `fit_max_samples` solves, only the solved points are written. Below 60 points it solves every point. Projects with frequency-dependent (Djordjevic–Sarkar) materials are solved in sub-bands. ## Adaptive meshing On by default. The mesh is refined at the solution frequency until max |ΔS| ≤ `max_delta_s` (eigenmode: `amr_max_delta_freq_pct`), then the sweep runs once on that mesh. The per-pass table is in `convergence.json` (in a job's case folder, or `logs//` for solves from the app); `te10_studio.solver.adaptive.load_report(path)` reads it. Electrically short structures barely change between early passes even on a coarse mesh: give them a smaller `max_delta_s` or a larger `amr_min_passes`. **Reuse:** when nothing that affects the mesh changed since a setup's last solve (geometry, materials, boundaries, ports, mesh rules, element order, solution frequency, adaptive settings), the next solve skips the passes and sweeps on the earlier adapted mesh. Changing only the sweep, `save_fields` or `far_field` keeps it. Scripted jobs look for a matching earlier job in the project's `jobs/` folder. Set `setup.core.reuse_adapted_mesh = False` to adapt again. Cluster and cloud jobs apply the same ΔS stop with a small watcher script shipped in the job package (standard-library Python); without `python3` on the cluster, the solver's own error tolerance and the pass limit stop the refinement. ## Jobs `setup.submit()` and `prj.sweep()` return a `Job`; `prj.jobs()` lists the project's jobs (also those started from the app). Save the project to remember a job. | Member | Returns | |---|---| | `status()` | `em.JobState`, asking the backend | | `state` | The last known `JobState` | | `wait(poll=5.0, timeout=None)` | The final `JobState` | | `logs(lines=200)` | The tail of the job's log, `str` | | `cancel()` | | | `fetch()` | Downloads the results; returns the local folder | | `results(fetch=True)` | `list[Result]`, one per case (variation) | | `result()` | The single `Result` | | `cleanup()` | Cloud: deletes the job's machine (done automatically once `results()` has downloaded) | | `estimate` | Cloud: the machine, price, model size and cost cap; the time and cost estimate once started | | `record` | The internal job record (`record.name`, ...) | `em.JobState` values: `PREPARED`, `PENDING`, `RUNNING`, `COMPLETED`, `FAILED`, `CANCELLED`, `UNKNOWN` (`.value` is the lower-case string). ```python job = prj.setups["S1"].submit(backend="mycluster", cores=64, walltime="01:00:00") prj.save("model.te10") # remembers the job state = job.wait(poll=30) if state == em.JobState.COMPLETED: job.result().write_touchstone("model.s2p") else: print(job.logs()) ``` ## Cloud solves ```python setup = prj.setups["S1"] print(setup.estimate()) # machine, $/h, model size, time limit and cap result = setup.solve(backend="skypilot", max_cost=2.0) ``` The machine is sized from the mesh (unless the project's cloud settings fix it) and priced before anything starts. The machine is deleted after `results()` downloads; for a failed or cancelled job call `job.cleanup()`. Connect an AWS account first: `te10 cloud connect`, or **Connect Cloud...** in the app. See [Solving in the cloud](/docs/app/cloud). --- # Results `Setup.solve()` returns a `Result`; `Job.results()` returns one per case. For a parametric sweep, `result.variables` holds that case's variable values. ## Result | Member | Returns | |---|---| | `s_parameters()` | [`SParameterResult`](#s-parameters): \|S\| in dB, phase in degrees, frequencies in GHz | | `network(z0=50.0, raw=False)` | A [scikit-rf](https://scikit-rf.readthedocs.io) `Network`, with the ports' de-embedding and renormalisation applied (as the app shows them) unless `raw=True` | | `write_touchstone(path, z0=50.0)` | Writes `.sNp` (the extension follows the port count); returns the path | | `eigenmodes()` | `[(frequency_GHz, Q), ...]` of an eigenmode solve | | `fields()` | [`FieldSolution`](#fields): saved field data of any solve type | | `farfield()` | [`FarFieldResult`](#far-field): directivity, gain and realized-gain patterns | | `rcs()` | [`RCSResult`](#radar-cross-section) of a plane-wave solve | | `rlgc(length_m, near_ports=None, far_ports=None, z0=50.0)` | Per-metre R, L, G, C matrices of the solved line (a port at each end of each conductor; near ends first unless the port lists say otherwise, 1-based) | | `write_rlgc_csv(path, length_m, near_ports=None, far_ports=None)` | The same, as CSV; returns the path | | `log()` | The solver's console output, `str` | | `folder` | The case's result folder | | `variables` | `{name: value}` of this case (parametric sweeps) | ## S-parameters ```python sp = result.s_parameters() f = sp.frequencies_ghz # numpy array, GHz s21_db = sp.get_db(2, 1) # numpy array, dB s21_deg = sp.get_phase_deg(2, 1) # numpy array, degrees s21 = sp.get_linear_complex(2, 1) # complex numpy array sp.available_ports() # [(1, 1), (1, 2), (2, 1), (2, 2)] ``` Ports are numbered from 1, response first: `get_db(2, 1)` is S21. A getter returns `None` for a pair that wasn't solved. ### As a scikit-rf network ```python ntwk = result.network() # skrf.Network, frequencies in Hz inside ntwk.s_db[:, 1, 0] # S21 in dB (0-based in scikit-rf) ntwk.write_touchstone("filter") # or result.write_touchstone("filter.s2p") ``` The functions in [Post-processing](/docs/api/postprocessing) take this `Network`. ## Eigenmodes ```python for f_ghz, q in result.eigenmodes(): print(f"{f_ghz:.4f} GHz, Q = {q:.0f}") ``` ## Fields `result.fields()` returns a `FieldSolution` for driven, eigenmode, transient or static solves. | Member | Returns | |---|---| | `steps(excitation=None)` | The saved steps (frequencies, modes or times), in order | | `nearest_step(frequency_ghz, excitation=None)` | The saved step closest to a frequency | | `frequencies_ghz(excitation=None)` | The saved frequencies | | `excitations()` | Excitation (port) indices with saved fields | | `available_quantities()` | Quantity names this solution can give | | `evaluate(quantity, step=None, phase_deg=0.0, excitation=None, boundary=None)` | A PyVista dataset with the quantity as point data named after it | | `port_mode(port_index, step=None, phase_deg=0.0)` | The port's mode field on its own faces | | `eigenmodes()` | `[(frequency_GHz, Q), ...]` | | `volume(step=None)`, `boundary(step=None)` | The raw volume / boundary datasets as the solver wrote them | Quantities include `E_magnitude` (at a phase), `E_peak`, `E_vectors`, `H_magnitude` (H = B/(μ0·μr) per material), `H_vectors`, `Surface_current_vectors`, `Surface_charge`, `Power_flow` and energy densities; `available_quantities()` gives the exact list for a solution. ```python sol = result.fields() step = sol.nearest_step(10.0) # 10 GHz grid = sol.evaluate("E_magnitude", step, phase_deg=45) print(grid.point_data["E_magnitude"].max()) # V/m grid.save("e_10ghz.vtu") # open in ParaView ``` Fields are saved at the solution frequency by default; use `save_fields="all"` on the setup, or a field monitor, for others. ## Far field `result.farfield()` returns a `FarFieldResult` (needs a far-field setup and an open boundary). | Member | Returns | |---|---| | `excitations()` | Excitation indices | | `frequencies_ghz(excitation=None)` | Frequencies with far-field data | | `pattern(freq_ghz=None, excitation=None)` | A `Pattern` at the nearest solved frequency (default: the first) | `Pattern`: | Member | Returns | |---|---| | `theta`, `phi` | Direction arrays (degrees) | | `values(quantity="Directivity", component="Total")` | Linear values: `"Directivity"`, `"Gain"`, `"RealizedGain"` (dimensionless) or `"rE"` (volts); component `"Total"`, `"Theta"`, `"Phi"` | | `peak(quantity="Directivity", component="Total")` | `(peak linear value, theta, phi)` | | `intensity(component="Total")` | Radiation intensity U (W/sr) | | `radiation_efficiency` | Radiated / accepted power | | `p_rad`, `p_acc`, `p_inc` | Radiated, accepted and incident power (W) | | `summary()` | Peak values and powers as a dict | ```python pat = result.farfield().pattern(2.4) d, th, ph = pat.peak("Directivity") print(f"Peak directivity {10 * np.log10(d):.2f} dBi at theta={th:.0f}, phi={ph:.0f}") ``` ## Radar cross-section `result.rcs()` returns an `RCSResult` for plane-wave solves. | Member | Returns | |---|---| | `bistatic(freq_ghz=None, wave=None, phi_cut=None)` | An `RCSCut`: `theta`, `phi`, `sigma`, `sigma_theta`, `sigma_phi` (m²) and `.dbsm`. With `phi_cut`, the θ cut at that φ (and φ + 180° as negative θ) | | `monostatic(wave=None)` | `(frequencies_GHz, sigma_m2)` back-scatter at each wave's incidence direction | | `frequencies_ghz(wave=None)` | | | `wave(name_or_index=None)` | One plane wave's run | Shielding effectiveness from E probes: `te10_studio.postprocess.rcs.shielding_effectiveness(prj.core)`. ## Monitors `te10_studio.postprocess.monitors.results_for(prj.core, setup_name=None, excitation=None)` returns each probe, voltage and current monitor's values against frequency. See [Monitors and probes](/docs/api/excitations-boundaries#monitors-and-probes). ## The results folder A project `Filter.te10` keeps solver output in `Filter.te10results/`. The `.te10` never contains results: copying only it gives the project without them. | Folder | Holds | |---|---| | `mesh//` | `model.msh`, `adapted.mesh`, `passes/pass.mesh` | | `fields//` | `paraview/` volume and boundary fields | | `sparams//` | `port-S.csv`, port voltages and currents, `terminal-*.csv` (C, L) | | `data//` | Other solver tables: `eig.csv`, energies, surface and far-field data | | `logs//` | `solve.log`, solver configurations, `convergence.json`; `failed-run/` | | `jobs/` | Packages of jobs from `submit()` / `solve()` (one case folder each) | --- # Post-processing ```python from te10_studio.postprocess import networks, channel ntwk = result.network() # or networks.load_touchstone("board.s4p") ``` ## Networks: `te10_studio.postprocess.networks` The functions behind the app's S-parameter window, so a script gets the same numbers as the app. Each takes a scikit-rf `Network` (`result.network()`, or `networks.load_touchstone(path)`), with ports numbered from **1**: | Function | Result | |---|---| | `trace(ntwk, quantity, i, j, param="S")` | `(f_GHz, values)`; quantity `db`, `mag`, `phase`, `phase_unwrapped`, `group_delay` (ns), `vswr`, `return_loss`, `real`, `imag`; param `S`, `Z`, `Y`, `ABCD`, `T` | | `renormalize(ntwk, z0)`, `port_extension(ntwk, {port: length_m}, eps_eff=1)` | new Networks (reference impedance / reference planes moved) | | `mixed_mode(ntwk, pairs=None)` | differential / common mode; `pairs=[(1, 3), (2, 4)]` (positive, negative), default (1,2), (3,4), …; ports D1..DP, C1..CP, then unpaired ports | | `interpolate(ntwk, f1_GHz, f2_GHz, points)`, `cascade(a, b)`, `deembed_fixtures(ntwk, left, right)` | new Networks (fixtures: 2-ports removed from either side) | | `enforce_passivity(ntwk)` | singular values of S above 1 clipped, frequency by frequency | | `causality(ntwk)` | {(i, j): impulse-response energy fraction at negative time}; > ~1 % is suspect | | `time_response(ntwk, i, j, "impulse", "step" or "tdr", window="hamming", gate=(center_ns, span_ns), rise_time_ps=None, rise_definition="10-90")` | `(t_ns, response)`; `rise_definition` `10-90`, `20-80` or `0-100` (linear ramp) | | `tdr(s_reflection, f_hz, z_ref, Edge("rise", rise_ps=None, definition="10-90"))` | `(t_ns, z_ohm)` of any reflection term (e.g. SDD11 from `channel`); `rise_ps=None` = the fastest the sweep supports, a faster one is clamped (`edge_rise_ps`) | | `min_rise_time_ps(f_max_hz, definition="10-90")`, `tdr_view_range(t, z, rise_ns, round_trip_ns=None)` | fastest edge of a sweep; `(t0, t1, z_lo, z_hi)` worth showing | | `checks(ntwk)` | passivity, reciprocity and, for 2-ports, Rollett K, μ and maximum gain | | `write_touchstone(ntwk, path)`, `write_csv(ntwk, path)` | files (`.sNp` follows the port count) | `time_response` raises `ValueError` when a `rise_time_ps` is faster than the sweep's top frequency supports (about 0.875 / f_max for 10–90 %); leave it `None` for the fastest edge. ## Channel measurements: `te10_studio.postprocess.channel` The S-parameter window's port map and measurements. A **port map** says which channel each port belongs to, which end (side 1 or 2) it is at, and its polarity (single-ended, or the + / − leg of a pair). | Function | Result | |---|---| | `auto_port_map(ntwk, pair_hint=None)` | `PortMap`: each port's channel, side (1 / 2) and polarity (`single`, `+`, `-`); `pair_hint=[(p, n), …]` | | `PortMap.signals()`, `.ports(channel, side)`, `.pair(channel, side)`, `.is_pair(channel)`, `.to_dict()` / `from_dict` | the map | | `mode_s(ntwk, pmap, mode_out, lane_out, side_out, mode_in, lane_in, side_in)` | one mixed-mode term (modes `S`, `D`, `C`), e.g. SDD21 = `mode_s(n, pm, "D", 1, 2, "D", 1, 1)` | | `curves(ntwk, pmap, measurement, channels, sides, mode=None, aggressors="each")` | list of `Curve(label, x, y, unit, meta)`; measurement `il`, `rl`, `vswr`, `next`, `fext`, `modeconv`, `gd`, `skew`, `phase`, `zin`, `smith`, `polar_refl`, `polar_thru`; mode `SE`, `DD`, `CC`, `CD`, `DC`, … | | `available(ntwk, pmap)`, `modes_available(pmap, measurement)` | what the map supports | | `power_sum(terms)`, `skew_ps(ntwk, pmap, channel)`, `input_impedance(s, zref)`, `through_delay_ns(ntwk, pmap, channel)` | helpers | ```python from te10_studio.postprocess import channel n = result.network() pm = channel.auto_port_map(n) for c in channel.curves(n, pm, "il", pm.signals(), [1], "DD"): print(c.label, c.y.min()) # e.g. "SDD21 · Channel 1" ``` ## Examples ```python from te10_studio.postprocess import networks as nw ntwk = result.network() f, il = nw.trace(ntwk, "db", 2, 1) # insertion loss, dB f, gd = nw.trace(ntwk, "group_delay", 2, 1) # ns mm = nw.mixed_mode(ntwk, pairs=[(1, 3), (2, 4)]) # differential + common mode network t, z = nw.time_response(ntwk, 1, 1, "tdr") # fastest edge the sweep supports print(nw.checks(ntwk)) # passivity, reciprocity, stability nw.write_touchstone(nw.renormalize(ntwk, 100), "board_100ohm.s4p") ``` --- # Clusters and cloud Solves run on a cluster or in the cloud through the same `Setup.solve()` / `Setup.submit()` calls, with `backend=` set to a cluster profile name or `"skypilot"`. Set a cluster up once, from the app (**Add Cluster...**), the command line (`te10 cluster add`) or Python. See the user guide's [cluster page](/docs/app/clusters) for what TE10 does on the cluster, and [cloud page](/docs/app/cloud) for AWS. ## `em.clusters` ```python from te10_studio import api as em ``` ### `em.clusters.add_cluster` ```python profile, ok, message = em.clusters.add_cluster( target, name="", partition="", account=None, scratch="", solver="", identity_file="", jump_host="", key_login=False, test=True) ``` Connects to `target` (`"user@host"`, or a host alias from `~/.ssh/config`), finds the scheduler, queues, accounts and a scratch folder, uploads TE10's solver, runs a test solve and saves the profile. Returns `(profile, ok, message)`; the profile is saved only when the test passed (or `test=False`). | Parameter | Meaning | |---|---| | `name` | The name to save it under (default: the host's short name) | | `partition` | Always use this queue (default: chosen per job) | | `account` | The allocation jobs are charged to | | `scratch` | Folder for job files (default: the cluster's scratch space) | | `solver` | `"te10"` (TE10's solver, default), `"te10-image"` (in a container, for old Linux) or `"site"` (the cluster's own Palace) | | `identity_file`, `jump_host` | SSH key file and gateway host | | `key_login` | Create a TE10 key so later logins need no password | ### Other functions | Function | Does | |---|---| | `load_profiles(path=None)` | `list[ClusterProfile]`: the saved clusters | | `get_profile(name)` | One profile | | `test_cluster(profile, two_nodes=False)` | `(ok, message)`: the test solve again (`two_nodes` checks MPI between nodes) | | `refresh_cluster(name)` | Reads the queues and limits again; returns the updated profile | | `remove_cluster(name)` | Deletes the profile | | `export_shared(profile, path)` | Writes a `.te10cluster` file (no user name, key or account in it) | | `add_shared(path, user="", name="", account="", test=True)` | `(profile, ok, message)`: adds a cluster from a `.te10cluster` file for `user` | | `here_profile()` | A profile for the login node the script runs on (`backend="here"` does this) | `prj.compute.names()` and `prj.compute["name"]` give the same profiles from a project. ## Job resources Keyword arguments to `submit()` / `solve()` / `prj.sweep()` override the profile's defaults (fields of `em.JobSpec`): | Field | Default | | |---|---|---| | `nodes` | `1` | Nodes | | `threads_per_rank` | `1` | OpenMP threads per solver process | | `walltime` | `"04:00:00"` | Time limit | | `memory_gb` | `0` | Memory per node (0 = the scheduler's default) | | `partition`, `account` | `""` | Queue and allocation | | `modules` | `[]` | `module load` lines run before the solver, e.g. `["gcc/12", "openmpi/4.1"]` | | `container` | `""` | An Apptainer / Singularity image | | `extra_directives` | `[]` | Raw scheduler lines, e.g. `["--gres=gpu:1", "--exclusive"]` | `cores` sets the number of solver processes. With no resources given, TE10 sizes the job from the mesh and the cluster's partitions, as the app does. ```python em.clusters.add_cluster("you@login.cluster.edu", name="mycluster") # once job = prj.setups["S1"].submit(backend="mycluster", cores=64, walltime="01:00:00", account="proj-rf") prj.save("model.te10") job.wait(poll=30) job.result().write_touchstone("model.s2p") ``` ## Cloud (AWS) ```python setup = prj.setups["S1"] print(setup.estimate()) # machine, $/h, model size, the time limit and the cost cap job = setup.submit(backend="skypilot", max_cost=1.50) print(job.estimate) # once started: the time and cost estimate result = job.result() # downloads, then deletes the machine ``` - Connect an AWS account first: `te10 cloud connect` (an access key) or **Connect Cloud...** in the app (sign in with AWS). - The machine is sized from the mesh (about 60,000 unknowns per core) and priced before anything starts. - `max_cost` (dollars) refuses a job whose cap (price per hour × time limit) is above it. A job is also not started when this month's AWS spend is over the account's AWS Budget, unless `over_budget=True`. - `job.cleanup()` deletes the machine of a failed or cancelled job; `te10 cloud leftovers` lists any still running. --- # RF tools and material library The app's **Tools › Macros** are plain functions. **All values are SI here** (metres, hertz, ohms), not project units. ```python from te10_studio.rftools import tlines, builders, ports, catalog ``` ## Calculators: `tlines` | Function | Returns | |---|---| | `microstrip(w, h, er, t=0.0, f=None)` | `LineResult` (Hammerstad–Jensen with strip thickness; Kirschning–Jansen dispersion at `f`) | | `microstrip_width(z0, h, er, t=0.0)` | Width for an impedance, m | | `stripline(w, b, er)` | `LineResult` of a centred zero-thickness strip (Cohn) | | `stripline_width(z0, b, er)` | m | | `cpw(w, s, h, er, grounded=False)` | `LineResult` of coplanar waveguide (conformal mapping) | | `cpw_width(z0, s, h, er, grounded=False)` | m | | `coax(d_inner, d_outer, er=1.0)` | `LineResult` | | `coax_outer_diameter(z0, d_inner, er=1.0)` | m | | `coax_cutoff_te11(d_inner, d_outer, er=1.0)` | Hz | | `rect_waveguide_modes(a, b, er=1.0, count=8)` | `list[Mode]` (`name`, `fc` in Hz), lowest first | | `circ_waveguide_modes(d, er=1.0, count=8)` | `list[Mode]` | | `waveguide_mode(fc, f, er=1.0)` | `(beta_rad_per_m, guided_wavelength_m, te_wave_impedance_ohm)`; `ValueError` below cutoff | | `skin_depth(f, sigma, mu_r=1.0)`, `surface_resistance(f, sigma, mu_r=1.0)` | m, Ω/sq | | `wavelength(f, er=1.0, mu_r=1.0)` | m | `LineResult` has `z0` (Ω), `eps_eff`, `wavelength(f)` and `electrical_length_deg(length, f)`. ```python w = tlines.microstrip_width(50, h=1.6e-3, er=4.4) # 0.00306 m line = tlines.microstrip(w, 1.6e-3, 4.4, t=35e-6, f=2.4e9) print(line.z0, line.eps_eff, line.wavelength(2.4e9)) ``` ## Builders: `builders` Each builds into a project (`em.Project`), adds wave ports and a frequency sweep around its design frequency, makes that setup active, and returns a `BuildResult` (`summary`, `objects`, `ports`, `values`). | Function | Builds | |---|---| | `microstrip_line(prj, z0=50.0, er=4.4, h=1.6e-3, length=0.03, f0=5e9, tand=0.0, board_width=None)` | A straight line on its board, ports at both ends | | `quarter_wave_transformer(prj, z_source=50.0, z_load=100.0, f0=2.4e9, er=4.4, h=1.6e-3, tand=0.0)` | Source line, √(Zs·ZL) λg/4 section, load line | | `tapered_line(prj, z1=50.0, z2=100.0, length=0.04, kind="exponential", er=4.4, h=1.6e-3, f0=3e9, segments=40, tand=0.0, gamma_max=0.02)` | `kind`: `"linear"`, `"exponential"` or `"klopfenstein"` | | `branchline_coupler(prj, f0=2.4e9, z0=50.0, er=4.4, h=1.6e-3, tand=0.0, feed_length=None)` | 3 dB 90° hybrid, four ports | | `patch_antenna(prj, f0=2.4e9, er=4.4, h=1.6e-3, tand=0.02, z0=50.0)` | Inset-fed patch, ground, radiation box, wave port | | `waveguide_section(prj, size="WR-90", length=0.05, a=None, b=None, er=1.0)` | A standard or custom rectangular guide | | `coax_section(prj, z0=50.0, d_inner=1.27e-3, er=2.1, length=0.02)` | A coax sized for an impedance | | `design_patch(f0, er, h, z0=50.0)` | `PatchDesign` (`W`, `L`, `eps_eff`, `dL`, `r_edge`, `inset`, `feed_w`), nothing built | ```python prj = em.Project("coupler", units="mm") res = builders.branchline_coupler(prj, f0=2.4e9, er=3.66, h=0.508e-3) print(res.summary, res.ports) # ['Port1', 'Port2', 'Port3', 'Port4'] print(prj.setups.names()) # ['CouplerSweep']: the sweep the builder added result = prj.setups["CouplerSweep"].solve(cores=4) ``` ## Ports on your own traces: `ports` | Function | | |---|---| | `add_line_port(prj, trace, kind="microstrip", name=None, **kw)` | Plans and adds a port on a trace's end; returns `(port, plan)` | | `plan_line_port(prj, trace, kind="microstrip", end="auto", port_type="wave", ...)` | Works out the port without changing anything; returns a `PortPlan`. Lengths read from the model unless given (`w`, `t`, `h`, `er`, `s`, `b`, `width`, `height`, metres) | | `apply_port_plan(prj, plan, name=None, modes=1, resistance=50.0)` | Builds a plan: the air box if needed, the port sheet and the port | | `describe(plan)` | A readable summary | | `port_size(kind, w, h, er, s=None, b=None)` | `(width, height above the reference, depth below it)` by the usual sizing rules | `kind` is `"microstrip"`, `"stripline"`, `"cpw"` or `"gcpw"`; `port_type` `"wave"` or `"lumped"`. Sizing rules are in the user guide's [RF tools](/docs/app/rf-tools#ports) page. ## The tool catalogue: `catalog` `catalog.run(tool_id, prj, values=None, build=False) -> str` runs any menu tool by id with SI `values` overriding its defaults, and returns its text output. `build=True` also builds it. `catalog.defaults(catalog.TOOLS_BY_ID[tool_id])` gives the defaults. | Ids | | |---|---| | `calc.microstrip`, `calc.stripline`, `calc.cpw`, `calc.coax`, `calc.waveguide`, `calc.skin`, `calc.patch` | Calculators | | `port.wave`, `port.lumped` | Port wizards | | `build.microstrip`, `build.qwt`, `build.taper`, `build.branchline`, `build.patch`, `build.waveguide`, `build.coax` | Builders | ## Material library ```python from te10_studio.core import material_library as lib ``` | Function | Returns | |---|---| | `lib.search(text="", category="", conductors=None)` | Entries whose name, category, vendor or construction contain every word of `text` | | `lib.get(name)` | One entry (case-insensitive), or `None` | | `entry.values_at(freq_hz)` | `(eps_r, tan_delta, sigma)` at a frequency (tables interpolated linearly in log f) | | `lib.make_material(entry, freq_hz=10e9, dispersive=False, name=None)` | A project material with the entry's values at that frequency; `dispersive=True` for a Djordjevic–Sarkar model anchored there | ```python e = lib.get("Panasonic MEGTRON 6 R-5775(N) 2x1078 RC59 5.0mil core") print(e.values_at(28e9)) mat = lib.make_material(e, 28e9) prj.core.materials[mat.name] = mat # add it to the project ``` What the library holds is listed in the user guide's [Materials](/docs/app/materials#the-material-library) page. --- # Command line The installer puts `te10` on your PATH. `te10 --help` prints every option. ## Projects and scripts | Command | Does | |---|---| | `te10` | Opens the app | | `te10 model.te10` | Opens the app with a project | | `te10 run script.py [args...]` | Runs a Python script that uses `te10_studio.api`; `args` go to `sys.argv` | | `te10 version` | The version | ## `te10 solve` ```bash te10 solve model.te10 [--setup S1] [--backend local||here|skypilot] [--cores N] [--no-wait] [--poll SECONDS] [--touchstone out.s2p] [--save] ``` | Option | | |---|---| | `--setup` | The setup to solve (default: the active one) | | `--backend` | `local` (default), a cluster name, `here` (on this cluster's login node), or `skypilot` (AWS) | | `--cores` | Solver processes | | `--no-wait` | Submit and exit; check with `te10 jobs` | | `--poll` | Seconds between status checks while waiting (default 10) | | `--touchstone` | Write the S-parameters to this file | | `--save` | Save the project afterwards (remembers the job) | ```bash te10 solve filter.te10 --cores 8 --touchstone filter.s2p te10 solve filter.te10 --backend mycluster --no-wait --save ``` ## `te10 jobs` ```bash te10 jobs model.te10 [--refresh] [--logs JOB [--lines N]] [--cancel JOB] [--fetch JOB] ``` Lists the project's jobs (from scripts and the app). `--refresh` asks each cluster or cloud machine for the job's state and says why a job waits. `JOB` is a job's name, scheduler id or key. ## `te10 cluster` | Command | | |---|---| | `te10 cluster add user@host [--name N] [--partition P] [--account A] [--scratch DIR] [--solver te10\|te10-image\|site] [--key FILE] [--jump HOST] [--key-login] [--no-test]` | Finds everything, runs the test solve, saves | | `te10 cluster add USER --from file.te10cluster` | Adds a shared cluster for your user name | | `te10 cluster list` (or `te10 profiles`) | The clusters you added | | `te10 cluster show NAME` | One cluster's settings | | `te10 cluster test NAME [--two-nodes]` | The test solve again | | `te10 cluster refresh NAME` | Reads the queues and limits again | | `te10 cluster export NAME --to file.te10cluster` | Writes a shareable file (nothing personal in it) | | `te10 cluster shared` | Files in the shared folder (`TE10_CLUSTER_PROFILES`) | | `te10 cluster remove NAME` | | ## `te10 cloud` | Command | | |---|---| | `te10 cloud connect [--region R]` | Stores an AWS access key for TE10 (asked here; the secret isn't shown) | | `te10 cloud status` | Whether the key works, the account's limits and credits | | `te10 cloud leftovers [--delete]` | TE10 machines still running (they cost money); `--delete` deletes them | ## `te10 account` | Command | | |---|---| | `te10 account` / `te10 account status` | The license and this computer's seat | | `te10 account activate KEY` | Enters the license key and takes a seat | | `te10 account refresh` | Checks the license online now | | `te10 account release` | Frees this computer's seat | | `te10 account remove` | Removes the key from this computer | ## `te10 solver` The local solver. On Windows it lives in TE10's own WSL distribution. | Command | | |---|---| | `te10 solver status [--check]` | Where the solver is and its version; `--check` starts it once | | `te10 solver setup [--install-wsl] [--force]` | Windows: installs or updates the WSL solver; `--install-wsl` also switches WSL on (asks for administrator rights, then a restart) | | `te10 solver test` | A small test solve | | `te10 solver remove` | Removes TE10's WSL solver | --- # Examples Save any of these as a `.py` file and run it with `te10 run `. Each is complete and checks its result against theory where there is one. Some use the project saved by an earlier one (noted in their first lines). | Script | Shows | |---|---| | [`01_waveguide.py`](#wr-90-waveguide-against-theory) | WR-90 waveguide against theory | | [`02_microstrip.py`](#50-ω-microstrip-on-fr-4) | 50 Ω microstrip on FR-4 | | [`03_width_sweep.py`](#parametric-sweep-of-a-trace-width) | Parametric sweep of a trace width | | [`04_cavity_eigenmodes.py`](#cavity-resonances) | Cavity resonances | | [`05_build123d_shapes.py`](#any-build123d-shape) | Any build123d shape | | [`06_optimize_length.py`](#optimisation-with-scipy) | Optimisation with SciPy | | [`07_cluster_submit_and_collect.py`](#submit-to-a-cluster-collect-later) | Submit to a cluster, collect later | | [`08_palace_overrides.py`](#raw-solver-settings) | Raw solver settings | ## WR-90 waveguide against theory `01_waveguide.py`: A parametric box, wave ports chosen by face, a driven solve, Touchstone output, and a check of the S21 phase against the TE10 dispersion relation. ```python """WR-90 waveguide: S-parameters vs. the TE10 dispersion relation, written to Touchstone.""" import math import numpy as np from te10_studio import api as em a, b = 22.86, 10.16 # mm prj = em.Project("wr90", units="mm") prj.variables["L"] = "50mm" air = prj.modeler.box("Air", size=(a, b, "L"), origin=(-a / 2, -b / 2, 0)) # outer faces are PEC by default prj.excitations.wave_port("P1", air.face("-z")) prj.excitations.wave_port("P2", air.face("+z")) setup = prj.setups.driven("S1", start=8, stop=12, step=0.5, order=2) res = setup.solve(cores=4) sp = res.s_parameters() f = sp.frequencies_ghz * 1e9 beta = np.sqrt((2 * math.pi * f / 299792458.0) ** 2 - (math.pi / (a * 1e-3)) ** 2) expected = np.degrees(-beta * prj.variables["L"]) err = (sp.get_phase_deg(2, 1) - expected + 180) % 360 - 180 print(f"|S11| max {sp.get_db(1, 1).max():.1f} dB, |S21| min {sp.get_db(2, 1).min():.3f} dB, phase error max {abs(err).max():.2f} deg") print("Touchstone:", res.write_touchstone("wr90.s2p")) prj.save("wr90.te10") ``` ## 50 Ω microstrip on FR-4 `02_microstrip.py`: Variables and expressions, materials, mesh priority, and wave ports that span the substrate and the air. Prints the effective permittivity from the S21 phase. ```python """50-ohm microstrip on FR4 with wave ports spanning substrate and air; effective permittivity.""" import math import numpy as np from te10_studio import api as em prj = em.Project("microstrip", units="mm") for name, value in {"h": "1.6mm", "w": "3mm", "t": "0.035mm", "L": "20mm"}.items(): prj.variables[name] = value width, air_h = "10*w", "8*h" sub = prj.modeler.box("Substrate", size=(width, "L", "h"), origin=("-5*w", 0, 0), material="FR4") air = prj.modeler.box("Air", size=(width, "L", air_h), origin=("-5*w", 0, "h")) trace = prj.modeler.box("Trace", size=("w", "L", "t"), origin=("-w/2", 0, "h"), material="copper", priority=1) # A port covers the whole cross-section at each end: the substrate face and the air face. prj.excitations.wave_port("P1", [sub.face("-y"), air.face("-y")]) prj.excitations.wave_port("P2", [sub.face("+y"), air.face("+y")]) setup = prj.setups.driven("S1", start=1, stop=2, step=1, order=2) res = setup.solve(cores=4) sp = res.s_parameters() f = sp.frequencies_ghz * 1e9 phase = np.unwrap(np.radians(sp.get_phase_deg(2, 1))) eps_eff = (-phase / (2 * math.pi * f / 299792458.0 * prj.variables["L"])) ** 2 for fi, e in zip(sp.frequencies_ghz, eps_eff): print(f"{fi:.1f} GHz: eps_eff = {e:.3f}") prj.save("microstrip.te10") ``` ## Parametric sweep of a trace width `03_width_sweep.py`: One job with one result per width (an array job on a cluster). Uses the project saved by the microstrip example. ```python """Parametric sweep of the trace width: one job (an array job on a cluster), one result per width. te10 run 03_width_sweep.py # on this computer te10 run 03_width_sweep.py my-cluster # on a cluster profile (Analysis > Cluster Profiles) """ import sys from te10_studio import api as em backend = sys.argv[1] if len(sys.argv) > 1 else "local" prj = em.Project.open("microstrip.te10") # made by 02_microstrip.py job = prj.sweep({"w": ["2mm", "3mm", "4mm"]}, "S1", backend=backend, cores=4) print(job, "->", job.wait(poll=5).value) for res in job.results(): sp = res.s_parameters() print(res.variables, f"|S11| at {sp.frequencies_ghz[-1]:.1f} GHz: {sp.get_db(1, 1)[-1]:.1f} dB") prj.save("microstrip.te10") # the job is remembered (see `te10 jobs`) ``` ## Cavity resonances `04_cavity_eigenmodes.py`: An eigenmode solve of a PEC box, compared with the analytic resonances. ```python """Rectangular PEC cavity: the first resonances against the analytic formula.""" import math from te10_studio import api as em a, b, d = 22.86, 10.16, 30.0 prj = em.Project("cavity", units="mm") prj.modeler.box("Air", size=(a, b, d)) setup = prj.setups.eigenmode("E1", modes=3, target="5GHz", order=2) res = setup.solve(cores=4) c0 = 299792458.0 analytic = sorted(c0 / 2 * math.sqrt((m / a) ** 2 + (n / b) ** 2 + (p / d) ** 2) * 1e3 for m in range(3) for n in range(3) for p in range(3) if (p > 0 and (m or n)) or (p == 0 and m and n))[:3] for (f, q), exact in zip(sorted(res.eigenmodes()), analytic): print(f"{f:.4f} GHz (analytic {exact / 1e9:.4f} GHz), Q = {q:.3g}") ``` ## Any build123d shape `05_build123d_shapes.py`: CAD made with build123d added with a material; booleans and transforms on API objects. ```python """Anything build123d can make goes into the model with modeler.add (drawn in project units).""" import build123d as bd from te10_studio import api as em prj = em.Project("shapes", units="mm") # A filleted, drilled block: build123d does the CAD, the API adds it with a material. block = bd.Box(20, 12, 6) block = bd.fillet(block.edges().filter_by(bd.Axis.Z), radius=2) block -= bd.Cylinder(2, 6) part = prj.modeler.add("Block", block, material="FR4") print(part, f"volume {part.volume:.1f} mm^3") # Booleans and transforms on API objects pin = prj.modeler.cylinder("Pin", radius=1, height=10, origin=(6, 0, -2), material="copper") pin.move((0, 2, 0)) prj.modeler["Block"].subtract(pin, keep_tools=True) print([o.name for o in prj.modeler], prj.modeler["Block"].history) prj.save("shapes.te10") ``` ## Optimisation with SciPy `06_optimize_length.py`: Tunes a waveguide length for −90° of S21 phase at 10 GHz; the geometry and ports follow the variable on every solve. ```python """Optimization loop: find the waveguide length that gives S21 phase -90 deg at 10 GHz (scipy).""" from scipy.optimize import minimize_scalar from te10_studio import api as em a, b = 22.86, 10.16 prj = em.Project("tune", units="mm") prj.variables["L"] = "20mm" air = prj.modeler.box("Air", size=(a, b, "L"), origin=(-a / 2, -b / 2, 0)) prj.excitations.wave_port("P1", air.face("-z")) prj.excitations.wave_port("P2", air.face("+z")) setup = prj.setups.driven("S1", start=10, stop=10, step=1, order=2) def cost(length_mm: float) -> float: prj.variables["L"] = f"{length_mm}mm" # geometry and ports follow the variable phase = setup.solve(cores=4).s_parameters().get_phase_deg(2, 1)[0] err = (phase + 90 + 180) % 360 - 180 print(f"L = {length_mm:.3f} mm -> phase {phase:.2f} deg") return err * err best = minimize_scalar(cost, bounds=(5, 25), method="bounded", options={"xatol": 0.05}) print(f"Best L = {best.x:.3f} mm") ``` ## Submit to a cluster, collect later `07_cluster_submit_and_collect.py`: Submits and saves the project (which remembers the job); a second run collects the finished results. ```python """Submit a solve to a cluster and come back later for the results. te10 run 07_cluster_submit_and_collect.py submit my-cluster te10 run 07_cluster_submit_and_collect.py collect """ import sys from te10_studio import api as em prj = em.Project.open("wr90.te10") # made by 01_waveguide.py if sys.argv[1:2] == ["submit"]: job = prj.setups["S1"].submit(backend=sys.argv[2], cores=64, walltime="01:00:00") print("submitted:", job) prj.save("wr90.te10") # remembers the job else: for job in prj.jobs(): print(job, job.status().value) if job.state.value == "completed": print(" ", job.result().write_touchstone(f"{job.record.name}.s2p")) prj.save("wr90.te10") ``` ## Raw solver settings `08_palace_overrides.py`: Palace options the API doesn't expose, merged into the generated configuration. ```python """Settings the API doesn't expose yet: raw Palace JSON merged into the generated config.""" from te10_studio import api as em prj = em.Project.open("wr90.te10") # made by 01_waveguide.py setup = prj.setups["S1"] setup.palace_overrides = {"Solver": {"Linear": {"Tol": 1e-8, "MaxIts": 400}}} res = setup.solve(cores=4) print(res.s_parameters().get_db(2, 1)) ``` --- # Reference Generated from the source of API version `0.1.0`. Type shorthands: `Value` = a number (project units for lengths, GHz for frequencies) or a string with units or an expression; `Vec3` = three `Value`s; `Faces` = one `FaceRef` or a list of them. Methods that change an `Object` return it. Exported by `te10_studio.api`: `API_VERSION`, `ClusterProfile`, `clusters`, `Job`, `JobSpec`, `JobState`, `Object`, `Project`, `Result`, `Setup`. ## Project A model you build, solve and post-process from Python. The same `.te10` files as the GUI, so a scripted model opens in the app and the other way round. Results go in `.te10results` next to the saved file. Attributes: `modeler`, `variables`, `materials`, `boundaries`, `excitations`, `mesh`, `setups`, `compute`, `picks`, `wcs`. - `Project(name: str = "Project", units: str = "mm")` - `name` *property* - `units` *property* - `core` *property*: The underlying project object (internal API; may change between versions). - `from_palace(config_path: str, name: Optional[str] = None) -> Project` *classmethod*: A project from a Palace model: the configuration (.json) and the mesh it names, rebuilt as geometry with its materials, boundaries, ports and setup (te10_studio/importers/palace_importer.py). What could not be carried over is in `prj.import_notes`. - `open(path: str) -> Project` *classmethod* - `attach(core: TE10Project, on_change=None) -> Project` *classmethod*: Wraps a project that is open in the GUI (the Python console's `prj`). - `overlap_rule` (settable) *property*: Which of two overlapping objects with equal priority owns the overlap: "earlier" (the one created first; the default) or "later" (the newer one, as when a shape is inserted). - `save(path: str) -> str`: Saves the .te10; later solves keep their results in .te10results next to it. - `validate() -> List[str]`: Validation errors (empty when the model is ready to solve). - `sweep(values: Dict[str, Iterable], setup: Union[str, Setup, None] = None, backend="local", cores: Optional[int] = None, **resources) -> Job`: Parametric sweep over the Cartesian product of variable values, e.g. prj.sweep({"w": ["2mm", "3mm", "4mm"]}, "S1", backend="my-slurm") (a job array on schedulers). - `jobs() -> List[Job]`: Saved jobs (also those started from the GUI), to check or collect after reopening. ## Variables (`prj.variables`) prj.variables["w"] = "3mm"; prj.variables["w"] -> 0.003 (SI). - `__setitem__(name: str, expression: Union[str, float])` - `__getitem__(name: str) -> float` - `__delitem__(name: str)` - `__contains__(name: str) -> bool` - `expression(name: str) -> str` - `items()` - `dataset(name: str, points=None)`: prj.variables.dataset("er", [(1e9, 4.4), (10e9, 4.2)]) defines a dataset (SI numbers), used in expressions as pwl(er, x); without points, returns the stored points. ## Materials (`prj.materials`) prj.materials["copper"]; prj.materials.add("Rogers4003", permittivity=3.55, loss_tangent=0.0027). - `__getitem__(name: str)` - `names() -> List[str]` - `add(name: str, permittivity: float = 1.0, permeability: float = 1.0, conductivity: float = 0.0, loss_tangent: float = 0.0, is_pec: bool = False, djordjevic_sarkar_at: Union[str, float, None] = None, ds_f_low: Union[str, float] = 1000.0, ds_f_high: Union[str, float] = 1000000000000.0, ds_sigma_dc: float = 0.0)`: A material. `djordjevic_sarkar_at` (a frequency: "1GHz", or a number in GHz) makes it frequency-dependent: `permittivity` and `loss_tangent` are then the values at that frequency, and the Djordjevic-Sarkar model (poles between `ds_f_low` and `ds_f_high`, in Hz unless given with a unit, plus an optional DC conductivity in S/m) gives them elsewhere. - `set_roughness(name: str, model: Optional[str], radius: Value = None, surface_ratio: Optional[float] = None, area_ratio: float = 1.0, rms: Value = None)`: Surface roughness of a metal: every conductivity surface made from it (solids of this material) gets it. `model` "huray", "hammerstad", "groisse" or None (smooth); the other arguments as for boundaries.conductivity. - `import_amat(path: str) -> List[str]`: Adds the materials in an Ansys Electronics Desktop library (.amat). Returns the names added (a name already used by a different material gets a numbered suffix). - `import_mtd(*paths: str) -> List[str]`: Adds the materials of CST material files (.mtd). Returns the names added. - `export_mtd(folder: str, names: Optional[Sequence[str]] = None) -> List[str]`: Writes materials (all of the project's, or `names`) as CST material files (.mtd), one per material, into `folder`. Returns warnings. - `export_amat(path: str, names: Optional[Sequence[str]] = None) -> List[str]`: Writes materials (all of the project's, or `names`) as an .amat library. Returns warnings. ## Modeler (`prj.modeler`) prj.modeler: create and look up objects. Positions and sizes in project units. - `__getitem__(name: str) -> Object`: An object by name, or by "folder:name". - `__contains__(name: str) -> bool` - `__iter__() -> Iterator[Object]` - `names() -> List[str]` - `folders() -> List[str]`: Every model folder ("a/b"), parents before children. - `new_folder(path: str) -> str`: Creates a folder (and its parents); returns its canonical path. - `rename_folder(old: str, new: str) -> str`: Renames or moves a folder with everything in it. - `delete_folder(path: str, delete_objects: bool = False) -> List[str]`: Removes a folder; its objects are deleted, or (by default) move up to the parent folder. - `in_folder(path: str, recursive: bool = True) -> List[Object]`: The objects in a folder (and its subfolders when `recursive`). - `box(name: str, size: Vec3, origin: Vec3 = (0, 0, 0), material: str = "vacuum", priority: int = 0) -> Object`: Box with a corner at `origin` and edge lengths `size` (negative sizes extend the other way). - `cylinder(name: str, radius: Value, height: Value, origin: Vec3 = (0, 0, 0), axis: str = "z", material: str = "vacuum", priority: int = 0) -> Object`: Cylinder whose base circle is centered at `origin`, extending `height` along `axis`. - `sphere(name: str, radius: Value, center: Vec3 = (0, 0, 0), material: str = "vacuum", priority: int = 0) -> Object` - `rectangle(name: str, size: Vec3, origin: Vec3 = (0, 0, 0), plane: str = "xy", material: str = "vacuum") -> Object`: Rectangular sheet with a corner at `origin` in the XY / YZ / ZX plane (size: the two in-plane lengths). - `circle(name: str, radius: Value, center: Vec3 = (0, 0, 0), plane: str = "xy", material: str = "vacuum") -> Object` - `cone(name: str, bottom_radius: Value, top_radius: Value, height: Value, origin: Vec3 = (0, 0, 0), axis: str = "z", material: str = "vacuum", priority: int = 0) -> Object`: Cone (or truncated cone) whose base circle (`bottom_radius`) is centered at `origin`, extending `height` along `axis` to the top circle (`top_radius`, 0 for a point). - `torus(name: str, major_radius: Value, minor_radius: Value, center: Vec3 = (0, 0, 0), axis: str = "z", material: str = "vacuum", priority: int = 0) -> Object`: Torus centered at `center`, its ring around `axis`. - `loft(name: str, profiles: Sequence[Object], ruled: bool = False, material: str = "vacuum", priority: int = 0) -> Object`: A solid through two or more sheets (or closed curves), in order; it follows later profile edits. - `polyline(name: str, points: Sequence[Vec3], closed: bool = False, cover: bool = False, material: str = "vacuum") -> Object`: Straight segments through `points` (a curve, for paths and sweeps). `closed` joins the last point to the first; `cover` also fills it, making a planar sheet. Points may use variables. - `add(name: str, shape, material: str = "vacuum", priority: int = 0, kind: Optional[str] = None) -> Object`: Adds any build123d shape, drawn in project units (it is scaled to meters). Use build123d for anything the primitives above don't cover: sketches, lofts, sweeps, fillets, imports. - `import_step(path: str, material: Optional[str] = None, heal: bool = True, unit: str = "mm") -> List[Object]`: Imports a CAD file: STEP or IGES (their own units are honored), BREP or STL (no unit in the file: `unit`, default mm). Its solids, and any surfaces that don't close as sheets. `heal` repairs the file first (sewing, small defects). `material` overrides the guess from the names. STL triangles in one plane are merged into single faces; curved surfaces stay faceted. - `import_cad(path: str, material: Optional[str] = None, heal: bool = True, unit: str = "mm") -> List[Object]`: Imports a CAD file: STEP or IGES (their own units are honored), BREP or STL (no unit in the file: `unit`, default mm). Its solids, and any surfaces that don't close as sheets. `heal` repairs the file first (sewing, small defects). `material` overrides the guess from the names. STL triangles in one plane are merged into single faces; curved surfaces stay faceted. - `import_gds(path: str, layers: Dict[Any, Dict[str, Any]], cell: Optional[str] = None, substrates=(("Silicon", "525um"),), vacuum_above: Value = "500um", vacuum_below: Value = 0, margin: Value = 0, min_edge: Value = "1um") -> List[Object]`: Imports a GDSII / OASIS layout as a 3D chip (te10_studio/importers/gds_importer.py). `layers` maps (layer, datatype) (or "L1/0") to a dict of GdsLayerRole fields: role ('metal', 'solid', 'outline', 'ignore'), negative, z, thickness (lengths as values or strings like "200nm"), material, boundary ('PEC', 'Conductivity', 'None'), film_thickness. Layers left out are ignored. `substrates`: (material, thickness) top first, below z = 0. `min_edge`: outline points closer than this are merged, sharp corners kept (0 = exact; arcs exported as tiny segments otherwise force tiny mesh elements). - `import_mesh(path: str, unit: str = "mm") -> List[Object]`: A volume mesh (.msh, .vtu, ...) as geometry: a solid per region, sheets for inner tagged surfaces, and a named selection per tagged surface (te10_studio/importers/mesh_importer.py). ## Object A solid, sheet or curve in the model. Lengths read and written in project units. - `name` (settable) *property* - `kind` *property*: 'solid', 'sheet', 'wire' or 'point'. - `shape` *property*: The build123d shape (meters). - `material` (settable) *property*: Material name ("(protected)" for locked parts of an encrypted 3D model). - `solve_inside` (settable) *property*: Whether the field is solved inside this object (meshed, with the material's conductivity as a volume loss). Default: off for PEC and conductors (sigma >= 1e5 S/m: a surface impedance on their faces instead), on for everything else. Set True/False to override, None for the default; assigning a material resets it to the default. - `priority` (settable) *property*: Mesh priority: where objects overlap, the higher one wins. - `folder` (settable) *property*: The model folder the object is in ("a/b"; "" = top level). Setting it moves the object, creating the folder if needed. - `qualified_name` *property*: "folder/sub:name", the name with its folder ("name" at the top level). - `model` (settable) *property*: False for construction geometry (not meshed). - `history` *property* - `volume` *property* - `area` *property* - `bounding_box() -> Tuple[Tuple[float, float, float], Tuple[float, float, float]]` - `faces(normal: Optional[str] = None) -> List[FaceRef]`: All faces, or the planar faces whose normal points along `normal` ('z', '+x', '-y', ...). - `face(selector: Optional[str] = None, nearest: Optional[Vec3] = None, index: Optional[int] = None) -> FaceRef`: One face: face("+z") is the face on the +z side (largest z, normal +z); face(nearest=(x, y, z)) the face closest to a point (project units); face(index=i) by index. - `move(vector_: Vec3) -> Object` - `rotate(axis: str, angle_deg: Value) -> Object` - `mirror(origin: Vec3, normal: Sequence[float]) -> Object` - `subtract(*tools: Object, keep_tools: bool = False) -> Object` - `shell(thickness: Value, inside: bool = True, open_faces: Sequence[FaceRef] = ()) -> Object`: Hollows the solid: walls `thickness` thick inside (or outside) its surface; `open_faces` (e.g. [obj.face("+z")]) are removed. - `trace(name: str, width: Value, thickness: Value, material: str = "copper") -> Object`: A trace of `width` x `thickness` along this curve (it follows later edits of the curve). - `insert() -> List[Object]`: Cuts this solid out of every solid it overlaps (it stays whole); returns the changed objects. - `unite(*tools: Object) -> Object` - `intersect(*tools: Object) -> Object` - `delete() -> None` - `sweep_along_vector(vector_: Vec3) -> Object`: Extrudes a sheet (into a solid) or a curve (into a sheet) along `vector_`. - `sweep_around_axis(axis: str, angle_deg: Value = 360) -> Object`: Revolves a sheet or a curve about the global X, Y or Z axis. - `sweep_along_path(path: Object) -> Object`: Sweeps a sheet or a curve along another object, a curve (e.g. from `modeler.polyline`). - `thicken(thickness: Value) -> Object`: Turns a sheet into a solid of the given thickness (negative: to the other side). - `cover() -> Object`: Fills a closed planar curve, making it a sheet. ## Boundaries (`prj.boundaries`) prj.boundaries.pec / pmc / radiation / conductivity / impedance / periodic. - `pec(name: str, faces: Faces = None, object: Optional[Object] = None)` - `pmc(name: str, faces: Faces = None, object: Optional[Object] = None)` - `radiation(name: str, faces: Faces = None, object: Optional[Object] = None)`: Absorbing boundary; object=airbox puts it on every face of the air region. - `conductivity(name: str, conductivity: float, faces: Faces = None, object: Optional[Object] = None, thickness: Value = None, roughness: Optional[str] = None, radius: Value = None, surface_ratio: Optional[float] = None, area_ratio: float = 1.0, rms: Value = None)`: Lossy metal surface. `roughness` adds surface roughness: "huray" (nodule `radius` and `surface_ratio` = N·4πa²/A_hex, optional `area_ratio` = A_matte/A_flat), or "hammerstad" / "groisse" (RMS roughness `rms`). Lengths take project units or a unit ("0.5um"). - `impedance(name: str, rs: float = 0.0, ls: float = 0.0, cs: float = 0.0, faces: Faces = None, object: Optional[Object] = None)` - `periodic(name: str, primary: FaceRef, secondary: FaceRef, phase_deg: float = 0.0)`: Periodic pair: `secondary` must be a translated copy of `primary` (e.g. the -x and +x faces of a unit cell). `phase_deg` is the phase delay of the secondary face relative to the primary. ## Excitations (`prj.excitations`) prj.excitations.wave_port / lumped_port / plane_wave. The first port added is excited. - `wave_port(name: str, faces: Faces, modes: int = 1, active: Optional[bool] = None, impedance: float = 50.0, ground: Sequence[str] = (), signal: Sequence[str] = (), deembed: Value = None, renormalize: Optional[float] = None, line: Optional[Sequence[Vec3]] = None, terminals: Optional[Sequence[Sequence[Vec3]]] = None, results: str = "modal")`: A wave port. `line`: the integration line [signal point, ground point] on the port face; or `ground` / `signal`: conductor object names it is drawn between (either is needed for Z_PV and renormalising). `deembed`: distance ("5mm" or meters) the reference plane moves into the model; `renormalize`: impedance in ohms the results are referenced to. Several conductors (`modes` > 1): `results="terminal"` gives one S-parameter port per terminal (a terminal solution; differential pairs then follow from mixed-mode conversion) instead of one per mode. The terminals are `terminals`, one line [signal point, ground point] per mode, or else one per `signal` conductor over the `ground` ones. Terminals are named _T1, ... - `lumped_port(name: str, faces: Faces, resistance: float = 50.0, direction: str = "+X", active: Optional[bool] = None, renormalize: Optional[float] = None)` - `floquet_port(name: str, face: FaceRef, active: Optional[bool] = None, polarization: str = "TE", max_order: int = 1, theta: float = 0.0, phi: float = 0.0, reference_frequency: Value = 0)`: A plane-wave port on a periodic unit cell's boundary face (needs periodic boundaries). The excited port's incidence (theta from the normal, phi in the port plane, degrees) holds at `reference_frequency` (default: the sweep centre) and scales with frequency. - `plane_wave(name: str, theta: float = 0.0, phi: float = 0.0, polarization="theta", amplitude: Value = 1.0, direction: Optional[Sequence[float]] = None)`: An incident plane wave arriving from (theta, phi) in degrees, or travelling along `direction` ([kx, ky, kz]). `polarization`: "theta" / "phi" (with angles), an angle in degrees from theta-hat towards phi-hat, or an E-field vector. `amplitude` in V/m ("2V/m" or a number). Needs a first-order radiation boundary around the model and TE10's Palace build. - `discrete_port(name: str, start: Vec3, end: Vec3, width: Value = None, resistance: float = 50.0, active: Optional[bool] = None)`: A lumped port on a narrow strip (default: a tenth of the gap wide) between two points; the current runs from `start` to `end`. ## MeshOperations (`prj.mesh`) prj.mesh.length_on / length_inside / skin_depth / surface_approximation: controls on the initial mesh. `objects=` takes objects (or their names); lengths take units like the modeler. - `__getitem__(name: str)` - `names() -> List[str]` - `__delitem__(name: str)` - `length_on(max_length: Value, faces: Faces = None, objects=None, name: Optional[str] = None)`: No surface triangle on the faces (or on the surface of the objects) longer than max_length. - `length_inside(max_length: Value, objects, name: Optional[str] = None)`: No element inside the objects longer than max_length. Non-model objects are refinement regions. - `skin_depth(faces: Faces = None, objects=None, layers: int = 2, max_length: Value = None, skin_depth: Value = None, name: Optional[str] = None)`: Conductor surface refinement; skin_depth=None computes it from the material and frequency. - `surface_approximation(faces: Faces = None, objects=None, max_deviation: Value = None, normal_deviation_deg: float = 15.0, max_length: Value = None, name: Optional[str] = None)`: Shorter elements on curved faces: facets within max_deviation (sag) and the normal angle. ## Setups (`prj.setups`) - `__getitem__(name: str) -> Setup` - `names() -> List[str]` - `driven(name: str, start: Value, stop: Value, step: Value = None, points: Optional[int] = None, sweep: str = "uniform", order: int = 2, cores: int = 4, linear_tol: Optional[float] = None, save_fields: str = "solution", far_field: str = "solution", min_solved: Value = None) -> Setup`: Frequency sweep; numbers are GHz ("2.4GHz" / "800MHz" also work). start = 0 gives a fitted DC point: Palace solves down to `min_solved` (default: chosen from the model) and the 0 Hz S-matrix is fitted from the lowest solves (te10_studio.solver.dc_point). sweep: 'uniform', 'adaptive' (Palace's reduced model) or 'interpolating' (a few dozen solves, S-parameters fitted); the older 'adaptive-ports' and 'adaptive-exact-ports' mean 'adaptive'. linear_tol: Palace's iterative-solver tolerance (default: the setup default). save_fields / far_field: 'solution' (at the solution frequency only, from the last adaptive pass: the default), 'all' (every sweep point: slow, and fields take a full set per point and excitation) or 'none'. - `eigenmode(name: str, modes: int = 5, target: Value = "1GHz", order: int = 2, cores: int = 4) -> Setup` ## Setup A solve setup. `solve()` runs it (locally by default) and returns the Result. - `core` *property* - `palace_overrides` (settable) *property*: Raw Palace JSON deep-merged into the generated config (still schema-checked). - `submit(backend: Union[str, object] = "local", cores: Optional[int] = None, name: Optional[str] = None, variations: Optional[List[Dict[str, str]]] = None, max_cost: Optional[float] = None, over_budget: bool = False, **resources) -> Job`: Packages the model and starts the solve without waiting. `backend`: "local", a cluster profile name (or ClusterProfile), "skypilot", or ("export", "", ""). `resources` override JobSpec fields (nodes, walltime, partition, account, modules, container...). - `estimate(backend: Union[str, object] = "skypilot") -> str`: What a cloud solve would run on (machine, price per hour, model size, time limit and cap), without starting it. The time and cost estimate is given on the Job once it has started. - `solve(backend: Union[str, object] = "local", cores: Optional[int] = None, timeout: Optional[float] = None, poll: float = 2.0, max_cost: Optional[float] = None, over_budget: bool = False, **resources) -> Result`: Runs the setup, waits for it, and returns its Result. ## Job A submitted solve (local, cluster or cloud). Results are per case (several for sweeps). - `state` *property* - `status() -> JobState` - `wait(poll: float = 5.0, timeout: Optional[float] = None) -> JobState` - `logs(lines: int = 200) -> str` - `cancel() -> None` - `fetch() -> str` - `cleanup() -> None`: Deletes a cloud job's machine (a stopped machine still keeps its disk). Done automatically once results() has downloaded a cloud job; call it for a failed or cancelled one. - `results(fetch: bool = True) -> List[Result]`: One Result per case, in sweep order. Downloads remote results first (fetch=True). - `result() -> Result` ## Result Palace output of one case (`postpro/` inside `folder`). - `postpro` *property* - `s_parameters()`: te10_studio.postprocess.sparams.SParameterResult (|S| in dB, phase in degrees, f in GHz). - `network(z0: float = 50.0, raw: bool = False)`: S-parameters as a scikit-rf Network, with the ports' de-embedding and renormalisation applied (as the S-parameter window shows them) unless `raw`. The same conversion the S-parameter window uses (te10_studio.postprocess.networks). - `write_touchstone(path: str, z0: float = 50.0) -> str` - `rlgc(length_m: float, near_ports=None, far_ports=None, z0: float = 50.0)`: Per-metre R, L, G, C of the solved line (te10_studio.postprocess.rlgc_from_s): the network must have a port at each end of each conductor, near ends first unless the port lists say otherwise (1-based, conductor order). - `write_rlgc_csv(path: str, length_m: float, near_ports=None, far_ports=None) -> str` - `eigenmodes() -> List[Tuple[float, float]]`: [(frequency in GHz, Q), ...] from an eigenmode solve. - `rcs()`: te10_studio.postprocess.rcs.RCSResult of a plane-wave solve (bistatic / monostatic RCS). - `farfield()`: te10_studio.postprocess.farfield.FarFieldResult of an antenna solve: directivity, gain and realized gain patterns (`.pattern(freq_ghz, excitation)`). - `fields()`: te10_studio.postprocess.fields.FieldSolution: saved field data (any problem type). - `log() -> str` ## Picks (`prj.picks`) The pick list. Points, edges and faces picked here are what `prj.wcs.align()` uses, as in the GUI: - `__iter__()` - `point(xyz: Vec3) -> Pick`: A point given by coordinates (project units, "3mm", or expressions). - `vertex(obj: Union[str, Object], index: int) -> Pick` - `edge_center(obj: Union[str, Object], index: int) -> Pick` - `circle_center(obj: Union[str, Object], index: int) -> Pick` - `face_center(face: Union[FaceRef, str, Object], index: Optional[int] = None) -> Pick` - `edge(obj: Union[str, Object], index: int) -> Pick` - `face(face: Union[FaceRef, str, Object], index: Optional[int] = None) -> Pick`: A face: a face reference such as `obj.face("+z")`, or an object and a face index. - `distance() -> float`: Distance between the last two picked points (or a newest edge pick's ends), in project units. - `clear()` ## WCS (`prj.wcs`) The local working coordinate system. While it is on, new objects are placed in it: positions given to the modeler are in its axes. Objects keep their place when the working CS moves later. - `active` *property* - `on()` - `off()` - `matrix` *property*: 4x4 global frame (columns X, Y, Z, origin in meters). - `origin` *property* - `align()`: Aligns to the newest picks (a face, a straight edge, or 1-3 points) and clears them, like the GUI's Align Working CS. - `align_to_face(face: FaceRef)` - `align_to_points(*points: Vec3)` - `move(u: Value = 0, v: Value = 0, w: Value = 0)`: Moves along the working CS's own axes. - `rotate(u: Value = 0, v: Value = 0, w: Value = 0)`: Rotates about the working CS's own U, then V, then W axis (degrees). - `store(name: Optional[str] = None) -> str` - `reset()` ## Compute (`prj.compute`) prj.compute["my-slurm"] -> the cluster profile of that name (Analysis > Cluster Profiles). - `__getitem__(name: str)` - `names() -> List[str]` ## JobState `em.JobState`: `PREPARED` (`"prepared"`), `PENDING` (`"pending"`), `RUNNING` (`"running"`), `COMPLETED` (`"completed"`), `FAILED` (`"failed"`), `CANCELLED` (`"cancelled"`), `UNKNOWN` (`"unknown"`). ## JobSpec `em.JobSpec` fields (resources for `submit()`): `ranks` = `4`, `nodes` = `1`, `threads_per_rank` = `1`, `walltime` = `'04:00:00'`, `memory_gb` = `0`, `partition` = `''`, `account` = `''`, `modules` = `[]`, `container` = `''`, `palace_bin` = `'palace'`, `mpirun_bin` = `'mpirun'`, `extra_directives` = `[]`, `parallel_env` = `''`, `tasks_per_node` = `False`. ## clusters (`em.clusters`) - `add_cluster(target: str, name: str = "", partition: str = "", account: Optional[str] = None, scratch: str = "", solver: str = "", identity_file: str = "", jump_host: str = "", key_login: bool = False, test: bool = True, askpass: str = "", interactive: bool = False, log: Callable[[str], None] = print) -> Tuple[ClusterProfile, bool, str]`: Connects to `target` ("user@host", or an ~/.ssh/config alias), finds what the cluster offers, runs the test solve and saves the profile. Returns (profile, ok, message); the profile is saved only when the test passed (or `test` is False). - `load_profiles(path: Optional[str] = None) -> List[ClusterProfile]` - `get_profile(name: str, profiles=None) -> ClusterProfile` - `test_cluster(profile: ClusterProfile, askpass: str = "", interactive: bool = False, log: Callable[[str], None] = print, two_nodes: bool = False) -> Tuple[bool, str]`: The test solve. `two_nodes`: the solve across two nodes instead (checks MPI between nodes). - `refresh_cluster(name: str, askpass: str = "", interactive: bool = False) -> ClusterProfile`: Probes the cluster again and stores its current queues (limits and node sizes change). - `remove_cluster(name: str) -> None` - `export_shared(profile: ClusterProfile, path: str) -> str`: Writes `profile` as a .te10cluster file. The user's name in the scratch path becomes $USER. - `add_shared(path: str, user: str = "", name: str = "", account: str = "", test: bool = True, askpass: str = "", interactive: bool = False, log: Callable[[str], None] = print) -> Tuple[ClusterProfile, bool, str]`: Adds the cluster a .te10cluster file describes for `user`, with the test solve. - `here_profile(log: Callable[[str], None] = print) -> ClusterProfile`: `--backend here`: for a user working on the cluster's login node itself. The scheduler and its queues are read from this machine (no SSH), jobs go in the scratch space found here. Not saved: a saved cluster named "here" takes its place. ## postprocess.networks `from te10_studio.postprocess import networks` - `as_parameter(ntwk: skrf.network.Network, param: str) -> skrf.network.Network`: A copy whose `s` holds another parameter set (Z, Y, ABCD, T), so the quantities apply to it. - `cascade(a: skrf.network.Network, b: skrf.network.Network) -> skrf.network.Network`: 2-port a followed by b (frequencies interpolated onto a's grid when they differ). - `causality(ntwk: skrf.network.Network, window: str = "hamming") -> Dict[Tuple[int, int], float]`: Fraction of each S_ij's impulse-response energy at negative time (after extrapolating to DC). A causal response has almost none; more than ~1 % points at a non-causal model, too coarse a sweep or a too-narrow band. A non-uniform sweep is resampled first (from_dc_uniform). - `checks(ntwk: skrf.network.Network, tol: float = 1e-06) -> Checks` - `dc_extrapolation_note(ntwk: skrf.network.Network) -> Optional[str]`: A warning when `ntwk` has no 0 Hz point and too few points close to DC to extrapolate it: the DC S-matrix extrapolated from the two lowest frequencies and from the next two differ by more than DC_SPREAD_WARN (the response bends too much below the data), or there are fewer than three frequencies. None when the data is fine. - `deembed_fixtures(ntwk: skrf.network.Network, left: Optional[skrf.network.Network] = None, right: Optional[skrf.network.Network] = None) -> skrf.network.Network`: A 2-port measured or simulated through fixtures: DUT = left⁻¹ · total · right⁻¹ (frequencies interpolated onto the total's grid). The right fixture is given port 1 towards the DUT. - `edge_rise_ps(f_max_hz: float, edge: Edge) -> Tuple[Optional[float], bool]`: (rise time actually used in ps, True if the requested one was faster than the sweep allows and was clamped). (None, False) for a windowed step. - `enforce_passivity(ntwk: skrf.network.Network, margin: float = 1e-06) -> skrf.network.Network`: Clips every singular value of S above 1 to 1 - margin, frequency by frequency (the smallest change in the 2-norm that makes S passive). Frequencies that are already passive are left untouched. - `entries(ntwk: skrf.network.Network) -> List[Tuple[int, int]]`: Every (i, j) with data. - `extrapolate_to_dc(ntwk: skrf.network.Network, points: Optional[int] = None) -> skrf.network.Network`: Uniform grid starting at DC, as time-domain transforms need. - `from_dc_uniform(one: skrf.network.Network, kind: str = "cubic") -> skrf.network.Network`: `one` on a uniform grid starting at 0 Hz, as a time transform needs: a uniform sweep without DC is extrapolated to DC; a non-uniform one (a log or adaptive sweep) is first resampled onto a uniform grid with the step of its coarse end (the 90th percentile of its steps), at most MAX_TIME_POINTS points. - `from_palace_csv(path: str, name: Optional[str] = None, z0: float = 50.0) -> Optional[skrf.network.Network]` - `from_result(result: SParameterResult, name: str = "Simulation", z0: float = 50.0) -> skrf.network.Network`: An N-port Network from parsed Palace output. Missing S_ji are filled from S_ij (reciprocal structures); entries with no data on either side stay NaN. - `group_delay(ntwk: skrf.network.Network, i: int, j: int) -> numpy.ndarray`: -d(phase)/dω in seconds, from the unwrapped phase. - `interpolate(ntwk: skrf.network.Network, f_start_ghz: float, f_stop_ghz: float, points: int, kind: str = "linear") -> skrf.network.Network` - `load_touchstone(path: str) -> skrf.network.Network` - `min_rise_time_ps(f_max_hz: float, definition: str = "10-90") -> float`: The fastest rise time a sweep up to f_max can show. Gaussian edges are down to RISE_TIME_EDGE at f_max: 10-90 % about 0.875 / f_max (55 ps for 16 GHz), 20-80 % about 0.575 / f_max. A 0-100 % ramp: 1 / f_max (the first null of its sinc spectrum at the top frequency). - `mixed_mode(ntwk: skrf.network.Network, pairs: Optional[List[Tuple[int, int]]] = None) -> skrf.network.Network`: Single-ended ports to mixed-mode (differential / common). `pairs` are (positive, negative) port numbers, default (1,2), (3,4), ... . The result's ports are D1..DP, C1..CP, then any unpaired single-ended ports in their original order. Reference impedances: 2·z0 differential, z0/2 common. - `mixed_mode_labels(npairs: int, nsingles: int) -> List[str]` - `mu_factor(ntwk: skrf.network.Network) -> numpy.ndarray` - `parse_pairs(text: str) -> List[Tuple[int, int]]`: "1-2, 3-4" (or "1:2 3:4") -> [(1, 2), (3, 4)]. - `port_extension(ntwk: skrf.network.Network, lengths_m: Dict[int, float], eps_eff: float = 1.0) -> skrf.network.Network`: Moves reference planes by lossless line lengths (positive = into the device, i.e. de-embeds feed line). S_ij gains exp(+jβ(l_i + l_j)), with β = 2πf·√ε_eff / c. - `renormalize(ntwk: skrf.network.Network, z0) -> skrf.network.Network` - `rise_time_filter(f_hz: numpy.ndarray, rise_time_ps: float, definition: str = "10-90") -> numpy.ndarray`: Spectrum of the edge that gives a step the rise time `rise_time_ps` under `definition`: a Gaussian (centred on t = 0) or a linear ramp from -T/2 to T/2 (sinc). - `tdr(s_reflection: numpy.ndarray, frequency_hz: numpy.ndarray, z_ref: float, edge: Edge = Edge(kind="rise", rise_ps=None, definition="10-90", window="hamming")) -> Tuple[numpy.ndarray, numpy.ndarray]`: (t in ns, impedance in ohm) of a ready-made complex reflection (single-ended or a mixed-mode term from postprocess.channel) referenced to `z_ref`, for the edge `edge` (a too-fast rise time is clamped to the fastest the sweep supports; see edge_rise_ps). - `tdr_view_range(t: numpy.ndarray, z: numpy.ndarray, rise_ns: float, round_trip_ns: Optional[float] = None) -> Tuple[float, float, float, float]`: (t0, t1, z_lo, z_hi): the part of a TDR trace worth showing. Start: back from t = 0 until the trace has sat within 0.5 % of its pre-edge level for one rise time. End, with the structure's round trip (2 x through delay): from the round trip on, until the trace stays within 1 % of its final level for 2 rise times, capped at 1.5 x the round trip (later ringing / aliasing is not shown). One-sided data: the last time |dZ/dt| exceeds 2 % of its peak, plus 3 rise times. Impedance: the data in that range with 8 % margin, at least 10 ohm. - `time_response(ntwk: skrf.network.Network, i: int, j: int, kind: str = "impulse", window: str = "hamming", gate: Optional[Tuple[float, float]] = None, rise_time_ps: Optional[float] = None, rise_definition: str = "10-90") -> Tuple[numpy.ndarray, numpy.ndarray]`: (time in ns, response) of S_ij: "impulse" or "step" response, or "tdr" (the step reflected from port i as impedance in ohm, Z = Z0 (1 + rho) / (1 - rho), i = j), after extrapolating to DC. `gate` = (center_ns, span_ns) applies a time gate first. `rise_time_ps` shapes the excitation as an edge with that rise time under `rise_definition` ("10-90", "20-80" or "0-100"), as a TDR instrument's (the window is then not used: the edge already rolls the spectrum off); it can't be faster than min_rise_time_ps(f_max, rise_definition). - `trace(ntwk: skrf.network.Network, quantity: str, i: int, j: int, param: str = "S") -> Tuple[numpy.ndarray, numpy.ndarray]`: (frequency in GHz, values) for one entry. - `vswr(ntwk: skrf.network.Network, i: int, j: int) -> numpy.ndarray` - `write_csv(ntwk: skrf.network.Network, path: str) -> str`: Frequency and every S_ij as dB and degrees, one row per frequency. - `write_touchstone(ntwk: skrf.network.Network, path: str, r_ref: float = 50.0, comment: Optional[str] = None) -> str`: Writes an .sNp file (the extension follows the port count). Returns the path written. Touchstone holds only real reference impedances: data referenced to complex port impedances (e.g. a waveguide's TE10 wave impedance) is renormalized to `r_ref` ohms on the way out. `comment` goes on a "!" line at the top. ## postprocess.channel `from te10_studio.postprocess import channel` - `auto_port_map(ntwk, pair_hint: Optional[Sequence[Tuple[int, int]]] = None) -> PortMap`: Port map detected from the S-matrix alone (see the module notes; port names are never used). Every group of through-connected ports (through_groups) is a channel: two ports are a line, side 1 = the lower-numbered end; more than two (a divider, a multiplexer) have the lowest port at side 1 and the others as its far ends; a port with no through is a one-sided channel of its own. Differential pairs are two lines that `pair_hint` ([(p, n), ...], either end) names, or else that couple clearly more to each other than to anything else (coupled_pairs). - `available(ntwk, pmap: PortMap, domain: Optional[str] = None) -> List[Measurement]`: The measurements this data supports (in registry order), optionally for one domain: by the port map, and for the time domain by the sweep (time_domain_ok). - `coupled_pairs(s: numpy.ndarray, far: Dict[int, int]) -> List[Tuple[int, int]]`: Differential pairs found from the coupling between lines (see PAIR_COUPLING_DB). - `curves(ntwk, pmap: PortMap, measurement: str, signals: Sequence[int], sides: Sequence[int], mode: Optional[str] = None, aggressors: str = "each") -> List[Curve]`: The curves of one frequency-domain (or Smith / polar) measurement. `aggressors`: "each", "psum" or "both" for NEXT / FEXT. x is frequency in GHz (Smith / polar: Re and Im of the term, with "f_ghz" and "s" in meta). - `default_mode(pmap: PortMap, measurement: str, signals: Optional[Iterable[int]] = None) -> Optional[str]` - `ends(pmap: PortMap, signal: int, side: int, letter: str) -> List[Tuple[str, Tuple[str, Tuple[int, ...]]]]`: The terminals of one end of a signal in one mode letter (S, D or C), with a short tag: every port separately for S (each leg of a pair), the pair for D and C. - `group_delay_s(f_hz: numpy.ndarray, s: numpy.ndarray) -> numpy.ndarray`: -d(phase)/dω in seconds. - `input_impedance(s: numpy.ndarray, zref: float) -> numpy.ndarray` - `line_coupling_db(s: numpy.ndarray, far: Dict[int, int]) -> Dict[Tuple[int, int], float]`: Coupling between every two through lines (keyed by their side-1 ports): the band-averaged |S| of the strongest of the four crosstalk terms (NEXT at either end, FEXT either way), in dB. - `mode_s(ntwk, pmap: PortMap, mode_out: str, sig_out: int, side_out: int, mode_in: str, sig_in: int, side_in: int) -> numpy.ndarray`: One mixed-mode term: response in mode `mode_out` ("S", "D" or "C") at signal/side `sig_out`, `side_out` for a stimulus `mode_in` at `sig_in`, `side_in`. For "S" on a pair the + leg is used. - `modes_available(pmap: PortMap, measurement: str, signals: Optional[Iterable[int]] = None) -> List[str]`: Mode keys offered for a measurement on the given signals (default: all). - `port_map_detected(pmap: PortMap) -> bool`: False when 3 or more ports show no through connection at all (every port is a channel of its own): nothing told the channels apart, so the user should check the map. - `power_sum(terms: Sequence[numpy.ndarray]) -> numpy.ndarray`: sqrt(sum |S_k|^2): the power-sum crosstalk of several aggressors. - `sides_available(pmap: PortMap, signals: Optional[Iterable[int]] = None) -> List[int]` - `signal_name(signal: int) -> str` - `skew_ps(ntwk, pmap: PortMap, signal: int, side_in: int = 1) -> numpy.ndarray`: Intra-pair skew (ps): delay of the + leg minus delay of the - leg, from their group delays. - `term_label(mode: str, out: Tuple[str, Tuple[int, ...]], inn: Tuple[str, Tuple[int, ...]], side_out: int, side_in: int) -> str` - `term_s(ntwk, out: Tuple[str, Tuple[int, ...]], inn: Tuple[str, Tuple[int, ...]]) -> numpy.ndarray`: a^T S b for the response terminal `out` and the stimulus terminal `inn`. - `terminal_zref(ntwk, term: Tuple[str, Tuple[int, ...]]) -> float`: Reference impedance of a terminal: Z0, 2 Z0 (differential) or Z0/2 (common). - `terms(ntwk, pmap: PortMap, kind: str, signals: Sequence[int], sides: Sequence[int], mode: str, victim_other: Optional[int] = None) -> List[Tuple[str, numpy.ndarray, dict]]`: Complex terms (label, values, meta) for kind "refl" (same end), "thru" (far end of the same signal), or "next"/"fext" (victim in `signals`, aggressor = every other signal, or only `victim_other`). `sides`: the driven sides. - `through_delay_ns(ntwk, pmap: PortMap, signal: int, mode: str = "SE") -> Optional[float]`: Median group delay (ns) of a signal's through term, side 1 to side 2; None if one-sided. - `through_groups(s: numpy.ndarray) -> List[List[int]]`: The ports of an S-matrix grouped by what is actually connected through (never by port names or numbering): each group is one net, a single port being one with no through to any other. Connections are read from the lowest 10 % of the band, where lines are short and crosstalk is weakest; ports left alone there (a DC block, a filter or waveguide whose passband is higher up) are tried again among themselves with the whole band. - `time_domain_ok(ntwk) -> bool`: Whether the sweep reaches low enough for a TDR (see TIME_DOMAIN_MAX_START). ## postprocess.monitors `from te10_studio.postprocess import monitors` - `evaluate(monitor: Monitor, indices: Dict[Tuple[float, ...], int], e_table: Optional[ProbeTable], b_table: Optional[ProbeTable], excitation: Optional[int] = None) -> Optional[MonitorResult]`: One monitor's result, or None when the run didn't probe its points. - `probe_indices(config: dict) -> Dict[Tuple[float, ...], int]`: Probe position -> index, from a run's Palace configuration. - `results_for(project, setup_name: Optional[str] = None, excitation: Optional[int] = None) -> Dict[str, Optional[MonitorResult]]`: Every probe / voltage / current monitor's result for a setup's last solve (None: not solved). ## rftools.tlines `from te10_studio.rftools import tlines` - `circ_waveguide_modes(d: float, er: float = 1.0, count: int = 8) -> List[Mode]` - `coax(d_inner: float, d_outer: float, er: float = 1.0) -> LineResult`: Coax with inner conductor diameter d_inner and outer (shield inner) diameter d_outer. - `coax_cutoff_te11(d_inner: float, d_outer: float, er: float = 1.0) -> float`: First higher-order mode (TE11) cutoff of a coax (approximation c / (π (a + b) √er)). - `coax_outer_diameter(z0: float, d_inner: float, er: float = 1.0) -> float` - `cpw(w: float, s: float, h: float, er: float, grounded: bool = False) -> LineResult`: Coplanar waveguide: centre strip w, gaps s, on a substrate of height h (finite). Without a bottom ground (`grounded=False`) the substrate is in air; with one, it is conductor-backed. Lateral grounds are wide. - `cpw_width(z0: float, s: float, h: float, er: float, grounded: bool = False) -> float` - `microstrip(w: float, h: float, er: float, t: float = 0.0, f: Optional[float] = None) -> LineResult`: Microstrip of width w on a substrate of height h and permittivity er, strip thickness t. With `f`, the effective permittivity includes dispersion (Kirschning-Jansen); Z0 is the static value either way. - `microstrip_width(z0: float, h: float, er: float, t: float = 0.0) -> float` - `rect_waveguide_modes(a: float, b: float, er: float = 1.0, count: int = 8) -> List[Mode]`: The lowest `count` TE / TM modes of an a×b rectangular waveguide (a ≥ b), by cutoff. - `skin_depth(f: float, sigma: float, mu_r: float = 1.0) -> float` - `stripline(w: float, b: float, er: float) -> LineResult`: Zero-thickness strip of width w centred between ground planes b apart (Cohn). - `stripline_width(z0: float, b: float, er: float) -> float` - `surface_resistance(f: float, sigma: float, mu_r: float = 1.0) -> float` - `synthesize_width(z0_target: float, analyse: Callable[[float], LineResult], scale: float) -> float`: The width w for which `analyse(w).z0 == z0_target` (impedance falls as w grows). `scale` is a typical length (the substrate height) bounding the search to scale/1000 .. 100·scale. - `waveguide_mode(fc: float, f: float, er: float = 1.0) -> Tuple[float, float, float]`: (β in rad/m, guided wavelength in m, TE wave impedance in ohm) above cutoff; ValueError below. - `wavelength(f: float, er: float = 1.0, mu_r: float = 1.0) -> float` ## rftools.builders `from te10_studio.rftools import builders` - `branchline_coupler(prj, f0: float = 2400000000.0, z0: float = 50.0, er: float = 4.4, h: float = 0.0016, tand: float = 0.0, feed_length: Optional[float] = None) -> BuildResult`: 90° hybrid: two Z0/√2 through arms and two Z0 branch arms, each λg/4 between junction centres; four Z0 feed lines to the board edges with wave ports. - `coax_section(prj, z0: float = 50.0, d_inner: float = 0.00127, er: float = 2.1, length: float = 0.02) -> BuildResult`: A coax section along z (outer conductor = the outer boundary) with wave ports at both ends. - `design_patch(f0: float, er: float, h: float, z0: float = 50.0) -> PatchDesign`: Rectangular patch dimensions and inset depth for a z0 feed (Balanis, transmission-line model). - `klopfenstein_profile(z1: float, z2: float, gamma_max: float, n: int) -> numpy.ndarray`: ln Z at n points along a Klopfenstein taper with passband ripple Γm (Pozar §5.9): ln Z(x) = ½ ln(Z1·Z2) + Γ0 / cosh A · A² φ(2x - 1, A), A = acosh(Γ0 / Γm). The design has small steps at both ends (from Z1 and to Z2), part of its optimum. - `microstrip_line(prj, z0: float = 50.0, er: float = 4.4, h: float = 0.0016, length: float = 0.03, f0: float = 5000000000.0, tand: float = 0.0, board_width: Optional[float] = None) -> BuildResult`: A straight microstrip test line on its board, with wave ports at both ends. - `patch_antenna(prj, f0: float = 2400000000.0, er: float = 4.4, h: float = 0.0016, tand: float = 0.02, z0: float = 50.0) -> BuildResult`: Inset-fed rectangular patch on a grounded substrate in a radiation box, fed by a wave port. - `quarter_wave_transformer(prj, z_source: float = 50.0, z_load: float = 100.0, f0: float = 2400000000.0, er: float = 4.4, h: float = 0.0016, tand: float = 0.0) -> BuildResult`: Source line (λg/4), the √(Zs·ZL) quarter-wave section, load line (λg/4); ports at both ends. - `taper_impedances(z1: float, z2: float, n: int, kind: str = "exponential", gamma_max: float = 0.02) -> numpy.ndarray` - `tapered_line(prj, z1: float = 50.0, z2: float = 100.0, length: float = 0.04, kind: str = "exponential", er: float = 4.4, h: float = 0.0016, f0: float = 3000000000.0, segments: int = 40, tand: float = 0.0, gamma_max: float = 0.02) -> BuildResult`: A smooth impedance taper (outline through `segments` points) with short uniform lines at both ends. - `waveguide_section(prj, size: str = "WR-90", length: float = 0.05, a: Optional[float] = None, b: Optional[float] = None, er: float = 1.0) -> BuildResult`: A rectangular waveguide section along z (walls = the outer PEC boundary) with wave ports at both ends. ## rftools.ports `from te10_studio.rftools import ports` - `add_line_port(prj, trace: str, kind: str = "microstrip", name: Optional[str] = None, **kw)`: plan_line_port + apply_port_plan in one call; returns (port, plan). - `apply_port_plan(prj, plan: PortPlan, name: Optional[str] = None, modes: int = 1, resistance: float = 50.0)`: Builds the plan: the air box (if any), the port sheet and the port. Returns the port. - `describe(plan: PortPlan) -> str`: A short readable summary of a plan (for dialogs and logs). - `line_model(kind: str, w: float, h: float, er: float, t: float = 0.0, s: Optional[float] = None, b: Optional[float] = None, f: Optional[float] = None) -> LineResult` - `plan_line_port(prj, trace: str, kind: str = "microstrip", end: str = "auto", port_type: str = "wave", w: Optional[float] = None, t: Optional[float] = None, h: Optional[float] = None, er: Optional[float] = None, s: Optional[float] = None, b: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, add_air: bool = True, f: Optional[float] = None) -> PortPlan`: Works out a port for the trace (nothing is changed). Lengths in meters. - `port_size(kind: str, w: float, h: float, er: float, s: Optional[float] = None, b: Optional[float] = None) -> Tuple[float, float, float]`: (width, height above the reference, depth below it) by the guidelines in the module docstring. The reference is the bottom ground (microstrip, stripline, grounded CPW) or the strip (CPW). ## rftools.catalog `from te10_studio.rftools import catalog` - `defaults(tool: Tool) -> Dict[str, Any]`: The tool's default values in SI (what the dialog starts with). - `ghz(x: float) -> str` - `mm(x: float) -> str` - `run(tool_id: str, prj, values: Optional[Dict[str, Any]] = None, build: bool = False) -> str`: Runs a tool from a script: `values` in SI override the defaults. - `si(kind: str, value)`: A dialog value in SI (mm -> m, GHz -> Hz). ## core.material_library `from te10_studio.core import material_library` - `categories() -> List[str]`: Every category path, sorted (parents not listed separately). - `cole_cole(p: Sequence[float], freq_hz: float) -> complex`: Gabriel's four-term Cole-Cole permittivity (e^{jwt}, eps' - j eps''). `p` is the IFAC row: eps_inf, sigma_i, then (d_eps, tau, alpha) with tau in ps, ns, us, ms. - `debye2(p: dict, freq_hz: float) -> complex`: Two-term Debye permittivity plus ionic conductivity (e^{jwt}). - `get(name: str) -> Optional[LibraryEntry]`: The library entry called `name` (case-insensitive), or None. - `lookup_material(name: str, freq_hz: float = 10000000000.0) -> Optional[Material]`: A Material for a library entry named `name` (None if there is no such entry). - `make_material(entry: LibraryEntry, freq_hz: float = 10000000000.0, dispersive: bool = False, name: Optional[str] = None) -> Material`: A project `Material` with `entry`'s values at `freq_hz`. - `search(text: str = "", category: str = "", conductors: Optional[bool] = None) -> List[LibraryEntry]`: Entries whose name/category/vendor/construction contain every word of `text`, inside `category` (a path prefix such as "PCB Laminates/Isola"). ## core.monitors `from te10_studio.core import monitors` - `add(project, monitor: Monitor) -> Monitor` - `current_loop(name: str, center: Sequence[float], normal: Sequence[float], radius: float, segments_: int = 36) -> Monitor`: A circle of `radius` around `center`; the current is positive along `normal` (right-hand rule). - `field_monitor(name: str, kind: str, frequency_hz: float) -> Monitor` - `from_list(project, data) -> None` - `monitors_of(project) -> Dict[str, Monitor]` - `path_length(points, closed: bool = False) -> float` - `probe(name: str, kind: str, point: Sequence[float]) -> Monitor` - `probe_entries(project) -> List[Dict[str, Any]]`: Palace "Probe" entries for every enabled probe, voltage and current monitor (deduplicated points). - `restrict_saves(driven: Dict[str, Any]) -> None`: Keeps only the "Save" frequencies that a run actually solves, after its samples were rewritten (a sub-band or a batch of points); Palace refuses a save frequency it doesn't sample. - `save_frequencies_hz(project, setup) -> List[float]`: Sweep frequencies the field monitors ask Palace to save fields at. - `segments(points: Sequence[Sequence[float]], closed: bool = False) -> List[Tuple[numpy.ndarray, numpy.ndarray]]`: (midpoint, step vector) of each segment of a polyline (closed: the last point joins the first). - `simpson_nodes(points, closed: bool = False) -> Tuple[List[numpy.ndarray], List[numpy.ndarray]]`: Nodes and weight vectors for ∫F·dl along a polyline with Simpson's rule on each segment: ∫F·dl ≈ Σ w_k · F(node_k). Nodes are the vertices and the segment midpoints. - `snap_frequency(freq_hz: float, sweep_hz: Sequence[float]) -> Optional[float]`: The sweep frequency nearest to `freq_hz` (fields can only be saved at solved frequencies). - `to_list(project) -> List[Dict[str, Any]]` - `unique_name(project, base: str) -> str` - `voltage_line(name: str, start: Sequence[float], end: Sequence[float], segments_: int = 20) -> Monitor`