Skip to content

Commit

Permalink
Merge pull request #2187 from AllenInstitute/rc/2.13.0
Browse files Browse the repository at this point in the history
rc/2.13.0
  • Loading branch information
aamster authored Sep 22, 2021
2 parents fdedea1 + 39247c8 commit a6d2afc
Show file tree
Hide file tree
Showing 182 changed files with 12,075 additions and 8,658 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.13.0] = 2021-09-22
- Major internal refactor to BehaviorSession, BehaviorOphysExperiment classes. Implements DataObject pattern for fetching and serialization of data.

## [2.12.4] = 2021-09-21
- Documentation changes ahead of SWDB 2021
- Bugfix to CloudCache; it is now possible for multiple users to share a cache.
Expand Down
2 changes: 1 addition & 1 deletion allensdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#
import logging

__version__ = '2.12.4'
__version__ = '2.13.0'


try:
Expand Down
591 changes: 442 additions & 149 deletions allensdk/brain_observatory/behavior/behavior_ophys_experiment.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ def get_behavior_ophys_experiment(self, ophys_experiment_id: int
f" there are {row.shape[0]} entries.")
file_id = str(int(row[self.cache.file_id_column]))
data_path = self._get_data_path(file_id=file_id)
return BehaviorOphysExperiment.from_nwb_path(str(data_path))
return BehaviorOphysExperiment.from_nwb_path(
str(data_path))

def _get_ophys_session_table(self):
session_table_path = self._get_metadata_path(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
BehaviorSession)
from allensdk.brain_observatory.behavior.behavior_ophys_experiment import (
BehaviorOphysExperiment)
from allensdk.brain_observatory.behavior.session_apis.data_io import (
BehaviorLimsApi, BehaviorOphysLimsApi)
from allensdk.internal.api import db_connection_creator
from allensdk.brain_observatory.ecephys.ecephys_project_api.http_engine \
import (HttpEngine)
Expand Down Expand Up @@ -327,8 +325,8 @@ def get_behavior_ophys_experiment(self, ophys_experiment_id: int
:type ophys_experiment_id: int
:rtype: BehaviorOphysExperiment
"""
return BehaviorOphysExperiment(
BehaviorOphysLimsApi(ophys_experiment_id))
return BehaviorOphysExperiment.from_lims(
ophys_experiment_id=ophys_experiment_id)

def _get_ophys_experiment_table(self) -> pd.DataFrame:
"""
Expand Down Expand Up @@ -484,7 +482,8 @@ def get_behavior_session(
:type behavior_session_id: int
:rtype: BehaviorSession
"""
return BehaviorSession(BehaviorLimsApi(behavior_session_id))
return BehaviorSession.from_lims(
behavior_session_id=behavior_session_id)

def get_ophys_experiment_table(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
from allensdk.brain_observatory.behavior.behavior_project_cache.tables \
.project_table import \
ProjectTable
from allensdk.brain_observatory.behavior.metadata.behavior_metadata import \
BehaviorMetadata
from allensdk.brain_observatory.behavior.behavior_project_cache.project_apis.data_io import BehaviorProjectLimsApi # noqa: E501

from allensdk.brain_observatory.behavior.data_objects.metadata\
.subject_metadata.full_genotype import \
FullGenotype

from allensdk.brain_observatory.behavior.data_objects.metadata\
.subject_metadata.reporter_line import \
ReporterLine


class SessionsTable(ProjectTable):
"""Class for storing and manipulating project-level data
Expand Down Expand Up @@ -45,11 +51,11 @@ def __init__(

def postprocess_additional(self):
self._df['reporter_line'] = self._df['reporter_line'].apply(
BehaviorMetadata.parse_reporter_line)
ReporterLine.parse)
self._df['cre_line'] = self._df['full_genotype'].apply(
BehaviorMetadata.parse_cre_line)
lambda x: FullGenotype(x).parse_cre_line())
self._df['indicator'] = self._df['reporter_line'].apply(
BehaviorMetadata.parse_indicator)
lambda x: ReporterLine(x).parse_indicator())

self.__add_session_number()

Expand Down
Loading

0 comments on commit a6d2afc

Please sign in to comment.