Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BehaviorEcephysSession instantiation fails on unnecessary validation check #2382

Closed
3 tasks
danielsf opened this issue Apr 24, 2022 · 1 comment
Closed
3 tasks
Assignees

Comments

@danielsf
Copy link
Contributor

danielsf commented Apr 24, 2022

When trying to instantiate BehaviorEcephysSessions from the input jsons in

/allen/aibs/technology/sergeyg/Projects/vbn/input_json_templates

The 18 files posted below failed with an error like

BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1130113579_input.json
When getting num_frames from <class 'allensdk.brain_observatory.behavior.data_files.stimulus_file.ReplayStimulusFile'>
len(self.data['items']['behavior']['intervalsms'] == 216178; expected zero

filepath: /allen/programs/braintv/production/visualbehavior/prod0/specimen_1104573427/ecephys_session_1130113579/1130277628/1130113579_579993_20210922.replay.pkl

This is triggered by the following block of code

https://github.com/AllenInstitute/AllenSDK/blob/vbn_2022_dev/allensdk/brain_observatory/behavior/data_files/stimulus_file.py#L45-L67

This code was implemented based on @danielsf's intuition. No stakeholder has told us this validation check is appropriate. It obviously isn't. Just remove this check and try to re-instantiate the BehaviorEcephysSessions.

Note: There will be a unit test that fails when you remove this block of code. It is a test that the offending code raises an exception when it is supposed to. Go ahead and remove that test.

To create a BehaviorEcephysSession, run something like

import pandas as pd
import json
import pathlib
import numpy as np
from allensdk.brain_observatory.ecephys.behavior_ecephys_session import (
    BehaviorEcephysSession)


def main():
    json_path = pathlib.Path('/allen/aibs/technology/sergeyg/Projects/vbn/input_
json_templates/BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1111216934_input.json')
    src_dir = json_path.parent
    json_path_list = [n for n in src_dir.rglob('*input.json')]
    whole_msg = ""
    for json_path in json_path_list:
        with open(json_path, 'rb') as in_file:
            json_data = json.load(in_file)
        session = BehaviorEcephysSession.from_json(session_data=json_data)

Task

  • Remove unnecessary validation check cited above
  • Remove unit test that depends on that validation check
  • Re run the sessions listed below through BehaviorEcephysSession instantiation and verify that they pass (or fail on some other bug that we should open a ticket for)
@danielsf
Copy link
Contributor Author

These are the input.jsons that fail in this way

BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1124507277_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1130113579_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1122903357_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1130349290_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1139846596_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1152632711_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1119946360_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1121607504_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1128520325_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1128719842_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1120251466_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1123100019_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1121406444_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1124285719_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1125937457_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1125713722_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1140102579_input.json
BEHAVIOR_ECEPHYS_WRITE_NWB_QUEUE_1152811536_input.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants