All pipelines

Batch processing

Run one analysis with the same settings on a folder of files and get one summary table, a log and, for LDF, the trial files.

What each pipeline measures

What each pipeline measures

  • LDF: the LDF Process steps (decimate, filter, cut trials around each onset), then the response features of the mean trial (onset 0 s, baseline = the pre-onset part): peak latency and amplitude, onset delay, FWHM, AUC, rise and decay time, integral.
  • LFP: ERP per channel as in LFP Analysis (onsets on the mean-subtracted stimulus). N1 = minimum in the N1 window, P2 = maximum in the P2 window; latency in ms after the stimulus, amplitude relative to the pre-stimulus mean, multiplied by Amplitude scale (1e6: V to µV). With Compute CSD (≥ 3 channels, in the listed order, top to bottom): the CSD minimum in the N1 window per channel (AmpUnit / mm²) and the sink channel of the file.
  • MUA: spike sorting per channel as in MUA Analysis. The random generator is set to Random seed before every channel, so the same file always gives the same clusters, whatever its position in the list. Per channel: spikes in units, units (good / rejected by the quality check: SNR < 2 or > 2% ISIs below the refractory period), mean rate and rate per unit, mean SNR, worst ISI violation and, with a stimulus, the rate in the response window vs the baseline window.
  • Imaging: per ROI the mean brightness and ΔF/F (F0 = mean of the first baseline frames) with its peak and peak time; with a line, the vessel diameter (FWHM; Robust diameter ignores red blood cells) as mean, min and max. No smoothing or normalisation is applied; Motion correction registers every frame onto the mean image first.
  • Response features: the nine features of Signal Characterization, for the mean of the series in each file or for every series.

Good to know

  • Channels are the numbers saved in the file (lfp_channels / mua_channels), otherwise the row numbers. Empty = all channels.
  • Vector fields take numbers separated by spaces, e.g. 5 50 for a window or 45 70 75 70 for a line.
  • The same pipelines run from scripts: R = Batch.run('ldf', folder, params, outFolder); Batch.defaults('ldf') lists the settings.

A file that fails does not stop the batch: it gets a red row with the reason, and the other files are processed. Cancel stops before the next file and still writes the summary of the files done. Rows are coloured by status: green ok, orange warning (some channels failed), red error, grey skipped.

Walkthrough on the demo batches

Inputs and outputs

In

  • LDF: cropped .mat files from LDF Extract (stim, LDF, t, Fs)
  • LFP: .mat files from Extract Ephys (lfp_data, stim_data, lfp_fs, stim_fs; t_lfp, lfp_channels optional)
  • MUA: .mat files from Extract Ephys (mua_data, mua_fs; t_mua, mua_channels, stim_data + t_stim optional)
  • Imaging: .mat with stack (or frames), optional timeVec / t and roiMask / roiMasks, or a multi-frame TIFF
  • Response features: any file Signal Characterization reads (segmentedLDF + segmentedTime, lfp_data + t_lfp, t + y, t + LDF)

Out

  • <name>_summary.csv and <name>_summary.mat (table summary + struct batch with the settings, files, statuses and log): columns File, Status, Message, then the pipeline's results
  • <name>_log.txt: date, settings and one line per file (result or error)
  • LDF: trials/<file>_segments.mat per recording (segmentedLDF, segmentedTime, Fs), ready for LDF Average

From scripts

The same pipelines run without the window, which is useful for many sessions or for a methods section:

p = Batch.defaults('ldf');          % the settings and their defaults
p.threshold = 2.5;
R = Batch.run('ldf', folder, p, outFolder);

Pipelines: 'ldf', 'erp', 'mua', 'roi', 'features'. The MUA pipeline sets the random generator to the Random seed setting before every channel, so the same file always gives the same clusters, and leaves MATLAB's global random stream as it was.

Demo expectations

Try demo batch writes a few files per pipeline, each with slightly different known answers (generator: core/demo/demoBatch.m, described on the demo data page).

  • Data: Try demo batch writes synthetic files for the chosen pipeline, each with slightly different known answers, and fills the settings.
  • LDF: 4 cropped recordings (200 s, 7 stimuli of 5 s). What you should get: 7 onsets and 6 trials per file (the last stimulus is too close to the end); peak latency ~3, 3.5, 4 and 4.5 s and peak amplitude ~20, 25, 30 and 35 PU (within ~2 PU); one trial file per recording in the trials folder.
  • LFP: 3 recordings, 8 channels 100 µm apart. What you should get: 8 rows per file; the N1 is largest and the CSD sink (SinkChannel) is on channel 3, 4 and 5, with the N1 at ~12, 15 and 18 ms (roughly −100 to −140 µV on the sink channel).
  • MUA: the demo MUA recording and a copy recorded at twice the gain, channel 4. What you should get: 2–3 units and the same spike count in both files (sorting does not depend on the gain); the evoked rate (5–55 ms after each stimulus) is several times the baseline rate.
  • Imaging: 3 stacks with a cell (roiMask) and a vessel crossed by the line 25 50 63 50. What you should get: peak ΔF/F ~0.5, 1.0 and 1.5 at ~6.7 s (the second of two transients, which rides on the tail of the first) and mean vessel diameter ~10, 12 and 14 px.
  • Response features: 4 trial files. What you should get: peak latency ~3, 3.5, 4, 4.5 s and peak amplitude ~20, 25, 30, 35 PU (one row per file); Series = Each series gives one row per trial (32 rows).

Troubleshooting: Batch processing in the guide.