Skip to content

Commit

Permalink
fixed 0 division bug
Browse files Browse the repository at this point in the history
  • Loading branch information
barel committed Feb 27, 2020
1 parent 4e85926 commit 0bdbd82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions netcore/create_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def change_range(weights,NewMin=1,NewMax=100):
OldMin = min(weights)
OldRange = (OldMax - OldMin)
NewRange = (NewMax - NewMin)
if OldRange==0:
# there is only one value for the seed weights
OldRange=NewRange
sizes = [0]*len(weights)
for i,w in enumerate(weights):
NewValue = (((w - OldMin) * NewRange) / OldRange) + NewMin
Expand Down

0 comments on commit 0bdbd82

Please sign in to comment.