Skip to content

Commit

Permalink
python 3.12 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gitmv committed Oct 6, 2024
1 parent 3441f70 commit bff6bd3
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Exploration/Behaviour_UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_behaviors(file, base_classes=['Behavior']):
bpo.base_class = r.pop(0)

name = r[0].replace('class ', '')
name = name[0:min(name.find('('), name.find(':'))]
name = name[0:min([name.find('('), name.find(':')])]
bpo.name = name

bpo.tags = []
Expand Down
8 changes: 4 additions & 4 deletions Exploration/Evolution/EvolutionPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def paint(self, painter, option, widget=None):

def boundingRect(self):
br = self.picture.boundingRect()
br.setTop(max(br.top()-10, br.left()-10))
br.setLeft(min(br.top()-10, br.left()-10))
br.setRight(max(br.right()+10, br.bottom()+10))
br.setBottom(max(br.right()+10, br.bottom()+10))
br.setTop(max([br.top()-10, br.left()-10]))
br.setLeft(min([br.top()-10, br.left()-10]))
br.setRight(max([br.right()+10, br.bottom()+10]))
br.setBottom(max([br.right()+10, br.bottom()+10]))
return QtCore.QRectF(br)

def add_evolution_plot_items(ui, tab):
Expand Down
6 changes: 3 additions & 3 deletions Exploration/Network_UI/Basic_Tabs/Helper/PCA.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
#X = np.array([np.random.rand(1000) for i in range(1000)])

def get_PCA(act, num_sv=100):
num_sv = min(num_sv, len(act))
num_sv = min([num_sv, len(act)])
pca = PCA(n_components=num_sv)
pca.fit(act)

return pca

def get_activity_singular_values(act, num_sv=100):
num_sv = min(num_sv, len(act))
num_sv = min([num_sv, len(act)])
pca = PCA(n_components=num_sv)
pca.fit(act)

return pca.singular_values_

def get_activity_singular_values_and_components(act, num_sv=100):
num_sv = min(num_sv, len(act))
num_sv = min([num_sv, len(act)])
pca = PCA(n_components=num_sv)
pca.fit(act)

Expand Down
8 changes: 4 additions & 4 deletions Exploration/Network_UI/Basic_Tabs/fourier_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def update(self, Network_UI):
max_x = np.max(xf)

self.exc_delta.setData([0.1, 3.9], [0, 0], fillLevel=max_y, brush=(50, 250, 50, 50), pen=(50, 250, 50, 50))
self.exc_theta.setData([min(max_x, 4), min(max_x, 7.9)], [0, 0], fillLevel=max_y, brush=(100, 200, 50, 50), pen=(50, 250, 50, 50))
self.exc_alpha.setData([min(max_x, 8), min(max_x, 13.9)], [0, 0], fillLevel=max_y, brush=(150, 150, 50, 50), pen=(50, 250, 50, 50))
self.exc_beta.setData([min(max_x, 14), min(max_x, 29.9)], [0, 0], fillLevel=max_y, brush=(200, 100, 50, 50), pen=(50, 250, 50, 50))
self.exc_gamma.setData([min(max_x, 30), min(max_x, 100)], [0, 0], fillLevel=max_y, brush=(250, 50, 50, 50), pen=(50, 250, 50, 50))
self.exc_theta.setData([min([max_x, 4]), min([max_x, 7.9])], [0, 0], fillLevel=max_y, brush=(100, 200, 50, 50), pen=(50, 250, 50, 50))
self.exc_alpha.setData([min([max_x, 8]), min([max_x, 13.9])], [0, 0], fillLevel=max_y, brush=(150, 150, 50, 50), pen=(50, 250, 50, 50))
self.exc_beta.setData([min([max_x, 14]), min([max_x, 29.9])], [0, 0], fillLevel=max_y, brush=(200, 100, 50, 50), pen=(50, 250, 50, 50))
self.exc_gamma.setData([min([max_x, 30]), min([max_x, 100])], [0, 0], fillLevel=max_y, brush=(250, 50, 50, 50), pen=(50, 250, 50, 50))
except:
print(self.parameter, 'cannot be evaluated')

Expand Down
8 changes: 4 additions & 4 deletions Exploration/Network_UI/Basic_Tabs/partition_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def paint(self, painter, option, widget=None):

def boundingRect(self):
br=self.picture.boundingRect()
br.setTop(min(br.top(), br.left()))
br.setLeft(min(br.top(), br.left()))
br.setRight(max(br.right(), br.bottom()))
br.setBottom(max(br.right(), br.bottom()))
br.setTop(min([br.top(), br.left()]))
br.setLeft(min([br.top(), br.left()]))
br.setRight(max([br.right(), br.bottom()]))
br.setBottom(max([br.right(), br.bottom()]))
return QtCore.QRectF(br)


Expand Down
6 changes: 3 additions & 3 deletions Exploration/Network_UI/Basic_Tabs/weight_tab_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def update(self, Network_UI):
for key in syn_dict[transmitter][weight_attr]:
m = np.max(syn_dict[transmitter][weight_attr][key])

tr_max[transmitter] = max(tr_max[transmitter], m)
var_max[transmitter][weight_attr] = max(var_max[transmitter][weight_attr], m)
tr_max[transmitter] = max([tr_max[transmitter], m])
var_max[transmitter][weight_attr] = max([var_max[transmitter][weight_attr], m])
key_max[transmitter][weight_attr][key] = m
glob_max = max(glob_max, m)
glob_max = max([glob_max, m])

if min_max_mode == 'Global':
max_w = glob_max
Expand Down
4 changes: 2 additions & 2 deletions Exploration/Network_UI/Network_UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def add_recording_variable(self, group, var, timesteps):
if var in group._rec_dict:
old_ts=group._rec_dict[var]

group._rec_dict[var] = max(timesteps,old_ts)
group._rec_dict[var] = max([timesteps,old_ts])
#recorder.add_varable('output')
return True

Expand Down Expand Up @@ -209,7 +209,7 @@ def add_event(self, tag, duration=0):
self.event_list.append(event(self.network.iteration, tag, self.network.iteration+duration))

def get_color(type_index, layer=1):
dim_value = max(layer * 0.9, 1.0)
dim_value = max([layer * 0.9, 1.0])

if type_index == 0:
return (0.0, 0.0, 255.0 / dim_value, 255.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ def paint(self, painter, option, widget=None):

def boundingRect(self):
br = self.picture.boundingRect()
br.setTop(max(br.top()-10, br.left()-10))
br.setLeft(min(br.top()-10, br.left()-10))
br.setRight(max(br.right()+10, br.bottom()+10))
br.setBottom(max(br.right()+10, br.bottom()+10))
br.setTop(max([br.top()-10, br.left()-10]))
br.setLeft(min([br.top()-10, br.left()-10]))
br.setRight(max([br.right()+10, br.bottom()+10]))
br.setBottom(max([br.right()+10, br.bottom()+10]))
return QtCore.QRectF(br)

class sun_gravity_plot_tab(TabBase):
Expand Down
2 changes: 1 addition & 1 deletion Exploration/StorageManager/StorageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def backup_execued_file(self):
self.backup(executed_file)

def backup(self, file_or_folder):
file_or_folder.replace('\\','/')
file_or_folder = file_or_folder.replace('\\','/')
if file_or_folder[-1]=='/':
file_or_folder=file_or_folder[:-1]
parts = file_or_folder.split('/')
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
add_project_root_path()

#print numpy arrays with commas for easier copy paste
np.set_string_function(lambda x: repr(x), repr=False)
#np.set_string_function(lambda x: repr(x), repr=False)

from PymoNNto.NetworkCore.Network import *
from PymoNNto.NetworkCore.Behavior import *
Expand Down

0 comments on commit bff6bd3

Please sign in to comment.