From a66de571a729c4cc6becb1d57864aa3d6545be0b Mon Sep 17 00:00:00 2001 From: Bryn Keller Date: Tue, 19 Jun 2018 17:32:40 -0700 Subject: [PATCH] Renamed to pyrivet, made tests pass --- pr-check.sh | 10 +++++----- {atlatl => pyrivet}/Codensity_Estimate.py | 0 {atlatl => pyrivet}/Coeccentricity.py | 0 {atlatl => pyrivet}/__init__.py | 0 {atlatl => pyrivet}/barcode.py | 0 {atlatl => pyrivet}/dimension_distance.py | 0 {atlatl => pyrivet}/hera.py | 0 {atlatl => pyrivet}/matching_distance.py | 9 +++++---- {atlatl => pyrivet}/rank.py | 2 +- {atlatl => pyrivet}/rivet.py | 0 run-checks.sh | 2 +- run-tests.sh | 6 +++--- setup.py | 4 ++-- tests/{atlatl => pyrivet}/test_dimension.py | 4 ++-- tests/{atlatl => pyrivet}/test_matching.py | 2 +- tests/{atlatl => pyrivet}/test_pointclouds.py | 2 +- tests/{atlatl => pyrivet}/test_rank_norm.py | 2 +- 17 files changed, 22 insertions(+), 21 deletions(-) rename {atlatl => pyrivet}/Codensity_Estimate.py (100%) rename {atlatl => pyrivet}/Coeccentricity.py (100%) rename {atlatl => pyrivet}/__init__.py (100%) rename {atlatl => pyrivet}/barcode.py (100%) rename {atlatl => pyrivet}/dimension_distance.py (100%) rename {atlatl => pyrivet}/hera.py (100%) rename {atlatl => pyrivet}/matching_distance.py (97%) rename {atlatl => pyrivet}/rank.py (99%) rename {atlatl => pyrivet}/rivet.py (100%) rename tests/{atlatl => pyrivet}/test_dimension.py (92%) rename tests/{atlatl => pyrivet}/test_matching.py (98%) rename tests/{atlatl => pyrivet}/test_pointclouds.py (95%) rename tests/{atlatl => pyrivet}/test_rank_norm.py (98%) diff --git a/pr-check.sh b/pr-check.sh index 01f5764..c7949da 100755 --- a/pr-check.sh +++ b/pr-check.sh @@ -18,9 +18,9 @@ set -ev -if [ ! -f atlatl/__init__.py ] +if [ ! -f pyrivet/__init__.py ] then - echo "Run "$(basename "$0")" from the root of the Atlatl repository" + echo "Run "$(basename "$0")" from the root of the pyrivet repository" exit 1 fi @@ -95,7 +95,7 @@ else fi # optional, but highly recommended: create a virtualenv to isolate tests -venv=$(mktemp -u atlatl_pr_venv_XXXXX) || \ +venv=$(mktemp -u pyrivet_pr_venv_XXXXX) || \ exit_with_error "mktemp -u error" $create_venv $venv || { exit_with_error "virtualenv creation failed" @@ -105,9 +105,9 @@ $activate_venv $venv || { exit_with_error "virtualenv activation failed" } -# install atlatl in editable mode (required for testing) +# install pyrivet in editable mode (required for testing) pip3 install $ignore_installed -U -e . || \ - exit_with_error_and_venv "pip3 failed to install atlatl" + exit_with_error_and_venv "pip3 failed to install pyrivet" # install developer dependencies pip3 install $ignore_installed -U -r requirements-dev.txt || \ diff --git a/atlatl/Codensity_Estimate.py b/pyrivet/Codensity_Estimate.py similarity index 100% rename from atlatl/Codensity_Estimate.py rename to pyrivet/Codensity_Estimate.py diff --git a/atlatl/Coeccentricity.py b/pyrivet/Coeccentricity.py similarity index 100% rename from atlatl/Coeccentricity.py rename to pyrivet/Coeccentricity.py diff --git a/atlatl/__init__.py b/pyrivet/__init__.py similarity index 100% rename from atlatl/__init__.py rename to pyrivet/__init__.py diff --git a/atlatl/barcode.py b/pyrivet/barcode.py similarity index 100% rename from atlatl/barcode.py rename to pyrivet/barcode.py diff --git a/atlatl/dimension_distance.py b/pyrivet/dimension_distance.py similarity index 100% rename from atlatl/dimension_distance.py rename to pyrivet/dimension_distance.py diff --git a/atlatl/hera.py b/pyrivet/hera.py similarity index 100% rename from atlatl/hera.py rename to pyrivet/hera.py diff --git a/atlatl/matching_distance.py b/pyrivet/matching_distance.py similarity index 97% rename from atlatl/matching_distance.py rename to pyrivet/matching_distance.py index df15fd1..ae90d98 100644 --- a/atlatl/matching_distance.py +++ b/pyrivet/matching_distance.py @@ -1,7 +1,7 @@ import math import numpy as np -from atlatl import rivet, barcode, hera -from atlatl.rivet import Point, PointCloud +from pyrivet import rivet, barcode, hera +from pyrivet.rivet import Point, PointCloud def find_offset(sl, pt): @@ -120,7 +120,7 @@ def matching_distance(module1, module2, grid_size, normalize, fixed_bounds=None) # the line, and also the normalization, which changes both the effective # weight and the effective bottleneck distance. - slope = lines[:, 0] + slope = np.array(lines)[:, 0] w = calculate_weight(slope, normalize, delta_x, delta_y) # moreover, normalization changes the length of a line segment along the line (slope,offset), @@ -159,6 +159,7 @@ def generate_lines(grid_size, upper_left, lower_right): for j in range(grid_size): offset = LR_offset + j * (UL_offset - LR_offset) / (grid_size - 1) lines.append((slope, float(offset))) + assert lines return lines @@ -189,7 +190,7 @@ def calculate_weight(slopes, normalize=False, delta_x=None, delta_y=None): mn = m * delta_x / delta_y # so the associated weight in the normalized case is given by - q = max(mn, 1 / mn) + q = np.max(np.vstack([mn, 1 / mn]), axis=0) w = 1 / np.sqrt(1 + q ** 2) # of course, this code can be made more compact, but hopefully this diff --git a/atlatl/rank.py b/pyrivet/rank.py similarity index 99% rename from atlatl/rank.py rename to pyrivet/rank.py index 818173e..ecc51c7 100644 --- a/atlatl/rank.py +++ b/pyrivet/rank.py @@ -2,7 +2,7 @@ import numpy as np -from atlatl import rivet, matching_distance +from pyrivet import rivet, matching_distance def find_parameters(slopes, offsets, points): diff --git a/atlatl/rivet.py b/pyrivet/rivet.py similarity index 100% rename from atlatl/rivet.py rename to pyrivet/rivet.py diff --git a/run-checks.sh b/run-checks.sh index 8ed2cf6..d58e5c8 100755 --- a/run-checks.sh +++ b/run-checks.sh @@ -17,5 +17,5 @@ set -ev set -o pipefail -flake8 --config setup.cfg atlatl +flake8 --config setup.cfg pyrivet rst-lint *.rst | { grep -v "is clean.$" || true; } diff --git a/run-tests.sh b/run-tests.sh index e36c061..be65df0 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -16,9 +16,9 @@ set -ev -pip freeze | grep -qi /atlatl || { - echo "You must install atlatl in editable mode using \"pip install -e\""` - `" before calling "$(basename "$0") +pip freeze | grep -qi pyrivet || { + echo "You must install pyrivet in editable mode using \"pip install -e\" + before calling "$(basename "$0") exit 1 } diff --git a/setup.py b/setup.py index c91d74c..0da2056 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ def finalize_options(self): setup( - name='atlatl', + name='pyrivet', use_scm_version=True, setup_requires=[ # 'cython', @@ -120,7 +120,7 @@ def finalize_options(self): ], author='Princeton Neuroscience Institute and Intel Corporation', author_email='bryn.keller@intel.com', - url='https://github.com/IntelPNI/atlatl', + url='https://github.com/IntelPNI/pyrivet', description='Algebraic Topology Loves All These Libraries', license='Apache 2', keywords='topology, algebraic topology, topological data analysis', diff --git a/tests/atlatl/test_dimension.py b/tests/pyrivet/test_dimension.py similarity index 92% rename from tests/atlatl/test_dimension.py rename to tests/pyrivet/test_dimension.py index 53539d9..fd17c65 100644 --- a/tests/atlatl/test_dimension.py +++ b/tests/pyrivet/test_dimension.py @@ -5,9 +5,9 @@ import sys -from atlatl import rivet, hera, barcode, matching_distance +from pyrivet import rivet, hera, barcode, matching_distance import numpy as np -from atlatl.dimension_distance import SplitMat, Dimension, DimensionQueryResult +from pyrivet.dimension_distance import SplitMat, Dimension, DimensionQueryResult def test_splitmat(): diff --git a/tests/atlatl/test_matching.py b/tests/pyrivet/test_matching.py similarity index 98% rename from tests/atlatl/test_matching.py rename to tests/pyrivet/test_matching.py index 25c38eb..1ae9bf2 100644 --- a/tests/atlatl/test_matching.py +++ b/tests/pyrivet/test_matching.py @@ -6,7 +6,7 @@ import sys -from atlatl import rivet, hera, barcode, matching_distance, rank +from pyrivet import rivet, hera, barcode, matching_distance, rank inf = float('inf') diff --git a/tests/atlatl/test_pointclouds.py b/tests/pyrivet/test_pointclouds.py similarity index 95% rename from tests/atlatl/test_pointclouds.py rename to tests/pyrivet/test_pointclouds.py index 5943fad..565320e 100644 --- a/tests/atlatl/test_pointclouds.py +++ b/tests/pyrivet/test_pointclouds.py @@ -1,5 +1,5 @@ # Borrowed from https://github.com/IntelPNI/brainiak-extras -from atlatl import rivet, hera, barcode +from pyrivet import rivet, hera, barcode inf = float('inf') diff --git a/tests/atlatl/test_rank_norm.py b/tests/pyrivet/test_rank_norm.py similarity index 98% rename from tests/atlatl/test_rank_norm.py rename to tests/pyrivet/test_rank_norm.py index 4adcf62..073d56f 100644 --- a/tests/atlatl/test_rank_norm.py +++ b/tests/pyrivet/test_rank_norm.py @@ -1,4 +1,4 @@ -from atlatl import rivet, rank +from pyrivet import rivet, rank import math prism_3 = rivet.Bifiltration("x_label", "y_label", [