File MIES_AnalysisBrowser.ipf

AB Analysis browser

ABM Analysis browser Macro

Has no dependencies on any hardware related functions.

Functions

static variable AB_ResetListBoxWaves()
static variable AB_RemoveEmptyWorkingDF()

Remove empty working DF from previous AB sessions.

static variable AB_InitializeAnalysisBrowserWaves()

Reset all waves of the main experiment browser.

static variable AB_AddMapEntry(string baseFolder, string discLocation)

Create relation (map) between file on disk and datafolder in current experiment.

Returns:

index into mapping wave of the newly added entry or -1 if the file is already in the map

static variable AB_RemoveMapEntry(variable index)
wave AB_GetMap(string discLocation)

Get single matching entry from GetAnalysisBrowserMap.

Parameters:

discLocation – first column. Path to file on disc

Returns:

wave with 4 columns Columns: 0: DiscLocation: Path to Experiment on Disc 1: FileName: Name of File in experiment column in ExperimentBrowser 2: DataFolder Data folder inside current Igor experiment 3: FileType File Type identifier for routing to loader functions, one of AnalysisBrowserFileTypes

wave AB_SaveDeviceList(string deviceList, string dataFolder)

save deviceList to wave

Returns:

created wave.

static variable AB_AddFile(string discLocation, string sourceEntry)

general loader for pxp, uxp and nwb files

Returns:

0 if the file was loaded, or 1 if not (usually due to an error or because it was already loaded)

string AB_PrefixExtendedStimsetNamesToStimsetNames(string stimsets)

from a list of extended stimset names with WP_, WPT_ or SegWvType_ prefix return a boiled down list of unique stimset names without prefix

static string AB_GetStimsetListFromIgorFile(string fullPath)

Returns a list of stimset names from an igor experiment file.

static variable AB_FileHasStimsets(WaveText map)

returns 1 if the file has stimsets, 0 otherwise

static variable AB_LoadFile(string discLocation)

function tries to load Data From discLocation.

static variable AB_HasCompatibleVersion(string discLocation)

Check if the given file has a compatible version which this version of the analysis browser can handle.

Parameters:

discLocation – file to check, parameter to AB_GetMap()

static string AB_GetSettingNumFiniteVals(wave wv, string device, variable sweepNo, string name)
static variable AB_FillListWave(string diskLocation, string fileName, string device, string dataFolder, string fileType, WaveOrNull sweepNums)

Creates list-view for AnalysisBrowser.

Depends on LabNoteBook to be loaded prior to call.

Parameters:
  • diskLocation – full file path of Project file

  • fileName – current Project’s filename

  • device – current device, if device is empty only the experiment name is added

  • dataFolder – current Project’s Lab Notebook DataFolder reference

  • fileType – current Project’s file type, one of AnalysisBrowserFileTypes

  • sweepNums – Wave containing all sweeps actually present for device

static string AB_GetRowHash(WaveText list, variable row)
static variable AB_LoadDataWrapper(dfref tmpDFR, string expFilePath, string datafolderPath, string listOfNames, variable typeFlags = defaultValue, variable recursive = defaultValue)

Load waves from a packed/unpacked experiment file.

This function is special as it does change the CDF!

Parameters:
  • tmpDFR – Temporary work folder, function returns with that folder as CDF

  • expFilePath – full path to the experiment file on disc

  • datafolderPath – igor datafolder to look for the waves inside the experiment

  • listOfNames – list of names of waves/strings/numbers to load

  • typeFlags – [optional, defaults to 1 (waves)] data types to load, valid values are the same as for LoadData, see also LoadDataConstants

  • recursive – [optional, defaults to 1] when set loads data recursive from the experiment file

Returns:

number of loaded items

static wave AB_GetSweepsFromLabNotebook(string dataFolder, string device, variable clean = defaultValue)

Returns a wave containing all present sweep numbers.

Parameters:
  • dataFolder – DataFolder of HDF5 or Experiment File where LabNoteBook is saved

  • device – device for which to get sweeps.

  • clean – Variable indicating if ouput can contain duplicate values

static variable AB_GetHighestPossibleSweepNum(string dataFolder, string device)

Returns the highest referenced sweep number from the labnotebook.

static wave AB_LoadSweepsFromExperiment(string discLocation, string device)

Returns a wave containing all present sweep numbers.

Function uses Config Waves from Igor Experiment to determine present sweeps

Parameters:
  • discLocation – location of Experiment File on Disc. ID in AnalysisBrowserMap

  • device – device for which to get sweeps.

static variable AB_LoadSweepsFromNWB(string discLocation, string dataFolder, string device)

Analyse data in NWB file and sort as sweeps.

Todo:

: Update this function for the use with SweepTable

Parameters:
  • discLocation – location of NWB File on Disc. ID in AnalysisBrowserMap

  • dataFolder – datafolder of the project

  • device – device for which to get sweeps.

static variable AB_StoreChannelsBySweep(variable groupID, variable nwbVersion, string channelList, WaveInteger sweeps, WaveText storage)

Store channelList in storage wave according to index in sweeps wave.

Todo:

Update this function for the use with SweepTable

static variable AB_LoadTPStorageFromIgor(string expFilePath, string expFolder, string device)
variable AB_LoadTPStorageFromNWB(string nwbFilePath, string expFolder, string device)
static variable AB_LoadStoredTestpulsesFromNWB(string nwbFilePath, string expFolder, string device)
static variable AB_LoadResultsFromIgor(string expFilePath, string expFolder)
static variable AB_LoadResultsFromNWB(string nwbFilePath, string expFolder)
static variable AB_LoadUserCommentFromFile(string expFilePath, string expFolder, string device)
static variable AB_LoadUserCommentAndHistoryFromNWB(string nwbFilePath, string expFolder, string device)
static string AB_LoadLabNotebook(string discLocation)
static string AB_LoadLabNotebookFromFile(string discLocation)
static string AB_LoadLabNotebookFromIgor(string discLocation)
static variable AB_LoadLabNotebookFromIgorLow(string discLocation, string path, string device, string *deviceList)

Try loading the four labnotebooks from path.

Parameters:
  • discLocation[in] experiment location on disc

  • path[in] datafolder path which holds the labnotebooks (might not exist)

  • device[in] name of the device

  • deviceList[inout] list of loaded devices, for successful loads we add to that list

static string AB_LoadLabNotebookFromNWB(string discLocation)
static variable AB_checkLabNotebook(dfref dfr)

function checks if LabNoteBook Waves do exist.

Parameters:

dfr – path to labNoteBook dataFolder reference.

Returns:

0 labNotebook does not exist. 1 labNoteBook exists. also update dimension lables

static variable AB_updateLabelsInLabNotebook(dfref dfr)

add dimension labels in older versions of igor-MIES and hdf5-loaded data overwrite invalid dim labels (labnotebook waves created with versions prior to a8f0f43)

static string AB_TranslatePath(string path, string expFolder)
static variable AB_LoadSweepConfigData(string expFilePath, string expFolder, string device, variable highestSweepNumber)

Load all Config_Sweep_* waves from the given experiment file or folder and the given device.

The implementation here tries to load LOAD_CONFIG_CHUNK_SIZE number of config sweep waves at a time until there could not be loaded at least one config sweep wave and we have reached highestSweepNumber.

The size of LOAD_CONFIG_CHUNK_SIZE is limited by a limitation of LoadData as this operations accepts only a stringlist of waves shorter than 400 characters.

static variable AB_ExpandListColumn(variable col)

Expand all tree views in the given column.

static variable AB_CollapseListColumn(variable col)

Collapse all tree views in the given column.

static variable AB_SetGUISelBits(wave selBits)

Set the selection bits of the experiment browser ListBox selection wave.

Parameters:

selBits – wave returned by AB_ReturnAndClearGUISelBits

static wave AB_ReturnAndClearGUISelBits()

Return the selection bits from the experiment browser ListBox selection wave and clear them.

static variable AB_CollapseListEntry(variable row, variable col)

Collapse the given treeview.

static variable AB_ExpandListEntry(variable row, variable col)

Expand the given treeview.

static variable AB_GetListRowWithSameHash(WaveText list, string h)
static variable AB_ExpandIfCollapsed(variable row, variable subSectionColumn)
Returns:

0 if the treeview could be expanded, zero otherwise

static wave AB_GetExpandedIndices()

get indizes from AB window while successive expanding all columns

Returns:

valid indizes wave on success

static variable AB_GUIRowIsStimsetsOnly(variable row)
static variable AB_LoadFromExpandedRange(variable row, variable subSectionColumn, variable loadType, variable overwrite = defaultValue, dfref sweepBrowserDFR = defaultValue, WaveText dfCollect = defaultValue)
Returns:

0 if at least one sweep or stimset could be loaded, 1 otherwise

static variable AB_GetRowWithNextTreeView(wave selWave, variable startRow, variable col)

Return the row with treeview in the column col starting from startRow.

static variable AB_LoadFromFile(variable loadType, dfref sweepBrowserDFR = defaultValue)
variable AB_FreeWorkingDFs(WaveText relativeDFPaths, variable actualSize)
variable AB_AllocWorkingDFs(WaveText relativeDFPaths, variable actualSize)
static variable AB_FreeOrAllocWorkingDF(WaveText relativeDFPaths, variable actualSize, variable free)
variable AB_LoadStimsetForSweep(string device, variable index, variable sweep)
static variable AB_LoadFromFileASSERT(string discLocation, string dataFolder, string fileType, string device, variable sweep, variable overwrite)
static variable AB_LoadSweepFromFile(string discLocation, string dataFolder, string fileType, string device, variable sweep, variable overwrite = defaultValue)
Returns:

0 if the sweeps could be loaded, or already exists, and 1 on error

static variable AB_LoadStimsetFromFile(string discLocation, string dataFolder, string fileType, string device, variable sweep, variable overwrite = defaultValue)
static variable AB_LoadSweepFromNWB(string discLocation, dfref sweepDFR, string device, variable sweep)
static variable AB_LoadSweepFromNWBgeneric(variable h5_groupID, variable nwbVersion, string channelList, dfref sweepDFR, WaveInteger configSweep)
static variable AB_SortConfigSweeps(WaveInteger config)

Sorts the faked Config Sweeps Wave to get correct display order in Sweep Browser.

function is oriented at MDSort()

static variable AB_LoadSweepFromIgor(string discLocation, string expFolder, dfref sweepDFR, string device, variable sweep)

Load specified device/sweep combination from Igor experiment file to sweepDFR.

Returns:

name of loaded sweep

static variable AB_LoadStimsetsRAW(string expFilePath, string stimsets, variable overwrite)

a failsave alternative for AB_LoadStimsets() to load RAW stimsets

If a stimset could not get loaded using AB_LoadStimsets() this function is used in addition to try to load the stimset without its corresponding Parameter Waves. overwrite is not supported

Parameters:
  • expFilePath – Path on disc to igor experiment

  • stimsets – “;” separated list of all stimsets

  • overwrite – overwrite flag

Returns:

1 on error and 0 on success

static string AB_LoadStimsets(string expFilePath, string stimsets, variable overwrite, string processedStimsets = defaultValue)

Load specified stimsets from Igor experiment file.

recurses into all dependent stimsets as soon as they have been loaded. the list of stimsets is extended “on the left side”: new items are added left. use numEnd to indicate unto which item the list was already processed. see StimsetRecursion() for a similar structure

Parameters:
  • expFilePath – Path on disc to igor experiment

  • stimsets – “;” separated list of all stimsets of the current sweep.

  • processedStimsets – [optional] input a list of already processed stimsets

  • overwrite – overwrite flag

Returns:

1 on error and 0 on success

static variable AB_LoadStimset(string expFilePath, string stimset, variable overwrite)

Load specified stimset from Igor experiment file.

Returns:

1 on error and 0 on success

static variable AB_LoadStimsetRAW(string expFilePath, string stimset, variable overwrite)
static variable AB_LoadStimsetTemplateWaves(string expFilePath, string stimset)

Load template waves for a specific stimset from Igor experiment file.

Returns:

1 on error and 0 on success

static string AB_LoadCustomWaves(string expFilePath, string stimsets, variable overwrite)

Load custom waves for specified stimset from Igor experiment file.

Returns:

1 on error and 0 on success

static variable AB_LoadWave(string expFilePath, string fullPath, variable overwrite)

Load specified wave from Igor Experiment file.

Returns:

1 on error and 0 on success

static variable AB_SplitSweepIntoComponents(string expFolder, string device, variable sweep, wave sweepWave)
static variable AB_RemoveExperimentEntry(string win, string entry)
static variable AB_AddExperimentEntries(string win, WaveText entries)
string AB_GetPanelName()
static variable AB_SetUserData(string key, string value)
static string AB_GetUserData(string key)
string AB_OpenAnalysisBrowser(variable restoreSettings = defaultValue)
static variable AB_CheckPanelVersion(string panel)
variable AB_BrowserStartupSettings()
variable AB_ButtonProc_ExpandAll(WMButtonAction *ba)

Button “Expand all”.

variable AB_ButtonProc_CollapseAll(WMButtonAction *ba)

Button “Collapse all”.

variable AB_ButtonProc_LoadSweeps(WMButtonAction *ba)

Button “Load Sweeps”.

variable AB_ButtonProc_LoadBoth(WMButtonAction *ba)

Button “Load Both”.

variable AB_ButtonProc_LoadStimsets(WMButtonAction *ba)

Button “Load Stimsets”.

variable AB_ButtonProc_Refresh(WMButtonAction *ba)

Button “Refresh”.

variable AB_ButtonProc_OpenFolders(WMButtonAction *ba)

Button “Open folder(s)”.

variable AB_ButtonProc_Remove(WMButtonAction *ba)

Button “Remove folder(s)”.

variable AB_ButtonProc_AddFolder(WMButtonAction *ba)

Button “Add folder” Display dialog box for choosing a folder and call AB_ScanFolder()

variable AB_ButtonProc_AddFiles(WMButtonAction *ba)

Button “Add files” Display dialog box for choosing files and call AB_AddFolder()

static variable AB_AddFiles(string win, WaveText selFiles)
variable AB_AddElementToSourceList(string entry)
static variable AB_SaveSourceListInSettings()
variable AB_ButtonProc_SelectStimSets(WMButtonAction *ba)

Button “Select same stim set sweeps”.

variable AB_ListBoxProc_ExpBrowser(WMListboxAction *lba)

main ListBox list_experiment_contents

static variable AB_UpdateColors()
variable AB_ButtonProc_OpenCommentNB(WMButtonAction *ba)

Button “Open comment NB”.

variable AB_ButtonProc_ResaveAsNWB(WMButtonAction *ba)
static variable AB_LoadAllSweepsAndStimsets(string discLocation, string dataFolder, string fileType, string device)
static variable AB_ReExport(variable index, variable overwrite)
static variable BeforeFileOpenHook(variable refNum, string file, string pathName, string type, string creator, variable kind)

Load dropped NWB files into the analysis browser.

string AB_GetAllDevicesForExperiment(string dataFolder)
string AB_GetAllExperiments()

Return all experiments the analysis browser knows about.

string AB_GetStimsetList(string fileType, string discLocation, string dataFolder, string device, variable sweep)

Get stimset list either by analysing dataFolder of loaded sweep or if device is empty, get all stimsets.

numericalValues and textualValues are generated from previously loaded data. used in the context of loading from a stored experiment file. on load a sweep is stored in a device/dataFolder hierarchy.

Returns:

list of stimsets

static string AB_GetStimsetFromSweepGeneric(variable sweep, wave numericalValues, WaveText textualValues)

Get related Stimsets by corresponding sweep.

input numerical and textual values storage waves for current sweep

Returns:

list of stimsets

string AB_GetStimsetFromPanel(string device, variable sweep)

Get stimsets by analysing currently loaded sweep.

numericalValues and textualValues are generated from device

Returns:

list of stimsets

variable AB_WindowHook(WMWinHookStruct *s)
static variable AB_MemoryFreeMappedDF()

Variables

static const double EXPERIMENT_TREEVIEW_COLUMN = 0
static const double DEVICE_TREEVIEW_COLUMN = 3
static const double AB_LOAD_SWEEP = 0
static const double AB_LOAD_STIMSET = 1
static const string AB_UDATA_WORKINGDF = "datafolder"
static const string AB_WORKFOLDER_NAME = "workFolder"
static const double LOAD_CONFIG_CHUNK_SIZE = 50