Skip to content

Commit 0b3213a

Browse files
committed
fix broken tests wip
1 parent aa7af7f commit 0b3213a

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/visiomode/webpanel/export.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,15 @@ def to_nwb(session_path):
5353

5454
nwbfile.subject = pynwb.file.Subject(subject_id=session["animal_id"])
5555

56-
nwbfile.add_trial_column(name="stimulus", description="the visual stimuli during the trial")
57-
nwbfile.add_trial_column(name="cue_onset", description="when the stimulus came on")
58-
nwbfile.add_trial_column(name="response", description="trial response type (left, right, lever)")
59-
nwbfile.add_trial_column(name="response_time", description="response timestamp")
60-
nwbfile.add_trial_column(name="pos_x", description="response position in x-axis")
61-
nwbfile.add_trial_column(name="pos_y", description="response position in y-axis")
62-
nwbfile.add_trial_column(name="dist_x", description="response displacement in x-axis")
63-
nwbfile.add_trial_column(name="dist_y", description="response displacement in y-axis")
64-
nwbfile.add_trial_column(name="outcome", description="trial outcome")
65-
nwbfile.add_trial_column(name="correction", description="whether trial was a correction trial")
66-
nwbfile.add_trial_column(name="sdt_type", description="signal detection theory classification")
67-
68-
for trial in flatten_trials(session):
56+
trials = flatten_trials(session)
57+
trial_keys = set().union(*(trial.keys() for trial in trials))
58+
for key in trial_keys:
59+
try:
60+
nwbfile.add_trial_column(name=key, description="")
61+
except ValueError:
62+
continue
63+
64+
for trial in trials:
6965
nwbfile.add_trial(**trial)
7066

7167
nwbfile.create_device(

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def session(config):
8585
[
8686
models.Trial(
8787
outcome="correct",
88+
timestamp=str(datetime.now().isoformat()),
8889
iti=5.0,
8990
response=models.Response(
9091
timestamp=str(datetime.now().isoformat()),
@@ -100,6 +101,7 @@ def session(config):
100101
),
101102
models.Trial(
102103
outcome="incorrect",
104+
timestamp=str(datetime.now().isoformat()),
103105
iti=5.0,
104106
response=models.Response(
105107
timestamp=str(datetime.now().isoformat()),

0 commit comments

Comments
 (0)