Skip to main content

util.sample_data

logger_config​

logger​

T​

SAMPLE_DATA_URL​

DOWNLOAD_PATH​

DATASETS​

GIN_UNREACHABLE_MSG​

_with_retries​

def _with_retries(func: Callable[[], T],
attempts: int = 4,
base_delay: float = 5.0) -> T

Call func, retrying on network errors with exponential backoff.

_fetch​

def _fetch(remote_path: str,
sha256: str | None,
fname: str | None = None) -> Path

Download one file from the sample-data repository, or reuse the cached copy if its hash matches.

download_sample_data​

def download_sample_data(source_software: str,
with_video: bool = True) -> dict

Download sample data.

Files are downloaded from movement's sample-data repository on SWC GIN and cached in ~/.movement/data. This bypasses movement.sample_data for now: up to movement 0.17.0 it downloads from G-Node GIN (gin.g-node.org), which is often unreachable. movement moved to SWC GIN in https://github.com/neuroinformatics-unit/movement/pull/1080, which is not yet released. Once a movement release includes it, go back to movement.sample_data.fetch_dataset_paths and require that version.

Parameters

  • source_software (str): Source software used for pose estimation.
  • with_video (bool, optional): If True, the video will be downloaded as well. Defaults to True.

Returns

  • dict: Dictionary with the paths to the downloaded sample data ("poses", "video", "frame") and the video frame rate ("fps"). The video is saved under the pose file's name.