Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add recording key restraint to model.get_trajectory #82

Open
trose-neuro opened this issue Jul 28, 2023 · 1 comment
Open

add recording key restraint to model.get_trajectory #82

trose-neuro opened this issue Jul 28, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@trose-neuro
Copy link

trose-neuro commented Jul 28, 2023

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
    
@trose-neuro trose-neuro added the bug Something isn't working label Jul 28, 2023
trose-neuro added a commit to SFB1089/element-deeplabcut that referenced this issue Jul 28, 2023
@kabilar
Copy link
Collaborator

kabilar commented Aug 2, 2023

Thanks for the report, @trose-neuro. We are looking into this issue and will submit a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

4 participants