Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: extend caching and review Surrogates API #236

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs = 0
disable = [
"duplicate-code", "invalid-name", "fixme",
"missing-docstring", "no-else-return",
"arguments-differ", "no-member", "no-name-in-module"
"arguments-differ", "no-name-in-module"
]

[tool.pylint.format]
Expand Down
21 changes: 5 additions & 16 deletions src/pyunicorn/timeseries/inter_system_recurrence_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
analysis (RQA) and recurrence network analysis.
"""

from typing import Tuple
from collections.abc import Hashable

# array object and fast numerics
import numpy as np

Expand Down Expand Up @@ -211,22 +214,8 @@ def __str__(self):
# Service methods
#

def clear_cache(self):
"""
Clean up memory by deleting information that can be recalculated from
basic data.

Extends the clean up methods of the parent classes.
"""
# Call clean up of RecurrencePlot objects
self.rp_x.clear_cache()
self.rp_y.clear_cache()

# Call clean up of CrossRecurrencePlot object
self.crp_xy.clear_cache()

# Call clean up of InteractingNetworks
InteractingNetworks.clear_cache(self)
def __cache_state__(self) -> Tuple[Hashable, ...]:
return (self.rp_x, self.rp_x, self.crp_xy,)

#
# Methods to handle inter system recurrence networks
Expand Down
12 changes: 0 additions & 12 deletions src/pyunicorn/timeseries/joint_recurrence_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@ def __str__(self):
f"{JointRecurrencePlot.__str__(self)}\n"
f"{Network.__str__(self)}")

def clear_cache(self):
"""
Clean up memory by deleting information that can be recalculated from
basic data.

Extends the clean up methods of the parent classes.
"""
# Call clean up of RecurrencePlot
JointRecurrencePlot.clear_cache(self)
# Call clean up of Network
Network.clear_cache(self)

#
# Methods to handle recurrence networks
#
Expand Down
12 changes: 0 additions & 12 deletions src/pyunicorn/timeseries/recurrence_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,6 @@ def __str__(self):
f"{RecurrencePlot.__str__(self)}\n"
f"{Network.__str__(self)}")

def clear_cache(self):
"""
Clean up memory by deleting information that can be recalculated from
basic data.

Extends the clean up methods of the parent classes.
"""
# Call clean up of RecurrencePlot
RecurrencePlot.clear_cache(self)
# Call clean up of Network
Network.clear_cache(self)

#
# Methods to handle recurrence networks
#
Expand Down
Loading