Skip to content

Commit

Permalink
Cleanup (#1689)
Browse files Browse the repository at this point in the history
* fix argument name

* rename export to plot for optional dependencies

* don't import the submodules directly
  • Loading branch information
ljeub-pometry authored Jul 15, 2024
1 parent e1506d5 commit 2fb1bc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 2 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build-backend = "maturin"
[project]
name = "raphtory"
requires-python = ">=3.8"
dynamic = ["version"]
classifiers = [
"Programming Language :: Rust",
"Programming Language :: Python :: Implementation :: CPython",
Expand All @@ -30,7 +31,7 @@ slack = "https://join.slack.com/t/raphtory/shared_invite/zt-xbebws9j-VgPIFRleJFJ
youtube = "https://www.youtube.com/@pometry8546/videos"

[project.optional-dependencies]
export = ["seaborn >= 0.11.2"]
plot = ["seaborn >= 0.11.2"]

[tool.maturin]
features = ["pyo3/extension-module"]
Expand Down
4 changes: 0 additions & 4 deletions python/python/raphtory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
sys.modules["raphtory.vectors"] = vectors
sys.modules["raphtory.graphql"] = graphql

from .nullmodels import *
from .plottingutils import *

__doc__ = raphtory.__doc__
if hasattr(raphtory, "__all__"):
__all__ = raphtory.__all__
Expand All @@ -18,7 +15,6 @@
graph_gen.__doc__ = "Generate Raphtory graphs from attachment models"
graph_loader.__doc__ = "Load and save Raphtory graphs from/to file(s)"


try:
from importlib.metadata import version as _version

Expand Down
12 changes: 6 additions & 6 deletions python/python/raphtory/plottingutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def cdf(observations, normalised=True):
list(float): x coordinates for the cdf
list(float): y coordinates for the cdf
"""
data = np.array(listlike, dtype=object)
N = len(listlike)
data = np.array(observations, dtype=object)
N = len(observations)

x = np.sort(data)
if normalised:
Expand All @@ -209,11 +209,11 @@ def ccdf(observations, normalised=True):
list(float): x coordinates for the cdf
list(float): y coordinates for the cdf
"""
x, y = cdf(listlike, normalised)
x, y = cdf(observations, normalised)
if normalised:
return x, 1.0 - y
else:
return x, len(listlike) - y
return x, len(observations) - y


def lorenz(observations):
Expand All @@ -227,9 +227,9 @@ def lorenz(observations):
list(float): x coordinates for the cdf
list(float): y coordinates for the cdf
"""
tmp_arr = np.array(sorted(listlike))
tmp_arr = np.array(sorted(observations))
# print(tmp_arr[0])
x = np.arange(listlike.size) / (listlike.size - 1)
x = np.arange(observations.size) / (observations.size - 1)
y = tmp_arr.cumsum() / tmp_arr.sum()
return x, y

Expand Down

0 comments on commit 2fb1bc5

Please sign in to comment.