diff --git a/examples/aibs_smartspim_instrument.json b/examples/aibs_smartspim_instrument.json index 93111ab3c..876218973 100644 --- a/examples/aibs_smartspim_instrument.json +++ b/examples/aibs_smartspim_instrument.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/imaging/instrument.py", - "schema_version": "0.7.6", + "schema_version": "0.7.7", "instrument_id": "SmartSPIM2-2", "instrument_type": "SmartSPIM", "manufacturer": { @@ -71,7 +71,7 @@ ], "light_sources": [ { - "name": null, + "name": "Ex_488", "serial_number": "VL01222A11", "manufacturer": { "name": "Vortran", @@ -89,7 +89,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_561", "serial_number": "417927", "manufacturer": { "name": "Coherent Scientific", @@ -110,7 +110,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_647", "serial_number": "VL01222A10", "manufacturer": { "name": "Vortran", @@ -130,7 +130,7 @@ ], "fluorescence_filters": [ { - "name": null, + "name": "Em_525", "serial_number": "Unknown-1", "manufacturer": { "name": "Semrock", @@ -155,7 +155,7 @@ "description": null }, { - "name": null, + "name": "Em_600", "serial_number": "Unknown-2", "manufacturer": { "name": "Semrock", @@ -180,7 +180,7 @@ "description": null }, { - "name": null, + "name": "Em_690", "serial_number": "Unknown-3", "manufacturer": { "name": "Chroma", diff --git a/examples/aibs_smartspim_instrument.py b/examples/aibs_smartspim_instrument.py index 44cd39593..c69f6eb78 100644 --- a/examples/aibs_smartspim_instrument.py +++ b/examples/aibs_smartspim_instrument.py @@ -40,6 +40,7 @@ ], light_sources=[ Lightsource( + name="Ex_488", type="laser", coupling="Single-mode fiber", wavelength=488, @@ -50,6 +51,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_561", type="laser", coupling="Single-mode fiber", wavelength=561, @@ -60,6 +62,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_647", type="laser", coupling="Single-mode fiber", wavelength=647, @@ -161,6 +164,7 @@ ], fluorescence_filters=[ Filter( + name="Em_525", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -170,6 +174,7 @@ serial_number="Unknown-1", ), Filter( + name="Em_600", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -179,6 +184,7 @@ serial_number="Unknown-2", ), Filter( + name="Em_690", filter_type="Band pass", manufacturer=Manufacturer.CHROMA, diameter=25, diff --git a/examples/aibs_smartspim_procedures.py b/examples/aibs_smartspim_procedures.py index 3bf3b20ef..d636f885a 100644 --- a/examples/aibs_smartspim_procedures.py +++ b/examples/aibs_smartspim_procedures.py @@ -21,7 +21,11 @@ easy_index = procedures.Reagent(name="Easy Index", lot_number="1234", source="Vendor") -water = procedures.Reagent(name="Deionized water", lot_number="DDI/Filtered in house", source="This is not a reagent") +water = procedures.Reagent( + name="Deionized water", + lot_number="DDI/Filtered in house", + source="This is not a reagent", +) agarose = procedures.Reagent(name="Agarose", lot_number="1234", source="Other vendor") diff --git a/examples/aind_smartspim_instrument.json b/examples/aind_smartspim_instrument.json index e2efc8afe..d0b2095fc 100644 --- a/examples/aind_smartspim_instrument.json +++ b/examples/aind_smartspim_instrument.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/imaging/instrument.py", - "schema_version": "0.7.6", + "schema_version": "0.7.7", "instrument_id": "SmartSPIM1-3", "instrument_type": "SmartSPIM", "manufacturer": { @@ -128,7 +128,7 @@ ], "light_sources": [ { - "name": null, + "name": "Ex_445", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -146,7 +146,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_488", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -164,7 +164,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_561", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -182,7 +182,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_594", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -200,7 +200,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_639", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -218,7 +218,7 @@ "power_unit": "milliwatt" }, { - "name": null, + "name": "Ex_665", "serial_number": "VL08223M03", "manufacturer": { "name": "Vortran", @@ -238,7 +238,7 @@ ], "fluorescence_filters": [ { - "name": null, + "name": "Em_469", "serial_number": "Unknown-0", "manufacturer": { "name": "Semrock", @@ -263,7 +263,7 @@ "description": null }, { - "name": null, + "name": "Em_525", "serial_number": "Unknown-1", "manufacturer": { "name": "Semrock", @@ -288,7 +288,7 @@ "description": null }, { - "name": null, + "name": "Em_593", "serial_number": "Unknown-2", "manufacturer": { "name": "Semrock", @@ -313,7 +313,7 @@ "description": null }, { - "name": null, + "name": "Em_624", "serial_number": "Unknown-3", "manufacturer": { "name": "Semrock", @@ -338,7 +338,7 @@ "description": null }, { - "name": null, + "name": "Em_667", "serial_number": "Unknown-4", "manufacturer": { "name": "Chroma", @@ -363,7 +363,7 @@ "description": null }, { - "name": null, + "name": "Em_700", "serial_number": "Unknown-5", "manufacturer": { "name": "Thorlabs", diff --git a/examples/aind_smartspim_instrument.py b/examples/aind_smartspim_instrument.py index f581787a5..33617e885 100644 --- a/examples/aind_smartspim_instrument.py +++ b/examples/aind_smartspim_instrument.py @@ -68,6 +68,7 @@ ], light_sources=[ Lightsource( + name="Ex_445", type="laser", coupling="Single-mode fiber", wavelength=445, @@ -78,6 +79,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_488", type="laser", coupling="Single-mode fiber", wavelength=488, @@ -88,6 +90,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_561", type="laser", coupling="Single-mode fiber", wavelength=561, @@ -98,6 +101,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_594", type="laser", coupling="Single-mode fiber", wavelength=594, @@ -108,6 +112,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_639", type="laser", coupling="Single-mode fiber", wavelength=639, @@ -118,6 +123,7 @@ notes="All lasers controlled via Vortran VersaLase System", ), Lightsource( + name="Ex_665", type="laser", coupling="Single-mode fiber", wavelength=665, @@ -219,6 +225,7 @@ ], fluorescence_filters=[ Filter( + name="Em_469", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -228,6 +235,7 @@ serial_number="Unknown-0", ), Filter( + name="Em_525", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -237,6 +245,7 @@ serial_number="Unknown-1", ), Filter( + name="Em_593", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -246,6 +255,7 @@ serial_number="Unknown-2", ), Filter( + name="Em_624", filter_type="Band pass", manufacturer=Manufacturer.SEMROCK, diameter=25, @@ -255,6 +265,7 @@ serial_number="Unknown-3", ), Filter( + name="Em_667", filter_type="Band pass", manufacturer=Manufacturer.CHROMA, diameter=25, @@ -264,6 +275,7 @@ serial_number="Unknown-4", ), Filter( + name="Em_700", filter_type="Long pass", manufacturer=Manufacturer.THORLABS, diameter=25, diff --git a/examples/ephys_rig.json b/examples/ephys_rig.json index 62e96adf1..4397f0446 100644 --- a/examples/ephys_rig.json +++ b/examples/ephys_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/ephys/ephys_rig.py", - "schema_version": "0.7.6", + "schema_version": "0.7.7", "rig_id": "323_EPHYS1", "ephys_assemblies": [ { diff --git a/examples/ephys_rig.py b/examples/ephys_rig.py index 3ceef0f80..08cbb2617 100644 --- a/examples/ephys_rig.py +++ b/examples/ephys_rig.py @@ -96,7 +96,11 @@ ) -filt = Filter(filter_type="Long pass", manufacturer=Manufacturer.THORLABS, description="850 nm longpass filter") +filt = Filter( + filter_type="Long pass", + manufacturer=Manufacturer.THORLABS, + description="850 nm longpass filter", +) lens = Lens(focal_length=15, manufacturer=Manufacturer.EDMUND_OPTICS, max_aperture="f/2") @@ -113,7 +117,11 @@ ) camassm1 = CameraAssembly( - camera_assembly_name="Face Camera Assembly", camera=face_camera, camera_target="Face side", filter=filt, lens=lens + camera_assembly_name="Face Camera Assembly", + camera=face_camera, + camera_target="Face side", + filter=filt, + lens=lens, ) body_camera = Camera( @@ -129,7 +137,11 @@ ) camassm2 = CameraAssembly( - camera_assembly_name="Body Camera Assembly", camera=body_camera, camera_target="Body", filter=filt, lens=lens + camera_assembly_name="Body Camera Assembly", + camera=body_camera, + camera_target="Body", + filter=filt, + lens=lens, ) rig = EphysRig( diff --git a/examples/ephys_session.json b/examples/ephys_session.json index 202fb0a07..130efb139 100644 --- a/examples/ephys_session.json +++ b/examples/ephys_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/ephys/ephys_session.py", - "schema_version": "0.4.7", + "schema_version": "0.4.8", "experimenter_full_name": [ "Jane Doe" ], diff --git a/examples/exaspim_acquisition.json b/examples/exaspim_acquisition.json index f745fd237..f732c3c79 100644 --- a/examples/exaspim_acquisition.json +++ b/examples/exaspim_acquisition.json @@ -1,12 +1,50 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/imaging/acquisition.py", - "schema_version": "0.4.7", + "schema_version": "0.4.8", "experimenter_full_name": [ "###" ], "specimen_id": "###", "subject_id": "###", "instrument_id": "###", + "calibrations": [ + { + "date_of_calibration": "2022-11-22T08:43:00", + "device_name": "Laser_1", + "description": "Laser power calibration", + "input": { + "power_setting": { + "value": 100.0, + "unit": "percent" + } + }, + "output": { + "power_measurement": { + "value": 50.0, + "unit": "milliwatt" + } + }, + "notes": null + } + ], + "maintenance": [ + { + "date_of_maintenance": "2022-11-22T08:43:00", + "device_name": "Chamber", + "description": "Clean chamber", + "protocol_id": null, + "reagents": [ + { + "name": "reagent1", + "source": "xxx", + "rrid": "xxx", + "lot_number": "xxx", + "expiration_date": "2022-11-22" + } + ], + "notes": null + } + ], "session_start_time": "2022-11-22T08:43:00", "session_end_time": "2022-11-22T08:43:00", "session_type": null, diff --git a/examples/exaspim_acquisition.py b/examples/exaspim_acquisition.py index 9cae3df9c..fe149ce78 100644 --- a/examples/exaspim_acquisition.py +++ b/examples/exaspim_acquisition.py @@ -2,7 +2,10 @@ import datetime +from aind_data_schema.device import Calibration, Maintenance from aind_data_schema.imaging import acquisition, tile +from aind_data_schema.procedures import Reagent +from aind_data_schema.utils.units import PowerValue t = datetime.datetime(2022, 11, 22, 8, 43, 00) @@ -11,6 +14,25 @@ specimen_id="###", subject_id="###", instrument_id="###", + maintenance=[ + Maintenance( + date_of_maintenance=t, + device_name="Chamber", + description="Clean chamber", + reagents=[ + Reagent(name="reagent1", source="xxx", rrid="xxx", lot_number="xxx", expiration_date=t), + ] + ) + ], + calibrations=[ + Calibration( + date_of_calibration=t, + device_name="Laser_1", + description="Laser power calibration", + input={"power_setting": PowerValue(value=100.0, unit="percent")}, + output={"power_measurement": PowerValue(value=50.0, unit="milliwatt")}, + ) + ], session_start_time=t, session_end_time=t, local_storage_directory="D:", diff --git a/examples/exaspim_instrument.json b/examples/exaspim_instrument.json index a60b83ee4..6a9290bf2 100644 --- a/examples/exaspim_instrument.json +++ b/examples/exaspim_instrument.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/imaging/instrument.py", - "schema_version": "0.7.6", + "schema_version": "0.7.7", "instrument_id": "exaSPIM1-1", "instrument_type": "exaSPIM", "manufacturer": { diff --git a/examples/exaspim_instrument.py b/examples/exaspim_instrument.py index a1d0b1c44..0e2a25caa 100644 --- a/examples/exaspim_instrument.py +++ b/examples/exaspim_instrument.py @@ -86,12 +86,42 @@ name="Dev2", serial_number="Unknown", channels=[ - DAQChannel(channel_name="3", channel_type="Analog Output", device_name="LAS-08308", sample_rate=10000), - DAQChannel(channel_name="5", channel_type="Analog Output", device_name="539251", sample_rate=10000), - DAQChannel(channel_name="4", channel_type="Analog Output", device_name="LAS-08309", sample_rate=10000), - DAQChannel(channel_name="2", channel_type="Analog Output", device_name="stage-x", sample_rate=10000), - DAQChannel(channel_name="0", channel_type="Analog Output", device_name="TL-1", sample_rate=10000), - DAQChannel(channel_name="6", channel_type="Analog Output", device_name="LAS-08307", sample_rate=10000), + DAQChannel( + channel_name="3", + channel_type="Analog Output", + device_name="LAS-08308", + sample_rate=10000, + ), + DAQChannel( + channel_name="5", + channel_type="Analog Output", + device_name="539251", + sample_rate=10000, + ), + DAQChannel( + channel_name="4", + channel_type="Analog Output", + device_name="LAS-08309", + sample_rate=10000, + ), + DAQChannel( + channel_name="2", + channel_type="Analog Output", + device_name="stage-x", + sample_rate=10000, + ), + DAQChannel( + channel_name="0", + channel_type="Analog Output", + device_name="TL-1", + sample_rate=10000, + ), + DAQChannel( + channel_name="6", + channel_type="Analog Output", + device_name="LAS-08307", + sample_rate=10000, + ), ], ) ], diff --git a/examples/fip_ophys_rig.json b/examples/fip_ophys_rig.json index 3a458a09a..848739a25 100644 --- a/examples/fip_ophys_rig.json +++ b/examples/fip_ophys_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/ophys/ophys_rig.py", - "schema_version": "0.6.6", + "schema_version": "0.6.7", "rig_id": "428_FIP1_2", "temperature_control": null, "humidity_control": null, diff --git a/examples/fip_ophys_rig.py b/examples/fip_ophys_rig.py index d5556e574..49fb5f27d 100644 --- a/examples/fip_ophys_rig.py +++ b/examples/fip_ophys_rig.py @@ -69,9 +69,24 @@ ) ], light_sources=[ - d.LightEmittingDiode(name="470nm LED", manufacturer=d.Manufacturer.THORLABS, model="M470F3", wavelength=470), - d.LightEmittingDiode(name="415nm LED", manufacturer=d.Manufacturer.THORLABS, model="M415F3", wavelength=415), - d.LightEmittingDiode(name="565nm LED", manufacturer=d.Manufacturer.THORLABS, model="M565F3", wavelength=415), + d.LightEmittingDiode( + name="470nm LED", + manufacturer=d.Manufacturer.THORLABS, + model="M470F3", + wavelength=470, + ), + d.LightEmittingDiode( + name="415nm LED", + manufacturer=d.Manufacturer.THORLABS, + model="M415F3", + wavelength=415, + ), + d.LightEmittingDiode( + name="565nm LED", + manufacturer=d.Manufacturer.THORLABS, + model="M565F3", + wavelength=415, + ), ], detectors=[ ophr.Detector( diff --git a/examples/ophys_session.json b/examples/ophys_session.json index 7584bd8f7..e523534a2 100644 --- a/examples/ophys_session.json +++ b/examples/ophys_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/ophys/ophys_session.py", - "schema_version": "0.2.5", + "schema_version": "0.2.6", "experimenter_full_name": [ "John Doe" ], diff --git a/examples/smartspim_power_calibrations.json b/examples/smartspim_power_calibrations.json new file mode 100644 index 000000000..bf4c1c2b9 --- /dev/null +++ b/examples/smartspim_power_calibrations.json @@ -0,0 +1,44 @@ +[ + { + "date_of_calibration": "2023-06-20T14:04:05.770680", + "light_source": { + "name": null, + "serial_number": "VL01222A11", + "manufacturer": "Vortran", + "model": "Stradus", + "notes": "All lasers controlled via Vortran VersaLase System", + "type": "laser", + "coupling": "Single-mode fiber", + "wavelength": 488.0, + "wavelength_unit": "nanometer", + "max_power": 150.0, + "power_unit": "milliwatt" + }, + "illumination_index": 1, + "power_setting": 100.0, + "power_setting_unit": "percent", + "power_measurement": 75.0, + "power_measurement_unit": "mW" + }, + { + "date_of_calibration": "2023-06-20T14:04:08.922669", + "light_source": { + "name": null, + "serial_number": "VL01222A11", + "manufacturer": "Vortran", + "model": "Stradus", + "notes": "All lasers controlled via Vortran VersaLase System", + "type": "laser", + "coupling": "Single-mode fiber", + "wavelength": 488.0, + "wavelength_unit": "nanometer", + "max_power": 150.0, + "power_unit": "milliwatt" + }, + "illumination_index": 0, + "power_setting": 100.0, + "power_setting_unit": "percent", + "power_measurement": 75.0, + "power_measurement_unit": "mW" + } + ] \ No newline at end of file diff --git a/src/aind_data_schema/base.py b/src/aind_data_schema/base.py index a2f1fe31b..f257d928f 100644 --- a/src/aind_data_schema/base.py +++ b/src/aind_data_schema/base.py @@ -93,7 +93,11 @@ def __init_subclass__(cls, optional_fields=None, **kwargs): value = build_described_by(cls) field = ModelField.infer( - name="describedBy", value=value, annotation=str, class_validators=None, config=cls.__config__ + name="describedBy", + value=value, + annotation=str, + class_validators=None, + config=cls.__config__, ) field.field_info.const = True cls.__fields__.update({"describedBy": field}) diff --git a/src/aind_data_schema/behavior/behavior_rig.py b/src/aind_data_schema/behavior/behavior_rig.py index f8cffd83c..dc20b75c8 100644 --- a/src/aind_data_schema/behavior/behavior_rig.py +++ b/src/aind_data_schema/behavior/behavior_rig.py @@ -7,17 +7,28 @@ from pydantic import Field from aind_data_schema.base import AindCoreModel -from aind_data_schema.device import CameraAssembly, DAQDevice, Device, Disc, HarpDevice, Monitor, Treadmill, Tube +from aind_data_schema.device import ( + Calibration, + CameraAssembly, + DAQDevice, + Device, + Disc, + HarpDevice, + Monitor, + Treadmill, + Tube +) class BehaviorRig(AindCoreModel): """Description of an behavior rig""" - schema_version: str = Field("0.1.6", description="schema version", title="Version", const=True) + schema_version: str = Field("0.1.7", description="schema version", title="Version", const=True) rig_id: str = Field(..., description="room_stim apparatus_version", title="Rig ID") cameras: Optional[List[CameraAssembly]] = Field(None, title="Camera assemblies", unique_items=True) visual_monitors: Optional[List[Monitor]] = Field(None, title="Visual monitors", unique_items=True) mouse_platform: Optional[Union[Tube, Treadmill, Disc]] = Field(None, title="Mouse platform") daqs: Optional[List[Union[HarpDevice, DAQDevice]]] = Field(None, title="Data acquisition devices") additional_devices: Optional[List[Device]] = Field(None, title="Additional devices", unique_items=True) + calibrations: Optional[List[Calibration]] = Field(None, title="Calibrations", unique_items=True) notes: Optional[str] = Field(None, title="Notes") diff --git a/src/aind_data_schema/behavior/behavior_session.py b/src/aind_data_schema/behavior/behavior_session.py index 2cd0805ac..730d9b80d 100644 --- a/src/aind_data_schema/behavior/behavior_session.py +++ b/src/aind_data_schema/behavior/behavior_session.py @@ -4,19 +4,20 @@ from datetime import datetime from decimal import Decimal -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, List from pydantic import Field from aind_data_schema.base import AindCoreModel from aind_data_schema.utils.units import MassUnit, VolumeUnit +from aind_data_schema.device import Calibration, Maintenance class BehaviorSession(AindCoreModel): """Description of a behavior session""" schema_version: str = Field( - "0.0.3", + "0.0.4", description="Schema version", title="Schema Version", const=True, @@ -29,6 +30,16 @@ class BehaviorSession(AindCoreModel): session_start_time: datetime = Field(..., title="Session start time") session_end_time: datetime = Field(..., title="Session end time") rig_id: str = Field(..., title="Rig ID") + calibrations: Optional[List[Calibration]] = Field( + None, + title="Calibrations", + description="Calibrations of rig devices prior to session" + ) + maintenance: Optional[List[Maintenance]] = Field( + None, + title="Maintenance", + description="Maintenance of rig devices prior to session" + ) subject_id: int = Field(..., title="Subject ID") animal_weight_prior: Optional[Decimal] = Field( None, @@ -46,14 +57,18 @@ class BehaviorSession(AindCoreModel): behavior_type: str = Field(..., title="Behavior type", description="Name of the behavior session") session_number: int = Field(..., title="Session number") behavior_code: str = Field( - ..., title="Behavior code", description="URL for the commit of the code used to run the behavior" + ..., + title="Behavior code", + description="URL for the commit of the code used to run the behavior", ) code_version: str = Field(..., description="Version of the software used", title="Code version") input_parameters: Dict[str, Any] = Field( ..., title="Input parameters", description="Parameters used in behavior session" ) output_parameters: Dict[str, Any] = Field( - ..., title="Performance parameters", description="Performance metrics from session" + ..., + title="Performance parameters", + description="Performance metrics from session", ) water_consumed_during_training: Decimal = Field(..., title="Water consumed during training (uL)") water_consumed_total: Decimal = Field(..., title="Total water consumed (uL)") diff --git a/src/aind_data_schema/data_description.py b/src/aind_data_schema/data_description.py index 32186d31d..e2f59f2e5 100755 --- a/src/aind_data_schema/data_description.py +++ b/src/aind_data_schema/data_description.py @@ -108,18 +108,30 @@ class Modality(Enum, metaclass=BaseNameEnumMeta): BEHAVIOR_VIDEOS = BaseName(name="Behavior videos", abbreviation="behavior-videos") CONFOCAL = BaseName(name="Confocal microscopy", abbreviation="confocal") - DISPIM = BaseName(name="Dual inverted selective plane illumination microscopy", abbreviation="diSPIM") + DISPIM = BaseName( + name="Dual inverted selective plane illumination microscopy", + abbreviation="diSPIM", + ) ECEPHYS = BaseName(name="Extracellular electrophysiology", abbreviation="ecephys") EPHYS = BaseName(name="Electrophysiology", abbreviation="ephys") - EXASPIM = BaseName(name="Expansion-assisted selective plane illumination microscopy", abbreviation="exaSPIM") + EXASPIM = BaseName( + name="Expansion-assisted selective plane illumination microscopy", + abbreviation="exaSPIM", + ) FIP = BaseName(name="Frame-projected independent-fiber photometry", abbreviation="FIP") FMOST = BaseName(name="Fluorescence micro-optical sectioning tomography", abbreviation="fMOST") HSFP = BaseName(name="Hyperspectral fiber photometry", abbreviation="HSFP") ICEPHYS = BaseName(name="Intracellular electrophysiology", abbreviation="icephys") FIB = BaseName(name="Fiber photometry", abbreviation="fib") FISH = BaseName(name="Fluorescence in situ hybridization", abbreviation="fish") - MESOSPIM = BaseName(name="Mesoscale selective plane illumination microscopy", abbreviation="mesoSPIM") - MERFISH = BaseName(name="Multiplexed error-robust fluorescence in situ hybridization", abbreviation="merfish") + MESOSPIM = BaseName( + name="Mesoscale selective plane illumination microscopy", + abbreviation="mesoSPIM", + ) + MERFISH = BaseName( + name="Multiplexed error-robust fluorescence in situ hybridization", + abbreviation="merfish", + ) MPOPHYS = BaseName(name="Multiplane optical physiology", abbreviation="multiplane-ophys") MRI = BaseName(name="Magnetic resonance imaging", abbreviation="MRI") OPHYS = BaseName(name="Optical physiology", abbreviation="ophys") diff --git a/src/aind_data_schema/device.py b/src/aind_data_schema/device.py index 7f0a81dea..14b3e4ba2 100644 --- a/src/aind_data_schema/device.py +++ b/src/aind_data_schema/device.py @@ -8,6 +8,7 @@ from pydantic import Field from aind_data_schema.base import AindModel, BaseNameEnumMeta, EnumSubset, PIDName, Registry +from aind_data_schema.procedures import Reagent from aind_data_schema.utils.units import AngleUnit, FrequencyUnit, PowerUnit, SizeUnit @@ -260,6 +261,28 @@ class Software(AindModel): parameters: Optional[dict] = Field(None, title="Software parameters", additionalProperties={"type": "string"}) +class Calibration(AindModel): + """Generic calibration class""" + + date_of_calibration: datetime = Field(..., title="Date and time of calibration") + device_name: str = Field(..., title="Device name", description="Must match a device name in rig/instrument") + description: str = Field(..., title="Description", description="Brief decsription of what is being calibrated") + input: Optional[Dict[str, Any]] = Field({}, description="Calibration input", title="inputs") + output: Optional[Dict[str, Any]] = Field({}, description="Calibration output", title="outputs") + notes: Optional[str] = Field(None, title="Notes") + + +class Maintenance(AindModel): + """Generic maintenance class""" + + date_of_maintenance: datetime = Field(..., title="Date and time of maintenance") + device_name: str = Field(..., title="Device name", description="Must match a device name in rig/instrument") + description: str = Field(..., title="Description", description="Description on maintenance procedure") + protocol_id: Optional[str] = Field(None, title="Protocol ID") + reagents: Optional[List[Reagent]] = Field(None, title="Reagents") + notes: Optional[str] = Field(None, title="Notes") + + class MotorizedStage(Device): """Description of motorized stage""" @@ -306,7 +329,10 @@ class Lens(Device): # required fields manufacturer: EnumSubset[ - Manufacturer.COMPUTAR, Manufacturer.EDMUND_OPTICS, Manufacturer.THORLABS, Manufacturer.OTHER + Manufacturer.COMPUTAR, + Manufacturer.EDMUND_OPTICS, + Manufacturer.THORLABS, + Manufacturer.OTHER, ] # optional fields @@ -345,7 +371,9 @@ class Filter(Device): center_wavelength: Optional[int] = Field(None, title="Center wavelength (nm)") wavelength_unit: SizeUnit = Field(SizeUnit.NM, title="Wavelength unit") description: Optional[str] = Field( - None, title="Description", description="More details about filter properties and where/how it is being used" + None, + title="Description", + description="More details about filter properties and where/how it is being used", ) @@ -515,7 +543,9 @@ class Disc(MousePlatform): encoder: Optional[str] = Field(None, title="Encoder", description="Encoder hardware type") decoder: Optional[str] = Field(None, title="Decoder", description="Decoder chip type") encoder_firmware: Optional[Software] = Field( - None, title="Encoder firmware", description="Firmware to read from decoder chip counts" + None, + title="Encoder firmware", + description="Firmware to read from decoder chip counts", ) diff --git a/src/aind_data_schema/ephys/ephys_rig.py b/src/aind_data_schema/ephys/ephys_rig.py index 7cfcce5a9..357118d8b 100644 --- a/src/aind_data_schema/ephys/ephys_rig.py +++ b/src/aind_data_schema/ephys/ephys_rig.py @@ -129,7 +129,7 @@ class EphysAssembly(AindModel): class EphysRig(AindCoreModel): """Description of an ephys rig""" - schema_version: str = Field("0.7.6", description="schema version", title="Version", const=True) + schema_version: str = Field("0.7.7", description="schema version", title="Version", const=True) rig_id: str = Field(..., description="room_stim apparatus_version", title="Rig ID") ephys_assemblies: Optional[List[EphysAssembly]] = Field(None, title="Ephys probes", unique_items=True) stick_microscopes: Optional[List[StickMicroscopeAssembly]] = Field(None, title="Stick microscopes") diff --git a/src/aind_data_schema/ephys/ephys_session.py b/src/aind_data_schema/ephys/ephys_session.py index 4e63afaa6..a08c47fa2 100644 --- a/src/aind_data_schema/ephys/ephys_session.py +++ b/src/aind_data_schema/ephys/ephys_session.py @@ -51,7 +51,9 @@ class DomeModule(AindModel): # optional fields rotation_angle: Optional[Decimal] = Field(0.0, title="Rotation Angle", units="degrees") coordinate_transform: Optional[str] = Field( - None, title="Transform from local manipulator axes to rig", description="Path to coordinate transform" + None, + title="Transform from local manipulator axes to rig", + description="Path to coordinate transform", ) calibration_date: Optional[datetime] = Field(None, title="Date on which coordinate transform was last calibrated") notes: Optional[str] = Field(None, title="Notes") @@ -126,7 +128,7 @@ class Stream(AindModel): class EphysSession(AindCoreModel): """Description of an ephys recording session""" - schema_version: str = Field("0.4.7", description="schema version", title="Version", const=True) + schema_version: str = Field("0.4.8", description="schema version", title="Version", const=True) experimenter_full_name: List[str] = Field( ..., description="First and last name of the experimenter(s).", @@ -140,7 +142,9 @@ class EphysSession(AindCoreModel): iacuc_protocol: Optional[str] = Field(None, title="IACUC protocol") rig_id: str = Field(..., title="Rig ID") stick_microscopes: Optional[List[DomeModule]] = Field( - ..., title="Stick microscopes", description="Must match stick microscope assemblies in rig file" + ..., + title="Stick microscopes", + description="Must match stick microscope assemblies in rig file", ) data_streams: List[Stream] = Field( ..., diff --git a/src/aind_data_schema/imaging/acquisition.py b/src/aind_data_schema/imaging/acquisition.py index 051a08adb..e4e81705e 100644 --- a/src/aind_data_schema/imaging/acquisition.py +++ b/src/aind_data_schema/imaging/acquisition.py @@ -10,6 +10,7 @@ from pydantic import Field from aind_data_schema.base import AindCoreModel, AindModel, EnumSubset +from aind_data_schema.device import Calibration, Maintenance from aind_data_schema.imaging.tile import AcquisitionTile from aind_data_schema.processing import ProcessName from aind_data_schema.utils.units import SizeUnit @@ -101,7 +102,7 @@ class ProcessingSteps(AindModel): class Acquisition(AindCoreModel): """Description of an imaging acquisition session""" - schema_version: str = Field("0.4.7", description="schema version", title="Version", const=True) + schema_version: str = Field("0.4.8", description="schema version", title="Version", const=True) experimenter_full_name: List[str] = Field( ..., description="First and last name of the experimenter(s).", @@ -110,6 +111,16 @@ class Acquisition(AindCoreModel): specimen_id: str = Field(..., title="Specimen ID") subject_id: Optional[str] = Field(None, title="Subject ID") instrument_id: str = Field(..., title="Instrument ID") + calibrations: Optional[List[Calibration]] = Field( + None, + title="Calibrations", + description="List of calibration measurements taken prior to acquisition.", + ) + maintenance: Optional[List[Maintenance]] = Field( + None, + title="Maintenance", + description="List of maintenance on rig prior to acquisition." + ) session_start_time: datetime = Field(..., title="Session start time") session_end_time: datetime = Field(..., title="Session end time") session_type: Optional[str] = Field(None, title="Session type") diff --git a/src/aind_data_schema/imaging/instrument.py b/src/aind_data_schema/imaging/instrument.py index 1ac1a4fe2..2a0911109 100644 --- a/src/aind_data_schema/imaging/instrument.py +++ b/src/aind_data_schema/imaging/instrument.py @@ -144,7 +144,7 @@ class OpticalTable(Device): class Instrument(AindCoreModel): """Description of an instrument, which is a collection of devices""" - schema_version: str = Field("0.7.6", description="schema version", title="Version", const=True) + schema_version: str = Field("0.7.7", description="schema version", title="Version", const=True) instrument_id: Optional[str] = Field( None, description="Unique identifier for this instrument. Naming convention: --", diff --git a/src/aind_data_schema/imaging/mri_session.py b/src/aind_data_schema/imaging/mri_session.py index 9a3d30d0e..e1a203bde 100644 --- a/src/aind_data_schema/imaging/mri_session.py +++ b/src/aind_data_schema/imaging/mri_session.py @@ -79,6 +79,8 @@ class MriSession(AindCoreModel): mri_scanner: Scanner = Field(..., title="MRI scanner") axes: List[Axis] = Field(..., title="Imaging axes") voxel_sizes: Scale3dTransform = Field( - ..., title="Voxel sizes", description="Size of voxels in order as specified in axes" + ..., + title="Voxel sizes", + description="Size of voxels in order as specified in axes", ) notes: Optional[str] = Field(None, title="Notes") diff --git a/src/aind_data_schema/imaging/tile.py b/src/aind_data_schema/imaging/tile.py index b87bbb6bd..895b97012 100644 --- a/src/aind_data_schema/imaging/tile.py +++ b/src/aind_data_schema/imaging/tile.py @@ -63,7 +63,12 @@ class Tile(AindModel): """Description of an image tile""" coordinate_transformations: List[ - Union[Scale3dTransform, Translation3dTransform, Rotation3dTransform, Affine3dTransform] + Union[ + Scale3dTransform, + Translation3dTransform, + Rotation3dTransform, + Affine3dTransform, + ] ] = Field(..., title="Tile coordinate transformations") file_name: Optional[str] = Field(None, title="File name") diff --git a/src/aind_data_schema/ophys/ophys_rig.py b/src/aind_data_schema/ophys/ophys_rig.py index 89a2ddcfc..abf010150 100644 --- a/src/aind_data_schema/ophys/ophys_rig.py +++ b/src/aind_data_schema/ophys/ophys_rig.py @@ -86,7 +86,7 @@ class OphysRig(AindCoreModel): """Description of an optical physiology rig""" schema_version: str = Field( - "0.6.6", + "0.6.7", description="schema version", title="Schema Version", const=True, diff --git a/src/aind_data_schema/ophys/ophys_session.py b/src/aind_data_schema/ophys/ophys_session.py index ff3f14418..ab8c37768 100644 --- a/src/aind_data_schema/ophys/ophys_session.py +++ b/src/aind_data_schema/ophys/ophys_session.py @@ -103,7 +103,7 @@ class OphysSession(AindCoreModel): """Description of an ophys session""" schema_version: str = Field( - "0.2.5", + "0.2.6", description="schema version", title="Schema Version", const=True, diff --git a/src/aind_data_schema/procedures.py b/src/aind_data_schema/procedures.py index 6d0002b21..6eb7c3b3b 100644 --- a/src/aind_data_schema/procedures.py +++ b/src/aind_data_schema/procedures.py @@ -231,7 +231,10 @@ class Craniotomy(SubjectProcedure): None, title="Craniotomy coordinate reference" ) bregma_to_lambda_distance: Optional[Decimal] = Field( - None, title="Bregma to lambda (mm)", description="Distance between bregman and lambda", units="mm" + None, + title="Bregma to lambda (mm)", + description="Distance between bregman and lambda", + units="mm", ) bregma_to_lambda_unit: SizeUnit = Field(SizeUnit.MM, title="Bregma to lambda unit") craniotomy_size: Decimal = Field(..., title="Craniotomy size (mm)", units="mm") @@ -334,7 +337,10 @@ class BrainInjection(Injection): None, title="Injection coordinate reference" ) bregma_to_lambda_distance: Optional[Decimal] = Field( - None, title="Bregma to lambda (mm)", description="Distance between bregman and lambda", units="mm" + None, + title="Bregma to lambda (mm)", + description="Distance between bregman and lambda", + units="mm", ) bregma_to_lambda_unit: SizeUnit = Field(SizeUnit.MM, title="Bregma to lambda unit") injection_angle: Decimal = Field(..., title="Injection angle (deg)", units="deg") @@ -349,7 +355,10 @@ class NanojectInjection(BrainInjection): procedure_type: str = Field("Nanoject injection", title="Procedure type", const=True) injection_volume: List[Decimal] = Field( - ..., title="Injection volume (nL)", units="nL", description="Injection volume, one value per location" + ..., + title="Injection volume (nL)", + units="nL", + description="Injection volume, one value per location", ) injection_volume_unit: VolumeUnit = Field(VolumeUnit.NL, title="Injection volume unit") @@ -368,7 +377,10 @@ class IntraCerebellarVentricleInjection(BrainInjection): procedure_type: str = Field("ICV injection", title="Procedure type", const=True) injection_volume: List[Decimal] = Field( - ..., title="Injection volume (nL)", units="nL", description="Injection volume, one value per location" + ..., + title="Injection volume (nL)", + units="nL", + description="Injection volume, one value per location", ) injection_volume_unit: VolumeUnit = Field(VolumeUnit.NL, title="Injection volume unit") @@ -378,7 +390,10 @@ class IntraCisternalMagnaInjection(BrainInjection): procedure_type: str = Field("ICM injection", title="Procedure type", const=True) injection_volume: List[Decimal] = Field( - ..., title="Injection volume (nL)", units="nL", description="Injection volume, one value per location" + ..., + title="Injection volume (nL)", + units="nL", + description="Injection volume, one value per location", ) injection_volume_unit: VolumeUnit = Field(VolumeUnit.NL, title="Injection volume unit") @@ -429,7 +444,10 @@ class OphysProbe(AindModel): None, title="Stereotactic coordinate reference" ) bregma_to_lambda_distance: Optional[Decimal] = Field( - None, title="Bregma to lambda (mm)", description="Distance between bregman and lambda", units="mm" + None, + title="Bregma to lambda (mm)", + description="Distance between bregman and lambda", + units="mm", ) bregma_to_lambda_unit: SizeUnit = Field(SizeUnit.MM, title="Bregma to lambda unit") angle: Decimal = Field(..., title="Angle (deg)", units="deg") diff --git a/src/aind_data_schema/processing.py b/src/aind_data_schema/processing.py index a55ec3c49..3f168ccb4 100644 --- a/src/aind_data_schema/processing.py +++ b/src/aind_data_schema/processing.py @@ -75,9 +75,13 @@ class Registration(DataProcess): """Description of tile alignment coordinate transformations""" registration_type: RegistrationType = Field( - ..., title="Registration type", description="Either inter channel across different channels or intra channel" + ..., + title="Registration type", + description="Either inter channel across different channels or intra channel", ) registration_channel: Optional[int] = Field( - None, title="Registration channel", description="Channel registered to when inter channel" + None, + title="Registration channel", + description="Channel registered to when inter channel", ) tiles: List[Tile] = Field(..., title="Data tiles") diff --git a/src/aind_data_schema/stimulus.py b/src/aind_data_schema/stimulus.py index 59171b638..1de0e5002 100644 --- a/src/aind_data_schema/stimulus.py +++ b/src/aind_data_schema/stimulus.py @@ -39,7 +39,9 @@ class OptoStim(AindModel): ) pulse_train_interval_unit: TimeUnit = Field(TimeUnit.S, title="Pulse train interval unit") baseline_duration: Decimal = Field( - ..., title="Baseline duration (s)", description="Duration of baseline recording prior to first pulse train" + ..., + title="Baseline duration (s)", + description="Duration of baseline recording prior to first pulse train", ) baseline_duration_unit: TimeUnit = Field(TimeUnit.S, title="Baseline duration unit") other_parameters: Optional[Dict[str, Any]] @@ -56,7 +58,9 @@ class VisualStim(AindModel): description="Define and list the parameter values used (e.g. all TF or orientation values)", ) stimulus_template_name: Optional[List[str]] = Field( - None, title="Stimulus template name", description="Name of image set or movie displayed" + None, + title="Stimulus template name", + description="Name of image set or movie displayed", ) stimulus_software: str = Field( ..., diff --git a/src/aind_data_schema/utils/erd_generator.py b/src/aind_data_schema/utils/erd_generator.py index 2d5037a20..a94683312 100644 --- a/src/aind_data_schema/utils/erd_generator.py +++ b/src/aind_data_schema/utils/erd_generator.py @@ -63,7 +63,8 @@ def from_args(cls, args: list): ) optional_args = parser.parse_args(args) return cls( - classes_to_generate=optional_args.classes_to_generate, output_directory=Path(optional_args.output_directory) + classes_to_generate=optional_args.classes_to_generate, + output_directory=Path(optional_args.output_directory), ) def generate_erd_diagrams(self) -> None: diff --git a/src/aind_data_schema/utils/json_writer.py b/src/aind_data_schema/utils/json_writer.py index 4452a4bb0..49a6d2045 100644 --- a/src/aind_data_schema/utils/json_writer.py +++ b/src/aind_data_schema/utils/json_writer.py @@ -36,7 +36,9 @@ def _parse_arguments(self, args: list) -> argparse.Namespace: ) parser.add_argument( - "--attach-version", action="store_true", help="Add extra directory with schema version number" + "--attach-version", + action="store_true", + help="Add extra directory with schema version number", ) parser.set_defaults(attach_version=False) diff --git a/src/aind_data_schema/utils/schema_version_check.py b/src/aind_data_schema/utils/schema_version_check.py index 610b83790..2e809aae4 100644 --- a/src/aind_data_schema/utils/schema_version_check.py +++ b/src/aind_data_schema/utils/schema_version_check.py @@ -46,7 +46,10 @@ def compare_versions(new_ver: str, old_ver: Optional[str]) -> (bool, Optional[st if major_bump or minor_bump or patch_bump: return (True, None) else: - return (False, f"Version not bumped correctly. New Version: {new_ver}. Old Version: {old_ver}") + return ( + False, + f"Version not bumped correctly. New Version: {new_ver}. Old Version: {old_ver}", + ) def run_job(new_schema_folder: str, old_schema_folder: str) -> None: @@ -86,7 +89,7 @@ def open_json_file(path): old_schema_version_dict = old_model["properties"].get("schema_version") old_schema_version = ( None - if old_schema_version_dict is None or type(old_schema_version_dict) is not dict + if old_schema_version_dict is None or not isinstance(old_schema_version_dict, dict) else old_schema_version_dict.get("const") ) v_check = compare_versions(new_schema_version, old_schema_version) @@ -112,4 +115,7 @@ def open_json_file(path): required=True, ) folder_args = parser.parse_args(sys_args) - run_job(new_schema_folder=folder_args.new_schema_folder, old_schema_folder=folder_args.old_schema_folder) + run_job( + new_schema_folder=folder_args.new_schema_folder, + old_schema_folder=folder_args.old_schema_folder, + ) diff --git a/src/aind_data_schema/utils/units.py b/src/aind_data_schema/utils/units.py index 8aac7ad09..183516e75 100644 --- a/src/aind_data_schema/utils/units.py +++ b/src/aind_data_schema/utils/units.py @@ -64,10 +64,11 @@ class TimeUnit(Enum): class PowerUnit(Enum): - """Power units""" + """Unit for power, set or measured""" UW = "microwatt" MW = "milliwatt" + PERCENT = "percent" class CurrentUnit(Enum): @@ -97,3 +98,4 @@ def create_unit_with_value(model_name, scalar_type, unit_type, unit_default): FrequencyValue = create_unit_with_value("FrequencyValue", Decimal, FrequencyUnit, FrequencyUnit.HZ) AngleValue = create_unit_with_value("AngleValue", Decimal, AngleUnit, AngleUnit.DEG) TimeValue = create_unit_with_value("TimeValue", Decimal, TimeUnit, TimeUnit.S) +PowerValue = create_unit_with_value("PowerValue", Decimal, PowerUnit, PowerUnit.MW) diff --git a/tests/test_check_schema_versions.py b/tests/test_check_schema_versions.py index 609ed3104..ff7a97458 100644 --- a/tests/test_check_schema_versions.py +++ b/tests/test_check_schema_versions.py @@ -33,27 +33,45 @@ def test_compare_versions(self): # False checks self.assertEqual( - (False, "Version not bumped correctly. New Version: 0.0.1. Old Version: 0.0.2"), + ( + False, + "Version not bumped correctly. New Version: 0.0.1. Old Version: 0.0.2", + ), compare_versions("0.0.1", "0.0.2"), ) self.assertEqual( - (False, "Version not bumped correctly. New Version: 0.3.2. Old Version: 0.2.1"), + ( + False, + "Version not bumped correctly. New Version: 0.3.2. Old Version: 0.2.1", + ), compare_versions("0.3.2", "0.2.1"), ) self.assertEqual( - (False, "Version not bumped correctly. New Version: 2.0.1. Old Version: 1.2.3"), + ( + False, + "Version not bumped correctly. New Version: 2.0.1. Old Version: 1.2.3", + ), compare_versions("2.0.1", "1.2.3"), ) self.assertEqual( - (False, "Version not bumped correctly. New Version: 0.0.1. Old Version: 0.0.3"), + ( + False, + "Version not bumped correctly. New Version: 0.0.1. Old Version: 0.0.3", + ), compare_versions("0.0.1", "0.0.3"), ) self.assertEqual( - (False, "Version not bumped correctly. New Version: 0.1.1. Old Version: 0.2.1"), + ( + False, + "Version not bumped correctly. New Version: 0.1.1. Old Version: 0.2.1", + ), compare_versions("0.1.1", "0.2.1"), ) self.assertEqual( - (False, "Version not bumped correctly. New Version: 1.0.2. Old Version: 2.1.4"), + ( + False, + "Version not bumped correctly. New Version: 1.0.2. Old Version: 2.1.4", + ), compare_versions("1.0.2", "2.1.4"), ) self.assertEqual((False, "Malformed version: 1.0"), compare_versions("1.0", "2.1.4")) @@ -62,7 +80,12 @@ def test_compare_versions(self): def test_run_job(self): """Tests the run_job method.""" # Should run without any errors - self.assertIsNone(run_job(new_schema_folder=str(NEW_SCHEMA_DIR), old_schema_folder=str(OLD_SCHEMA_DIR))) + self.assertIsNone( + run_job( + new_schema_folder=str(NEW_SCHEMA_DIR), + old_schema_folder=str(OLD_SCHEMA_DIR), + ) + ) # Should raise an assertion expected_error_message = ( @@ -72,7 +95,10 @@ def test_run_job(self): "New Version: 0.2.2. Old Version: 0.2.2']" ) with self.assertRaises(AssertionError) as error: - run_job(new_schema_folder=str(NEW_SCHEMA_DIR2), old_schema_folder=str(OLD_SCHEMA_DIR)) + run_job( + new_schema_folder=str(NEW_SCHEMA_DIR2), + old_schema_folder=str(OLD_SCHEMA_DIR), + ) self.assertEqual(str(error.exception), expected_error_message) diff --git a/tests/test_data_description.py b/tests/test_data_description.py index eb8d3114a..bb2f008da 100644 --- a/tests/test_data_description.py +++ b/tests/test_data_description.py @@ -211,7 +211,9 @@ def test_from_data_description(self): # Test Override derived_dd_0_6_2_wrong_field2 = DerivedDataDescription.from_data_description( - new_dd_0_6_2_wrong_field, process_name=process_name, experiment_type=ExperimentType.OTHER + new_dd_0_6_2_wrong_field, + process_name=process_name, + experiment_type=ExperimentType.OTHER, ) self.assertEqual(ExperimentType.OTHER, derived_dd_0_6_2_wrong_field2.experiment_type) diff --git a/tests/test_ephys.py b/tests/test_ephys.py index 185de56ff..ffc2eac32 100644 --- a/tests/test_ephys.py +++ b/tests/test_ephys.py @@ -31,10 +31,26 @@ def test_constructors(self): ports=[], computer_name="foo", channels=[ - DAQChannel(channel_name="123", device_name="Laser A", channel_type="Analog Output"), - DAQChannel(channel_name="321", device_name="Probe A", channel_type="Analog Output"), - DAQChannel(channel_name="234", device_name="Camera A", channel_type="Digital Output"), - DAQChannel(channel_name="2354", device_name="Disc A", channel_type="Digital Output"), + DAQChannel( + channel_name="123", + device_name="Laser A", + channel_type="Analog Output", + ), + DAQChannel( + channel_name="321", + device_name="Probe A", + channel_type="Analog Output", + ), + DAQChannel( + channel_name="234", + device_name="Camera A", + channel_type="Digital Output", + ), + DAQChannel( + channel_name="2354", + device_name="Disc A", + channel_type="Digital Output", + ), ], ) ] @@ -76,7 +92,11 @@ def test_constructors(self): with self.assertRaises(pydantic.ValidationError): rig = er.EphysRig( daqs=[ - er.HarpDevice(computer_name="asdf", harp_device_type="Sound Board", harp_device_version="1"), + er.HarpDevice( + computer_name="asdf", + harp_device_type="Sound Board", + harp_device_version="1", + ), er.NeuropixelsBasestation( basestation_firmware_version="1", bsc_firmware_version="2", @@ -85,7 +105,11 @@ def test_constructors(self): ports=[er.ProbePort(index=0, probes=["Probe B"])], computer_name="foo", channels=[ - DAQChannel(channel_name="321", device_name="Probe A", channel_type="Analog Output"), + DAQChannel( + channel_name="321", + device_name="Probe A", + channel_type="Analog Output", + ), ], ), ], diff --git a/tests/test_imaging.py b/tests/test_imaging.py index 8bb21b0e9..e51a20534 100644 --- a/tests/test_imaging.py +++ b/tests/test_imaging.py @@ -5,12 +5,13 @@ from pydantic import ValidationError -from aind_data_schema.device import Manufacturer +from aind_data_schema.device import Calibration, Manufacturer from aind_data_schema.imaging import acquisition as acq from aind_data_schema.imaging import instrument as inst from aind_data_schema.imaging import mri_session as ms from aind_data_schema.imaging import tile from aind_data_schema.processing import Registration +from aind_data_schema.utils.units import PowerValue class ImagingTests(unittest.TestCase): @@ -27,6 +28,15 @@ def test_constructors(self): specimen_id="12345", subject_id="1234", instrument_id="1234", + calibrations=[ + Calibration( + date_of_calibration=datetime.datetime.now(), + description="Laser power calibration", + device_name="Laser 1", + input={"power_setting": PowerValue(value=100.0, unit="percent")}, + output={"power_measurement": PowerValue(value=50.0, unit="milliwatt")}, + ), + ], session_end_time=datetime.datetime.now(), chamber_immersion=acq.Immersion(medium="PBS", refractive_index=1), tiles=[ diff --git a/tests/test_schema_upgrade.py b/tests/test_schema_upgrade.py index 1417b5ef1..748a5f9ba 100644 --- a/tests/test_schema_upgrade.py +++ b/tests/test_schema_upgrade.py @@ -256,7 +256,10 @@ def test_funding_upgrade(self): "funder": { "name": "Allen Institute for Neural Dynamics", "abbreviation": "AIND", - "registry": {"name": "Research Organization Registry", "abbreviation": "ROR"}, + "registry": { + "name": "Research Organization Registry", + "abbreviation": "ROR", + }, "registry_identifier": "04szwah67", }, "grant_number": None,