-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The spinner remote lab sends values batched into an array e.g. {"d":[6935.37,6935.37,6935.37,6935.37],"v":[0.00,0.00,0.00,0.00],"t":[636742613,636742618,636742623,636742628],"y":[0.00,0.00,0.00,0.00],"c":[0.00,0.00,0.00,0.00],"e":[0.00,0.00,0.00,0.00],"p_sig":0,"i_sig":0,"d_sig":0,"m":"s"}; whilst the pendulum remote lab sends messages that contain single values e.g. {"enc":356,"time":3807661886}.
The extract_series() method assumes that the value for an extracted key is a list as it iterates through that list to get the individual values. This causes an error when run with the pendulum experiment, since no iterable list is returned in the line vv = self.extract(obj, key, separator=separator)
Current method:
def extract_series(self, arr, key, separator="/"):
values = []
for obj in arr:
vv = self.extract(obj, key, separator=separator)
for v in vv:
values.append(v)
return values
Possible solution:
def extract_series(self, arr, key, separator="/"):
values = []
for obj in arr:
vv = self.extract(obj, key, separator=separator)
if(isinstance(vv, list)):
for v in vv:
values.append(v)
else:
values.append(vv)
return values
Metadata
Metadata
Assignees
Labels
No labels