Receptive field mapping pipeline applied to Allen Open Scope electrophysiology data. Zebra noise (pink noise video) stimuli are decomposed by a Gabor wavelet filter bank, and the resulting wavelet responses are cross-correlated with single-unit spike rates to estimate receptive field maps.
conda env create -f envs/waven_dandi.yml
conda activate waven_dandiThis installs the waven package directly from the develop branch of github.com/RaabeM/waven.
Open waven_settings.py and update the two path entries to point to your data:
"Movie Path": "/path/to/zebra_allen_screen_tscale_30_scale_10.mp4",
"Library Path": "/path/to/filter_libraries/",Movie Path: Path to Zebra stimulus, can be downloaded from Open-Scope-Repo LinkLibrary Path: Path to where the wavelet library will be saved
Caution: Under the current settings loading the filter libraries takes 256 GB of RAM! I am working on making it more handy.
python compute_waven_pipeline.py ProbeB \***
--nwb-path /data/sub-820454.nwb \
--results-dir /results/waven/probe(positional, defaultProbeB): probe to process--nwb-path: path to the NWB file--results-dir: root directory for output HDF5 files
Results are saved to <results-dir>/<probe>/lib_<hash>/ as one .h5 file per (delay, duration) combination.
Each result file is an HDF5 with the following structure:
/attrs: sigmas, thetas, frequencies, delay, duration, session, probe
/unit_ids — (n_units,) unit identifiers
/correlation_matrix — (n_units, nx, ny, n_thetas, ns, n_freqs) gzip-4
/best_gabor_params_idx — (5, n_units)
/best_gabor_params_degree — (4, n_units)
/abs_max_value — (n_units,)
After running the pipeline across the full delay × duration grid:
python optimize_waven_parameters.py /results/waven/ProbeB/lib_<hash>/ \
--output /results/waven/ProbeB/lib_<hash>/best_params.h5/unit_ids — (n_units,) unit identifier strings
/rf_maps — (n_units, nx, ny) float32 gzip-4 spatial RF map at best params
/delay — (n_units,) optimal delay in seconds
/duration — (n_units,) optimal duration in seconds
/abs_max_value — (n_units,) peak |Pearson r| across all (delay, duration, θ, σ, f)
/x_deg — (n_units,) RF centre azimuth in visual degrees
/y_deg — (n_units,) RF centre elevation in visual degrees
/theta_deg — (n_units,) orientation in Waven's degree convention
/theta_rad — (n_units,) orientation in radians
/sigma_deg — (n_units,) Gabor σ in visual degrees
/sigma — (n_units,) Gabor σ in pixels
/frequency — (n_units,) spatial frequency in cycles/pixel
/xi, /yi — (n_units,) grid indices of RF centre
/theta_idx, /sigma_idx, /frequency_idx — (n_units,) grid indices of best params
/lib_id — (n_units,) filter library hash string
/source_file — (n_units,) path to the per-(delay, duration) source .h5