Skip to content
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

installation/min-python-310 #73

Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
# - macos-latest
# - windows-latest
include:
- name: python 3.9
toxenv: py39
python-version: 3.9

- name: python 3.10
toxenv: py310
Expand All @@ -44,6 +41,10 @@ jobs:
toxenv: py311
python-version: 3.11

- name: python 3.12
toxenv: py312
python-version: 3.12

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
1.1.1 (unreleased)
==================

installation
------------
- Set minimum python version to 3.10, include py312 in test suite, replace deprecated pkg_resources with importlib.metadata [#73]
- Set minimum tensorflow version to 2.16.1 [#73]
- Pre-trained neural networks updated for compatibility with Keras 3 [#73]
- Dockerfile images now use debian bookworm [#73]


1.1.0 (2024-04-09)
==================

Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.IN
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ include *.md

# Include the license file
include LICENSE

# Include setup.py
include setup.py
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# spacekit

[![Powered by Astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org)
![GitHub license](https://img.shields.io/github/license/spacetelescope/spacekit?color=black)
[![CodeFactor](https://www.codefactor.io/repository/github/spacetelescope/spacekit/badge)](https://www.codefactor.io/repository/github/spacetelescope/spacekit)
[![Build Status](https://github.com/spacetelescope/spacekit/workflows/ci/badge.svg?branch=main)](https://github.com/spacetelescope/spacekit/actions)
[![Powered by STScI Badge](https://img.shields.io/badge/powered%20by-STScI-blue.svg?colorA=707170&colorB=3e8ddd&style=flat)](http://www.stsci.edu)
[![Powered by Astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org)
[![DOI](https://zenodo.org/badge/11169350.svg)](https://zenodo.org/badge/latestdoi/11169350)

Astronomical Data Science and Machine Learning Toolkit

Expand Down
2 changes: 1 addition & 1 deletion docker/images/dashboard_image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye-slim
FROM debian:bookworm-slim
ENV DEV_HOME=/home/developer

RUN apt update && \
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools>=61.2",
"wheel"
]
build-backend = "setuptools.build_meta"
Expand Down
17 changes: 9 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = spacekit
version = 1.1.0
version = 1.1.1rc1
author = Ru Keïn
author_email = [email protected]
license = MIT
Expand All @@ -16,27 +16,28 @@ project_urls =
Documentation = https://spacekit.readthedocs.io
Tracker = https://github.com/spacetelescope/spacekit/issues
classifiers=
Programming Language :: Python :: 3
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Astronomy
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Operating System :: OS Independent
Development Status :: 3 - Alpha
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12

[options]
zip_safe = False
packages = find:
include_package_data = True
python_requires = >=3.7
python_requires = >=3.10
setup_requires =
setuptools >=42
setuptools >=61.2

install_requires =
tensorflow<2.16
tensorflow>=2.16.1
astropy
boto3
numpy>=1.19
numpy>=1.22
pandas
scikit-learn>=1.3.2

Expand Down
6 changes: 3 additions & 3 deletions spacekit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pkg_resources import get_distribution, DistributionNotFound
import importlib.metadata

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError:
pass # package is not installed

# def reload(mod):
Expand Down
13 changes: 6 additions & 7 deletions spacekit/builder/architect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
MaxPool3D,
GlobalAveragePooling3D,
)

from tensorflow.keras.metrics import RootMeanSquaredError as RMSE
from spacekit.generator.augment import augment_data, augment_image
from spacekit.analyzer.track import stopwatch
Expand Down Expand Up @@ -86,7 +85,7 @@ def load_saved_model(
"""Load saved keras model from local disk (located at the ``model_path`` attribute) or a pre-trained model from
spacekit.skopes.trained_networks (if ``model_path`` attribute is None). Example for ``compile_params``:
``dict(loss="binary_crossentropy",metrics=["accuracy"],\
optimizer=Adam(learning_rate=optimizers.schedules.ExponentialDecay(lr=1e-4, \
optimizer=Adam(learning_rate=optimizers.schedules.ExponentialDecay(1e-4, \
decay_steps=100000, decay_rate=0.96, staircase=True)))``

Parameters
Expand Down Expand Up @@ -328,7 +327,7 @@ def set_callbacks(self, patience=15):
list
[callbacks.ModelCheckpoint, callbacks.EarlyStopping]
"""
model_name = str(self.model.name_scope().rstrip("/"))
model_name = str(self.model.name)
checkpoint_cb = callbacks.ModelCheckpoint(
f"{model_name}_checkpoint.h5", save_best_only=True
)
Expand Down Expand Up @@ -362,7 +361,7 @@ def save_model(self, weights=True, output_path=".", keras_archive=True, parent_d
save model using new (preferred) keras archive format, by default True
"""
if self.name is None:
self.name = str(self.model.name_scope().rstrip("/"))
self.name = str(self.model.name)
datestamp = dt.datetime.now().isoformat().split("T")[0]
model_name = f"{self.name}_{datestamp}"
else:
Expand Down Expand Up @@ -440,7 +439,7 @@ def batch_fit(self):
tf.keras.model.history
Keras training history
"""
model_name = str(self.model.name_scope().rstrip("/").upper())
model_name = str(self.model.name).upper()
self.log.info("FITTING MODEL...")
validation_data = (
(self.X_test, self.y_test) if self.X_test is not None else None
Expand Down Expand Up @@ -483,7 +482,7 @@ def fit(self, params=None):
"""
if params is not None:
self.fit_params(**params)
model_name = str(self.model.name_scope().rstrip("/").upper())
model_name = str(self.model.name).upper()
self.log.info("FITTING MODEL...")
validation_data = (
(self.X_test, self.y_test) if self.X_test is not None else None
Expand Down Expand Up @@ -983,7 +982,7 @@ def batch(self):
for i in range(self.batch_size):
xa[i] = augment_data(xa[i])
xb[i] = augment_image(xb[i])
yield [xa, xb], yb
yield (xa, xb), yb


class BuilderCNN2D(Builder):
Expand Down
Binary file modified spacekit/builder/trained_networks/hst_cal.zip
Binary file not shown.
Binary file modified spacekit/builder/trained_networks/jwst_cal.zip
Binary file not shown.
Binary file modified spacekit/builder/trained_networks/svm_align.zip
Binary file not shown.
40 changes: 20 additions & 20 deletions spacekit/datasets/meta.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
calcloud = {
"uri": "https://zenodo.org/record/10895592/files",
"uri": "https://zenodo.org/record/11169350/files",
"data": {
"2022-02-14": {
"fname": "hst_cal_std_2022-02-14.zip?download=1",
"hash": "e9375c65feb413a660cb737a9a8a3a73",
"hash": "3ca674b0d81e98e319f6e80d78ce8db8",
"desc": "data, model and training results",
"key": "2022-02-14-1644848448",
"size": "11.4MB",
"size": "9.7MB",
},
"2021-11-04": {
"fname": "hst_cal_std_2021-11-04.zip?download=1",
Expand All @@ -32,29 +32,29 @@
},
"model": {
"fname": "hst_cal.zip",
"hash": "ffe7d00504ad5d6ebc79488abe612474",
"hash": "acb07516b9385ce7182577ef7216ae75",
"desc": "hst calcloud resource prediction models",
"key": "hst_cal",
"size": "385.42kB",
"size": "385.47kB",
},
}

svm = {
"uri": "https://zenodo.org/record/10895592/files",
"uri": "https://zenodo.org/record/11169350/files",
"data": {
"2022-02-14": {
"fname": "hst_drz_svm_2022-02-14.zip?download=1",
"hash": "3d6ade5510cc7aad4c2c45329c0751fe",
"hash": "2660e4457b19ce01b625d7a668d04e89",
"desc": "latest model, data and training results",
"key": "2022-02-14-1644850390",
"size": "18MB",
"size": "5MB",
},
"2022-01-30": {
"fname": "hst_drz_svm_2022-01-30.zip?download=1",
"hash": "9ad9b95c20b82877f1ea7b0fa64b10a1",
"hash": "370fdbdb8d2b45b2ded998dbcc6927a5",
"desc": "updated model, data and training results",
"key": "2022-01-30-1643523529",
"size": "18MB",
"size": "5MB",
},
"2022-01-16": {
"fname": "hst_drz_svm_2022-01-16.zip?download=1",
Expand All @@ -80,7 +80,7 @@
},
"model": {
"fname": "svm_align.zip",
"hash": "af3b019cc3079cb29fd01bae58e9560d",
"hash": "c98492b1e729407c72a69d2c739232be",
"desc": "hst svm alignment prediction models",
"key": "svm_align",
"size": "4.92MB",
Expand All @@ -89,7 +89,7 @@


jwst_cal = {
"uri": "https://zenodo.org/record/10895592/files",
"uri": "https://zenodo.org/record/11169350/files",
"data": {
"2023-08-02": {
"fname": "",
Expand All @@ -101,16 +101,16 @@
},
"model": {
"fname": "jwst_cal.zip",
"hash": "f3b6dbcc3fc92a6f806f5b5464e68c02",
"hash": "c2c6764bcf1092e993d061be43075e3d",
"desc": "JWST Calibration Processing Resource Prediction Models",
"key": "jwst_cal",
"size": "1.5MB",
"size": "526.89kB",
},
}


k2 = {
"uri": "https://zenodo.org/record/10895592/files",
"uri": "https://zenodo.org/record/11169350/files",
"data": {
"test": {
"fname": "k2-exo-flux-ts-test.csv.zip?download=1",
Expand Down Expand Up @@ -142,19 +142,19 @@
"calcloud": {
"basepath": "spacekit.builder.trained_networks",
"fname": "hst_cal.zip",
"hash": "f3422c98d93520898e10d068a1e434dd5caf40e632760687df377c1b2bccff57",
"size": "385.42kB",
"hash": "3dcfd4760154dee890f7943e237e679a43eef82d3c0838ff62ecf17e4c3702fb",
"size": "385.47kB",
},
"svm": {
"basepath": "spacekit.builder.trained_networks",
"fname": "svm_align.zip",
"hash": "577a87fab157fdadc657af0dcd67b55af2d89d855d5597bd96671b20ff135636",
"hash": "cda062ba768374802e4e8b919c0dcce79ce3b72e29004cc09601a67da454b008",
"size": "4.92MB",
},
"jwst_cal": {
"basepath": "spacekit.builder.trained_networks",
"fname": "jwst_cal.zip",
"hash": "b61d0281fd149e2b0ffcded81ba54b24b479c5b7191072be2bfb59464d779187",
"size": "1.5MB",
"hash": "31142d47e5fc31650b49edb44dfa3db5f1d09380864b9560e2dded456723dfe6",
"size": "526.89kB",
},
}
2 changes: 1 addition & 1 deletion tests/data_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def pytest_configure(config):
tmp_path_factory = TempPathFactory(
config.option.basetemp, trace=config.trace.get("tmpdir"), _ispytest=True
)
data_uri = "https://zenodo.org/record/10895592/files/pytest_data.tgz?download=1"
data_uri = "https://zenodo.org/record/11169350/files/pytest_data.tgz?download=1"
basepath = tmp_path_factory.getbasetemp()
target_path = os.path.join(basepath, "pytest_data.tgz")
with open(target_path, "wb") as f:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
isolated_build = True
envlist =
py3{9,10,11}
py3{10,11,12}
check-{style,security}
pep517
#test{,-oldestdeps,-devdeps}
Expand Down
Loading