Skip to content

Commit

Permalink
Fix data offset when reading data from frame
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Sep 17, 2024
1 parent da8edf2 commit daaa66a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if(MSVC)
target_compile_options(${PLUGIN_NAME} PRIVATE /sdl- /W0)

install(TARGETS ${PLUGIN_NAME} RUNTIME DESTINATION ${GUI_BIN_DIR}/plugins CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
install(FILES $<TARGET_PDB_FILE:${PLUGIN_NAME}> DESTINATION ${GUI_BIN_DIR}/plugins OPTIONAL)

set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../libs)
elseif(LINUX)
Expand Down
5 changes: 3 additions & 2 deletions Source/Devices/Neuropixels_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void Neuropixels_1::addFrame(oni_frame_t* frame)

for (int i = 0; i < framesPerSuperFrame; i++)
{
int newDataOffset = dataOffset + i * 36; // 36 = 32 ADCs + type + 2 counters
if (i == 0) // LFP data
{
int superCountOffset = superFrameCount % superFramesPerUltraFrame;
Expand All @@ -152,7 +153,7 @@ void Neuropixels_1::addFrame(oni_frame_t* frame)

int chanIndex = adcToChannel[adc] + superCountOffset * 2; // map the ADC to muxed channel
lfpSamples[(chanIndex * numUltraFrames) + ultraFrameCount ] =
float(*(dataPtr + adcToFrameIndex[adc] + dataOffset) >> 5) * 0.195f;
float(*(dataPtr + adcToFrameIndex[adc] + newDataOffset) >> 5);

}
}
Expand All @@ -163,7 +164,7 @@ void Neuropixels_1::addFrame(oni_frame_t* frame)
{
int chanIndex = adcToChannel[adc] + chanOffset; // map the ADC to muxed channel.
apSamples[(chanIndex * superFramesPerUltraFrame * numUltraFrames) + superFrameCount] =
float(*(dataPtr + adcToFrameIndex[adc] + dataOffset) >> 5) * 0.195f;
float(*(dataPtr + adcToFrameIndex[adc] + newDataOffset) >> 5);
}
}
}
Expand Down

0 comments on commit daaa66a

Please sign in to comment.