Skip to content

Commit

Permalink
MNT: import user functionality from top-level module (#166)
Browse files Browse the repository at this point in the history
Make the main user-facing functionality available from the top-level
`heracles` module.

Closes: #160
Reviewed-by: baugstein
  • Loading branch information
ntessore authored Aug 27, 2024
1 parent ea2d5c2 commit 1a1e3bd
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 132 deletions.
1 change: 1 addition & 0 deletions .commitlint.rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
"healpy",
"io",
"mapper",
"mapping",
"progress",
"twopoint",
],
Expand Down
225 changes: 103 additions & 122 deletions examples/example.ipynb

Large diffs are not rendered by default.

104 changes: 101 additions & 3 deletions heracles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,116 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Main module of the *Heracles* package."""
"""
Main module of the *Heracles* package.
"""

__all__ = [
# _version
"__version__",
"__version_tuple__",
# catalog
"ArrayCatalog",
"Catalog",
"CatalogPage",
"FitsCatalog",
"FootprintFilter",
"InvalidValueFilter",
# core
"TocDict",
"toc_filter",
"toc_match",
"update_metadata",
# fields
"ComplexField",
"Field",
"Positions",
"ScalarField",
"Shears",
"Spin2Field",
"Visibility",
"Weights",
# io
"read_alms",
"read_cls",
"read_maps",
"read_mms",
"write_alms",
"write_cls",
"write_maps",
"write_mms",
# mapper
"Mapper",
# mapping
"map_catalogs",
"transform",
# twopoint
"angular_power_spectra",
"debias_cls",
"mixing_matrices",
"bin2pt",
"binned_cls",
"binned_mms",
]

try:
from ._version import __version__, __version_tuple__
except ModuleNotFoundError:
pass
__version__ = None
__version_tuple__ = None

from ._mapping import map_catalogs, transform
from .catalog import (
ArrayCatalog,
Catalog,
CatalogPage,
FitsCatalog,
FootprintFilter,
InvalidValueFilter,
)

from .core import (
TocDict,
toc_filter,
toc_match,
update_metadata,
)

from .fields import (
ComplexField,
Field,
Positions,
ScalarField,
Shears,
Spin2Field,
Visibility,
Weights,
)

from .io import (
read_alms,
read_cls,
read_maps,
read_mms,
write_alms,
write_cls,
write_maps,
write_mms,
)

from .mapper import (
Mapper,
)

from .mapping import (
map_catalogs,
transform,
)

from .twopoint import (
angular_power_spectra,
debias_cls,
mixing_matrices,
bin2pt,
binned_cls,
binned_mms,
)
19 changes: 15 additions & 4 deletions heracles/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""module for catalogue processing"""

from .array import ArrayCatalog # noqa: F401
from .base import Catalog, CatalogBase, CatalogPage, CatalogView # noqa: F401
from .filters import FootprintFilter, InvalidValueFilter # noqa: F401
from .fits import FitsCatalog # noqa: F401
__all__ = [
"ArrayCatalog",
"Catalog",
"CatalogBase",
"CatalogPage",
"CatalogView",
"FitsCatalog",
"FootprintFilter",
"InvalidValueFilter",
]

from .array import ArrayCatalog
from .base import Catalog, CatalogBase, CatalogPage, CatalogView
from .filters import FootprintFilter, InvalidValueFilter
from .fits import FitsCatalog
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __iter__(self):

@pytest.mark.parametrize("parallel", [False, True])
def test_map_catalogs(parallel):
from heracles._mapping import map_catalogs
from heracles.mapping import map_catalogs

fields = {
"a": unittest.mock.AsyncMock(),
Expand All @@ -32,7 +32,7 @@ def test_map_catalogs(parallel):


def test_map_catalogs_match():
from heracles._mapping import map_catalogs
from heracles.mapping import map_catalogs

fields = {
"a": unittest.mock.AsyncMock(),
Expand All @@ -51,7 +51,7 @@ def test_map_catalogs_match():


def test_transform(rng):
from heracles._mapping import transform
from heracles.mapping import transform

x = unittest.mock.Mock()
y = unittest.mock.Mock()
Expand Down

0 comments on commit 1a1e3bd

Please sign in to comment.