Skip to content

Commit

Permalink
added catch for empty strings in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson committed Dec 6, 2023
1 parent d45c6ce commit b103307
Showing 1 changed file with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,14 @@ def _resolve_duplicates(resolved_dict, ids1, dict1, ids2, dict2):
resolved_dict[id1] = {}
for key1 in dict1[id1].keys():
if key1 in dict2[id1].keys():
if dict1[id1][key1] == "":
dict1[id1][key1] = dict2[id1][key1]
if dict2[id1][key1] == "":
dict2[id1][key1] = dict1[id1][key1]
if dict1[id1][key1] != dict2[id1][key1]:
print(
f"dict1 and dict2 don't match (dict1[{id1}][{key1}]: {dict1[id1][key1]}, dict2[{id1}][{key1}]: {dict2[id1][key1]})"
)
assert (
dict1[id1][key1] == dict2[id1][key1]
), f"dict1 and dict2 don't match (dict1[{id1}][{key1}]: {dict1[id1][key1]}, dict2[{id1}][{key1}]: {dict2[id1][key1]})"
Expand Down Expand Up @@ -632,32 +640,32 @@ def get_session_name(session_df):
]
velocity_modulation_examples = ["c621e134-50ec-4e8b-8175-a8c023d92789"]

reinforcement_session_metadata, reinforcement_subject_metadata = extract_reinforcement_metadata(
data_path,
)
photometry_session_metadata, photometry_subject_metadata = extract_photometry_metadata(
data_path,
)
# reinforcement_session_metadata, reinforcement_subject_metadata = extract_reinforcement_metadata(
# data_path,
# )
# photometry_session_metadata, photometry_subject_metadata = extract_photometry_metadata(
# data_path,
# )
(
reinforcement_photometry_session_metadata,
reinforcement_photometry_subject_metadata,
) = extract_reinforcement_photometry_metadata(data_path)
velocity_session_metadata, velocity_subject_metadata = extract_velocity_modulation_metadata(
data_path,
)
keypoint_session_metadata, keypoint_subject_metadata = extract_keypoint_metadata(data_path)
# velocity_session_metadata, velocity_subject_metadata = extract_velocity_modulation_metadata(
# data_path,
# )
# keypoint_session_metadata, keypoint_subject_metadata = extract_keypoint_metadata(data_path)

path2metadata = {
photometry_session_metadata_path: photometry_session_metadata,
photometry_subject_metadata_path: photometry_subject_metadata,
reinforcement_session_metadata_path: reinforcement_session_metadata,
reinforcement_subject_metadata_path: reinforcement_subject_metadata,
# photometry_session_metadata_path: photometry_session_metadata,
# photometry_subject_metadata_path: photometry_subject_metadata,
# reinforcement_session_metadata_path: reinforcement_session_metadata,
# reinforcement_subject_metadata_path: reinforcement_subject_metadata,
reinforcement_photometry_session_metadata_path: reinforcement_photometry_session_metadata,
reinforcement_photometry_subject_metadata_path: reinforcement_photometry_subject_metadata,
velocity_session_metadata_path: velocity_session_metadata,
velocity_subject_metadata_path: velocity_subject_metadata,
keypoint_session_metadata_path: keypoint_session_metadata,
keypoint_subject_metadata_path: keypoint_subject_metadata,
# velocity_session_metadata_path: velocity_session_metadata,
# velocity_subject_metadata_path: velocity_subject_metadata,
# keypoint_session_metadata_path: keypoint_session_metadata,
# keypoint_subject_metadata_path: keypoint_subject_metadata,
}
for path, resolved_dict in path2metadata.items():
with open(path, "w") as f:
Expand Down

0 comments on commit b103307

Please sign in to comment.