-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-41209: Make standalone, pip-installable lsst package #24
Changes from all commits
3fcf3c9
4a7a9d8
6fc6dff
a18a165
1d13e2b
5a3f65a
76bdae6
bc0a943
7bd2e16
78c8f8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- python -*- | ||
from lsst.sconsUtils import scripts | ||
# Python-only package | ||
scripts.BasicSConstruct("multiprofit", disableCc=True, noCfgFile=True) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
[build-system] | ||
requires = ["setuptools", "lsst-versions >= 1.3.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "lsst-multiprofit" | ||
description = "Astronomical image and source model fitting code." | ||
license = {file = "LICENSE"} | ||
readme = "README.rst" | ||
authors = [ | ||
{name="Rubin Observatory Data Management", email="dm-admin@lists.lsst.org"}, | ||
] | ||
classifiers = [ | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Scientific/Engineering :: Astronomy", | ||
] | ||
keywords = [ | ||
"astronomy", | ||
"astrophysics", | ||
"fitting", | ||
"lsst", | ||
"models", | ||
"modeling", | ||
] | ||
requires-python = ">=3.10.0" | ||
dependencies = [ | ||
"astropy", | ||
"gauss2d", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this on pypi? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I suppose it could be as it's a single repo and meson is pip-installable, although I'm not sure if the build configuration meets PyPI's requirements. For now, I configured the non-eups build to pip-install the bindings, so that they show up in |
||
"gauss2dfit", | ||
"lsst-pex-config", | ||
"lsst-utils", | ||
"importlib_resources", | ||
"matplotlib", | ||
"numpy", | ||
"pydantic", | ||
"scipy", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/lsst-dm/multiprofit" | ||
|
||
[project.optional-dependencies] | ||
galsim = ["galsim"] | ||
test = [ | ||
"pytest", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["python"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = { attr = "lsst_versions.get_lsst_version" } | ||
|
||
[tool.black] | ||
line-length = 110 | ||
target-version = ["py311"] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 110 | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
"__init__.py", | ||
"examples/fithsc.py", | ||
"examples/test_utils.py", | ||
"tests/*.py", | ||
] | ||
ignore = [ | ||
"N802", | ||
"N803", | ||
"N806", | ||
"N812", | ||
"N815", | ||
"N816", | ||
"N999", | ||
"D107", | ||
"D105", | ||
"D102", | ||
"D104", | ||
"D100", | ||
"D200", | ||
"D205", | ||
"D400", | ||
] | ||
line-length = 110 | ||
select = [ | ||
"E", # pycodestyle | ||
"F", # pycodestyle | ||
"N", # pep8-naming | ||
"W", # pycodestyle | ||
"D", # pydocstyle | ||
] | ||
target-version = "py311" | ||
|
||
[tool.ruff.pycodestyle] | ||
max-doc-length = 79 | ||
|
||
[tool.ruff.pydocstyle] | ||
convention = "numpy" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import pkgutil | ||
|
||
__path__ = pkgutil.extend_path(__path__, __name__) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import pkgutil | ||
|
||
__path__ = pkgutil.extend_path(__path__, __name__) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,8 @@ def _prepare(values, clip=True, out=None): | |
Prepare the data by optionally clipping and copying, and return the | ||
array that should be subsequently used for in-place calculations. | ||
""" | ||
|
||
if clip: | ||
return np.clip(values, 0., 1., out=out) | ||
return np.clip(values, 0.0, 1.0, out=out) | ||
else: | ||
if out is None: | ||
return np.array(values, copy=True) | ||
|
@@ -59,7 +58,7 @@ class AsinhStretchSigned(apvis.BaseStretch): | |
to logarithmic behavior, expressed as a fraction of the | ||
normalized image. Must be in the range between 0 and 1. | ||
Default is 0.1 | ||
""" | ||
""" # noqa: W505 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this because of the math? Can you put a backslash in after the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The math line is 10 characters too long, yes. Is a backslash supposed to split it? Anyway, most of this is copy-pasted from astropy and lightly modified. I haven't actually configured docs for the package yet so I'll do that on another ticket. |
||
|
||
def __init__(self, a=0.1): | ||
super().__init__() | ||
|
@@ -74,14 +73,14 @@ def __call__(self, values, clip=True, out=None): | |
np.abs(values, out=values) | ||
np.true_divide(values, self.a, out=values) | ||
np.arcsinh(values, out=values) | ||
np.true_divide(values, np.arcsinh(1. / self.a), out=values) | ||
np.true_divide(1. + signs*values, 2., out=values) | ||
np.true_divide(values, np.arcsinh(1.0 / self.a), out=values) | ||
np.true_divide(1.0 + signs * values, 2.0, out=values) | ||
return values | ||
|
||
@property | ||
def inverse(self): | ||
"""A stretch object that performs the inverse operation.""" | ||
return SinhStretchSigned(a=1. / np.arcsinh(1. / self.a)) | ||
return SinhStretchSigned(a=1.0 / np.arcsinh(1.0 / self.a)) | ||
|
||
|
||
class SinhStretchSigned(apvis.BaseStretch): | ||
|
@@ -99,24 +98,24 @@ class SinhStretchSigned(apvis.BaseStretch): | |
The ``a`` parameter used in the above formula. Default is 1/3. | ||
""" | ||
|
||
def __init__(self, a=1. / 3.): | ||
def __init__(self, a=1.0 / 3.0): | ||
super().__init__() | ||
self.a = a | ||
|
||
# [docs] | ||
# [docs] | ||
|
||
def __call__(self, values, clip=True, out=None): | ||
values = _prepare(values, clip=clip, out=out) | ||
values *= 2. | ||
values -= 1. | ||
values *= 2.0 | ||
values -= 1.0 | ||
np.true_divide(values, self.a, out=values) | ||
np.sinh(values, out=values) | ||
np.true_divide(values, np.sinh(1. / self.a), out=values) | ||
values += 1. | ||
values /= 2. | ||
np.true_divide(values, np.sinh(1.0 / self.a), out=values) | ||
values += 1.0 | ||
values /= 2.0 | ||
return values | ||
|
||
@property | ||
def inverse(self): | ||
"""A stretch object that performs the inverse operation.""" | ||
return AsinhStretchSigned(a=1. / np.sinh(1. / self.a)) | ||
return AsinhStretchSigned(a=1.0 / np.sinh(1.0 / self.a)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add GPL license to the classifier list and maybe there is a Science/Research intended audience and topic Scientific/Engineering :: Astronomy (see astropy)?