inincs / pyNCS

pyNCS is a python library that allows easy access to Neuromorphic Chips and Systems (NCS),
http://inincs.github.com/pyNCS/
GNU General Public License v2.0
16 stars 10 forks source link

load_parameters() fails with error: no attribute 'params' #6

Closed hongzhiyou closed 12 years ago

hongzhiyou commented 12 years ago

The following codes are my setup file:

This setup file initializes the setup

Import libraries

import pyNCS import pyNCS.neurosetup from pylab import show import pyST

Define file paths

prefix='./chipfiles/' setuptype = 'setupfiles/4bit_setuptype.xml' setupfile = 'setupfiles/zenzero.xml'

Initialize setup

nsetup = pyNCS.neurosetup.NeuroSetup(setuptype,setupfile,prefix=prefix)

clear mapper

nsetup.mapper.clear_mappings();

chip1 = nsetup.chips['ifslwta']; nsetup.chips['ifslwta'].load_parameters('biases/Biases_ifslwta');

However, there is a mistake in the last line: nsetup.chips['ifslwta'].load_parameters('biases/Biases_ifslwta');

ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (8, 0))


AttributeError Traceback (most recent call last)

/home/october/Experiment/youH2/initSetup.py in () 19 20 chip1 = nsetup.chips['ifslwta']; ---> 21 nsetup.chips['ifslwta'].load_parameters('biases/Biases_ifslwta'); 22 23 #chip2 = nsetup.chips['ifslwta_2'];

/usr/local/lib/python2.7/dist-packages/pyNCS/chip_v2.pyc in load_parameters(self, CSVfile, sep) 429 x = line.strip().split(sep) 430 b[x[0]] = float(x[1]) --> 431 self.set_parameters(b) 432 print 'Parameters loaded and set' 433 return None

/usr/local/lib/python2.7/dist-packages/pyNCS/chip_v2.pyc in set_parameters(self, param_dict) 377 ''' 378 with self.context_open(): --> 379 r = self.configurator.set_parameters(param_dict) 380 return r 381

/usr/local/lib/python2.7/dist-packages/pyNCS/init.pyc in f(_args, _kwargs) 64 @wraps(self.mthd, assigned=('name', 'module')) 65 def f(_args, _kwargs): ---> 66 return self.mthd(obj, _args, *_kwargs) 67 68 return self.use_parent_doc(f, overridden)

/usr/local/lib/python2.7/dist-packages/pyAMDA/api.pyc in set_parameters(self, param_dict) 40 def set_parameters(self, param_dict): 41 #This function is provided by the API, but it is implemented for performance issues

---> 42 self.__setBias(param_dict) 43 44 @doc_inherit

/usr/local/lib/python2.7/dist-packages/pyAMDA/api.pyc in setBias(self, param_dict) 78 with self.context_get_param(): 79 bias = self.parameters[param_name] ---> 80 x = self.setValue(param_name, param_value) 81 82 #Commit the bias type (DAC or Bias Generator)

/usr/local/lib/python2.7/dist-packages/pyAMDA/api.pyc in __setValue(self, biasname, value) 122 with self.context_get_param(): 123 bias = self.parameters[biasname] --> 124 norm = self.norm[bias.params['BiasType'].upper()] 125 if value >= 0 and value <= norm: 126 x = self.client.setchannel(bias.params['Channel'],

AttributeError: 'Parameter' object has no attribute 'params' WARNING: Failure executing file:

Do you know what is the problem?

sheiksadique commented 12 years ago

You probably don't have the latest version of pyAMDA (the driver for the AMDA board). Please update and install the latest version of pyAMDA. Please confirm weather or not this fixes the problem.

hongzhiyou commented 12 years ago

Thanks. It fixed the problem.

There is another problem. Clearing mapping table... ... done! tmp_mapping_october 100% 19KB 19.4KB/s 00:00
mmap succeeded, vaddr: 0x3775c000 Opening mapping table file /tmp/tmp_mapping

found 2 space delimiters. Reading probablitiy from file.

TypeError Traceback (most recent call last)

/home/october/Experiment/youH2/main_test.py in () 192 nsetup.mapping.write(incremential=False) 193 stim = pyST.merge_spikelists(stim_inh[pop_inh_seq.soma.channel], stim_exc_seq10[pop_exc_seq1.soma.channel],stim_exc_seq11[pop_exc_seq1.soma.channel],stim_exc_seq20[pop_exc_seq2.soma.channel],stim_exc_seq21[pop_exc_seq2.soma.channel],stim_exc_seq22[pop_exc_seq2.soma.channel],stim_exc_seq23[pop_exc_seq2.soma.channel]) --> 194 output = nsetup.run({pop_exc_seq1.soma.channel:stim}) 195 n_neurons = np.arange(0,128,1) 196 SpikeTrain = output[pop_DMaking_exc.soma.channel].raw_data()

/usr/local/lib/python2.7/dist-packages/pyNCS/neurosetup.pyc in run(self, _args, _kwargs) 385 self.prepare() 386 if not self.offline: --> 387 return self.stimulate(_args, _kwargs) 388 389 def stimulate_raw(self, raw_stim, **kwargs):

/usr/local/lib/python2.7/dist-packages/pyNCS/neurosetup.pyc in stimulate(self, stim, _kwargs) 402 Returns a Stas.RawOutput object and populates monitors. The latter is the preferred way of reading data out. 403 ''' --> 404 stim_evs = self._pre_process(stim) 405 evs = self.communicator.run_rec(stim_evs, _kwargs) 406 return self._post_process(evs, self.monitors.channels)

/usr/local/lib/python2.7/dist-packages/pyNCS/neurosetup.pyc in _pre_process(self, stim) 358 359 def _pre_process(self, stim): --> 360 evs_in = self.seq.exportAER(stim, isi=True) 361 return evs_in.get_adtmev() 362

/usr/local/lib/python2.7/dist-packages/pyNCS/pyST/STas.pyc in exportAER(self, spikeLists, filename, format, isi, sep, addr_format, time_format, _args, *_kwargs) 986 if not isinstance(spikeLists[i], SpikeList): 987 raise TypeError( --> 988 "Values of spikeLists must be SpikeList objects!") 989 else: 990 raise RuntimeError(

TypeError: Values of spikeLists must be SpikeList objects! WARNING: Failure executing file:

I did not suffer this problem before. Does the following code lead to this problem?

stim = pyST.merge_spikelists(stim_inh[pop_inh_seq.soma.channel], stim_exc_seq10[pop_exc_seq1.soma.channel],stim_exc_seq11[pop_exc_seq1.soma.channel],stim_exc_seq20[pop_exc_seq2.soma.channel],stim_exc_seq21[pop_exc_seq2.soma.channel],stim_exc_seq22[pop_exc_seq2.soma.channel],stim_exc_seq23[pop_exc_seq2.soma.channel])

sheiksadique commented 12 years ago

I think the problem is that you are using an older version of pyST. Please uninstall your pyST and use pyNCS.pyST instead.

Also since this is a different issue from what was originally reported, try to open a different issue (next time). It is just useful; next time some one else has a similar error, they can refer to the corresponding issue thread.

hongzhiyou commented 12 years ago

Sadique, there is no function named "merge_spikelists" in pyNCS.pyST.

sheiksadique commented 12 years ago

Okk i have added the functions to the main import. Please update (git pull) your pyNCS and check now.