-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from AllenInstitute/fix/legacy_metadata
legacy file support
- Loading branch information
Showing
12 changed files
with
185 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.3.0 | ||
current_version = 0.4.0 | ||
commit = True | ||
tag = True | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
setuptools.setup( | ||
name="visual-behavior", | ||
version="0.3.0", | ||
version="0.4.0", | ||
author="Justin Kiggins", | ||
author_email="[email protected]", | ||
description="analysis package for visual behavior", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,70 @@ | ||
from visual_behavior.translator import schemas | ||
|
||
from visual_behavior.schemas.core import MetadataSchema, StimulusSchema, \ | ||
RunningSchema, LickSchema, RewardSchema, TrialSchema | ||
from visual_behavior.schemas.extended_trials import ExtendedTrialSchema | ||
from visual_behavior.translator import foraging2, foraging | ||
from visual_behavior.translator.core import create_extended_dataframe | ||
from visual_behavior.uuid_utils import create_session_uuid | ||
|
||
|
||
"""test the schemas vs the outputs here | ||
""" | ||
|
||
def _test_core_data_schemas(core_data): | ||
|
||
# metadata | ||
|
||
# core dataframes | ||
dataframe_schemas = ( | ||
(StimulusSchema, core_data['visual_stimuli']), | ||
(RunningSchema, core_data['running']), | ||
(LickSchema, core_data['licks']), | ||
(RewardSchema, core_data['rewards']), | ||
(TrialSchema, core_data['trials']), | ||
) | ||
|
||
for Schema, data in dataframe_schemas: | ||
errors = Schema(many=True).validate(data.to_dict(orient='records')) | ||
|
||
for row, row_errors in errors.items(): | ||
assert len(row_errors)==0, (Schema, data, row_errors) | ||
|
||
extended_trials = create_extended_dataframe( | ||
trials=core_data['trials'], | ||
metadata=core_data['metadata'], | ||
licks=core_data['licks'], | ||
time=core_data['time'], | ||
) | ||
|
||
errors = ExtendedTrialSchema(many=True).validate( | ||
extended_trials.to_dict(orient='records') | ||
) | ||
|
||
for row, row_errors in errors.items(): | ||
assert len(row_errors)==0, row_errors | ||
|
||
errors = MetadataSchema().validate(core_data['metadata']) | ||
assert len(errors)==0, errors.keys() | ||
|
||
|
||
def test_foraging2_translator_schema(foraging2_data_stage4_2018_05_10): | ||
core_data = foraging2.data_to_change_detection_core( | ||
foraging2_data_stage4_2018_05_10 | ||
) | ||
core_data['metadata']['behavior_session_uuid'] = create_session_uuid( | ||
core_data['metadata']['mouseid'], | ||
core_data['metadata']['startdatetime'], | ||
) | ||
_test_core_data_schemas(core_data) | ||
|
||
def test_foraging_translator_schema(behavioral_session_output_fixture): | ||
core_data = foraging.data_to_change_detection_core( | ||
behavioral_session_output_fixture | ||
) | ||
|
||
core_data['metadata']['behavior_session_uuid'] = create_session_uuid( | ||
str(core_data['metadata']['mouseid']), | ||
core_data['metadata']['startdatetime'], | ||
) | ||
|
||
_test_core_data_schemas(core_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.3.0" | ||
__version__ = "0.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.