Skip to content

Commit

Permalink
rename stream_ml to stream_mapper (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <[email protected]>
  • Loading branch information
nstarman authored Nov 28, 2023
1 parent c918a36 commit d5c98a8
Show file tree
Hide file tree
Showing 82 changed files with 392 additions and 372 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report describing unexpected or incorrect behavior in `stream_ml`.
about: Create a report describing unexpected or incorrect behavior in `stream_mapper`.
title: "[BUG] "
labels: Bug
assignees: 'nstarman'
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea to improve ``stream_ml``
about: Suggest an idea to improve ``stream_mapper``
title: ''
labels: enhancement
assignees: ''
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "stream_ml.core"
name = "stream_mapper.core"
version = "0.1.0"
description = "Stream ML."
readme = "README.rst"
Expand Down Expand Up @@ -48,9 +48,9 @@
]

[project.urls]
homepage = "https://github.com/nstarman/stream_ml-core"
repository = "https://github.com/nstarman/stream_ml-core"
documentation = "https://github.com/nstarman/stream_ml-core"
homepage = "https://github.com/GalOrrery/stream_mapper-core"
repository = "https://github.com/GalOrrery/stream_mapper-core"
documentation = "https://github.com/GalOrrery/stream_mapper-core"


[build-system]
Expand Down Expand Up @@ -192,7 +192,7 @@ ban-relative-imports = "all"
[tool.ruff.isort]
force-sort-within-sections = true
combine-as-imports = true
known-first-party = ["stream_ml"]
known-first-party = ["stream_mapper"]
known-third-party = ["numpy", "pytest"]

[tool.ruff.pydocstyle]
Expand Down
36 changes: 36 additions & 0 deletions src/stream_mapper/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Core library for stream membership likelihood, with ML."""

__all__ = (
# classes
"Data",
"Params",
# modules
"params",
"prior",
"builtin",
# model classes
"ModelAPI",
"ModelBase",
"ModelsBase",
"MixtureModel",
"IndependentModels",
# model related
"NNField",
# misc
"WEIGHT_NAME",
"BACKGROUND_KEY",
)

from stream_mapper.core import builtin, params, prior
from stream_mapper.core._core.base import ModelBase
from stream_mapper.core._core.field import NNField
from stream_mapper.core._core.model_api import Model as ModelAPI
from stream_mapper.core._data import Data
from stream_mapper.core._multi.bases import ModelsBase
from stream_mapper.core._multi.independent import IndependentModels
from stream_mapper.core._multi.mixture import MixtureModel
from stream_mapper.core.params._values import Params
from stream_mapper.core.setup_package import BACKGROUND_KEY, WEIGHT_NAME

# isort: split
from stream_mapper.core import _connect # noqa: F401
8 changes: 4 additions & 4 deletions src/stream_ml/core/_api.py → src/stream_mapper/core/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

from typing import TYPE_CHECKING, Any, Protocol, SupportsIndex

from stream_ml.core._connect.nn_namespace import NN_NAMESPACE
from stream_ml.core._connect.xp_namespace import XP_NAMESPACE, XP_NAMESPACE_REVERSE
from stream_ml.core.typing import Array, ArrayNamespace, NNModel
from stream_mapper.core._connect.nn_namespace import NN_NAMESPACE
from stream_mapper.core._connect.xp_namespace import XP_NAMESPACE, XP_NAMESPACE_REVERSE
from stream_mapper.core.typing import Array, ArrayNamespace, NNModel

if TYPE_CHECKING:
from stream_ml.core.typing import NNNamespace
from stream_mapper.core.typing import NNNamespace


class SupportsXP(Protocol[Array]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__all__: tuple[str, ...] = ()

from stream_ml.core._connect import ( # noqa: F401
from stream_mapper.core._connect import ( # noqa: F401
compat,
data,
nn_namespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import numpy as np
import numpy.typing as npt

from stream_ml.core.typing import ArrayNamespace
from stream_ml.core.utils.compat import copy, get_namespace
from stream_mapper.core.typing import ArrayNamespace
from stream_mapper.core.utils.compat import copy, get_namespace

T = TypeVar("T", bound=np.generic)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
unstructured_to_structured,
)

from stream_ml.core._data import FROM_FORMAT_REGISTRY, TO_FORMAT_REGISTRY, Data
from stream_mapper.core._data import FROM_FORMAT_REGISTRY, TO_FORMAT_REGISTRY, Data

if TYPE_CHECKING:
from astropy.table import Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Protocol, cast

from stream_ml.core.typing import Array, ArrayNamespace, NNModel, NNNamespace
from stream_mapper.core.typing import Array, ArrayNamespace, NNModel, NNNamespace


class NNNamespaceMap(Protocol):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import numpy as np

from stream_ml.core.utils.scale._api import ASTYPE_REGISTRY
from stream_ml.core.utils.scale._standard import StandardScaler
from stream_mapper.core.utils.scale._api import ASTYPE_REGISTRY
from stream_mapper.core.utils.scale._standard import StandardScaler

if TYPE_CHECKING:
from numpy.typing import NDArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Protocol, cast, overload

from stream_ml.core.typing import Array, ArrayNamespace
from stream_mapper.core.typing import Array, ArrayNamespace

# ===============================================================

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,32 @@
from textwrap import indent
from typing import TYPE_CHECKING, Any, Literal, TypeVar, overload

from stream_ml.core._connect.nn_namespace import NN_NAMESPACE
from stream_ml.core._connect.xp_namespace import XP_NAMESPACE
from stream_ml.core._core.field import NNField
from stream_ml.core._core.model_api import Model
from stream_ml.core.params import ModelParametersField, Params, freeze_params, set_param
from stream_ml.core.setup_package import CompiledShim
from stream_ml.core.typing import Array, ArrayNamespace, BoundsT, NNModel, NNNamespace
from stream_ml.core.utils import DataScaler, within_bounds
from stream_ml.core.utils.dataclasses import ArrayNamespaceReprMixin
from stream_ml.core.utils.frozen_dict import FrozenDict, FrozenDictField
from stream_mapper.core._connect.nn_namespace import NN_NAMESPACE
from stream_mapper.core._connect.xp_namespace import XP_NAMESPACE
from stream_mapper.core._core.field import NNField
from stream_mapper.core._core.model_api import Model
from stream_mapper.core.params import (
ModelParametersField,
Params,
freeze_params,
set_param,
)
from stream_mapper.core.setup_package import CompiledShim
from stream_mapper.core.typing import (
Array,
ArrayNamespace,
BoundsT,
NNModel,
NNNamespace,
)
from stream_mapper.core.utils import DataScaler, within_bounds
from stream_mapper.core.utils.dataclasses import ArrayNamespaceReprMixin
from stream_mapper.core.utils.frozen_dict import FrozenDict, FrozenDictField

if TYPE_CHECKING:
from stream_ml.core import Data
from stream_ml.core.prior import Prior
from stream_ml.core.typing import ParamNameAllOpts, ParamsLikeDict
from stream_mapper.core import Data
from stream_mapper.core.prior import Prior
from stream_mapper.core.typing import ParamNameAllOpts, ParamsLikeDict

Self = TypeVar("Self", bound="ModelBase[Array, NNModel]") # type: ignore[valid-type]

Expand Down Expand Up @@ -78,7 +89,7 @@ class ModelBase(
name : str or None, optional keyword-only
The (internal) name of the model, e.g. 'stream' or 'background'. Note
that this can be different from the name of the model when it is used in
a mixture model (see :class:`~stream_ml.core.core.MixtureModel`).
a mixture model (see :class:`~stream_mapper.core.core.MixtureModel`).
"""

net: NNField[NNModel, NNModel] = NNField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast

from stream_ml.core.typing import Array, NNModel
from stream_ml.core.typing._nn import NNModelProtocol
from stream_ml.core.utils.sentinel import MISSING, MissingT
from stream_mapper.core.typing import Array, NNModel
from stream_mapper.core.typing._nn import NNModelProtocol
from stream_mapper.core.utils.sentinel import MISSING, MissingT

if TYPE_CHECKING:
from stream_ml.core import ModelAPI as Model
from stream_mapper.core import ModelAPI as Model


OtherValue = TypeVar("OtherValue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

from typing import TYPE_CHECKING, Any, Protocol

from stream_ml.core._api import SupportsXP
from stream_ml.core.typing import Array
from stream_mapper.core._api import SupportsXP
from stream_mapper.core.typing import Array

if TYPE_CHECKING:
from stream_ml.core import Data, Params
from stream_mapper.core import Data, Params


class LnProbabilities(Protocol[Array]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

from __future__ import annotations

from stream_ml.core._core.likelihood_api import AllProbabilities
from stream_mapper.core._core.likelihood_api import AllProbabilities

__all__: tuple[str, ...] = ()

from abc import abstractmethod
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Literal, Protocol, overload

from stream_ml.core._api import HasName, SupportsXP, SupportsXPNN
from stream_ml.core.params._field import ModelParametersField
from stream_ml.core.params._values import Params, freeze_params, set_param
from stream_ml.core.setup_package import PACK_PARAM_JOIN
from stream_ml.core.typing import Array, NNModel
from stream_ml.core.utils.frozen_dict import FrozenDict, FrozenDictField
from stream_mapper.core._api import HasName, SupportsXP, SupportsXPNN
from stream_mapper.core.params._field import ModelParametersField
from stream_mapper.core.params._values import Params, freeze_params, set_param
from stream_mapper.core.setup_package import PACK_PARAM_JOIN
from stream_mapper.core.typing import Array, NNModel
from stream_mapper.core.utils.frozen_dict import FrozenDict, FrozenDictField

if TYPE_CHECKING:
from stream_ml.core.prior._base import Prior
from stream_ml.core.typing import BoundsT, ParamNameAllOpts, ParamsLikeDict
from stream_mapper.core.prior._base import Prior
from stream_mapper.core.typing import BoundsT, ParamNameAllOpts, ParamsLikeDict


class Model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
overload,
)

from stream_ml.core.typing import Array
from stream_mapper.core.typing import Array

if TYPE_CHECKING:
from collections.abc import Callable

from stream_ml.core.typing import ArrayLike
from stream_mapper.core.typing import ArrayLike

Self = TypeVar("Self", bound="Data[Array]") # type: ignore[valid-type]

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
from dataclasses import KW_ONLY, dataclass, fields
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable

from stream_ml.core._connect.nn_namespace import NN_NAMESPACE
from stream_ml.core._core.model_api import Model
from stream_ml.core.setup_package import CompiledShim
from stream_ml.core.typing import (
from stream_mapper.core._connect.nn_namespace import NN_NAMESPACE
from stream_mapper.core._core.model_api import Model
from stream_mapper.core.setup_package import CompiledShim
from stream_mapper.core.typing import (
Array,
ArrayNamespace,
BoundsT,
NNModel,
ParamsLikeDict,
)
from stream_ml.core.utils.cached_property import cached_property
from stream_ml.core.utils.frozen_dict import FrozenDict, FrozenDictField
from stream_mapper.core.utils.cached_property import cached_property
from stream_mapper.core.utils.frozen_dict import FrozenDict, FrozenDictField

if TYPE_CHECKING:
from stream_ml.core._data import Data
from stream_ml.core.params import ModelParameters, Params
from stream_ml.core.prior import Prior
from stream_ml.core.typing import NNNamespace
from stream_mapper.core._data import Data
from stream_mapper.core.params import ModelParameters, Params
from stream_mapper.core.prior import Prior
from stream_mapper.core.typing import NNNamespace


def _get_array_namespace(
Expand Down Expand Up @@ -94,15 +94,15 @@ class ModelsBase(
name : str or None, optional keyword-only
The (internal) name of the model, e.g. 'stream' or 'background'. Note
that this can be different from the name of the model when it is used in
a mixture model (see :class:`~stream_ml.core.core.MixtureModel`).
a mixture model (see :class:`~stream_mapper.core.core.MixtureModel`).
Notes
-----
The following fields on :class:`~stream_ml.core.ModelAPI` are properties here:
The following fields on :class:`~stream_mapper.core.ModelAPI` are properties here:
- :attr:`~stream_ml.core.ModelBase.coord_names`
- :attr:`~stream_ml.core.ModelBase.coord_err_names`
- :attr:`~stream_ml.core.ModelBase.coord_bounds`
- :attr:`~stream_mapper.core.ModelBase.coord_names`
- :attr:`~stream_mapper.core.ModelBase.coord_err_names`
- :attr:`~stream_mapper.core.ModelBase.coord_bounds`
"""

components: FrozenDictField[str, Model[Array, NNModel]] = FrozenDictField()
Expand Down
Loading

0 comments on commit d5c98a8

Please sign in to comment.