Skip to content

Commit

Permalink
Merge pull request open-ephys#79 from malfatti/Fix20190819093115
Browse files Browse the repository at this point in the history
Add statement for multiple signal chains
  • Loading branch information
aacuevas authored Aug 19, 2019
2 parents d276160 + 6be9cc1 commit b0fda83
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions Python3/SettingsXML.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,30 @@ def XML2Dict(File):
def GetSamplingRate(File):
Info = XML2Dict(File)
Error = 'Cannot parse sample rate. Check your settings.xml file at SIGNALCHAIN>PROCESSOR>Sources/Rhythm FPGA.'
SignalChains = [_ for _ in Info.keys() if 'SIGNALCHAIN' in _]

try:
if 'SampleRateString' in Info['SIGNALCHAIN']['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']:
Rate = Info['SIGNALCHAIN']['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']['SampleRateString']
Rate = float(Rate.split(' ')[0])*1000
return(Rate)
elif Info['SIGNALCHAIN']['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']['SampleRate'] == '17':
Rate = 30000
return(Rate)
else:
for SignalChain in SignalChains:
if 'Sources/Rhythm FPGA' in Info[SignalChain]['PROCESSOR'].keys():
if 'SampleRateString' in Info[SignalChain]['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']:
Rate = Info[SignalChain]['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']['SampleRateString']
Rate = float(Rate.split(' ')[0])*1000
elif Info[SignalChain]['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']['SampleRate'] == '17':
Rate = 30000
elif Info[SignalChain]['PROCESSOR']['Sources/Rhythm FPGA']['EDITOR']['SampleRate'] == '16':
Rate = 25000
else:
Rate = None
else:
Rate = None

if not Rate:
print(Error); return(None)
except:
print(Error); return(None)
else:
return(Rate)

except Exception as Ex:
print(Ex); print(Error); return(None)


def GetRecChs(File):
Expand Down

0 comments on commit b0fda83

Please sign in to comment.