Skip to content
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
8 changes: 4 additions & 4 deletions src/data_morph/bounds/bounding_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,25 +170,25 @@ def clone(self) -> BoundingBox:
)

@property
def range(self) -> Iterable[Number]:
def range(self) -> tuple[Number, Number]:
"""
Calculate the range (width) of the bounding box in each direction.

Returns
-------
Iterable[numbers.Number]
tuple[Number, Number]
The range covered by the x and y bounds, respectively.
"""
return self.x_bounds.range, self.y_bounds.range

@property
def center(self) -> Iterable[Number]:
def center(self) -> tuple[Number, Number]:
"""
Calculate the center of the bounding box.

Returns
-------
Iterable[numbers.Number]
tuple[Number, Number]
The center of the x and y bounds, respectively.
"""
return self.x_bounds.center, self.y_bounds.center
213 changes: 0 additions & 213 deletions src/data_morph/shapes/circles.py

This file was deleted.

11 changes: 11 additions & 0 deletions src/data_morph/shapes/circles/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Shapes made up of circles."""

from .bullseye import Bullseye
from .circle import Circle
from .rings import Rings

__all__ = [
'Bullseye',
'Circle',
'Rings',
]
50 changes: 50 additions & 0 deletions src/data_morph/shapes/circles/bullseye.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Bullseye shape."""

from __future__ import annotations

from typing import TYPE_CHECKING

import numpy as np

from .rings import Rings

if TYPE_CHECKING:
from ..data.dataset import Dataset


class Bullseye(Rings):
"""
Class representing a bullseye shape comprising two concentric circles.

.. plot::
:scale: 75
:caption:
This shape is generated using the panda dataset.

from data_morph.data.loader import DataLoader
from data_morph.shapes.circles import Bullseye

_ = Bullseye(DataLoader.load_dataset('panda')).plot()

See Also
--------
Circle : The individual rings are represented as circles.
"""

@staticmethod
def _derive_radii(dataset: Dataset) -> np.ndarray:
"""
Derive the radii for the circles in the bullseye.

Parameters
----------
dataset : Dataset
The starting dataset to morph into.

Returns
-------
np.ndarray
The radii for the circles in the bullseye.
"""
stdev = dataset.data[['x', 'y']].std().mean() * 1.5
return np.linspace(stdev, 0, 2, endpoint=False)
Loading