Skip to content
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
12 changes: 7 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
pip --default-timeout=100 install -e .
pip --default-timeout=100 install "tensorflow>=2.10,<2.16"
# pip --default-timeout=100 install "tensorflow>=2.13"
- name: Install TensorFlow
# TF <2.16 has no 3.12 wheels (3.12 support requires TF 2.16+/Keras 3)
if: matrix.python-version != '3.12'
run: pip install "tensorflow>=2.10,<2.16"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
2 changes: 1 addition & 1 deletion ewstools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def pspec_welch(yVals,
ham_offset_points = int(ham_offset*ham_length)

## Compute the periodogram using Welch's method (scipy.signal function)
pspec_raw = signal.welch(yVals,
pspec_raw = signal.welch(np.asarray(yVals),
fs,
nperseg=ham_length,
noverlap=ham_offset_points,
Expand Down
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ version = "2.1.2"
description = "A Python package for early warning signals (EWS) of bifurcations in time series data."
authors = [{ name = "Thomas M Bury", email = "tombury182@gmail.com" }]
readme = "README.md"
requires-python = ">=3.8,<3.12" # Adjust based on your supported Python version
requires-python = ">=3.9"
dependencies = [
"pandas>=0.23.0",
"numpy>=1.14.0,<1.25.0",
"numpy>=1.26.0,<2.0", # 1.26 is oldest with 3.12 wheels; <2.0 avoids breaking changes
"plotly>=2.3.0",
"lmfit>=0.9.0",
"arch>=4.4",
"arch>=6.2", # 6.2 is oldest with compiled 3.12 wheels
"statsmodels>=0.9.0",
"scipy>=1.0.1",
"deprecation>=2.0",
Expand All @@ -31,9 +31,13 @@ classifiers = [

[project.optional-dependencies]
tf = [
"tensorflow>=2.10,<=2.16 ; sys_platform != 'win32'",
# <=2.16 includes 2.16.0 (Keras 3 breaking change); <2.16 excludes it
"tensorflow>=2.10,<2.16 ; sys_platform != 'win32'",
]

[tool.pytest.ini_options]
markers = ["tensorflow: tests requiring TensorFlow (deselect with '-m \"not tensorflow\"')"]

[tool.setuptools.packages]
find = {}

Expand Down
9 changes: 5 additions & 4 deletions tests/test_ewstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import pandas as pd
import plotly

import tensorflow as tf
from tensorflow.keras.models import load_model
from packaging import version

# Import ewstools
import ewstools
from ewstools import core
Expand Down Expand Up @@ -221,11 +217,16 @@ def test_TimeSeries_ews():
assert type(fig) == plotly.graph_objs._figure.Figure


@pytest.mark.tensorflow
def test_TimeSeries_dl_preds():
"""
Test the TimeSeries methods that involve computing DL predictions

"""
# TF imports moved inside test so rest of suite runs without TF installed
tf = pytest.importorskip("tensorflow")
from tensorflow.keras.models import load_model
from packaging import version

# Simulate a time series
tVals = np.arange(0, 10, 0.1)
Expand Down
Loading