Skip to content

Commit

Permalink
Merge pull request #193 from AllenNeuralDynamics/ophys-stim-epochs-an…
Browse files Browse the repository at this point in the history
…d-fov

Ophys stim epochs and fov
  • Loading branch information
arielleleon authored Nov 15, 2024
2 parents 83581b6 + 7df5673 commit 770496c
Show file tree
Hide file tree
Showing 19 changed files with 4,691 additions and 827 deletions.
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
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()
57 changes: 41 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,54 @@

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")
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 770496c

Please sign in to comment.