File MIES_MiesUtilities_Sweep.ipf

This file holds MIES utility functions for working with sweeps.

Functions

wave GetDAQDataSingleColumnWaves(dfref sweepDFR, variable channelType)

Return a wave reference wave with all single column waves of the given channel type.

Holds invalid wave refs for non-existing entries.

See also

GetDAQDataSingleColumnWave() or SplitSweepIntoComponents()

Parameters:
  • sweepDFR – datafolder reference with 1D sweep data

  • channelType – One of XopChannelConstants

wave GetDAQDataSingleColumnWaveNG(wave numericalValues, WaveText textualValues, variable sweepNo, dfref sweepDFR, variable channelType, variable GUIchannelNumber)

Return a 1D sweep data wave previously created by SplitSweepIntoComponents()

Returned wave reference can be null.

Parameters:
  • numericalValues – numerical labnotebook

  • textualValues – textual labnotebook

  • sweepNo – sweep number

  • sweepDFR – datafolder holding 1D waves

  • channelType – One of XopChannelConstants

  • GUIchannelNumber – GUI channel number

wave GetDAQDataSingleColumnWave(dfref sweepDFR, variable channelType, variable channelNumber, variable splitTTLBits = defaultValue, variable ttlBit = defaultValue)

Return a 1D data wave previously created by SplitSweepIntoComponents()

Returned wave reference can be invalid.

Parameters:
  • sweepDFR – datafolder holding 1D waves

  • channelType – One of XopChannelConstants

  • channelNumber – hardware channel number

  • splitTTLBits – [optional, defaults to false] return a single bit of the TTL wave

  • ttlBit – [optional] number specifying the TTL bit

variable IsValidSweepNumber(variable sweepNo)

Check if the given sweep number is valid.

UTF_NOINSTRUMENTATION

wave ExtractOneDimDataFromSweep(wave config, wave sweep, variable index)

Extract an one dimensional wave from the given sweep/hardware data wave and column.

Parameters:
  • config – config wave

  • sweep – sweep wave or hardware data wave from all hardware types

  • index – index into sweep, can be queried with AFH_GetDAQDataColumn

Returns:

a reference to a free wave with the single channel data

wave CopySweepToWRef(wave sweep, wave config)

Creates a copy of the sweep data and returns it in wRef format.

variable SplitAndUpgradeSweep(wave numericalValues, variable sweep, wave sweepWave, wave configWave, variable rescale, variable doUpgrade, dfref targetDFR = defaultValue, variable createBackup = defaultValue)

Split a sweep wave into one 1D-wave per channel/ttlBit and convert the sweep wave to the current text sweep format. Sweeps already in text format are not split (because that already part of their format). When attempted to split, already existing single channel waves are preserved. The old 2D sweep format is converted automatically to the current text sweep format. If targetDFR is a free DF then only splitting is done. The sweepWave can get invalid and must be reobtained after calling. See GetSweepWave for detailed documentation of the sweep format.

Parameters:
  • numericalValues – numerical labnotebook

  • sweep – sweep number

  • sweepWave – sweep wave, either old 2D numerical sweep wave, wave ref wave or text sweep wave

  • configWave – config wave

  • rescale – One of TTLRescalingOptions

  • doUpgrade – When this flag is set, then the sweep wave is upgraded to the latest format. When set, createBackup must be set and targetDFR must not be a free DF.

  • targetDFR – [optional, defaults to the sweep wave DFR] datafolder where to put the waves, can be a free datafolder

  • createBackup – [optional, defaults 1] flag to enable/disable backup creation of single channel sweep waves

static dfref GetParentDFR(dfref dfr)
static variable AreAllSingleSweepWavesPresent(dfref targetDFR, WaveText componentNames, variable backupMustExist = defaultValue)
static variable SplitSweepWave(wave numericalValues, variable sweep, wave sweepWave, wave configWave, variable rescale, dfref targetDFR, WaveText componentNames, variable createBackup)
static variable UpgradeSweepWave(wave sweepWave, WaveText componentNames, dfref targetDFR)
static variable SplitTTLWaveIntoComponents(wave data, variable ttlBits, dfref targetDFR, string wavePrefix, variable rescale, variable createBackup)

Split TTL data into a single wave for each bit.

This function is only for data from ITC hardware.

The created waves will be named TTL_3_3 so the final suffix is the running TTL Bit.

Parameters:
  • data – 1D channel data extracted by ExtractOneDimDataFromSweep

  • ttlBits – bit mask of the active TTL channels form e.g. GetTTLBits

  • targetDFR – datafolder where to put the waves, can be a free datafolder

  • wavePrefix – prefix of the created wave names

  • rescale – One of TTLRescalingOptions. Rescales the data to be in the range [0, 1] when on, does no rescaling when off.

  • createBackup – when set then backups are created

wave ResolveSweepChannel(WaveText sweepWave, variable index, variable allowFail = defaultValue)

Resolves a single channel of a text sweep wave and returns a reference to it.

Parameters:
  • sweepWave – text sweep wave

  • index – index of the channel

  • allowFail – [optional: default = 0] when set a null wave ref is returned if the channel could not be resolved, e.g. through a missing single channel wave. On default the function checks for a valid wave and asserts if none was found.

std::tuple<string, string> SplitTextSweepElement(string element)

Splits a text sweep wave element into the DF and wave name part.

string GetSweepComponentWaveName(wave config, variable channelIndex)

Returns a wave name for a single channel sweep wave. The wave name is based on the channel type and channel number and is built from the XOP_CHANNEL_NAMES in the form DA_0, DA_1, AD_0, AD_1, TTL_0 and so on.

Parameters:
  • config – config wave

  • channelIndex – index in config wave

Returns:

string with a constructed wave name

variable UpdateLeftOverSweepTime(string device, variable fifoPos)

Update the repurposed sweep time global variable.

Currently only useful for handling mid sweep analysis functions.

variable LeftOverSweepTime(string device, variable fifoPos)
variable IsValidSweepWave(WaveOrNull sweep)

Check if the given wave is a valid DAQDataWave.

variable GetTotalOnsetDelay(wave numericalValues, variable sweepNo)

Return the total onset delay of the given sweep from the labnotebook.

UTF_NOINSTRUMENTATION

variable SplitAndUpgradeSweepGlobal(string device, variable sweepNo)
wave TextSweepToWaveRef(wave sweepWave)

Converts a text sweep wave to a free waveRef sweep wave. The waveRef sweep wave contains references to the channels from the text sweep wave, that are local or global waves. See also GetSweepWave docu on “intermediate sweep format”. Generally waveRef waves are easier to handle. It is currently used for NWB saving where the sweep channel data needs to be available in a preemptive thread.

variable ExtractSweepNumber(string str)

Extract the sweep number from a $something_* string.