sources ¤
Parse SPICE independent-source specifications into waveform source settings.
The returned dictionaries use the keyword names of :class:circulax.components.electronic.WaveformVoltageSource and :class:~circulax.components.electronic.WaveformCurrentSource, so an SDK client binds parsed text with WaveformVoltageSource(**parse_source("DC 0.5 SIN(...)")). Numeric arguments use the shared safe expression evaluator with SPICE suffix semantics (M is milli, meg is mega). Unit letters after a suffix, AC magnitudes and unsupported waveform kinds raise :class:NetlistError instead of silently degrading to a DC source.
Functions:
| Name | Description |
|---|---|
parse_sine_waveform | Parse SIN with an explicit frequency; return phase in radians. |
parse_source | Parse the value part of a SPICE V/I source card: |
parse_waveform | Parse |
parse_sine_waveform ¤
Parse SIN with an explicit frequency; return phase in radians.
Source code in circulax/netlist_io/sources.py
parse_source ¤
parse_source(
spec: str,
*,
dialect: str = "spice",
tstep: float | None = None,
tstop: float | None = None,
pwl_points: int | None = None
) -> dict[str, float | tuple[float, ...]]
Parse the value part of a SPICE V/I source card: [DC] value and/or a waveform.
Accepts "1.2", "DC 1.2", "SIN(...)" and "DC 0.5 SIN(...)" (in either order). dc_given preserves whether an operating-point override was supplied. Without one, DC analysis uses the waveform's time-zero value. Transients always initialize from the waveform, independently of an explicit DC override. AC clauses are rejected (source-driven AC is out of scope).
Returns:
| Type | Description |
|---|---|
dict[str, float | tuple[float, ...]] | Keyword settings with |
dict[str, float | tuple[float, ...]] | for |
@tags circulax-simulation
Source code in circulax/netlist_io/sources.py
parse_waveform ¤
parse_waveform(
waveform: str,
*,
dialect: str = "spice",
tstep: float | None = None,
tstop: float | None = None,
pwl_points: int | None = None
) -> dict[str, float | tuple[float, ...]]
Parse SIN(...), PULSE(...) or PWL(...) into waveform source settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waveform | str | SPICE waveform text, e.g. | required |
dialect | str | Number-suffix dialect; | 'spice' |
tstep | float | None | SPICE | None |
tstop | float | None | SPICE | None |
pwl_points | int | None | When set, emit | None |
Returns:
| Type | Description |
|---|---|
dict[str, float | tuple[float, ...]] | Keyword settings for the waveform source components, including |
dict[str, float | tuple[float, ...]] | Fields not needed by the waveform keep their component defaults. |
@tags circulax-simulation