Skip to content

Commit f370f92

Browse files
author
Kyle
committed
Hybrid approach: generate SpikeGLX locally, download pre-built Phy data
Instead of downloading everything or generating everything: - SpikeGLX recording data is generated locally (fast, ~10s) - Phy sorting data is downloaded from GitHub release (17MB, avoids ~2min PCA) - Falls back to full generation if download fails (offline support)
1 parent ceaa846 commit f370f92

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

src/pyflask/manageNeuroconv/manage_neuroconv.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,22 +1691,6 @@ def _download_and_extract_tar_gz(url: str, output_path: Path):
16911691
Path(tmp_path).unlink(missing_ok=True)
16921692

16931693

1694-
def download_test_data(output_path: str):
1695-
"""Generate SpikeGLX data locally (fast) and download pre-generated Phy data (avoids slow PCA fitting)."""
1696-
base_path = Path(output_path)
1697-
phy_output_folder = base_path / "phy"
1698-
1699-
# Generate SpikeGLX data locally -- fast (just writing binary files + meta)
1700-
generate_test_data(base_path)
1701-
1702-
# Download Phy data if not already present -- avoids the slow PCA/waveform computation
1703-
if not phy_output_folder.exists() or not any(phy_output_folder.iterdir()):
1704-
_download_and_extract_tar_gz(TUTORIAL_PHY_DATA_URL, phy_output_folder)
1705-
1706-
1707-
TUTORIAL_PHY_DATA_URL = "https://github.com/NeurodataWithoutBorders/nwb-guide/releases/download/tutorial-test-data-v1/tutorial_phy_data.tar.gz"
1708-
1709-
17101694
def _generate_spikeglx_data(base_path: Path):
17111695
"""Generate synthetic SpikeGLX recording data (AP + LF bands). Fast — just writes binary files + meta."""
17121696
import spikeinterface
@@ -1771,10 +1755,6 @@ def _generate_spikeglx_data(base_path: Path):
17711755

17721756
def download_test_data(output_path: str):
17731757
"""Generate SpikeGLX data locally (fast) and download pre-generated Phy data (avoids slow PCA fitting)."""
1774-
import tarfile
1775-
import urllib.request
1776-
import tempfile
1777-
17781758
base_path = Path(output_path)
17791759
phy_output_folder = base_path / "phy"
17801760

@@ -1783,17 +1763,7 @@ def download_test_data(output_path: str):
17831763

17841764
# Download Phy data — avoids the slow PCA/waveform computation (~2 min)
17851765
if not phy_output_folder.exists() or not any(phy_output_folder.iterdir()):
1786-
phy_output_folder.mkdir(parents=True, exist_ok=True)
1787-
1788-
with tempfile.NamedTemporaryFile(suffix=".tar.gz", delete=False) as tmp:
1789-
tmp_path = tmp.name
1790-
1791-
try:
1792-
urllib.request.urlretrieve(TUTORIAL_PHY_DATA_URL, tmp_path)
1793-
with tarfile.open(tmp_path, "r:gz") as tar:
1794-
tar.extractall(path=str(phy_output_folder))
1795-
finally:
1796-
Path(tmp_path).unlink(missing_ok=True)
1766+
_download_and_extract_tar_gz(TUTORIAL_PHY_DATA_URL, phy_output_folder)
17971767

17981768

17991769
def generate_test_data(output_path: str):

0 commit comments

Comments
 (0)