-
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 branch 'vbn_2022_dev' into rc/2.13.5
- Loading branch information
Showing
204 changed files
with
16,659 additions
and
3,651 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import List | ||
|
||
import pandas as pd | ||
|
||
from allensdk.internal.api import PostgresQueryMixin | ||
from allensdk.internal.api.queries.utils import build_in_list_selector_query | ||
|
||
|
||
def get_death_date_for_mouse_ids( | ||
lims_connections: PostgresQueryMixin, | ||
mouse_ids_list: List[int] | ||
) -> pd.DataFrame: | ||
""" | ||
Parameters | ||
---------- | ||
lims_connections: | ||
mouse_ids_list: list of mouse ids | ||
Returns | ||
------- | ||
Dataframe with columns: | ||
- mouse id: int | ||
- death on: datetime | ||
""" | ||
query = f""" | ||
SELECT external_donor_name as mouse_id, death_on | ||
FROM donors | ||
{build_in_list_selector_query( | ||
col='external_donor_name', | ||
valid_list=mouse_ids_list | ||
)} | ||
""" | ||
return lims_connections.select(query=query) |
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
62 changes: 62 additions & 0 deletions
62
...k/brain_observatory/behavior/behavior_project_cache/behavior_neuropixels_project_cache.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,62 @@ | ||
from allensdk.brain_observatory.behavior.behavior_project_cache.\ | ||
project_apis.data_io import VisualBehaviorNeuropixelsProjectCloudApi | ||
from allensdk.brain_observatory.behavior.behavior_project_cache.\ | ||
project_cache_base import ProjectCacheBase | ||
|
||
|
||
class VisualBehaviorNeuropixelsProjectCache(ProjectCacheBase): | ||
|
||
PROJECT_NAME = "visual-behavior-neuropixels-2022" | ||
BUCKET_NAME = "sfd-cloudcache-test-bucket" | ||
|
||
def __init__( | ||
self, | ||
fetch_api: VisualBehaviorNeuropixelsProjectCloudApi, | ||
fetch_tries: int = 2, | ||
): | ||
""" Entrypoint for accessing Visual Behavior Neuropixels data. | ||
Supports access to metadata tables: | ||
get_ecephys_session_table() | ||
get_behavior_session_table() | ||
get_probe_table() | ||
get_channel_table() | ||
get_unit_table | ||
Provides methods for instantiating session objects | ||
from the nwb files: | ||
get_ecephys_session() to load BehaviorEcephysSession | ||
get_behavior_sesion() to load BehaviorSession | ||
Provides tools for downloading data: | ||
Will download data from the s3 bucket if session nwb file is not | ||
in the local cache, othwerwise will use file from the cache. | ||
""" | ||
super().__init__(fetch_api=fetch_api, fetch_tries=fetch_tries) | ||
|
||
@classmethod | ||
def cloud_api_class(cls): | ||
return VisualBehaviorNeuropixelsProjectCloudApi | ||
|
||
def get_ecephys_session_table(self): | ||
return self.fetch_api.get_ecephys_session_table(), | ||
|
||
def get_behavior_session_table(self): | ||
return self.fetch_api.get_behavior_session_table(), | ||
|
||
def get_probe_table(self): | ||
self.fetch_api.get_probe_table(), | ||
|
||
def get_channel_table(self): | ||
return self.fetch_api.get_channel_table(), | ||
|
||
def get_unit_table(self): | ||
return self.fetch_api.get_unit_table(), | ||
|
||
def get_ecephys_session(self, ecephys_session_id: int): | ||
return self.fetch_api.get_ecephys_session(ecephys_session_id) | ||
|
||
def get_behavior_session(self, behavior_session_id: int): | ||
return self.fetch_api.get_behavior_session(behavior_session_id) |
Oops, something went wrong.