-
Notifications
You must be signed in to change notification settings - Fork 150
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 #1838 from AllenInstitute/rc/2.6.0
rc/2.6.0
- Loading branch information
Showing
37 changed files
with
1,995 additions
and
415 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
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 |
---|---|---|
|
@@ -37,7 +37,8 @@ | |
|
||
|
||
|
||
__version__ = '2.5.0' | ||
|
||
__version__ = '2.6.0' | ||
|
||
|
||
try: | ||
|
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
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
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
2 changes: 2 additions & 0 deletions
2
allensdk/brain_observatory/behavior/session_apis/data_io/__init__.py
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
75 changes: 75 additions & 0 deletions
75
allensdk/brain_observatory/behavior/session_apis/data_io/behavior_json_api.py
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import logging | ||
from datetime import datetime | ||
import pytz | ||
|
||
from allensdk.brain_observatory.behavior.session_apis.data_transforms import ( | ||
BehaviorDataXforms) | ||
|
||
|
||
class BehaviorJsonApi(BehaviorDataXforms): | ||
"""A data fetching class that serves as an API for fetching 'raw' | ||
data from a json file necessary (but not sufficient) for filling | ||
a 'BehaviorSession'. | ||
Most 'raw' data provided by this API needs to be processed by | ||
BehaviorDataXforms methods in order to usable by 'BehaviorSession's. | ||
This class is used by the write_nwb module for behavior sessions. | ||
""" | ||
|
||
def __init__(self, data): | ||
self.data = data | ||
self.logger = logging.getLogger(self.__class__.__name__) | ||
|
||
def get_behavior_session_id(self) -> int: | ||
return self.data['behavior_session_id'] | ||
|
||
def get_foraging_id(self) -> int: | ||
return self.data['foraging_id'] | ||
|
||
def get_rig_name(self) -> str: | ||
"""Get the name of the experiment rig (ex: CAM2P.3)""" | ||
return self.data['rig_name'] | ||
|
||
def get_sex(self) -> str: | ||
"""Get the sex of the subject (ex: 'M', 'F', or 'unknown')""" | ||
return self.data['sex'] | ||
|
||
def get_age(self) -> str: | ||
"""Get the age of the subject (ex: 'P15', 'Adult', etc...)""" | ||
return self.data['age'] | ||
|
||
def get_stimulus_name(self) -> str: | ||
"""Get the name of the stimulus presented for a behavior or | ||
behavior + ophys experiment""" | ||
return self.data['stimulus_name'] | ||
|
||
def get_experiment_date(self) -> datetime: | ||
"""Get the acquisition date of an ophys experiment""" | ||
return pytz.utc.localize( | ||
datetime.strptime(self.data['date_of_acquisition'], | ||
"%Y-%m-%d %H:%M:%S")) | ||
|
||
def get_reporter_line(self) -> str: | ||
"""Get the (gene) reporter line for the subject associated with a | ||
behavior or behavior + ophys experiment""" | ||
return self.data['reporter_line'] | ||
|
||
def get_driver_line(self) -> str: | ||
"""Get the (gene) driver line for the subject associated with a | ||
behavior or behavior + ophys experiment""" | ||
return self.data['driver_line'] | ||
|
||
def get_full_genotype(self) -> str: | ||
"""Get the full genotype of the subject associated with a | ||
behavior or behavior + ophys experiment""" | ||
return self.data['full_genotype'] | ||
|
||
def get_behavior_stimulus_file(self) -> str: | ||
"""Get the filepath to the StimulusPickle file for the session""" | ||
return self.data['behavior_stimulus_file'] | ||
|
||
def get_external_specimen_name(self) -> int: | ||
"""Get the external specimen id (LabTracks ID) for the subject | ||
associated with a behavior experiment""" | ||
return int(self.data['external_specimen_name']) |
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.