Skip to content

Commit cb59f65

Browse files
committed
Correctly calcluate max openable files in open ephys format
1 parent 01caaca commit cb59f65

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,12 @@ void RecordNode::updateSettings()
396396
if (recordEngine->getEngineId().equalsIgnoreCase("OPENEPHYS") && getNumInputs() > 300)
397397
{
398398
int new_max = 0;
399+
int calculated_max = getNumInputs() + getTotalEventChannels() + getTotalSpikeChannels() + getNumDataStreams() + 5;
399400

400-
if (getNumInputs() < 8192) // actual upper bound of 8192
401-
new_max = _setmaxstdio(getNumInputs());
401+
if (calculated_max < 8192) // actual upper bound of 8192
402+
new_max = _setmaxstdio(calculated_max);
402403

403-
if (new_max != getNumInputs())
404+
if (new_max != calculated_max)
404405
{
405406
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon,
406407
"WARNING", "Open Ephys format does not support this many simultaneously recorded channels. Resetting to Binary format.");

Source/Processors/RecordNode/RecordNodeEditor.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,16 @@ void RecordNodeEditor::comboBoxChanged(ComboBox* box)
164164
{
165165

166166
int new_max = 0;
167+
int calculated_max = recordNode->getNumInputs()
168+
+ recordNode->getTotalEventChannels()
169+
+ recordNode->getTotalSpikeChannels()
170+
+ recordNode->getNumDataStreams() // 1 timestamp file per stream
171+
+ 5; // 1 each for STDIN + STDOUT + STDERROR, 1 for message channel & 1 for structure.openephys file
167172

168-
if (recordNode->getNumInputs() < 8000) // actual upper bound of 8192, but leave overhead for spike channels, event channels, etc.
169-
new_max = _setmaxstdio(recordNode->getNumInputs());
173+
if (calculated_max < 8192)
174+
new_max = _setmaxstdio(calculated_max);
170175

171-
if (new_max != recordNode->getNumInputs())
176+
if (new_max != calculated_max)
172177
{
173178
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon,
174179
"WARNING", "Open Ephys format does not support this many simultaneously recorded channels. Resetting to Binary format.");

0 commit comments

Comments
 (0)