Skip to content

add recording key restraint to model.get_trajectory #82

@trose-neuro

Description

@trose-neuro

Bug Report

Current behavior:
model.get_trajectory yields a fetch1 multiple tuple error when operating on a model.PoseEstimation.BodyPartPosition table with multiple recordings.

Workaround:

add key restraint (line 779)

for body_part in body_parts:
          x_pos, y_pos, z_pos, likelihood = (
              cls.BodyPartPosition & key & {"body_part": body_part} #TR23: added key restraint!
          ).fetch1("x_pos", "y_pos", "z_pos", "likelihood")
          if not z_pos:
              z_pos = np.zeros_like(x_pos)

          a = np.vstack((x_pos, y_pos, z_pos, likelihood))
          a = a.T
          pdindex = pd.MultiIndex.from_product(
              [[model_name], [body_part], ["x", "y", "z", "likelihood"]],
              names=["scorer", "bodyparts", "coords"],
          )
          frame = pd.DataFrame(a, columns=pdindex, index=range(0, a.shape[0]))
          df = pd.concat([df, frame], axis=1)
return df
    

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions