+10 XP

Scientific Notation in Python

In Python, 150e-3 means 150 × 10⁻³ = 0.15. Neuroscience uses tiny units — millivolts, picoamperes — so scientific notation keeps the code readable.

How to read it: XeY means X × 10^Y
150e-3 = 0.15 (150 milliseconds in seconds)
20e-3 = 0.02 (20 ms time constant)
25e-11 = 0.000000000025 (25 picoamperes)
100e6 = 100,000,000 (100 megaohms)

python
# All 8 LIF parameters
t_max = 150e-3   # 150 ms total simulation time
150e-3 = 150 × 10⁻³ = 0.15 seconds
dt = 1e-3        # 1 ms time step
tau = 20e-3      # 20 ms membrane time constant
el = -60e-3      # -60 mV resting potential
vr = -70e-3      # -70 mV reset voltage
vth = -50e-3     # -50 mV spike threshold
r = 100e6        # 100 MΩ resistance
i_mean = 25e-11  # 25 pA mean current
print(f"Simulation runs for {t_max*1000:.0f} ms")
f-string: {t_max*1000:.0f} converts to ms, :.0f rounds to 0 decimals
print(f"Time step: {dt*1000:.1f} ms")
print(f"Number of steps: {int(t_max/dt)}")
print(f"Threshold: {vth*1000:.0f} mV")

Run this to see the actual values. t_max/dt = 150 total steps.

Why use SI units (seconds, volts, amperes) throughout? Because the LIF equation τm·dV/dt = EL − V + R·I(t) is written in SI. If you mix millivolts with seconds, the math breaks. Stay consistent.