diff --git a/pyproject.toml b/pyproject.toml index f6a80f43..5ff9c2bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ readme = "README.md" dynamic = ["version"] dependencies = [ - "aind-data-schema==0.36.0", + "aind-data-schema==0.38.0", "aind-data-schema-models==0.1.7", "pydantic-settings>=2.0", "pandas", diff --git a/src/aind_metadata_mapper/bergamo/session.py b/src/aind_metadata_mapper/bergamo/session.py index 4aea2313..3fbb5c88 100644 --- a/src/aind_metadata_mapper/bergamo/session.py +++ b/src/aind_metadata_mapper/bergamo/session.py @@ -1,4 +1,5 @@ """Module to map bergamo metadata into a session model.""" + import argparse import bisect import json @@ -1154,7 +1155,7 @@ def run_job(self) -> JobResponse: # noqa: C901 stimulus_parameters=[photostim], # opticalBCI class to be added in future stimulus_device_names=self.job_settings.stimulus_device_names, - light_source_config=LaserConfig( + light_source_config=[LaserConfig( # from rig json name=self.job_settings.photostim_laser_name, wavelength=self.job_settings.photostim_laser_wavelength, @@ -1162,7 +1163,7 @@ def run_job(self) -> JobResponse: # noqa: C901 excitation_power=np.nanmean(group_powers), # from tiff header, excitation_power_unit=PowerUnit.PERCENT, - ), + )], output_parameters={ "tiff_files": tiff_list, "tiff_stem": tiff_stem, diff --git a/src/aind_metadata_mapper/open_ephys/utils/behavior_utils.py b/src/aind_metadata_mapper/open_ephys/utils/behavior_utils.py index a58e366e..49a08295 100644 --- a/src/aind_metadata_mapper/open_ephys/utils/behavior_utils.py +++ b/src/aind_metadata_mapper/open_ephys/utils/behavior_utils.py @@ -730,9 +730,9 @@ def fix_omitted_end_frame(stim_pres_table: pd.DataFrame) -> pd.DataFrame: stim_pres_table[stim_pres_table["omitted"]]["start_frame"] + median_stim_frame_duration ) - stim_pres_table.loc[ - stim_pres_table["omitted"], "end_frame" - ] = omitted_end_frames + stim_pres_table.loc[stim_pres_table["omitted"], "end_frame"] = ( + omitted_end_frames + ) stim_dtypes = stim_pres_table.dtypes.to_dict() stim_dtypes["start_frame"] = int @@ -796,9 +796,9 @@ def compute_is_sham_change( if np.array_equal( active_images, stim_image_names[passive_block_mask].values ): - stim_df.loc[ - passive_block_mask, "is_sham_change" - ] = stim_df[active_block_mask]["is_sham_change"].values + stim_df.loc[passive_block_mask, "is_sham_change"] = ( + stim_df[active_block_mask]["is_sham_change"].values + ) return stim_df.sort_index() diff --git a/src/aind_metadata_mapper/open_ephys/utils/constants.py b/src/aind_metadata_mapper/open_ephys/utils/constants.py index 1cda2fb4..aafdab8b 100644 --- a/src/aind_metadata_mapper/open_ephys/utils/constants.py +++ b/src/aind_metadata_mapper/open_ephys/utils/constants.py @@ -1,4 +1,5 @@ """ Constants for the naming utils of metadata mapper """ + import re INT_NULL = -99 diff --git a/tests/resources/bergamo/expected_session.json b/tests/resources/bergamo/expected_session.json index b25689a1..2379fa72 100644 --- a/tests/resources/bergamo/expected_session.json +++ b/tests/resources/bergamo/expected_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py", - "schema_version": "0.2.6", + "schema_version": "0.3.1", "protocol_id": [], "experimenter_full_name": [ "John Apple" diff --git a/tests/resources/bruker/expected_session.json b/tests/resources/bruker/expected_session.json index 76e3f7e4..cf928137 100644 --- a/tests/resources/bruker/expected_session.json +++ b/tests/resources/bruker/expected_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py", - "schema_version": "0.2.6", + "schema_version": "0.3.1", "protocol_id": [ "" ], diff --git a/tests/resources/dynamic_routing/base-missing-probe_rig.json b/tests/resources/dynamic_routing/base-missing-probe_rig.json index e7d01d3d..d0a27476 100644 --- a/tests/resources/dynamic_routing/base-missing-probe_rig.json +++ b/tests/resources/dynamic_routing/base-missing-probe_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,7 +233,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -375,7 +374,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -514,7 +512,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -1007,7 +1004,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/dynamic_routing/base_rig.json b/tests/resources/dynamic_routing/base_rig.json index 937040f4..5dc47b35 100644 --- a/tests/resources/dynamic_routing/base_rig.json +++ b/tests/resources/dynamic_routing/base_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,7 +233,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -375,7 +374,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -514,7 +512,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -1050,7 +1047,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/dynamic_routing/mvr_rig.json b/tests/resources/dynamic_routing/mvr_rig.json index 421f7870..437fd979 100644 --- a/tests/resources/dynamic_routing/mvr_rig.json +++ b/tests/resources/dynamic_routing/mvr_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,8 +233,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -380,7 +379,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -524,8 +522,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -1065,7 +1062,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/dynamic_routing/sync_rig.json b/tests/resources/dynamic_routing/sync_rig.json index eb2f5ec9..9d4bc6d7 100644 --- a/tests/resources/dynamic_routing/sync_rig.json +++ b/tests/resources/dynamic_routing/sync_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,7 +233,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -375,7 +374,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -514,7 +512,6 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", @@ -1050,7 +1047,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/fip/000000_ophys_session.json b/tests/resources/fip/000000_ophys_session.json index 6f055fa1..1f0c29b9 100644 --- a/tests/resources/fip/000000_ophys_session.json +++ b/tests/resources/fip/000000_ophys_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py", - "schema_version": "0.2.6", + "schema_version": "0.3.1", "protocol_id": [], "experimenter_full_name": [ "Don Key" diff --git a/tests/resources/gather_metadata_job/metadata_files/instrument.json b/tests/resources/gather_metadata_job/metadata_files/instrument.json index b8e0f745..2b377392 100644 --- a/tests/resources/gather_metadata_job/metadata_files/instrument.json +++ b/tests/resources/gather_metadata_job/metadata_files/instrument.json @@ -80,7 +80,7 @@ "data_interface": "Coax", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/mesoscope/expected_session.json b/tests/resources/mesoscope/expected_session.json index d1a40ce4..a8839afc 100644 --- a/tests/resources/mesoscope/expected_session.json +++ b/tests/resources/mesoscope/expected_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py", - "schema_version": "0.2.6", + "schema_version": "0.3.1", "protocol_id": [], "experimenter_full_name": [ "John Doe" @@ -8,6 +8,7 @@ "session_start_time": "2024-02-22T15:30:00Z", "session_end_time": "2024-02-22T17:30:00Z", "session_type": "Mesoscope", + "headframe_registration": None, "iacuc_protocol": "12345", "rig_id": "MESO.1", "calibrations": [], diff --git a/tests/resources/open_ephys/ephys_session.json b/tests/resources/open_ephys/ephys_session.json index 6424e19a..3f655c69 100644 --- a/tests/resources/open_ephys/ephys_session.json +++ b/tests/resources/open_ephys/ephys_session.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/session.py", - "schema_version": "0.2.6", + "schema_version": "0.3.1", "protocol_id": [], "experimenter_full_name": [ "Al Dente" diff --git a/tests/resources/open_ephys/open-ephys-inferred_rig.json b/tests/resources/open_ephys/open-ephys-inferred_rig.json index d5978557..0afd1f3d 100644 --- a/tests/resources/open_ephys/open-ephys-inferred_rig.json +++ b/tests/resources/open_ephys/open-ephys-inferred_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,8 +233,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -375,8 +374,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -514,8 +512,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -1050,7 +1047,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/resources/open_ephys/open-ephys_rig.json b/tests/resources/open_ephys/open-ephys_rig.json index 069503d8..13cdef48 100644 --- a/tests/resources/open_ephys/open-ephys_rig.json +++ b/tests/resources/open_ephys/open-ephys_rig.json @@ -1,6 +1,6 @@ { "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema/main/src/aind_data_schema/core/rig.py", - "schema_version": "0.3.8", + "schema_version": "0.5.1", "rig_id": "327_NP2_240401", "modification_date": "2024-04-01", "mouse_platform": { @@ -233,8 +233,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -375,8 +374,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -514,8 +512,7 @@ "data_interface": "Ethernet", "cooling": "None", "computer_name": "127.0.0.1", - "max_frame_rate": "102", - "frame_rate_unit": "hertz", + "frame_rate_unit": "hertz", "immersion": null, "chroma": "Monochrome", "sensor_width": 7400, @@ -1050,7 +1047,7 @@ "data_interface": "Other", "cooling": "Air", "computer_name": null, - "max_frame_rate": null, + "frame_rate_unit": "hertz", "immersion": null, "chroma": null, diff --git a/tests/test_mesoscope/test_session.py b/tests/test_mesoscope/test_session.py index bfe801b3..ef3bd336 100644 --- a/tests/test_mesoscope/test_session.py +++ b/tests/test_mesoscope/test_session.py @@ -177,15 +177,15 @@ def test_transform(self, mock_open, mock_scanimage) -> None: # mock scanimage metadata mock_meta = [{}] - mock_meta[0][ - "SI.hRoiManager.linesPerFrame" - ] = self.example_scanimage_meta["lines_per_frame"] - mock_meta[0][ - "SI.hRoiManager.pixelsPerLine" - ] = self.example_scanimage_meta["pixels_per_line"] - mock_meta[0][ - "SI.hRoiManager.scanZoomFactor" - ] = self.example_scanimage_meta["fov_scale_factor"] + mock_meta[0]["SI.hRoiManager.linesPerFrame"] = ( + self.example_scanimage_meta["lines_per_frame"] + ) + mock_meta[0]["SI.hRoiManager.pixelsPerLine"] = ( + self.example_scanimage_meta["pixels_per_line"] + ) + mock_meta[0]["SI.hRoiManager.scanZoomFactor"] = ( + self.example_scanimage_meta["fov_scale_factor"] + ) mock_scanimage.return_value = mock_meta extract = etl._extract()