Skip to content

Commit

Permalink
handle unit conversion in set_amplitudes_ecode
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkilic committed Jan 16, 2024
1 parent cfe6c68 commit 16763d1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bluepyefe/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,19 @@ def set_amplitudes_ecode(self, amp_name, config_data, reader_data, value):
given current amplitude is provided. If it isn't use the value
computed from the current series"""

unit = config_data.get("i_unit") or reader_data.get("i_unit")

if unit is None:
raise Exception(f"Current unit not configured for file {self.files}")

if amp_name in config_data and config_data[amp_name] is not None:
setattr(self, amp_name, config_data[amp_name])
amp = to_nA(config_data[amp_name], unit)
elif amp_name in reader_data and reader_data[amp_name] is not None:
setattr(self, amp_name, reader_data[amp_name])
amp = to_nA(reader_data[amp_name], unit)
else:
setattr(self, amp_name, value)
amp = value

setattr(self, amp_name, amp)

def index_to_ms(self, name_timing, time_series):
"""Used by some of the children classes to translate a timing attribute
Expand Down

0 comments on commit 16763d1

Please sign in to comment.