File MIES_GlobalStringAndVariableAccess.ipf

Helper functions for accessing global variables and strings.

The functions GetNVARAsString() and GetSVARAsString() are static as they should not be used directly.

Instead if you have a global variable named iceCreamCounter in root:myfood you would write in this file here a function like

Function/S GetIceCreamCounterAsVariable()
    return GetNVARAsString(createDFWithAllParents("root:myfood"), "iceCreamCounter")
End

and then use it in your code as

Function doStuff()
    NVAR iceCreamCounter = $GetIceCreamCounterAsVariable()

    iceCreamCounter += 1
End

if you want to ensure that you only get read-only access you can use ROVar() as in

Function doStuffReadOnly()
    variable iceCreamCounter = ROVar(GetIceCreamCounterAsVariable())

    iceCreamCounter += 1
End

this avoids accidental changes.

Functions

static string GetNVARAsString(dfref dfr, string globalVarName, variable initialValue = defaultValue)

Returns the full path to a global variable.

Parameters:
  • dfr – location of the global variable, must exist

  • globalVarName – name of the global variable

  • initialValue – initial value of the variable. Will only be used if it is created. 0 by default.

static string GetSVARAsString(dfref dfr, string globalStrName, string initialValue = defaultValue)

Returns the full path to a global string.

Parameters:
  • dfr – location of the global string, must exist

  • globalStrName – name of the global string

  • initialValue – initial value of the string. Will only be used if it is created. null by default.

variable ROVar(string path)

Helper function to get read-only access to a global variable.

Parameters:

path – absolute path to a global variable

string ROStr(string path)

Helper function to get read-only access to a global string.

Parameters:

path – absolute path to a global string

string GetMiesVersion()

Returns the full path to the mies-igor version string. Creating it when necessary.

Never ever write this string!

wave GetPossiblePathsToGit()

Return a text wave with absolute paths to git binaries with HFS : separators.

The paths may not exist.

static string CreateMiesVersion()

Return the version string for the mies-igor project.

The mies version looks like

/// Release_1.4_20170929-16-g497e7aa8
/// Date and time of last commit: 2018-05-08T14:42:50+02:00
/// Submodule status:
/// 160000 6c47163858d99986b27c70f6226e8fca894ed5f7 0   Packages/IPNWB
/// 160000 ed7e824a6e065e383ae31bb304383e13d7c7ccb5 0   Packages/ITCXOP2
/// 160000 2bd259940cb332339ed3c82b74632f06c9b68a15 0   Packages/ZeroMQ
/// 160000 657e9e8abdc92aa299301796d710a0a717da4ef8 0   Packages/unit-testing
///
or #UNKNOWN_MIES_VERSION on error

@returns the mies version

string GetDataAcqRunMode(string device)

Returns the absolute path to the variable runMode

The variable holds one of DAQRunModes.

string GetDAQDeviceID(string device)

Returns the absolute path to the device ID.

string GetCount(string device)

Returns the absolute path to the global variable count storing the number of data acquisition cycles performed.

Count equals zero on the first sweep.

string GetLockedDevices()

Returns the list of locked devices.

string GetUserComment(string device)

Return the absolute path to the user comment string.

string GetStopCollectionPoint(string device)

Return the stop collection point, this is a length.

string GetADChannelToMonitor(string device)

Return the ADC to monitor.

This is the first actice AD channel in DAQDataWave and DAQConfigWave.

string GetRunningSingleDevice()

Return global device for background tasks.

Todo:

remove and use background struct members for the deviceID and GetDeviceMapping instead

string GetActiveSetCount(string device)

Return the active set count.

Active set count keeps track of how many steps of the largest currently selected set on all active channels still have to be done. Not counting the currently acquiring sweep.

string GetInteractiveMode()

Return the interactive mode.

By default MIES operates in interactive mode (1) in the main thread and in non-interactive mode in preemptive threads. The user can change that to non-interactive mode where all dialog/popups etc. are avoided and replaced with sensible defaults.

string GetTestpulseRunMode(string device)

Returns the absolute path to the testpulse running modes, holds one of TestPulseRunModes.

string GetNIDeviceList()

Returns NI device list.

Internal use only, prefer DAP_GetNIDeviceList() instead.

The initial value "" is different from NONE which denotes no matches.

string GetITCDeviceList()

Returns ITC device list.

Internal use only, prefer DAP_GetITCDeviceList() instead.

The initial value "" is different from NONE which denotes no matches.

string GetLastAcqHookCallTimeStamp(string device)

Returns the last time stamp HW_NI_RepeatAcqHook was called.

string GetFIFOFileRef(string device)

Returns FIFO file reference.

string GetNITestPulseCounter(string device)

Returns TestPulse Counter for Background Task.

string GetNI_AISetup(string device)

Returns the current NI setup string for analog in through DAQmx_Scan.

string GetNI_ADCTaskID(string device)

Returns the ADC task ID set after DAQmx_Scan in HW_NI_StartAcq.

string GetNI_DACTaskID(string device)

Returns the DAC task ID set after DAQmx_WaveFormGen in HW_NI_PrepareAcq.

string GetNI_TTLTaskID(string device)

Returns the TTL task ID set by DAQmx_DIO_Config in HW_NI_PrepareAcq.

string GetSessionStartTime()

Return the experiment session start time in NWB-speech.

This is the time when the last device was locked.

string GetNWBFileIDExport()

Return the HDF5 file identifier for the NWB export.

string GetNWBFilePathExport()

Return the absolute path to the file for NWB export.

string GetSessionStartTimeReadBack()

Return the experiment session start time in NWB-speech as read back from the NWB file.

string GetThreadGroupIDFIFO(string device)

Return the thread group ID for the FIFO monitor/resetting daemon.

string GetTemporaryString()

Return the absolute path to the temporary global string.

Callers should always assume that this string contains garbage.

string GetTemporaryVar()

Return the absolute path to the temporary global variable.

Callers should always assume that this variable contains garbage.

string GetRNGSeed(string device)

Return the absolute path to the RNG seed value.

This seed value can be used for deriving device dependent random numbers.

Typical sequence:

NVAR rngSeed = $GetRNGSeed(device)
SetRandomSeed/BETR=1 rngSeed
rngSeed += 1
variable val = GetReproducibleRandonNumber()

string GetRepeatedAcquisitionCycleID(string device)

Return the absolute path to the repeated acquisition cycle ID.

string GetRepurposedSweepTime(string device)

Return the absolute path to the repurposed sweep time global variable.

Units are seconds.

This value is added on top of the left over sweep time. Use a negative value to have a shorter ITI than what is left over in the sweep.

string GetRepeatedAcquisitionFuncList()

Return the list of functions to be executed after ITI in repeated acquisition.

string GetRepeatedAcquisitionStart()

Return the start time, in ticks, of the ITI cycle.

string GetRepeatedAcquisitionDuration()

Return the duration, in ticks, of the ITI cycle.

string GetFifoPosition(string device)

Return the current fifo position (a length)

Only valid if called during DAQ with DATA_ACQUISITION_MODE. This value is relative to first row of the rawDACWave, so an possible offset is already included in it.

string GetAnalysisFuncErrorCounter(string device)

Return the error counter for the analysis function management.

Mainly used during testing to ensure that no RTE was thrown.

string GetMaxIntertrialInterval(string device)

Return the maximum ITI of all active sets.

Only meaningful after preparing DAQ in DC_Configure()

string GetPxPVersion()

Return the version number of the Igor experiment.

string GetPxPVersionForAB(dfref dfr)

Return the version number of the Igor experiment loaded into the analysis browser.

Parameters:

dfr – experiment folder,

string GetSweepFormulaJSONid(dfref dfr)

Return the JSON ID for the sweep formula.

string GetSweepFormulaParseErrorMessage()

Return the formula error message for the sweep formula.

string GetSettingsJSONid()

Return the JSON id of the settings file.

Loads the stored settings on disc if required.

string GetAcquisitionState(string device)

Return the path to the acquisition state.

Holds one of AcquisitionStates

string GetBugCount()

Return the global bug count, incremented by Bug()

Mostly used for testing.

string GetNWBOverrideHistoryAndLogFile()

Temporary storage for IP history and logfile.

Used for reexporting from NWBv1 into NWBv2, see AB_ReExport()

string GetTestpulseCycleID(string device)

Return the absolute path to the test pulse cycle ID.

string GetCalledOnceVariable(string name)

Returns the path to the “called once” variable of the given name.

string GetThreadGroupID()

Returns string path to the thread group id.

string GetNumThreads()

Returns string path to the number of threads.

string GetTaskDisableStatus()

Returns string path to flag if background task was disabled.

string GetLastSweepFormulaCode(dfref dfr)

Returns the string path to the last successfully executed SweepFormula code.

string GetDFReferenceCount(dfref dfr)

Returns the reference count variable of the given DF.