Spaces:
Sleeping
Sleeping
Download src/features/sanitization.py from koushik2109/mindscope-Model: direct link, hf CLI and curl.
- Browser
- Download file 360 Bytes
-
https://huggingface.co/spaces/koushik2109/mindscope-Model/resolve/main/src/features/sanitization.py
- Command line
-
hf download hf://spaces/koushik2109/mindscope-Model/src/features/sanitization.py
-
curl -L -o sanitization.py https://huggingface.co/spaces/koushik2109/mindscope-Model/resolve/main/src/features/sanitization.py
360 Bytes
| import numpy as np | |
| def sanitize_array(array: np.ndarray, fill_value: float = 0.0) -> np.ndarray: | |
| if not isinstance(array, np.ndarray): | |
| array = np.asarray(array, dtype=np.float32) | |
| else: | |
| array = array.astype(np.float32, copy=False) | |
| array = np.nan_to_num(array, nan=fill_value, posinf=fill_value, neginf=fill_value) | |
| return array | |