Skip to content

Commit

Permalink
change module name to polytope-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mathleur committed Oct 7, 2024
1 parent 6400ce4 commit 3954c0c
Show file tree
Hide file tree
Showing 101 changed files with 199 additions and 196 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, name, mapper_options):

def generate_final_transformation(self):
map_type = _type_to_datacube_mapper_lookup[self.grid_type]
module = import_module("polytope.datacube.transformations.datacube_mappers.mapper_types." + self.grid_type)
module = import_module("polytope_feature.datacube.transformations.datacube_mappers.mapper_types." + self.grid_type)
constructor = getattr(module, map_type)
transformation = deepcopy(
constructor(self.old_axis, self.grid_axes, self.grid_resolution, self.local_area, self._axis_reversed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_transform(name, transformation_type_key, transformation_options):
transformation_type = _type_to_datacube_transformation_lookup[transformation_type_key]
transformation_file_name = _type_to_transformation_file_lookup[transformation_type_key]
file_name = ".datacube_" + transformation_file_name
module = import_module("polytope.datacube.transformations" + file_name + file_name)
module = import_module("polytope_feature.datacube.transformations" + file_name + file_name)
constructor = getattr(module, transformation_type)
transformation_type_option = transformation_options
new_transformation = deepcopy(constructor(name, transformation_type_option))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, name, type_options):

def generate_final_transformation(self):
map_type = _type_to_datacube_type_change_lookup[self.new_type]
module = import_module("polytope.datacube.transformations.datacube_type_change.datacube_type_change")
module = import_module("polytope_feature.datacube.transformations.datacube_type_change.datacube_type_change")
constructor = getattr(module, map_type)
transformation = deepcopy(constructor(self.name, self.new_type))
return transformation
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

__version__ = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
io.open("polytope/version.py", encoding="utf_8_sig").read(),
io.open("polytope_feature/version.py", encoding="utf_8_sig").read(),
).group(1)

with open("requirements.txt") as f:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_axis_mappers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pandas as pd

from polytope.datacube.datacube_axis import (
from polytope_feature.datacube.datacube_axis import (
DatacubeAxisCyclic,
FloatDatacubeAxis,
IntDatacubeAxis,
PandasTimedeltaDatacubeAxis,
PandasTimestampDatacubeAxis,
)
from polytope.options import PolytopeOptions
from polytope_feature.options import PolytopeOptions


class TestAxisMappers:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_combinatorics.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pytest

from polytope import ConvexPolytope
from polytope.utility.combinatorics import group, tensor_product, validate_axes
from polytope.utility.exceptions import (
from polytope_feature import ConvexPolytope
from polytope_feature.utility.combinatorics import group, tensor_product, validate_axes
from polytope_feature.utility.exceptions import (
AxisNotFoundError,
AxisOverdefinedError,
AxisUnderdefinedError,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_axis_over_negative_vals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pandas as pd
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestSlicingCyclicAxisNegVals:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_axis_slicer_not_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pandas as pd
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestSlicingCyclicAxisNotOverZero:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_axis_slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pandas as pd
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestSlicingCyclic:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_nearest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from eccodes import codes_grib_find_nearest, codes_grib_new_from_file
from helper_functions import download_test_data

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Point, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Point, Select


class TestRegularGrid:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pandas as pd
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestSlicing3DXarrayDatacube:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cyclic_snapping.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Select


class TestSlicing3DXarrayDatacube:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_datacube_axes_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from earthkit import data
from helper_functions import download_test_data

from polytope.datacube.datacube_axis import FloatDatacubeAxis
from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.datacube.datacube_axis import FloatDatacubeAxis
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestInitDatacubeAxes:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_datacube_mock.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from polytope.datacube.backends.mock import MockDatacube
from polytope.utility.exceptions import AxisNotFoundError, AxisOverdefinedError
from polytope_feature.datacube.backends.mock import MockDatacube
from polytope_feature.utility.exceptions import AxisNotFoundError, AxisOverdefinedError


class TestMockDatacube:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_datacube_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import pytest
import xarray as xr

from polytope.datacube import Datacube, DatacubePath
from polytope.datacube.backends.xarray import XArrayDatacube
from polytope.datacube.datacube_axis import (
from polytope_feature.datacube import Datacube, DatacubePath
from polytope_feature.datacube.backends.xarray import XArrayDatacube
from polytope_feature.datacube.datacube_axis import (
FloatDatacubeAxis,
IntDatacubeAxis,
PandasTimestampDatacubeAxis,
)
from polytope.utility.exceptions import AxisNotFoundError, AxisOverdefinedError
from polytope_feature.utility.exceptions import AxisNotFoundError, AxisOverdefinedError


class TestXarrayDatacube:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ecmwf_oper_data_fdb.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import pytest

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Point, Select, Span
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Point, Select, Span


class TestSlicingFDBDatacube:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_engine_slicer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from polytope.datacube.backends.mock import MockDatacube
from polytope.engine.hullslicer import HullSlicer
from polytope.shapes import Box, Polygon
from polytope_feature.datacube.backends.mock import MockDatacube
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.shapes import Box, Polygon


class TestEngineSlicer:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fdb_datacube.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import pytest

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select, Span
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select, Span

# import geopandas as gpd
# import matplotlib.pyplot as plt
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fdb_unmap_tree.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import pytest

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestSlicingFDBDatacube:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_float_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pytest
import xarray as xr

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Select, Span
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Select, Span


class TestFloatType:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_healpix_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from earthkit import data
from helper_functions import download_test_data, find_nearest_latlon

from polytope.datacube.transformations.datacube_mappers.mapper_types.healpix import (
from polytope_feature.datacube.transformations.datacube_mappers.mapper_types.healpix import (
HealpixGridMapper,
)
from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestHealpixGrid:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_healpix_nested_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import pandas as pd
import pytest

from polytope.datacube.transformations.datacube_mappers.mapper_types.healpix_nested import (
from polytope_feature.datacube.transformations.datacube_mappers.mapper_types.healpix_nested import (
NestedHealpixGridMapper,
)
from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Box, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Box, Select


class TestHealpixNestedGrid:
Expand Down
24 changes: 12 additions & 12 deletions tests/test_hull_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import pytest

import polytope.engine.hullslicer
from polytope import ConvexPolytope
from polytope.datacube.backends.mock import MockDatacube
from polytope.utility.profiling import benchmark
from polytope_feature import ConvexPolytope
from polytope_feature.datacube.backends.mock import MockDatacube
from polytope_feature.engine.hullslicer import HullSlicer, slice
from polytope_feature.utility.profiling import benchmark


class TestHullSlicer:
def setup_method(self, method):
self.slicer = polytope.engine.hullslicer.HullSlicer()
self.slicer = HullSlicer()

def construct_nd_cube(self, dimension, lower=-1, upper=1):
axes = [str(chr(97 + ax)) for ax in range(dimension)]
Expand All @@ -20,40 +20,40 @@ def construct_nd_cube(self, dimension, lower=-1, upper=1):
def test_3D(self):
p3 = self.construct_nd_cube(3)
print(p3)
p2 = polytope.engine.hullslicer.slice(p3, "c", 0.5, 2)
p2 = slice(p3, "c", 0.5, 2)
print(p2)
p1 = polytope.engine.hullslicer.slice(p2, "b", 0.5, 1)
p1 = slice(p2, "b", 0.5, 1)
print(p1)

@pytest.mark.skip(reason="This is too slow.")
def test_4D(self):
p = self.construct_nd_cube(4)
print(p)
while len(p.axes()) > 1:
p = polytope.engine.hullslicer.slice(p, p._axes[-1], 0.5, -1)
p = slice(p, p._axes[-1], 0.5, -1)
print(p)

@pytest.mark.skip(reason="This is too slow.")
def test_ND(self):
with benchmark("4D"):
p = self.construct_nd_cube(4)
while len(p.axes()) > 1:
p = polytope.engine.hullslicer.slice(p, p._axes[-1], 0.5, -1)
p = slice(p, p._axes[-1], 0.5, -1)

with benchmark("5D"):
p = self.construct_nd_cube(5)
while len(p.axes()) > 1:
p = polytope.engine.hullslicer.slice(p, p._axes[-1], 0.5, -1)
p = slice(p, p._axes[-1], 0.5, -1)

with benchmark("6D"):
p = self.construct_nd_cube(6)
while len(p.axes()) > 1:
p = polytope.engine.hullslicer.slice(p, p._axes[-1], 0.5, -1)
p = slice(p, p._axes[-1], 0.5, -1)

with benchmark("7D"):
p = self.construct_nd_cube(7)
while len(p.axes()) > 1:
p = polytope.engine.hullslicer.slice(p, p._axes[-1], 0.5, -1)
p = slice(p, p._axes[-1], 0.5, -1)

# QHull is not performant above 7D as per its documentation
# with benchmark("8D"):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_hullslicer_engine.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np
import xarray as xr

from polytope.datacube.backends.xarray import XArrayDatacube
from polytope.datacube.tensor_index_tree import TensorIndexTree
from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope
from polytope.shapes import Box
from polytope_feature.datacube.backends.xarray import XArrayDatacube
from polytope_feature.datacube.tensor_index_tree import TensorIndexTree
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope
from polytope_feature.shapes import Box


class TestSlicerComponents:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_incomplete_tree_fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import pytest
from helper_functions import download_test_data

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Select


class TestRegularGrid:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_local_grid_cyclic.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pandas as pd
import pytest

from polytope.engine.hullslicer import HullSlicer
from polytope.polytope import Polytope, Request
from polytope.shapes import Point, Select
from polytope_feature.engine.hullslicer import HullSlicer
from polytope_feature.polytope import Polytope, Request
from polytope_feature.shapes import Point, Select


class TestSlicingFDBDatacube:
Expand Down
Loading

0 comments on commit 3954c0c

Please sign in to comment.