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

Fix behavior modality in upload manifest #1122

Merged
merged 5 commits into from
Dec 6, 2024
Merged

Conversation

alexpiet
Copy link
Collaborator

@alexpiet alexpiet commented Dec 5, 2024

Pull Request instructions:

  • Please follow the update protocol
  • Answer the questions below in detail. Your responses will be emailed to experimenters.
  • If the experimenters must do anything new, provide detailed step by step instructions on the wiki
  • If computer maintainers need to manually update anything, provide detailed step by step instructions
  • Use markdown syntax in order for your comments to be rendered reliably in the email: "1." instead of "1)", use four spaces for indents.
  • If you use the keyword "skip email" in the title, it will skip the email updates
  • Merges from "develop" into "production_testing" should use the keyword "production merge" in the title for reliable indexing of updates
  • Merges from "production_testing" into "main" should use the keyword "update main"

Describe changes:

Always adds the behavior modality, instead of checking stream_modalities which had behavior removed as a modality

What issues or discussions does this update address?

Describe the expected change in behavior from the perspective of the experimenter

  • none

Describe any manual update steps for task computers

  • none

Was this update tested in 446/447?

  • tested in 447

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 5, 2024

@XX-Yin This is ready for review, and replaces #1116

@alexpiet alexpiet mentioned this pull request Dec 5, 2024
@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 5, 2024

@alexpiet
The way to check the modality has two issues:

  1. The video modality will not be added to the manifest file as the video streams will only be added to the session streams when there is an end time detected.
  2. The current code would only generate manifest file in the first trial and could miss modality started after first trial.

I know that you thought the point 2 is not an issue. Please make changes to the point 1 to make the modality check more robust. I suggest we directly check the folder empty for each modality instead of using the session streams.

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 5, 2024

Why is the video only added to the stream modalities when there is an end time, but the FIP is added before there is an end time?

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 5, 2024

It's a history issue. You can also change the video modality to be like the FIP

        if hasattr(self, 'fiber_photometry_start_time'):
            Obj['fiber_photometry_start_time'] = self.fiber_photometry_start_time
            if hasattr(self, 'fiber_photometry_end_time'):
                end_time = self.fiber_photometry_end_time
            else:
                end_time = str(datetime.now())
            Obj['fiber_photometry_end_time'] = end_time

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 5, 2024

@XX-Yin what about this update

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 6, 2024

@XX-Yin what about this update

This works.

  1. Can you also remove the camera_start_time and fiber_photometry_start_time when starting a session(like I did in https://github.com/AllenNeuralDynamics/dynamic-foraging-task/pull/1116/files#diff-b3cf4ca4fc9cb05d0a854615b8178bb10c1805e102fa1685fd60bd66bec9d34aR4052)? Otherwise, it may interact with the next session.
  2. And don't delete the fiber_photometry_start_time at here https://github.com/AllenNeuralDynamics/dynamic-foraging-task/pull/1116/files#diff-b3cf4ca4fc9cb05d0a854615b8178bb10c1805e102fa1685fd60bd66bec9d34aL3628. Otherwise, it may not generate the fiber photometry data stream after the new session button is clicked (e.g. after saving).
  3. Can you also make changes in the fiber photometry data stream in the GeneratedMetadata.py to keep consistent with the behavior video data stream?

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

Those seem like separate issues from the upload manifest modality.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 6, 2024

At least the first one is directly associated the manifest file as the code is using the Session Metadata to get the modalities.

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

But I'm not setting the start time for the camera or photometry in either the metadata or the window object.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 6, 2024

If the previous session has the camera_start_time and camera_end_time and the current session doesn't have the video stream and we don't restart the GUI, the video stream will be added to the current session. I think the root issue is from the session metadata, but it will also influence the modality detection in the manifest file.

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

I just tried it, and that does not happen

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

Although that may be a result of this bug I just found: #1123

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 6, 2024

I just tried it, and that does not happen

Did you click the start recording (not the preview)?

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

No, I recorded video through the FIP workflow. I just fixed #1123. I will check in 446 and just record video

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

Commented on the wrong PR:

Ok, you are right that if you run a session with the camera, and then start a new session without the GUI, then it incorrectly lists behavior-video as a modality in the manifest and in the session metadata. I'll make a separate issue, since I don't have time to fix that right now. Lets merge this fix in, since it will effect every session
here is the issue: #1124

@alexpiet
Copy link
Collaborator Author

alexpiet commented Dec 6, 2024

@XX-Yin do you have any remaining concerns?

@XX-Yin
Copy link
Collaborator

XX-Yin commented Dec 6, 2024

@alexpiet We can first merge this and fix other issues

@alexpiet alexpiet merged commit d923c8a into develop Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants