Unable to save data as a MATLAB file

Moderator: tom_morse

Post Reply
astaylor
Posts: 7
Joined: Fri Jun 16, 2017 3:10 pm

Unable to save data as a MATLAB file

Post by astaylor » Fri Jun 16, 2017 3:45 pm

Hello,

I am trying to save output data to a MATLAB file, but I received the following error when I added the line of code: SimConfig.saveMat = True before running the simulation:

Code: Select all

Traceback (most recent call last):
  File "tut5.py", line 81, in <module>
    sim.createSimulateAnalyze(netParams, simConfig)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/netpyne/wrappers.py", line 71, in createSimulateAnalyze
    sim.analyze()
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/netpyne/wrappers.py", line 49, in analyze
    sim.saveData()                      # run parallel Neuron simulation  
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/netpyne/simFuncs.py", line 1280, in saveData
    savemat(sim.cfg.filename+'.mat', tupleToStr(replaceNoneObj(dataSave)))  # replace None and {} with [] so can save in .mat format
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio.py", line 211, in savemat
    MW.put_variables(mdict)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 846, in put_variables
    self._matrix_writer.write_top(var, asbytes(name), is_global)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 587, in write_top
    self.write(arr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 616, in write
    self.write_struct(narr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 735, in write_struct
    self._write_items(arr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 752, in _write_items
    self.write(el[f])
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 616, in write
    self.write_struct(narr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 735, in write_struct
    self._write_items(arr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 752, in _write_items
    self.write(el[f])
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 616, in write
    self.write_struct(narr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 735, in write_struct
    self._write_items(arr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 752, in _write_items
    self.write(el[f])
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 616, in write
    self.write_struct(narr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 735, in write_struct
    self._write_items(arr)
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 752, in _write_items
    self.write(el[f])
  File "/Users/aliyahtaylor/anaconda/lib/python2.7/site-packages/scipy/io/matlab/mio5.py", line 608, in write
    % (arr, type(arr)))
TypeError: Could not convert None (type <type 'NoneType'>) to array
Additionally, when I tried to save it as a TXT file instead, nothing was downloaded. I noticed that in the source code, the simFuncs.py file does not seem to handle this case despite it being documented on the website. I was testing this with the tut5.py file. I would appreciate any help with this issue. Thanks in advance!

salvadord
Posts: 57
Joined: Tue Aug 18, 2015 3:49 pm

Re: Unable to save data as a MATLAB file

Post by salvadord » Mon Jun 19, 2017 11:19 pm

Thanks for your message. Unfortunately I hadn't tested saving to .mat after the latest changes and there was a small bug -- I fixed it and pushed to the development branch in github: https://github.com/Neurosim-lab/netpyne ... evelopment . It will be included in the next version release, but if you want to use it before you can always remove your current version, clone from github and checkout the 'development' branch.

Re: saving to txt, this feature is still pending; apologies, I should remove from doc.

Thanks for your feedback and let us know if you have any more questions

astaylor
Posts: 7
Joined: Fri Jun 16, 2017 3:10 pm

Re: Unable to save data as a MATLAB file

Post by astaylor » Tue Jun 20, 2017 10:40 am

Thank you!

Post Reply