From 6996a0188e26d929233709d7cbff11b44879aee3 Mon Sep 17 00:00:00 2001 From: Constantinos Eleftheriou Date: Mon, 12 Oct 2026 11:53:57 +0100 Subject: [PATCH 1/5] add docs for regressions analyiss --- .../how-to/imaging-with-behaviour-analysis.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/how-to/imaging-with-behaviour-analysis.md b/docs/how-to/imaging-with-behaviour-analysis.md index e69de29..18b4e55 100644 --- a/docs/how-to/imaging-with-behaviour-analysis.md +++ b/docs/how-to/imaging-with-behaviour-analysis.md @@ -0,0 +1,21 @@ +# Imaging with behaviour + +## Pixel-wise regression + +`mesoscopy process regression` fits a ridge regression of behavioural regressors to every pixel of a ∆F/F +recording. Run it on a z-scored recording from `process zscore`. + +```bash +mesoscopy process regression /path/to/example-recording_zscored.h5 /path/to/example-recording_regressors.npz +``` + +The regressor file is an NPZ or HDF5 file holding the `regressors` matrix, their `labels` and the `trial_idx` of the +frames they cover. + +Pass `-n/--nuisance-regressors` to add regressors recorded on another clock, such as motion energy from a behaviour +camera. The nuisance file is an NPZ or HDF5 file with a `timestamps` array. Every other array in it becomes one +regressor, resampled onto the recording's timestamps, z-scored and added to the regressor matrix. Repeat `-n` to add +regressors from several files. + +The command writes `example-recording_zscored_regression.npz` with the coefficients, R² and mean squared error of +every pixel. Pass `--h5` for an HDF5 file instead. From 2ee8fc704a0da9f9ab1a18404ca31fe6bee9c52c Mon Sep 17 00:00:00 2001 From: Constantinos Eleftheriou Date: Mon, 12 Oct 2026 11:55:10 +0100 Subject: [PATCH 2/5] add docs about custom masks in extracting region activity --- docs/typical-workflow.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/typical-workflow.md b/docs/typical-workflow.md index 462cfa2..46af871 100644 --- a/docs/typical-workflow.md +++ b/docs/typical-workflow.md @@ -70,6 +70,13 @@ mesoscopy report /path/to/example-recording_registered.h5 mesoscopy process regions /path/to/example-recording.nwb ``` +This writes `example-recording_regions.csv` with the mean ∆F/F of each Allen atlas region in every frame. + +Pass `-m/--mask` to extract custom regions instead. A mask is an NPY, NPZ or TIFF file drawn on the registered +frames. A boolean mask gives one region, named after the file or, in an NPZ file, after its key. An integer mask +gives one region per label, named `_