Skip to content

Commit b2a7acf

Browse files
committed
move cec data to separate package
1 parent 7092543 commit b2a7acf

25 files changed

+10
-13
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ viz = [
4545
ml = [
4646
"scikit-learn",
4747
]
48-
# CEC benchmark data fetching
48+
# CEC benchmark data files
4949
cec = [
50-
"pooch>=1.5.0",
50+
"surfaces-cec-data>=0.1.0",
5151
]
5252
# Time-series functions with sktime
5353
timeseries = [

src/surfaces/test_functions/cec/_base_cec.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def _data_dir(self) -> Path:
104104
def _load_data(self) -> Dict[str, np.ndarray]:
105105
"""Load rotation matrices and shift vectors for this dimension.
106106
107-
Data files are cached at class level to avoid repeated disk access.
107+
Data files are fetched from GitHub releases on first use and cached
108+
locally. Subsequent calls use the cached files.
108109
109110
Returns
110111
-------
@@ -113,19 +114,15 @@ def _load_data(self) -> Dict[str, np.ndarray]:
113114
114115
Raises
115116
------
116-
FileNotFoundError
117-
If the data file for this dimension doesn't exist.
117+
ImportError
118+
If pooch is not installed.
118119
"""
119120
cache_key = (self.data_prefix, self.n_dim)
120121
if cache_key not in self._data_cache:
121-
data_file = self._data_dir / f"{self.data_prefix}_data_dim{self.n_dim}.npz"
122-
if not data_file.exists():
123-
raise FileNotFoundError(
124-
f"CEC data file not found: {data_file}\n"
125-
f"Download the official CEC data files from:\n"
126-
f"https://github.com/P-N-Suganthan/{self.data_prefix.upper()}\n"
127-
f"Then convert them using the provided conversion script."
128-
)
122+
from ..._data import fetch_file
123+
124+
filename = f"{self.data_prefix}_data_dim{self.n_dim}.npz"
125+
data_file = fetch_file(self.data_prefix, filename)
129126
self._data_cache[cache_key] = dict(np.load(data_file))
130127
return self._data_cache[cache_key]
131128

Binary file not shown.
Binary file not shown.
-4.11 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-6.23 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)