Skip to content

Commit

Permalink
separate structural and content changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ntessore committed Sep 19, 2023
1 parent af34c81 commit 552c1cc
Show file tree
Hide file tree
Showing 18 changed files with 509 additions and 1,441 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ __pycache__
_version.py
.*.swp
.envrc
.ipynb_checkpoints
.vscode
site
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# _Heracles_ — Harmonic-space statistics on the sphere

[![PyPI](https://badge.fury.io/py/heracles.svg)](https://pypi.org/project/heracles)
[![PyPI](https://img.shields.io/pypi/v/heracles)](https://pypi.org/project/heracles)
[![Python](https://img.shields.io/pypi/pyversions/heracles)](https://www.python.org)
[![Documentation](https://readthedocs.org/projects/heracles/badge/?version=latest)](https://heracles.readthedocs.io/en/latest/?badge=latest)
[![Test](https://github.com/heracles-ec/heracles/actions/workflows/test.yml/badge.svg)](https://github.com/heracles-ec/heracles/actions/workflows/test.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)

The _Heracles_ code was developed in the _Euclid_ Science Ground Segment.
2 changes: 1 addition & 1 deletion heracles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Heracles: Euclid code for harmonic-space statistics on the sphere."""
"""Main module of the *Heracles* package."""

try:
from ._version import __version__, __version_tuple__ # noqa: F401
Expand Down
4 changes: 2 additions & 2 deletions heracles/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Module for catalogue processing."""
"""module for catalogue processing"""

from .array import ArrayCatalog # noqa: F401
from .base import Catalog, CatalogPage, CatalogView, _CatalogBase # noqa: F401
from .base import Catalog, CatalogBase, CatalogPage, CatalogView # noqa: F401
from .filters import FootprintFilter, InvalidValueFilter # noqa: F401
from .fits import FitsCatalog # noqa: F401
69 changes: 14 additions & 55 deletions heracles/catalog/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,83 +16,42 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Module for array catalogues."""
from collections.abc import Iterator
from typing import Optional, TypeVar
"""module for array catalogues"""

from .base import CatalogPage, _CatalogBase
from .base import CatalogBase, CatalogPage


class ArrayCatalog(_CatalogBase):
"""Catalogue reader for arrays."""
class ArrayCatalog(CatalogBase):
"""catalogue reader for arrays"""

def __init__(self, arr: TypeVar("Unknown")) -> None:
"""Create a new array catalogue reader.
Args:
arr: _description_
"""
def __init__(self, arr):
"""create a new array catalogue reader"""
super().__init__()
self._arr = arr

def __copy__(self) -> "ArrayCatalog":
"""Return a copy of this catalogue.
Returns:
_description_
"""
def __copy__(self):
"""return a copy of this catalogue"""
other = super().__copy__()
other._arr = self._arr
return other

def _names(self) -> TypeVar("Unknown"):
"""_summary_.
Returns:
_description_
"""
def _names(self):
return self._arr.dtype.names

def _size(self, selection: Optional[TypeVar("Unknown")]) -> int:
"""_summary_.
Args:
selection: _description_
Returns:
_description_
"""
def _size(self, selection):
if selection is None:
return len(self._arr)
return len(self._arr[selection])

def _join(
self,
first: TypeVar("Unknown"),
*other: TypeVar("Unknown"),
) -> TypeVar("Unknown"):
"""Join boolean masks.
Args:
first: _description_
Returns:
_description_
"""
def _join(self, first, *other):
"""join boolean masks"""
mask = first
for a in other:
mask = mask & a
return mask

def _pages(self, selection: Optional[TypeVar("Unknown")]) -> Iterator[CatalogPage]:
"""Iterate the rows of the array in pages.
Args:
selection: _description_
Yields:
_description_
"""
def _pages(self, selection):
"""iterate the rows of the array in pages"""
if selection is None:
arr = self._arr
else:
Expand Down
Loading

0 comments on commit 552c1cc

Please sign in to comment.