Skip to content

Commit

Permalink
fix: assign correct units for Current devices
Browse files Browse the repository at this point in the history
  • Loading branch information
filimarc committed Nov 13, 2024
1 parent c3f0033 commit d67fadb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion bsb_neuron/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ def record(self, obj, **annotations):
v = p.record(obj)

def flush(segment):
if "unit" in annotations.keys():
device_unit = annotations["unit"]
else:
device_unit = "mV"
annotations["unit"] = "mV"
segment.analogsignals.append(
AnalogSignal(
list(v), units="mV", sampling_period=p.dt * ms, **annotations
list(v), units=device_unit, sampling_period=p.dt * ms, **annotations
)
)

Expand Down
2 changes: 1 addition & 1 deletion bsb_neuron/devices/current_clamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def _add_clamp(self, simdata, location, **annotations):
clamp = location.section.iclamp(
x=sx, delay=self.before, duration=self.duration, amplitude=self.amplitude
)
simdata.result.record(clamp._ref_i, **annotations)
simdata.result.record(clamp._ref_i, **annotations, unit="nA")
2 changes: 1 addition & 1 deletion bsb_neuron/devices/synapse_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def implement(self, adapter, simulation, simdata):


def _record_synaptic_current(result, synapse, **annotations):
result.record(synapse._pp._ref_i, **annotations)
result.record(synapse._pp._ref_i, **annotations, unit="nA")

0 comments on commit d67fadb

Please sign in to comment.