Skip to content

Commit

Permalink
Merge pull request #201 from AllenNeuralDynamics/release-v0.20.0
Browse files Browse the repository at this point in the history
Release v0.20.0
  • Loading branch information
jtyoung84 authored Nov 21, 2024
2 parents b283c50 + 13eed9a commit fd4cbcf
Show file tree
Hide file tree
Showing 38 changed files with 4,851 additions and 891 deletions.
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
from pathlib import Path
from datetime import date
from os.path import abspath, dirname
from pathlib import Path

from aind_metadata_mapper import __version__ as package_version

INSTITUTE_NAME = "Allen Institute for Neural Dynamics"
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ mesoscope = [
"aind-metadata-mapper[bergamo]",
"pillow >= 10.4.0",
"tifffile==2024.2.12 ; python_version >= '3.9'",
"numpy >= 1.26.4",
"h5py >= 3.11.0",
"scipy >= 1.11.0",
"pandas >= 2.2.2",
]

openephys = [
Expand Down
2 changes: 1 addition & 1 deletion src/aind_metadata_mapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Init package"""

__version__ = "0.19.0"
__version__ = "0.20.0"
1 change: 1 addition & 0 deletions src/aind_metadata_mapper/bruker/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module defining JobSettings for Bruker ETL"""

from pathlib import Path
from typing import List, Literal, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions src/aind_metadata_mapper/bruker/session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sets up the MRI ingest ETL"""

import argparse
import json
import logging
Expand Down
6 changes: 5 additions & 1 deletion src/aind_metadata_mapper/gather_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ def get_funding_info(domain: str, url_path: str, project_name: str):
funding_info = []
investigators = set()
for f in funding_info:
project_fundees = f.get("fundee", "").split(",")
project_fundees = (
""
if f.get("fundee", None) is None
else f.get("fundee", "").split(",")
)
pid_names = [
PIDName(name=p.strip()).model_dump_json()
for p in project_fundees
Expand Down
23 changes: 23 additions & 0 deletions src/aind_metadata_mapper/mesoscope/data_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
""" example data description """

from datetime import datetime, timezone

from aind_data_schema.core.data_description import Funding, RawDataDescription
from aind_data_schema_models.modalities import Modality
from aind_data_schema_models.organizations import Organization
from aind_data_schema_models.pid_names import PIDName
from aind_data_schema_models.platforms import Platform

d = RawDataDescription(
modality=[Modality.POPHYS, Modality.BEHAVIOR_VIDEOS, Modality.BEHAVIOR],
platform=Platform.MULTIPLANE_OPHYS,
subject_id="12345",
creation_time=datetime(2022, 2, 21, 16, 30, 1, tzinfo=timezone.utc),
institution=Organization.AIND,
investigators=[PIDName(name="Jane Smith")],
funding_source=[Funding(funder=Organization.AI)],
)

serialized = d.model_dump_json()
deserialized = RawDataDescription.model_validate_json(serialized)
deserialized.write_standard_file()
60 changes: 44 additions & 16 deletions src/aind_metadata_mapper/mesoscope/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,57 @@

from datetime import datetime
from pathlib import Path
from typing import List, Literal, Union
from typing import List, Literal, Optional

from pydantic import Field
from pydantic import Field, field_validator

from aind_metadata_mapper.core_models import BaseJobSettings


class JobSettings(BaseJobSettings):
"""Data to be entered by the user."""

job_settings_name: Literal["Mesoscope"] = "Mesoscope"
# TODO: Can probably put this as part of input_source
behavior_source: Union[Path, str]
session_start_time: datetime
session_end_time: datetime
subject_id: str
project: str
iacuc_protocol: str = "2115"
magnification: str = "16x"
fov_coordinate_ml: float = 1.5
fov_coordinate_ap: float = 1.5
fov_reference: str = "Bregma"
job_settings_name: Literal["Mesoscope"] = Field(
default="Mesoscope", title="Name of the job settings"
)
input_source: Path = Field(..., title="Path to the input source")
session_id: str = Field(..., title="ID of the session")
behavior_source: Path = Field(..., title="Path to the behavior source")
make_camsitm_dir: bool = Field(
default=False, title="Make camsitm directory"
)
output_directory: Path = Field(..., title="Path to the output directory")
session_start_time: datetime = Field(
..., title="Start time of the session"
)
session_end_time: datetime = Field(..., title="End time of the session")
subject_id: str = Field(..., title="ID of the subject")
project: str = Field(..., title="Name of the project")
iacuc_protocol: str = Field(default="2115", title="IACUC protocol number")
magnification: str = Field(default="16x", title="Magnification")
fov_coordinate_ml: float = Field(
default=1.5, title="Coordinate in ML direction"
)
fov_coordinate_ap: float = Field(
default=1.5, title="Coordinate in AL direction"
)
fov_reference: str = Field(
default="Bregma", title="Reference point for the FOV"
)
experimenter_full_name: List[str] = Field(
..., title="Full name of the experimenter"
title="Full name of the experimenter"
)
mouse_platform_name: str = Field(
default="disc", title="Name of the mouse platform"
)
mouse_platform_name: str = "disc"
optional_output: Optional[Path] = Field(
default=None, title="Optional output path"
)

@field_validator("input_source", "behavior_source", "output_directory")
@classmethod
def validate_path_is_dir(cls, v):
"""Validate that the input source is a directory"""
if not v.is_dir():
raise ValueError(f"{v} is not a directory")
return v
Loading

0 comments on commit fd4cbcf

Please sign in to comment.