Skip to content

Commit

Permalink
Fixing recursion in integration variable and going back to using dill…
Browse files Browse the repository at this point in the history
… for dump files
  • Loading branch information
stammler committed Jul 14, 2023
1 parent 1d6ac54 commit e50b9ed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dill
h5py
matplotlib
numpy
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def read_version():
],

packages=find_packages(),
install_requires=["h5py", "matplotlib", "numpy", "scipy"],
install_requires=["dill", "h5py", "matplotlib", "numpy", "scipy"],
include_package_data=True,
zip_safe=False,
)
4 changes: 2 additions & 2 deletions simframe/integration/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def integrate(self):
# And count the loops
i = 0
status = False
while(not status):
while (not status):
# The suggested stepsize has to be reset in the beginning of every try.
# We therefore have to copy the current stepsize in case the user is returning
# the suggested stepsize in the stepsize function.
Expand Down Expand Up @@ -169,7 +169,7 @@ def integrate(self):
continue
upd(None, inst.Y, None)
# Store the taken stepsize
self.var._prevstepsize = stepsize
self.var._prevstepsize = np.array(stepsize)
# Finalization
self._finalize()

Expand Down
6 changes: 3 additions & 3 deletions simframe/io/dump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pickle
import dill


def writedump(object, filename="object.dmp"):
Expand All @@ -11,7 +11,7 @@ def writedump(object, filename="object.dmp"):
filename : str, optional, default : "object.dmp"
path to file to be written"""
with open(filename, "wb") as dumpfile:
pickle.dump(object, dumpfile)
dill.dump(object, dumpfile)


def readdump(filename):
Expand All @@ -32,5 +32,5 @@ def readdump(filename):
Only read dump files from sources you trust.
Malware can be injected."""
with open(filename, "rb") as dumpfile:
obj = pickle.load(dumpfile)
obj = dill.load(dumpfile)
return obj

0 comments on commit e50b9ed

Please sign in to comment.