File IPNWB_Writer.ipf

Generic functions related to export into the NeuroDataWithoutBorders format.

Functions

variable CreateCommonGroups(variable locationID, ToplevelInfo *toplevelInfo, GeneralInfo *generalInfo = defaultValue, string subjectInfo = defaultValue)

Create and fill common HDF5 groups and datasets.

Parameters:
  • locationID – HDF5 identifier

  • toplevelInfo – [optional, see ToplevelInfo() for defaults] datasets directly below /

  • generalInfo – [optional, see GeneralInfo() for defaults] datasets directly below /general

  • subjectInfo – [optional, see SubjectInfo() for defaults] datasets below /general/subject

variable CreateIntraCellularEphys(variable locationID, string filtering = defaultValue)

Create the HDF5 group for intracellular ephys.

Parameters:
  • locationID – HDF5 identifier

  • filtering – [optional, defaults to PLACEHOLDER] filtering information

variable AddDevice(variable locationID, string name, variable version, string description)

Add an entry for the device name in the nwb file specified by locationID.

Parameters:
  • locationID – HDF5 identifier

  • name – name of device to create

  • version – major NWB version

  • description – a string describing the created device

Returns:

1 if a new device was created and 0 if it already existed

variable AddElectrode(variable locationID, string name, variable version, string data, string device)

Add an entry for the electrode name with contents data

variable AddModificationTimeEntry(variable locationID, variable version)

Add a modification timestamp to the NWB file.

variable MarkAsCustomEntry(variable locationID, string name)

Mark a dataset/group as custom.

According to the NWB spec everything not required should be specifically marked. In NWBv2, schema extensions can be used to accomplish this.

Parameters:
  • locationID – HDF5 identifier

  • name – dataset or group name

variable AddTimeSeriesUnitAndRes(variable locationID, string fullAbsPath, string unitWithPrefix, variable resolution = defaultValue, variable overwrite = defaultValue)

Add unit and resolution to TimeSeries dataset.

See also

ParseUnit

Parameters:
  • locationID – HDF5 identifier

  • fullAbsPath – absolute path to the TimeSeries dataset

  • unitWithPrefix – unit with optional prefix of the data in the TimeSeries,

  • resolution – [optional, defaults to NaN for unknown] experimental resolution

  • overwrite – [optional, defaults to false] should existing attributes be overwritten

variable AddProperty(TimeSeriesProperties *tsp, string nwbProp, variable value, string unit = defaultValue)

Add a TimeSeries property to the tsp structure.

variable AddCustomProperty(TimeSeriesProperties *tsp, string nwbProp, variable value)

Add a custom TimeSeries property to the names and data waves.

variable GetNextFreeGroupIndex(variable locationID, string path)

Return the next free group index of the format data_$NUM

variable WriteSingleChannel(variable locationID, string path, variable version, WriteChannelParams *p, TimeSeriesProperties *tsp, variable compressionMode = defaultValue, string nwbFilePath = defaultValue)

Write the data of a single channel to the NWB file.

Parameters:
  • locationID – HDF5 file identifier

  • path – Absolute path in the HDF5 file where the data should be stored

  • version – major NWB version

  • p – Filled WriteChannelParams structure

  • tsp – Filled TimeSeriesProperties structure

  • compressionMode – [optional, defaults to NO_COMPRESSION] Type of compression to use, one of CompressionMode

  • nwbFilePath – [optional, required only for epoch writing] disc location of the NWB file

Returns:

locationID, this is different from the parameter if epoch information was written

static variable WriteEpochs(string nwbFilePath, WaveText epochs, string timeseries, variable startingTime, variable samplingRate)
static variable AppendToEpochTable(string nwbFilePath, variable startTime, variable stopTime, WaveText tags, WaveText timeseries, wave startingTime, wave rate, variable treelevel)

Append an epoch to the TimeIntervals table.

Note: NWBv2 specific function

Parameters:
  • nwbFilePath – HDF5 file path (required for writing the timeseries compound using a custom XOP)

  • startTime – start time of the epoch in seconds in the global time coordinate system (included in the range)

  • stopTime – stop time of the epoch in seconds in the global time coordinate system (not included in the range)

  • tags – text wave with strings for the epoch, format is unspecified

  • timeseries – absolute paths to existing timeseries groups

  • startingTime – timeseries starting time in s according to NWBv2 spec

  • rate – timeseries rate in Hz according to NWBv2 spec

  • treelevel – Tree level of the epoch

static variable CreateDynamicTable(variable locationID, string path, DynamicTable *dt)

Create a Dynamic Table group at path.

Note: A dynamic table needs at least an id and a vectorData column

Returns:

NaN if the group already exists, 1 otherwise

static variable AppendToSweepTable(variable locationID, string reference, variable sweepNumber)

Append a sweep to the sweep table.

Note: NWBv2 specific function

Parameters:
  • locationID – HDF5 identifier

  • reference – path to dataset where sweep is stored

  • sweepNumber – sweep number

variable WriteSpecifications(variable locationID)

write NWB:N specifications that were used for creating this file

Note: non threadsafe due to limitations in LoadSpecification

Parameters:

locationID – open HDF5 file identifier

variable WriteSpecification(variable locationID, string spec_name, string spec_version, string spec_location, string spec_start, string spec_include)

write a specifications group to NWB_SPECIFICATIONS and link its location in .specloc

Parameters:
  • locationID – open HDF5 file identifier

  • spec_name – name of namespace, e.g. “core”

  • spec_version – version of added namespace as string

  • spec_location – Igor File Path to location of *.json files in IPNWB repository

  • spec_start – namespace.json declaration file

  • spec_include – “;” separated list of include files for defining extensions within the namespace

variable WriteNeuroDataType(variable locationID, string path, string neurodata_type)

Write a NeuroDataType.

Parameters:
  • locationID – HDF5 identifier

  • path – Path to element who’s DataType is queried

  • neurodata_type – String version of the data type that should get written

string DetermineDataTypeRefTree(string ancestry)

Determine the ancestry tree for the specified neurodata type definition.

Parameters:

ancestry – A list of all previously ancester dataTypes

Returns:

a specified neurodata type definition string json