Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions argos/experimentSetup/dataObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,13 +902,7 @@ def properties(self):
A dictionary mapping property labels to their parsed values.
"""

propDict = {}
propList = self._metadata['attributes'] if 'attributes' in self._metadata else self._metadata['properties']

for prop in propList:
propDict[prop['name']] = prop['value']

return propDict
return self._properties

@property
def trialSet(self):
Expand Down Expand Up @@ -956,8 +950,18 @@ def __init__(self, trialSet: TrialSet, metadata: dict):
if len(metadata.get('properties', [])):
propertiesPandas = pandas.DataFrame(metadata['properties']).set_index('key')

properties = propertiesPandas.merge(trialSet.propertiesTable, left_index=True, right_index=True)[
['val', 'type', 'label', 'description']]
# pandas 3.x: merge on index requires matching index types/values.
# Build the attribute-type definitions indexed by key/name so the
# join aligns on property names rather than integer positions.
pts = pandas.DataFrame(trialSet.properties)
key_col = 'key' if 'key' in pts.columns else 'name'
pts = pts.set_index(key_col)
for col in ('label', 'description'):
if col not in pts.columns:
pts[col] = ''
properties = propertiesPandas[['val']].join(
pts[['type', 'label', 'description']], how='inner'
)
getParser = lambda x: getattr(self, f"_parseProperty_{x.replace('-', '_')}")

# this wont work well for location property in the trial because it has 2 fields.
Expand Down Expand Up @@ -1172,7 +1176,11 @@ def _parseProperty_datetime_local(self, property, propertyMetadata):
if localdata is None:
data = [None]
else:
data = [localdata.tz_localize("israel")]
# pandas 3.x parses Z-suffix as tz-aware UTC; convert rather than localize
if localdata.tzinfo is not None:
data = [localdata.tz_convert("Asia/Jerusalem")]
else:
data = [localdata.tz_localize("Asia/Jerusalem")]
columns = [propertyLabel]

return columns, data
Expand Down
Loading