Karamanlis et al. 2024 Dataset
Mouse and marmoset retinal ganglion cell responses to natural stimuli, originally published in Karamanlis et al. (2024): Nonlinear receptive fields evoke redundant retinal coding of natural scenes, Nature.
Dataset: doi.org/10.12751/g-node.ejk8kx
Stimuli
stimuli
Minimal stimuli loading utilities to train a model on the data used in Karamanlis et al. 2024
Paper: https://doi.org/10.1038/s41586-024-08212-3 Data: https://doi.org/10.12751/g-node.ejk8kx
load_stimuli_for_session
load_stimuli_for_session(
session_path: str | PathLike,
stim_type: Literal[
"fixationmovie",
"frozencheckerflicker",
"gratingflicker",
"imagesequence",
],
downsampled_size: tuple[int, int],
normalize_stimuli: bool,
) -> MoviesTrainTestSplit | None
Load stimuli for a single session.
| PARAMETER | DESCRIPTION |
|---|---|
session_path
|
Path to the session directory.
TYPE:
|
stim_type
|
The stimulus type to filter files.
TYPE:
|
downsampled_size
|
Size to downsample the stimuli.
TYPE:
|
normalize_stimuli
|
Whether to normalize the stimuli.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MoviesTrainTestSplit | None
|
MoviesTrainTestSplit | None: Loaded stimuli for the session or None if no relevant file found. |
Source code in openretina/data_io/karamanlis_2024/stimuli.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
load_all_stimuli
load_all_stimuli(
base_data_path: str | PathLike,
stim_type: Literal[
"fixationmovie",
"frozencheckerflicker",
"gratingflicker",
"imagesequence",
] = "fixationmovie",
normalize_stimuli: bool = True,
specie: Literal["mouse", "marmoset"] = "mouse",
downsampled_size: tuple[int, int] = (60, 80),
) -> dict[str, MoviesTrainTestSplit]
Load stimuli for all sessions.
| PARAMETER | DESCRIPTION |
|---|---|
base_data_path
|
Base directory containing session data. Can also be the path to the "sessions" folder in the huggingface mirror.
TYPE:
|
"https
|
//huggingface.co/datasets/open-retina/open-retina/tree/main/gollisch_lab/karamanlis_2024/sessions"
|
stim_type
|
The stimulus type to filter files.
TYPE:
|
normalize_stimuli
|
Whether to normalize the stimuli.
TYPE:
|
specie
|
Animal species (e.g., "mouse", "marmoset").
TYPE:
|
downsampled_size
|
Size to downsample the stimuli.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, MoviesTrainTestSplit]
|
dict[str, MoviesTrainTestSplit]: Dictionary mapping session names to stimulus data. |
Source code in openretina/data_io/karamanlis_2024/stimuli.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
return_fix_movie_torch
return_fix_movie_torch(
screensize: tuple[int, int],
im_ensemble: ndarray | Tensor,
list_fixations: ndarray,
) -> Tensor
Generates a movie of fixations using an image ensemble. Faster version using PyTorch, which supports fancier indexing.
Python port from: https://github.com/dimokaramanlis/subunit_grid_model/blob/main/code/returnFixMovie.m
screensize : tuple (Ny, Nx) size of the monitor, e.g., (600, 800). im_ensemble : ndarray Ensemble of images with dimensions (Nyim, Nxim, Nimages). list_fixations : ndarray Array of shape (3, Nframes) containing fixations (image index, x, y).
blockstimulus : ndarray Movie of fixations with shape (Ny, Nx, Nframes), where the images presented at each frame are shifted based on gaze data.
Source code in openretina/data_io/karamanlis_2024/stimuli.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
return_fix_movie
return_fix_movie(
screensize: tuple[int, int],
im_ensemble: ndarray,
list_fixations: ndarray,
) -> ndarray
Generates a movie of fixations using an image ensemble.
Python port from: https://github.com/dimokaramanlis/subunit_grid_model/blob/main/code/returnFixMovie.m
screensize : tuple (Ny, Nx) size of the monitor, e.g., (600, 800). im_ensemble : ndarray Ensemble of images with dimensions (Nyim, Nxim, Nimages). list_fixations : ndarray Array of shape (3, Nframes) containing fixations (image index, x, y).
blockstimulus : ndarray Movie of fixations with shape (Ny, Nx, Nframes), where the images presented at each frame are shifted based on gaze data.
Source code in openretina/data_io/karamanlis_2024/stimuli.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
get_ranges
get_ranges(
tr_x: int,
tr_y: int,
Nxs: int,
Nys: int,
Nx: int,
Ny: int,
rx: ndarray,
ry: ndarray,
) -> tuple[int, int, int, int, ndarray, ndarray]
Compute valid ranges and indices based on translations.
tr_x, tr_y : int Translation values for x and y. Nxs, Nys : int Screen dimensions (Nx, Ny). Nx, Ny : int Image dimensions. rx, ry : ndarray Ranges for x and y.
xmin, xmax, ymin, ymax : int Indices for cropping (screen coordinates). x_or, y_or : ndarray Translated indices for image coordinates.
Source code in openretina/data_io/karamanlis_2024/stimuli.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
Responses
responses
Minimal responses loading utilities to train a model on the data used in Karamanlis et al. 2024
Paper: https://doi.org/10.1038/s41586-024-08212-3 Data: https://doi.org/10.12751/g-node.ejk8kx
load_responses_for_session
load_responses_for_session(
session_path: str | PathLike,
stim_type: Literal[
"fixationmovie",
"frozencheckerflicker",
"gratingflicker",
"imagesequence",
],
fr_normalisation: float,
) -> ResponsesTrainTestSplit | None
Load responses for a single session.
| PARAMETER | DESCRIPTION |
|---|---|
session_path
|
Path to the session directory.
TYPE:
|
stim_type
|
The stimulus type to filter files.
TYPE:
|
fr_normalisation
|
Normalization factor for firing rates.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ResponsesTrainTestSplit
|
Loaded responses for the session.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
IOError
|
If multiple relevant files are found. |
Source code in openretina/data_io/karamanlis_2024/responses.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
load_all_responses
load_all_responses(
base_data_path: str | PathLike,
stim_type: Literal[
"fixationmovie",
"frozencheckerflicker",
"gratingflicker",
"imagesequence",
] = "fixationmovie",
specie: Literal["mouse", "marmoset"] = "mouse",
fr_normalization: float = 1.0,
) -> dict[str, ResponsesTrainTestSplit]
Load responses for all sessions.
| PARAMETER | DESCRIPTION |
|---|---|
base_data_path
|
Base directory containing session data. Can also be the path to the "sessions" folder in the huggingface mirror.
TYPE:
|
"https
|
//huggingface.co/datasets/open-retina/open-retina/tree/main/gollisch_lab/karamanlis_2024/sessions"
|
stim_type
|
The stimulus type to filter files.
TYPE:
|
specie
|
Animal species (e.g., "mouse", "marmoset").
TYPE:
|
fr_normalization
|
Normalization factor for firing rates.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, ResponsesTrainTestSplit]
|
dict[str, ResponsesTrainTestSplit]: Dictionary mapping session names to response data. |
Source code in openretina/data_io/karamanlis_2024/responses.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |