File MIES_Browser_Plotter.ipf

Functions for plotting DataBrowser/Sweepbrowser Graphs.

Functions

static std::tuple<string, variable> GetOodDAQFullRange(TiledGraphSettings *tgs, WaveText oodDAQRegions)

Get all selected oodDAQ regions and the total X range in ms.

variable CreateTiledChannelGraph(string graph, wave config, variable sweepNo, wave numericalValues, WaveText textualValues, TiledGraphSettings *tgs, dfref sweepDFR, WaveText axisLabelCache, variable *traceIndex, string experiment, wave channelSelWave, string device, BufferedDrawInfo *bdi = defaultValue, variable mapIndex = defaultValue)

Create a vertically tiled graph for displaying AD and DA channels.

For preservering the axis scaling callers should do the following:

WAVE ranges = GetAxesRanges(graph)

CreateTiledChannelGraph()

    SetAxesRanges(graph, ranges)

Parameters:
  • graph – window

  • config – DAQ config wave

  • sweepNo – number of the sweep

  • numericalValues – numerical labnotebook wave

  • textualValues – textual labnotebook wave

  • tgs – settings for tuning the display, see TiledGraphSettings

  • sweepDFR – top datafolder to splitted 1D sweep waves

  • axisLabelCache – store existing vertical axis labels

  • traceIndex – [internal use only] set to zero on the first call in a row of successive calls

  • experiment – name of the experiment the sweep stems from

  • channelSelWave – channel selection wave

  • device – device name

  • bdi – [optional, default = n/a] initialized BufferedDrawInfo structure, when given draw calls are buffered instead for later execution

  • mapIndex – [optional, default = NaN] if the data originates from a sweepBrowser then the mapIndex is given here

variable TiledGraphAccelerateDraw(BufferedDrawInfo *bdi)

Runs through all graph groups in the json and appends them to the graph.

static variable TiledGraphAccelerateAppendTracesImpl(string w, string v, string h, variable r, variable g, variable b, wave y, WaveText t, WaveRefWave d)

Appends a group of traces to a graph, properties w to b must be constant for the group.

Parameters:
  • w[in] name of graph window

  • v[in] name of vertical axis

  • h[in] name of horizontal axis

  • r[in] red color component

  • g[in] green color component

  • b[in] blue color component

  • y[in] 1D wave with indices into wave d for the actual plot data

  • t[in] 1D wave with trace names, same size as y

  • d[in] wave reference wave with plot data

variable PostPlotTransformations(string win, variable mode, WaveOrNull additionalData = defaultValue)

Perform common transformations on the graphs traces.

Keeps track of all internal details wrt. to the order of the operations, backups, etc.

Needs to be called after adding/removing/updating sweeps via AddSweepToGraph(), RemoveSweepFromGraph(), UpdateSweepInGraph().

Parameters:
  • win – graph with sweep traces

  • mode – update mode, one of PostPlotUpdateModes

  • additionalData – [optional, defaults to invalid wave reference] additional data for subsequent users. Currently supported:

    • POST_PLOT_REMOVED_SWEEPS -> OVS indizes of the removed sweep

    • POST_PLOT_ADDED_SWEEPS -> OVS indizes of the added sweep Use OVS_GetSweepAndExperiment() to convert an index into a sweep/experiment pair.

static variable InitPostPlotSettings(string win, PostPlotSettings *pps)
static variable AverageWavesFromSameYAxisIfReq(string graph, variable averagingEnabled, dfref averageDataFolder, variable hideSweep)

Average traces in the graph from the same y-axis and append them to the graph.

Parameters:
  • graph – graph with traces create by CreateTiledChannelGraph

  • averagingEnabled – switch if averaging is enabled or not

  • averageDataFolder – permanent datafolder where the average waves can be stored

  • hideSweep – are normal channel traces hidden or not

static variable ZeroTracesIfReq(string graph, WaveTextOrNull traces, variable zeroTraces)

Zero all given traces.

static variable LayoutGraph(string win, TiledGraphSettings *tgs)

Layout the DataBrowser/SweepBrowser graph.

Takes also care of adding free axis for the headstage display.

Concept:

  • Block [#]: One axis with surrounded GRAPH_DIV_SPACING space

  • Slot [#]: Unit of vertical space, a block can occupy multiple slots

  • We have 100% space for all axes

  • AD axes should occupy four times the space of DA/TTL channels

  • So DA/TTL occupy one slot, AD occupy four slots

  • Between each axes we want GRAPH_DIV_SPACING clear space

  • Count the number of vertical blocks and slots to be used

  • Derive the space per slot

  • For overlay channels we reserve only one slot times slot multiplier per channel

The display order from top to bottom:

  • Associated channels (above: DA, below: AD) with increasing headstage number

  • Unassociated channels (above: DA, below: AD)

  • TTL channels

For overlayed channels we have up to three blocks (DA, AD, TTL) in that order.

static variable TweakAxes(string graph, TiledGraphSettings *tgs, WaveText allVerticalAxes, WaveText allHorizontalAxes)
static variable EnableAxis(string graph, WaveText axes, variable spacePerSlot, variable *first, variable *last)

Helper function for LayoutGraph()

Enables the given axis between [last - spacePerSlot, last] and updates both on return. Expects last to be 1.0 on the first call.

Variables

static const double NUM_CHANNEL_TYPES = 3
static const double ADC_SLOT_MULTIPLIER = 4
static const double EPOCH_SLOT_MULTIPLIER = 3