Skip to content

Commit

Permalink
change to f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
C.A.P. Linssen committed Sep 9, 2024
1 parent d1d0589 commit 5b15971
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pynest/examples/balancedneuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@


def output_rate(guess):
print("Inhibitory rate estimate: %5.2f spks/s" % guess)
print(f"Inhibitory rate estimate: {guess:5.2f} spks/s")
rate = float(abs(n_in * guess))
noise[1].rate = rate
spikerecorder.n_events = 0
nest.Simulate(t_sim)
out = spikerecorder.n_events * 1000.0 / t_sim
print(" -> Neuron rate: %6.2f spks/s (goal: %4.2f spks/s)" % (out, r_ex))
print(f" -> Neuron rate: {out:6.2f} spks/s (goal: {r_ex:4.2f} spks/s)")
return out


Expand All @@ -149,7 +149,7 @@ def output_rate(guess):
# firing rate of the neurons of the inhibitory population.

in_rate = bisect(lambda x: output_rate(x) - r_ex, lower, upper, xtol=prec)
print("Optimal rate for the inhibitory population: %.2f spks/s" % in_rate)
print(f"Optimal rate for the inhibitory population: {in_rate:.2f} spks/s")

###############################################################################
# The function ``bisect`` takes four arguments: first a function whose
Expand Down

0 comments on commit 5b15971

Please sign in to comment.