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

rc/2.11.3 #2179

Merged
merged 6 commits into from
Aug 4, 2021
Merged

rc/2.11.3 #2179

merged 6 commits into from
Aug 4, 2021

Conversation

djkapner
Copy link
Contributor

@djkapner djkapner commented Aug 4, 2021

Description

write_behavior_nwb was failing on NWB checks.

  • property indicator needed to be moved from BehaviorMetadata to BehaviorOphysMetadata
  • the BehaviorJsonExtractor needed to share the code with BehaviorLimsExtractor for getting the stimulus_name from a pkl file.

Validations

1) This code snippet reproduced the observed error from production (and one other related to stimulus_name) and passes now in this branch.

import json
from allensdk.brain_observatory.behavior.write_behavior_nwb.__main__ import write_behavior_nwb

prod_injson_path = "/allen/programs/braintv/production/visualbehavior/prod2/specimen_900263316/behavior_session_928263200/BEHAVIOR_WRITE_NWB_QUEUE_928263200_input.json"
with open(prod_injson_path, "r") as f:
    j = json.load(f)

write_behavior_nwb(j["session_data"], "tmp.nwb")

2) This code snippet passes the assert and shows that this branch reproduces a released BehaviorSession

import json

from allensdk.brain_observatory.behavior.write_behavior_nwb.__main__ import write_behavior_nwb
from allensdk.brain_observatory.behavior.behavior_project_cache import VisualBehaviorOphysProjectCache
from allensdk.brain_observatory.behavior.behavior_session import BehaviorSession
from allensdk.brain_observatory.session_api_utils import sessions_are_equal


data_storage_directory = "/home/danielk/data"
cache = VisualBehaviorOphysProjectCache.from_s3_cache(
        cache_dir=data_storage_directory)
prod_session = cache.get_behavior_session(870987812)

prod_injson_path = "/allen/programs/braintv/production/visualbehavior/prod2/specimen_850862430/behavior_session_870987812/BEHAVIOR_WRITE_NWB_QUEUE_870987812_input.json"
with open(prod_injson_path, "r") as f:
    j = json.load(f)
write_behavior_nwb(j["session_data"], "tmp.nwb")

test_session = BehaviorSession.from_nwb_path("tmp.nwb")
assert sessions_are_equal(prod_session, test_session)

3. This snippet passes the assert and shows that this branch reproduces a released BehaviorOphysExperiment

import json
  
from allensdk.brain_observatory.behavior.write_nwb.__main__ import write_behavior_ophys_nwb
from allensdk.brain_observatory.behavior.behavior_project_cache import VisualBehaviorOphysProjectCache
from allensdk.brain_observatory.behavior.behavior_ophys_experiment import BehaviorOphysExperiment
from allensdk.brain_observatory.session_api_utils import sessions_are_equal


data_storage_directory = "/home/danielk/data"
cache = VisualBehaviorOphysProjectCache.from_s3_cache(
        cache_dir=data_storage_directory)
prod_experiment = cache.get_behavior_ophys_experiment(951980471)

prod_injson_path = "/allen/programs/braintv/production/neuralcoding/prod0/specimen_840355567/ophys_session_951410079/ophys_experiment_951980471/BEHAVIOR_OPHYS_WRITE_NWB_QUEUE_NO_STATE_CHANGE_951980471_input.json"
with open(prod_injson_path, "r") as f:
    j = json.load(f)
write_behavior_ophys_nwb(j["session_data"], "tmp.nwb", skip_eye_tracking=False)

test_experiment = BehaviorOphysExperiment.from_nwb_path("tmp.nwb")
assert sessions_are_equal(prod_experiment, test_experiment)

4) Bamboo tests are passing.

@djkapner djkapner changed the title Rc/2.11.3 rc/2.11.3 Aug 4, 2021
Copy link
Contributor

@danielsf danielsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djkapner djkapner merged commit 6cf59d5 into master Aug 4, 2021
@djkapner djkapner deleted the rc/2.11.3 branch August 4, 2021 21:55
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

Successfully merging this pull request may close these issues.

2 participants