Skip to content

Commit d06ca64

Browse files
committed
GH AllenInstitute#533 - Check for autobias_v in sweep_metadata keys
First check that autobias_v is present in sweep_metadata.keys() before assigning value in Sweep(), set to None if not present. Also added autobias_v as None in test_get_sweep_metadata from test_mies_nwb_data.py so that expected result and obtained result match.
1 parent 59f5132 commit d06ca64

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ipfx/dataset/ephys_data_set.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ def sweep(self, sweep_number: int) -> Sweep:
228228

229229
sweep_data = self.get_sweep_data(sweep_number)
230230
sweep_metadata = self._data.get_sweep_metadata(sweep_number)
231+
if "autobias_v" in sweep_metadata.keys():
232+
autobias_v = sweep_metadata["autobias_v"]
233+
else:
234+
autobias_v = None
231235

232236
time = np.arange(
233237
len(sweep_data["stimulus"])
@@ -248,8 +252,8 @@ def sweep(self, sweep_number: int) -> Sweep:
248252
sampling_rate=sweep_data["sampling_rate"],
249253
sweep_number=sweep_number,
250254
clamp_mode=sweep_metadata["clamp_mode"],
251-
autobias_v = sweep_metadata["autobias_v"],
252255
epochs=sweep_data.get("epochs", None),
256+
autobias_v = autobias_v
253257
)
254258

255259
except Exception:

tests/dataset/test_mies_nwb_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def test_get_sweep_metadata(mies_nwb_data):
5858
'stimulus_code_ext': 'STIMULUS_CODE[1]',
5959
'clamp_mode': 'CurrentClamp',
6060
'stimulus_name': 'expected name',
61+
'autobias_v': None
6162
}
6263

6364
obtained = mies_nwb_data.get_sweep_metadata(sweep_number=4)

0 commit comments

Comments
 (0)