def test_add_stimulus_presentations(nwbfile, presentations, roundtripper): write_nwb.add_stimulus_timestamps(nwbfile, [0, 1]) write_nwb.add_stimulus_presentations(nwbfile, presentations) api = roundtripper(nwbfile, EcephysNwbSessionApi) obtained_stimulus_table = api.get_stimulus_presentations() pd.testing.assert_frame_equal(presentations, obtained_stimulus_table, check_dtype=False)
def test_add_stimulus_presentations_color(nwbfile, stimulus_presentations_color, roundtripper): write_nwb.add_stimulus_timestamps(nwbfile, [0, 1]) write_nwb.add_stimulus_presentations(nwbfile, stimulus_presentations_color) api = roundtripper(nwbfile, EcephysNwbSessionApi) obtained_stimulus_table = api.get_stimulus_presentations() expected_color = [1.0, "", "", -1.0, ""] obtained_color = obtained_stimulus_table["color"].values.tolist() mismatched = False for expected, obtained in zip(expected_color, obtained_color): if expected != obtained: mismatched = True assert not mismatched, f"expected: {expected_color}, obtained: {obtained_color}"