Skip to content
Snippets Groups Projects
Commit b3fdccb6 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Add bitVolts info to Kwik format

parent 0c664f44
No related branches found
No related tags found
No related merge requests found
Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Debug|x64 = Debug|x64
Debug64|Win32 = Debug64|Win32
Debug64|x64 = Debug64|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release64|Win32 = Release64|Win32
Release64|x64 = Release64|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64
EndGlobalSection
......
......@@ -117,6 +117,12 @@ void HDF5FileBase::close()
}
int HDF5FileBase::setAttribute(DataTypes type, void* data, String path, String name)
{
return setAttributeArray(type, data, 1, path, name);
}
int HDF5FileBase::setAttributeArray(DataTypes type, void* data, int size, String path, String name)
{
Group loc;
Attribute attr;
......@@ -131,6 +137,13 @@ int HDF5FileBase::setAttribute(DataTypes type, void* data, String path, String n
H5type = getH5Type(type);
origType = getNativeType(type);
if (size > 1)
{
hsize_t dims = size;
H5type = ArrayType(H5type,1,&dims);
origType = ArrayType(origType,1,&dims);
}
if (loc.attrExists(name.toUTF8()))
{
attr = loc.openAttribute(name.toUTF8());
......@@ -605,6 +618,8 @@ void KWDFile::startNewRecording(int recordingNumber, int nChannels, HDF5Recordin
// CHECK_ERROR(setAttribute(U32,&(info->start_sample),recordPath,String("start_sample")));
CHECK_ERROR(setAttribute(F32,&(info->sample_rate),recordPath,String("sample_rate")));
CHECK_ERROR(setAttribute(U32,&(info->bit_depth),recordPath,String("bit_depth")));
CHECK_ERROR(createGroup(recordPath+"/application_data"));
CHECK_ERROR(setAttributeArray(F32,info->bitVolts.getRawDataPointer(),info->bitVolts.size(),recordPath+"/application_data",String("channel_bit_volts")));
recdata = createDataSet(I16,0,nChannels,CHUNK_XSIZE,recordPath+"/data");
if (!recdata.get())
std::cerr << "Error creating data set" << std::endl;
......
......@@ -41,6 +41,7 @@ struct HDF5RecordingInfo
uint32 start_sample;
float sample_rate;
uint32 bit_depth;
Array<float> bitVolts;
};
class HDF5FileBase
......@@ -64,6 +65,7 @@ protected:
int setAttribute(DataTypes type, void* data, String path, String name);
int setAttributeStr(String value, String path, String name);
int setAttributeArray(DataTypes type, void* data, int size, String path, String name);
int createGroup(String path);
HDF5RecordingData* getDataSet(String path);
......
......@@ -54,7 +54,7 @@ void HDF5Recording::registerProcessor(GenericProcessor* proc)
info->bit_depth = 16;
infoArray.add(info);
fileArray.add(new KWDFile());
activeChannelCount.add(0);
bitVoltsArray.add(new Array<float>);
processorIndex++;
}
......@@ -62,7 +62,7 @@ void HDF5Recording::resetChannels()
{
processorIndex = -1;
fileArray.clear();
activeChannelCount.clear();
bitVoltsArray.clear();
processorMap.clear();
infoArray.clear();
if (spikesFile)
......@@ -103,7 +103,7 @@ void HDF5Recording::openFiles(File rootFolder, int experimentNumber, int record
fileArray[index]->initFile(getChannel(i)->nodeId,basepath);
fileArray[index]->open();
}
activeChannelCount.set(index,activeChannelCount[index]+1);
bitVoltsArray[index]->add(getChannel(i)->bitVolts);
}
}
for (int i = 0; i < fileArray.size(); i++)
......@@ -116,7 +116,8 @@ void HDF5Recording::openFiles(File rootFolder, int experimentNumber, int record
infoArray[i]->name = String("Open-Ephys Recording #") + String(recordingNumber);
infoArray[i]->start_time = timestamp;
infoArray[i]->start_sample = 0;
fileArray[i]->startNewRecording(recordingNumber,activeChannelCount[i],infoArray[i]);
infoArray[i]->bitVolts.addArray(*bitVoltsArray[i]);
fileArray[i]->startNewRecording(recordingNumber,bitVoltsArray[i]->size(),infoArray[i]);
}
}
}
......@@ -131,7 +132,7 @@ void HDF5Recording::closeFiles()
{
fileArray[i]->stopRecording();
fileArray[i]->close();
activeChannelCount.set(i,0);
bitVoltsArray[i]->clear();
}
}
......
......@@ -51,7 +51,7 @@ private:
int processorIndex;
Array<int> processorMap;
Array<int> activeChannelCount;
OwnedArray<Array<float>> bitVoltsArray;
OwnedArray<KWDFile> fileArray;
OwnedArray<HDF5RecordingInfo> infoArray;
ScopedPointer<KWIKFile> mainFile;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment