Skip to content

Commit

Permalink
Small bugfix
Browse files Browse the repository at this point in the history
Ensuring that the current change is a scalar. Some versions of numpy
return a one-element array.
  • Loading branch information
bendudson committed Feb 16, 2019
1 parent d05e439 commit 3647241
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion freegs/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ def controlAdjust(self, current_change):
controlcoils = [coil for label,coil in self.coils if coil.control]

for coil, dI in zip(controlcoils, current_change):
coil.current += dI
# Ensure that dI is a scalar
coil.current += np.asscalar(dI)

def controlCurrents(self):
"""
Expand Down

0 comments on commit 3647241

Please sign in to comment.