Skip to content

Commit

Permalink
refactor rig
Browse files Browse the repository at this point in the history
  • Loading branch information
mochic committed Nov 18, 2023
1 parent e7a8f7f commit fc78013
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 2,190 deletions.
9 changes: 0 additions & 9 deletions src/aind_metadata_mapper/neuropixels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
import copy
import pydantic


def rehydrate_partial(model: pydantic.BaseModel, partial: dict, **props):
return model.parse_obj(
copy.deepcopy(partial)
.update(props)
)
126 changes: 0 additions & 126 deletions src/aind_metadata_mapper/neuropixels/camera.py

This file was deleted.

Empty file.
129 changes: 0 additions & 129 deletions src/aind_metadata_mapper/neuropixels/monitor.py

This file was deleted.

58 changes: 2 additions & 56 deletions src/aind_metadata_mapper/neuropixels/rig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
import datetime
import configparser
from aind_data_schema import rig, device
from aind_data_schema import rig

from ..core import BaseEtl

Expand Down Expand Up @@ -167,64 +167,10 @@ def _transform(self, extracted_source: RigContext) -> rig.Rig:

return rig.Rig.parse_obj({
**partial,
"modification_date": datetime.date.today(),
"daqs": [
*partial["daqs"],
sync_daq,
],
"cameras": camera_assemblies,
})


cameras = []
for camera_assembly in base["cameras"]:
camera_kwargs = camera_assembly["camera"]
camera_kwargs["computer_name"] = camera_meta["host"]
cameras.append(
rig.CameraAssembly(
camera_target=camera_assembly["camera_target"],
camera_assembly_name=camera_assembly["camera_assembly_name"],
camera=device.Camera(**camera_kwargs),
lens=rig.Lens(**camera_assembly["lens"])
)
)
return rig.Rig(
describedBy=base["describedBy"],
rig_id=base["rig_id"],
modification_date=base["modification_date"],
modalities=base["modalities"],
mouse_platform=device.Disc(**base["mouse_platform"]),
cameras=cameras,
ephys_assemblies=[
rig.EphysAssembly(
ephys_assembly_name=ephys_assembly["ephys_assembly_name"],
manipulator=device.Manipulator(**ephys_assembly["manipulator"]),
probes=[
device.EphysProbe(**probe)
for probe in ephys_assembly["probes"]
],
)
for ephys_assembly in base["ephys_assemblies"]
],
laser_assemblies=[
rig.LaserAssembly(
laser_assembly_name=laser_assembly["laser_assembly_name"],
manipulator=device.Manipulator(
**laser_assembly["manipulator"]
),
lasers=[
rig.Laser(**laser)
for laser in laser_assembly["lasers"]
],
)
for laser_assembly in base["laser_assemblies"]
],
light_sources=[
device.LightEmittingDiode(**led)
for led in base["light_sources"]
],
stimulus_devices=list(map(
load_stimulus_device,
base["stimulus_devices"],
)),
calibrations=[],
)
33 changes: 0 additions & 33 deletions tests/resources/neuropixels/camera.partial.json

This file was deleted.

444 changes: 0 additions & 444 deletions tests/resources/neuropixels/dxdiag.xml

This file was deleted.

Loading

0 comments on commit fc78013

Please sign in to comment.