開発版ドキュメント · 0.2.3 30c2f8ba · 入門例の検証対象 0.2.3 · 版情報 · 既知の制限

gwexpy.interop.pyspice_#

Interoperate with PySpice circuit simulation results.


Interoperability with PySpice circuit simulation library.

Provides conversion from PySpice Analysis results (TransientAnalysis, AcAnalysis, NoiseAnalysis, DistortionAnalysis) to GWexpy TimeSeries and FrequencySeries types.

Functions

from_pyspice_ac(cls, analysis, *[, node, ...])

Create FrequencySeries or FrequencySeriesDict from a PySpice AcAnalysis.

from_pyspice_distortion(cls, analysis, *[, ...])

Create FrequencySeries or FrequencySeriesDict from a PySpice DistortionAnalysis.

from_pyspice_noise(cls, analysis, *[, node, ...])

Create FrequencySeries or FrequencySeriesDict from a PySpice NoiseAnalysis.

from_pyspice_transient(cls, analysis, *[, ...])

Create TimeSeries or TimeSeriesDict from a PySpice TransientAnalysis.

gwexpy.interop.pyspice_.from_pyspice_transient(cls: type, analysis: Any, *, node: str | None = None, branch: str | None = None, unit: Any | None = None) Any#

Create TimeSeries or TimeSeriesDict from a PySpice TransientAnalysis.

パラメータ:
  • cls (type) -- The TimeSeries (or TimeSeriesDict) class to instantiate.

  • analysis (PySpice.Spice.Simulation.TransientAnalysis) -- The transient analysis result from a PySpice simulation.

  • node (str, optional) -- Node name to extract (e.g. "out"). If None and branch is also None, all nodes and branches are returned as a dict.

  • branch (str, optional) -- Branch name to extract (e.g. "vcc"). Typically the name of a voltage source for current measurement. Cannot be combined with node.

  • unit (str or astropy.units.Unit, optional) -- Unit to assign to the result. PySpice waveforms carry unit information that is not astropy-compatible, so physical units must be supplied by the caller (e.g. "V", "A").

戻り値:

  • TimeSeries -- When a single node or branch is specified.

  • TimeSeriesDict -- When neither node nor branch is given; keyed by signal name.

サンプル

>>> from gwexpy.timeseries import TimeSeries
>>> # analysis = simulator.transient(...)
>>> ts = TimeSeries.from_pyspice_transient(analysis, node="out")
gwexpy.interop.pyspice_.from_pyspice_ac(cls: type, analysis: Any, *, node: str | None = None, branch: str | None = None, unit: Any | None = None) Any#

Create FrequencySeries or FrequencySeriesDict from a PySpice AcAnalysis.

AC analysis waveforms contain complex-valued frequency responses (transfer functions, impedances, etc.) with the frequency axis given by analysis.frequency.

パラメータ:
  • cls (type) -- The FrequencySeries (or FrequencySeriesDict) class to instantiate.

  • analysis (PySpice.Spice.Simulation.AcAnalysis) -- The AC analysis result from a PySpice simulation.

  • node (str, optional) -- Node name to extract. If None and branch is also None, all nodes and branches are returned.

  • branch (str, optional) -- Branch name to extract.

  • unit (str or astropy.units.Unit, optional) -- Unit to assign to the result (e.g. "V").

戻り値:

  • FrequencySeries -- When a single signal is selected; data is complex.

  • FrequencySeriesDict -- When no specific signal is selected; keyed by signal name.

サンプル

>>> from gwexpy.frequencyseries import FrequencySeries
>>> # analysis = simulator.ac(...)
>>> fs = FrequencySeries.from_pyspice_ac(analysis, node="out")
gwexpy.interop.pyspice_.from_pyspice_noise(cls: type, analysis: Any, *, node: str | None = None, unit: Any | None = None) Any#

Create FrequencySeries or FrequencySeriesDict from a PySpice NoiseAnalysis.

Noise analysis waveforms contain real-valued noise spectral densities (e.g. V²/Hz or A²/Hz) as a function of frequency.

パラメータ:
  • cls (type) -- The FrequencySeries (or FrequencySeriesDict) class to instantiate.

  • analysis (PySpice.Spice.Simulation.NoiseAnalysis) -- The noise analysis result from a PySpice simulation.

  • node (str, optional) -- Node name to extract (e.g. "onoise" for output-referred noise). If None, all signals are returned.

  • unit (str or astropy.units.Unit, optional) -- Unit to assign to the result (e.g. "V**2/Hz").

戻り値:

  • FrequencySeries -- When a single signal is selected; data is real.

  • FrequencySeriesDict -- When no signal is selected; keyed by signal name.

サンプル

>>> from gwexpy.frequencyseries import FrequencySeries
>>> # analysis = simulator.noise(...)
>>> fs = FrequencySeries.from_pyspice_noise(analysis, node="onoise")
gwexpy.interop.pyspice_.from_pyspice_distortion(cls: type, analysis: Any, *, node: str | None = None, unit: Any | None = None) Any#

Create FrequencySeries or FrequencySeriesDict from a PySpice DistortionAnalysis.

Distortion analysis waveforms contain harmonic/intermodulation distortion components as a function of frequency.

パラメータ:
  • cls (type) -- The FrequencySeries (or FrequencySeriesDict) class to instantiate.

  • analysis (PySpice.Spice.Simulation.DistortionAnalysis) -- The distortion analysis result from a PySpice simulation.

  • node (str, optional) -- Node name to extract. If None, all signals are returned.

  • unit (str or astropy.units.Unit, optional) -- Unit to assign to the result.

戻り値:

  • FrequencySeries -- When a single signal is selected.

  • FrequencySeriesDict -- When no signal is selected; keyed by signal name.

サンプル

>>> from gwexpy.frequencyseries import FrequencySeries
>>> # analysis = simulator.distortion(...)
>>> fs = FrequencySeries.from_pyspice_distortion(analysis, node="out")