bioelectric-interfaces / nfb_studio

NFB experiment designer.
https://bioelectric-interfaces.github.io/nfb_studio/
1 stars 0 forks source link

xml importing: "split" error #9

Open aksiotis opened 3 years ago

aksiotis commented 3 years ago

I was using a specific xml file inside the NFB lab and it works there. However, when I tried to import the file using Studio, I got the message:

Traceback (most recent call last):
  File "c:\users\владислав\nfb_studio\nfb_studio\experiment_view.py", line 510, in actionImport
    ex = Experiment.import_xml(data)
  File "c:\users\владислав\nfb_studio\nfb_studio\experiment.py", line 269, in import_xml
    group = Group.nfb_import_data(group_data)
  File "c:\users\владислав\nfb_studio\nfb_studio\group\group.py", line 102, in nfb_import_data
    group.repeats = [int(number) for number in data["sNumberList"].split(" ")]
AttributeError: 'NoneType' object has no attribute 'split'

The xml file:

<?xml version="1.0" encoding="utf-8"?>
<NeurofeedbackSignalSpecs>
    <bDC>0</bDC>
    <sPrefilterBand>None None</sPrefilterBand>
    <sExperimentName>game</sExperimentName>
    <sInletType>lsl_from_file</sInletType>
    <sStreamName>NVX136_Data</sStreamName>
    <sEventsStreamName></sEventsStreamName>
    <sRawDataFilePath>D:/NFB/Subjects/alpha2-delay-FBLow-subj-9_02-28_14-28-53/experiment_data.h5</sRawDataFilePath>
    <sFTHostnamePort>localhost:1972</sFTHostnamePort>
    <bPlotRaw>0</bPlotRaw>
    <bPlotSignals>1</bPlotSignals>
    <bPlotSourceSpace>0</bPlotSourceSpace>
    <bShowSubjectWindow>1</bShowSubjectWindow>
    <fRewardPeriodS>0.25</fRewardPeriodS>
    <sReference></sReference>
    <sReferenceSub></sReferenceSub>
    <bUseExpyriment>0</bUseExpyriment>
    <bShowPhotoRectangle>0</bShowPhotoRectangle>
    <sVizNotchFilters>0</sVizNotchFilters>
    <vSignals>
        <DerivedSignal>
            <sSignalName>AlphaP4</sSignalName>
            <SpatialFilterMatrix>P4=1</SpatialFilterMatrix>
            <bDisableSpectrumEvaluation>0</bDisableSpectrumEvaluation>
            <fSmoothingFactor>0.3</fSmoothingFactor>
            <fFFTWindowSize>500</fFFTWindowSize>
            <fBandpassLowHz>8</fBandpassLowHz>
            <fBandpassHighHz>12</fBandpassHighHz>
            <fAverage></fAverage>
            <fStdDev></fStdDev>
            <bBCIMode>0</bBCIMode>
            <sROILabel></sROILabel>
            <sTemporalType>envdetector</sTemporalType>
            <sTemporalFilterType>cfir</sTemporalFilterType>
            <fTemporalFilterButterOrder>2</fTemporalFilterButterOrder>
            <sTemporalSmootherType>exp</sTemporalSmootherType>
            <iDelayMs>0</iDelayMs>
        </DerivedSignal>
        <CompositeSignal></CompositeSignal>
    </vSignals>
    <vProtocols>
        <FeedbackProtocol>
            <sProtocolName>signal</sProtocolName>
            <bUpdateStatistics>0</bUpdateStatistics>
            <sStatisticsType>meanstd</sStatisticsType>
            <iDropOutliers>0</iDropOutliers>
            <bSSDInTheEnd>0</bSSDInTheEnd>
            <fDuration>360.0</fDuration>
            <fRandomOverTime>0.0</fRandomOverTime>
            <fbSource>AlphaP4</fbSource>
            <sFb_type>Feedback</sFb_type>
            <cString></cString>
            <bVoiceover>0</bVoiceover>
            <bUseExtraMessage>0</bUseExtraMessage>
            <cString2></cString2>
            <fBlinkDurationMs>50</fBlinkDurationMs>
            <fBlinkThreshold>0.0</fBlinkThreshold>
            <sMockSignalFilePath></sMockSignalFilePath>
            <sMockSignalFileDataset>protocol1</sMockSignalFileDataset>
            <iMockPrevious>0</iMockPrevious>
            <bReverseMockPrevious>0</bReverseMockPrevious>
            <bRandomMockPrevious>0</bRandomMockPrevious>
            <sRewardSignal>AlphaP4</sRewardSignal>
            <bRewardThreshold>0.0</bRewardThreshold>
            <bShowReward>0</bShowReward>
            <bPauseAfter>0</bPauseAfter>
            <bBeepAfter>0</bBeepAfter>
            <iRandomBound>0</iRandomBound>
            <sVideoPath></sVideoPath>
            <sMSignal>None</sMSignal>
            <fMSignalThreshold>1.0</fMSignalThreshold>
            <bMockSource>0</bMockSource>
            <bEnableDetectionTask>0</bEnableDetectionTask>
            <bAutoBCIFit>0</bAutoBCIFit>
        </FeedbackProtocol>
        <FeedbackProtocol>
            <sProtocolName>Baseline</sProtocolName>
            <bUpdateStatistics>1</bUpdateStatistics>
            <sStatisticsType>meanstd</sStatisticsType>
            <iDropOutliers>0</iDropOutliers>
            <bSSDInTheEnd>0</bSSDInTheEnd>
            <fDuration>10.0</fDuration>
            <fRandomOverTime>0.0</fRandomOverTime>
            <fbSource>All</fbSource>
            <sFb_type>Baseline</sFb_type>
            <cString>+</cString>
            <bVoiceover>0</bVoiceover>
            <bUseExtraMessage>0</bUseExtraMessage>
            <cString2></cString2>
            <fBlinkDurationMs>50</fBlinkDurationMs>
            <fBlinkThreshold>0.0</fBlinkThreshold>
            <sMockSignalFilePath></sMockSignalFilePath>
            <sMockSignalFileDataset>protocol1</sMockSignalFileDataset>
            <iMockPrevious>0</iMockPrevious>
            <bReverseMockPrevious>0</bReverseMockPrevious>
            <bRandomMockPrevious>0</bRandomMockPrevious>
            <sRewardSignal>AlphaP4</sRewardSignal>
            <bRewardThreshold>0.0</bRewardThreshold>
            <bShowReward>0</bShowReward>
            <bPauseAfter>0</bPauseAfter>
            <bBeepAfter>0</bBeepAfter>
            <iRandomBound>0</iRandomBound>
            <sVideoPath></sVideoPath>
            <sMSignal>None</sMSignal>
            <fMSignalThreshold>1.0</fMSignalThreshold>
            <bMockSource>0</bMockSource>
            <bEnableDetectionTask>0</bEnableDetectionTask>
            <bAutoBCIFit>0</bAutoBCIFit>
        </FeedbackProtocol>
    </vProtocols>
    <vPGroups>
        <PGroup>
            <sName>Group</sName>
            <sList>signal</sList>
            <sNumberList></sNumberList>
            <bShuffle>0</bShuffle>
            <sSplitBy></sSplitBy>
        </PGroup>
    </vPGroups>
    <vPSequence>
        <s>Baseline</s>
        <s>signal</s>
    </vPSequence>
</NeurofeedbackSignalSpecs>
bindreams commented 3 years ago

This seems incorrectly formatted. The group has a single item, "signal", but the sNumberList field has no items, when it should have had a single 1 to indicate that this "signal" block is executed once.

@nikolaims How should I parse this? If sNumberList is empty just insert N number of ones to match the number of items in sList?

bindreams commented 3 years ago

Apparently NFB Lab does not validate invalid field such as this. So this is not a bug - the file is actually invalid. I will keep this open until I implement a proper message for incorrectly formatted XML files.