# API Reference

Channel: development; package: 2.0.0rc1; source: 2c32b7cf79b796fae825bfa08fc73d9914e61723

Page: https://remilab.ai/rfx/api/
Source: https://github.com/bk-squared/rfx/blob/2c32b7cf79b796fae825bfa08fc73d9914e61723/docs/public/api/index.mdx

These pages describe the rfx API you should build on: the `Simulation` class,
its `add_*`, `run()` and calculator methods, and the result objects they
return. Each entry gives the signature, what it does, the key arguments and
what it returns. For every public symbol, including lower-level helpers, see
the [generated reference](https://remilab.ai/rfx/api/generated/).

## Pages

| Page | Covers |
|---|---|
| [Simulation](https://remilab.ai/rfx/api/simulation/) | the constructor, preflight, `run()`, `forward()`, `Simulation.auto()` |
| [Results & Observables](https://remilab.ai/rfx/api/results/) | probes, flux monitors, DFT planes, NTFF, snapshots; `Result`, `ForwardResult` and the S-parameter result objects |
| [Geometry & Materials](https://remilab.ai/rfx/api/geometry-materials/) | `add_material`, dispersive poles, shapes, CAD import, metal sheets |
| [Sources & Ports](https://remilab.ai/rfx/api/sources-ports/) | waveforms, sources, the four port families, lumped R/L/C, the S-parameter calculators |
| [Automation](https://remilab.ai/rfx/api/functions/) | `plan_mesh`, `auto_configure`, graded-profile builders |
| [Support Boundaries](https://remilab.ai/rfx/support/) | what is supported, limited, experimental or refused |

## Conventions

- Import from the top-level package: `from rfx import Simulation, Box,
  GaussianPulse`.
- Units are SI: lengths in metres, frequencies in hertz, time in seconds,
  conductivity in S/m, impedance in ohms.
- Positions are physical coordinates measured from the domain's lower corner,
  which is the inner edge of the absorber, not grid indices.
- `add_*` methods return the simulation, so they can be chained.
- S-parameter matrices are indexed `S[receiver_port, driven_port, freq_index]`.
- A combination rfx does not implement raises an error. It is not silently
  skipped.

## Minimal example

```python
from rfx import Box, GaussianPulse, Simulation

sim = Simulation(freq_max=5e9, domain=(0.04, 0.03, 0.03), dx=2e-3,
                 boundary="cpml", cpml_layers=6)
sim.add_material("slab", eps_r=3.0, sigma=0.01)
sim.add(Box((0.018, 0.0, 0.0), (0.024, 0.03, 0.03)), material="slab")
sim.add_source((0.010, 0.015, 0.015), "ez",
               waveform=GaussianPulse(f0=3e9, bandwidth=0.8),
               amplitude_kind="current")
sim.add_probe((0.030, 0.015, 0.015), "ez")

result = sim.run(n_steps=300)
print(result.time_series.shape, f"{result.settling_db:.1f} dB")
```

[Quick Start](https://remilab.ai/rfx/start/first-simulation/) walks through the same steps, and
[Core Concepts](https://remilab.ai/rfx/start/concepts/) explains the choices behind them.
