Skip to content

Commit

Permalink
Fix array handling from server to support multi stim returns (#649)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #649

Multistimuli experiments weren’t able to return to the client because the _tensor_to_config method didn’t handle nested object numpy arrays correctly. This fixes it.

Reviewed By: tymmsc

Differential Revision: D69474480

fbshipit-source-id: 1524206ea259dfe66cd5fa885edf4e29c2543a5f
  • Loading branch information
JasonKChow authored and facebook-github-bot committed Feb 11, 2025
1 parent 6f0b90a commit 2312ef0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions aepsych/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,7 @@ def _tensor_to_config(self, next_x):
config = {}
for i, name in enumerate(self.parnames):
val = next_x[:, i]
if isinstance(val, str):
config[name] = [val]
elif isinstance(val, (int, float)):
config[name] = [float(val)]
elif isinstance(val[0], str):
config[name] = val
else:
config[name] = list(np.array(val, dtype="float64"))
config[name] = val.tolist()
return config

def _config_to_tensor(self, config):
Expand Down

0 comments on commit 2312ef0

Please sign in to comment.