Skip to content

Is it possible to save the analysis object to disk? #377

@danieljfarrell

Description

@danieljfarrell

Environment (OS, Python version, PySpice version, simulator)

macOS 13.5, Python 3.12.2, PySpice 1.5, ngspice-42

I am simulating very large circuits that can take many minutes to solve.

For this reason I would like to be able to save the analysis object, so I do not have to recalculate it.

How can I save the analysis object to disk?

Pickle does not work

cir = Circuit(net)
simulator = cir.simulator(temperature=25, nominal_temperature=25)
result = simulator.dc(Vin=slice(-1, 2, 0.01))

import pickle
with open("result.obj", "wb") as f:
    pickle.dump(result, f)  # <-- this line crashes

The pickle fails,

Traceback (most recent call last):
  File "<snip>.py", line <snip>, in <module>
    pickle.dump(result, f)
TypeError: cannot pickle '_cffi_backend.__CDataOwn' object

Is there another way to export this object and save the data that you can recommend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions