File MIES_AnalysisFunctions_MultiPatchSeq.ipf

MSQ Analysis functions for multi patch sequence

The Multi Patch Seq analysis functions store various results in the labnotebook.

For orientation the following table shows their relation. All labnotebook keys can and should be created via CreateAnaFuncLBNKey().

Naming constant

Description

Unit

Labnotebook

Analysis function

Per chunk?

Headstage dependent?

List? (semicolon)

Key-Value pairs? (colon)

Values are lists? (comma)

MSQ_FMT_LBN_SPIKE_DETECT

The required number of spikes were detected on the sweep

ms

Numerical

FRE

No

Yes

No

No

No

MSQ_FMT_LBN_STEPSIZE

Current DAScale step size

(none)

Numerical

FRE

No

Yes

No

No

No

MSQ_FMT_LBN_FINAL_SCALE

Final DAScale of the given headstage, only set on success

(none)

Numerical

FRE

No

Yes

No

No

No

MSQ_FMT_LBN_HEADSTAGE_PASS

Pass/fail state of the headstage

On/Off

Numerical

FRE, DS, SC

No

Yes

No

No

No

MSQ_FMT_LBN_SWEEP_PASS

Pass/fail state of the complete sweep

On/Off

Numerical

FRE, DS, SC

No

No

No

No

No

MSQ_FMT_LBN_SET_PASS

Pass/fail state of the complete set

On/Off

Numerical

FRE, DS, SC

No

No

No

No

No

MSQ_FMT_LBN_ACTIVE_HS

Active headstages in pre set event

On/Off

Numerical

FRE, DS

No

Yes

No

No

No

MSQ_FMT_LBN_DASCALE_EXC

Allowed DAScale exceeded given limit

(none)

Numerical

FRE

No

Yes

No

No

No

MSQ_FMT_LBN_PULSE_DUR

Square pulse duration

ms

Numerical

FRE

No

Yes

No

No

No

MSQ_FMT_LBN_SPIKE_POSITIONS

Spike positions with P{1}_R{2}, pulse index ({1}) and region ({2}), as key and the spike positions as value in pulse active coordinate system (0 - 100)

(none)

Textual

SC

No

Yes

Yes

Yes

Yes

MSQ_FMT_LBN_SPIKE_COUNTS

Spike count with P{1}_R{2}, pulse index ({1}) and region ({2}), as key and the spike counts as value

(none)

Textual

SC

No

Yes

Yes

Yes

No

MSQ_FMT_LBN_SPIKE_POSITION_PASS

Pass/fail state of the spike positions

On/Off

Numerical

SC

No

Yes

No

No

No

MSQ_FMT_LBN_SPIKE_COUNTS_STATE

Result of the spike count check: Too few/Too many/Pass/Mixed

(none)

Textual

SC

No

Yes

No

No

No

MSQ_FMT_LBN_SPONT_SPIKE_PASS

Pass/fail state of the complete baseline

On/Off

Numerical

SC

No

Yes

No

No

No

MSQ_FMT_LBN_IDEAL_SPIKE_COUNTS

Ideal number of spikes (-1 for not present)

(none)

Numerical

SC

No

No

No

No

No

MSQ_FMT_LBN_FAILED_PULSE_LEVEL

Failed pulse level

(none)

Numerical

SC

No

No

No

No

No

MSQ_FMT_LBN_RERUN_TRIAL

Number of repetitions of given stimulus set sweep due to relevant QC failures (spike count or baseline)

(none)

Numerical

SC

No

Yes

No

No

No

MSQ_FMT_LBN_RERUN_TRIAL_EXC

Number of repetitions was exceeded for that stimulus sweep set count

On/Off

Numerical

SC

No

Yes

No

No

No

FMT_LBN_ANA_FUNC_VERSION

Integer version of the analysis function

(none)

Numerical

All

No

Yes

No

No

No

Query the standard STIMSET_SCALE_FACTOR_KEY entry from labnotebook for getting the DAScale.

Functions

static variable MSQ_GetPulseSettingsForType(variable type, MSQ_PulseSettings *s)

Fills s according to the analysis function type.

static wave MSQ_GetPulseDurations(string device, variable type, variable sweepNo, variable totalOnsetDelay, variable headstage, variable useSCI = defaultValue, variable forceRecalculation = defaultValue)

Return the pulse durations from the labnotebook or calculate them before if required. For convenience unused headstages will have 0 instead of NaN in the returned wave.

static wave MSQ_DeterminePulseDuration(string device, variable sweepNo, variable totalOnsetDelay)

Determine the pulse duration on each headstage.

Returns the labnotebook wave as well.

static variable MSQ_NumAcquiredSweepsInSet(string device, variable sweepNo, variable headstage)

Return the number of already acquired sweeps of the given stimset cycle ID.

static variable MSQ_NumPassesInSet(wave numericalValues, variable type, variable sweepNo, variable headstage)

Return the number of passed sweeps in all sweeps from the given repeated acquisition cycle.

static variable MSQ_GetDAStimsetLength(string device, variable headstage)

Return the DA stimset length in ms of the given headstage.

Returns:

stimset length or -1 on error

wave MSQ_CreateOverrideResults(string device, variable headstage, variable type)

MSQ_PSQ_CreateOverrideResults(“ITC18USB_DEV_0”, 0, $type) where type is one of:

MSQ_FAST_RHEO_EST

Type:

  • Double wave

Value:

  • x position in ms where the spike is in each sweep/step For convenience the values 0 always means no spike and 1 spike detected (at the appropriate position).

Rows:

  • Sweeps in set

Cols:

  • IC headstages

MSQ_DA_SCALE

Nothing

SC_SPIKE_CONTROL

Type:

  • Text wave

Value:

  • Key-Valuse pairs in format key1:value1;key2:value2; where value can be a comma separated list

  • SpontaneousSpikeMax: single value denoting the maximum value for the spontaneous spiking check

  • SpikePosition_ms: comma separated list with the spike positions in ms. Zero is the start of each pulse

Rows:

  • Sweeps in set

Cols (NUM_HEADSTAGES):

  • Headstage

Layers (10):

  • Pulse index, 0-based

Chunks (10):

  • Region, 0-based

static wave MSQ_SearchForSpikes(string device, variable type, wave sweepWave, variable headstage, variable totalOnsetDelay, variable numberOfSpikes = defaultValue, variable defaultValue = defaultValue, wave spikePositions = defaultValue)

Search the AD channel of the given headstage for spikes from the pulse onset until the end of the sweep.

Parameters:
  • device[in] device

  • type[in] One of MultiPatchSeqAnalysisFunctionTypes

  • sweepWave[in] sweep wave with acquired data

  • headstage[in] headstage in the range [0, NUM_HEADSTAGES[

  • totalOnsetDelay[in] total delay in ms until the stimset data starts

  • numberOfSpikes[in] [optional, defaults to one] number of spikes to look for

  • spikePositions[out] [optional] returns the position of the first numberOfSpikes found on success in ms

  • defaultValue[in] [optiona, defaults to NaN] the value of the other headstages in the returned wave

Returns:

labnotebook value wave suitable for ED_AddEntryToLabnotebook()

static variable MSQ_GetLBNEntryForHSSCIBool(wave numericalValues, variable sweepNo, variable type, string str, variable headstage)

Return true if one of the entries is true for the given headstage. False otherwise. Searches in the complete SCI and assumes that the entries are either 0/1/NaN.

Todo:

merge with LBN functions once these are reworked.

static variable MSQ_GetLBNEntryForHeadstageSCI(wave numericalValues, variable sweepNo, variable type, string str, variable headstage)

Return the last entry for a given headstage from the full SCI.

This differs from GetLastSettingSCI as specifically the setting for the passed headstage must be valid.

Todo:

merge with LBN functions once these are reworked.

string MSQ_FastRheoEst_GetParams()

Return a list of required parameters for MSQ_FastRheoEst()

string MSQ_FastRheoEst_GetHelp(string name)
string MSQ_FastRheoEst_CheckParam(string name, CheckParametersStruct *s)
variable MSQ_FastRheoEst(string device, AnalysisFunction_V3 *s)

Analysis function to find the smallest DAScale where the cell spikes.

Prerequisites:

  • Assumes that the stimset has a square pulse

Testing: For testing the spike detection logic, the results can be defined in the override wave,

Decision logic flowchart:

///
/// Sketch of a stimset with pre pulse baseline (-), square pulse (*), and post pulse baseline (-).
///
///    *******
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
///    |     |
/// ---|     |--------------------------------------------
///
///
static wave MSQ_DS_GetDAScaleOffset(string device, variable headstage)

Return the DAScale offset [pA] for MSQ_DaScale()

Returns:

wave with LABNOTEBOOK_LAYER_COUNT entries, each holding the final DA Scale entry from the previous fast rheo estimate run.

static variable MSQ_GetLastPassingLongRHSweep(string device, variable headstage)

Return a sweep number of an existing sweep matching the following conditions.

  • Acquired with Rheobase analysis function

  • Sweep set was passing

  • Pulse duration was longer than 500ms

And as usual we want the last matching sweep.

Returns:

existing sweep number or -1 in case no such sweep could be found

static variable MSQ_ForceSetEvent(string device, variable headstage)

Manually force the pre/post set events.

Required to do before skipping sweeps.

Todo:

this hack must go away.

variable MSQ_CommonPreDAQ(string device, variable headstage, variable clampMode = defaultValue)

Common pre DAQ calls for all multipatch analysis functions.

string MSQ_DAScale_GetParams()

Require parameters from stimset.

string MSQ_DAScale_GetHelp(string name)
string MSQ_DAScale_CheckParam(string name, CheckParametersStruct *s)
variable MSQ_DAScale(string device, AnalysisFunction_V3 *s)

Analysis function to apply a list of DAScale values to a range of sweeps.

Decision logic flowchart:

Variables

static const double MSQ_BL_PRE_PULSE = 0x0
static const double MSQ_BL_POST_PULSE = 0x1
static const double MSQ_RMS_SHORT_TEST = 0x0
static const double MSQ_RMS_LONG_TEST = 0x1
static const double MSQ_TARGETV_TEST = 0x2
struct MSQ_PulseSettings

Settings structure filled by MSQ_GetPulseSettingsForType()

Public Members

variable prePulseChunkLength
variable pulseDuration
variable postPulseChunkLength