@@ -110,9 +110,18 @@ def __init__(self):
110110
111111 def initUI (self ):
112112
113+ global learning
114+ learning = False # Determines whether hebbian learning will be applied
115+
116+ global learning_file # name of the file that contains name of modules that will undergo
117+ learning_file = "" # hebbian learning
118+
113119 global useTVBConnectome
114120 useTVBConnectome = False # Determines whether to use a TVB connectome within simulation
115121
122+ global embedding_file # locations of embedded LSNM nodes within TVB connectome
123+ embedding_file = ""
124+
116125 global generateSubject
117126 generateSubject = False # Determines whether or not to vary connection weights given
118127 # to create a new subject for the current simulation
@@ -163,21 +172,28 @@ def initUI(self):
163172 # define the action to be taken if Run button is clicked on
164173 neuralNetButton .clicked .connect (self .browseNeuralNets )
165174
175+ # define check box to allow user to define LSNM module that will participate as a source
176+ # in hebbian learning
177+ learningBox = QtGui .QCheckBox ('Use Hebbian Learning' , self )
178+ layout .addWidget (learningBox , 4 , 0 )
179+ # define the action to be taken if learning box is selected
180+ learningBox .stateChanged .connect (self .learningOrNot )
181+
166182 # define checkbox to allow users to determine whether or not a TVB connectome will be used
167183 # in simulation
168184 connectomeBox = QtGui .QCheckBox ('Use TVB Connectome' , self )
169- layout .addWidget (connectomeBox , 4 , 0 )
185+ layout .addWidget (connectomeBox , 5 , 0 )
170186 connectomeBox .stateChanged .connect (self .connectomeOrNot )
171187
172188 # create a push button object labeled 'Run'
173189 runButton = QtGui .QPushButton ('Run simulation' , self )
174- layout .addWidget (runButton , 5 , 0 )
190+ layout .addWidget (runButton , 7 , 0 )
175191 # define the action to be taken if Run button is clicked on
176192 runButton .clicked .connect (self .onStart )
177193
178194 # create a push button object labeled 'Exit'
179195 exitButton = QtGui .QPushButton ('Quit LSNM' , self )
180- layout .addWidget (exitButton , 6 , 0 )
196+ layout .addWidget (exitButton , 8 , 0 )
181197 # define the action to be taken if Exit button is clicked on
182198 exitButton .clicked .connect (QtCore .QCoreApplication .instance ().quit )
183199
@@ -197,20 +213,28 @@ def initUI(self):
197213 self .neuralNetTextEdit = QtGui .QLineEdit ()
198214 layout .addWidget (self .neuralNetTextEdit , 3 , 1 )
199215
216+ # create a text edit object for reading file that contains modules that will undergo learning
217+ self .learningTextEdit = QtGui .QLineEdit ()
218+ layout .addWidget (self .learningTextEdit , 4 , 1 )
219+
220+ # create text edit object that contains name of file with locations of LSNM nodes within TVB
221+ self .embeddingTextEdit = QtGui .QLineEdit ()
222+ layout .addWidget (self .embeddingTextEdit , 5 , 1 )
223+
200224 # define checkbox to allow users to determine whether or not to vary weights randomly from
201225 # weights given to create a new simulated subject
202226 newSubjectBox = QtGui .QCheckBox ('Vary weights to create new subject' , self )
203- layout .addWidget (newSubjectBox , 4 , 1 )
227+ layout .addWidget (newSubjectBox , 6 , 0 )
204228 newSubjectBox .stateChanged .connect (self .createNewSubject )
205229
206230 # define output display to keep users updated with simulation progress status messages
207231 self .runTextEdit = QtGui .QTextEdit ()
208- layout .addWidget (self .runTextEdit , 5 , 1 )
232+ layout .addWidget (self .runTextEdit , 7 , 1 )
209233
210234 # define progress bar to keep user informed of simulation progress status
211235 self .progressBar = QtGui .QProgressBar (self )
212236 self .progressBar .setRange (0 ,100 )
213- layout .addWidget (self .progressBar , 6 , 1 )
237+ layout .addWidget (self .progressBar , 8 , 1 )
214238
215239 # define the main thread as the main simulation code
216240 self .myLongTask = TaskThread ()
@@ -260,19 +284,40 @@ def browseNeuralNets(self):
260284 global neural_net
261285 # allow user to browse files to find desired input file containing neural net (model and weights
262286 # combined)
263- neural_net = QtGui .QFileDialog .getOpenFileName (self , 'Select *.txt file that contains neural net' , '.' )
287+ neural_net = QtGui .QFileDialog .getOpenFileName (self , 'Select *.json file that contains neural net' , '.' )
264288
265- # display contents of file containing neural net (model and weights combined
289+ # display contents of file containing neural net (model and weights combined)
266290 self .neuralNetTextEdit .setText (neural_net )
267291
292+ def learningOrNot (self , state ):
293+
294+ global learning
295+ global learning_file
296+ # allow user to decide whether network weights will be participating in Hebbian learning during
297+ # simulation
298+ if state == QtCore .Qt .Checked :
299+ learning = True
300+ print '\r Using Hebbian learning...'
301+ learning_file = QtGui .QFileDialog .getOpenFileName (self , 'Select file that contains learning modules' , '.' )
302+
303+ # display contents of file with names of modules whose weights will undergo hebbian learning
304+ self .learningTextEdit .setText (learning_file )
305+ else :
306+ learning = False
307+ print '\r Not Using learning...'
268308
269309 def connectomeOrNot (self , state ):
270310
271311 global useTVBConnectome
312+ global embedding_file
272313 # allow user to decide whether to use a TVB connectome as part of the simulation
273314 if state == QtCore .Qt .Checked :
274315 useTVBConnectome = True
275316 print '\r Using TVB Connectome...'
317+ embedding_file = QtGui .QFileDialog .getOpenFileName (self ,'Select file that contains locations of LSNM nodes' , '.' )
318+
319+ # display contents of file with locations of LSNM nodes with TVB connectome
320+ self .embeddingTextEdit .setText (embedding_file )
276321 else :
277322 useTVBConnectome = False
278323 print '\r NOT Using TVB Connectome...'
@@ -765,7 +810,7 @@ def run(self):
765810
766811 # run the simulation for the number of timesteps given
767812 print '\r Running simulation...'
768-
813+
769814 if useTVBConnectome :
770815 # the following 'for loop' is the main loop of the TVB simulation with the parameters
771816 # defined above. Note that the LSNM simulator is literally embedded into the TVB
0 commit comments