setChoices function and Iteration troubles ...

Questions about BrainVisa usage and installation

Moderators: denghien, riviere

Post Reply
User avatar
schwartz
Posts: 26
Joined: Mon Mar 08, 2004 9:12 am
Location: Pitié-Salpêtrière - Centre MEG/EEG
Contact:

setChoices function and Iteration troubles ...

Post by schwartz »

Hello all,

Sorry the message is quite long ...

One of my process is working properly when using "run" button on a single file, however when trying "iterate" to analyze several files BrainVisa return an error.

Here is a short description of the process :
This process updates "marker" choices when an input file is choosen (it implies reading the corresponding minf file, concatenate the marker names found and update the choices accordingly)

-----------------------
...
signature = Signature(
--'ds_directory', ReadDiskItem( 'CTF Data', 'CTF Data' ),
--'marker', Choice( 'First choose a signal file'),
...)

def initialization( self ):
-- def setMarkerAndFW( self, proc ):
## Read minf file and update choices
...
-- -- markers_labels = AttribMinf [ 'Markers_names' ]
...
-- -- eval_com = 'proc.signature[\'marker\'].setChoices( ' + tmp_markers + ')'
-- -- eval(eval_com)
-- -- return markers_labels[0]

## Let's update marker choices with respect to the choosen ds_directory
--- self.linkParameters( 'marker', 'ds_directory', setMarkerAndFW )
...

def execution( self, context ):
blabla ...
---------------------------

When using the iterate button, the choices are not updated correctly (ie it remains to the default value) and I get an error "Exception: Tr17 is not a valid choice" when setMarkerAndFW return Tr17.

I traced down the problem in setChoices function (Choice class in neuroData.py). Everything is ok until the following lines :
for f in self._warnChoices.keys():
-- f()
when using iterate self._warnChoices.keys() is empty so no updating of the values is done.
To be true here I'm a little bit lost, I wonder if the use of the "eval" function in my process is at the root of the problem, do I loose some "context" using this function (but it works properly using "run" button so ...)?

Thanks in advance,

Denis
Centre MEG/EEG - LENA-UPR640 CNRS
Ph.: 33 (0)1 42 16 14 16
User avatar
Yann Cointepas
Posts: 316
Joined: Tue Jan 20, 2004 2:56 pm
Location: Neurospin, Saint Aubin, France
Contact:

Post by Yann Cointepas »

Hi Denis,

I think the problem is not in your code but in BrainVISA. I will investigate and correct it as soon as possible.

Yann
Post Reply