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

AddingAindBehaviorTaskLogicModel #1223

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft

Conversation

micahwoodard
Copy link
Collaborator

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:

  • Adding AindBehaviorTaskLogicModel into framework

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?

  • 446/7

@micahwoodard micahwoodard changed the base branch from main to develop December 19, 2024 23:22
@micahwoodard micahwoodard marked this pull request as draft December 20, 2024 17:36
@micahwoodard micahwoodard marked this pull request as ready for review January 13, 2025 23:56
Copy link
Collaborator

@alexpiet alexpiet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@micahwoodard
Copy link
Collaborator Author

I'm going to change the imports to pull from the Aind.Behavior.DynamicForaging repo. Will request review then but should really only be the import that changes as well as the pyproject.toml

@@ -243,6 +254,233 @@ def __init__(self, parent=None,box_number=1,start_bonsai_ide=True):
self._ReconnectBonsai()
logging.info('Start up complete')

def initialize_task_parameters(self) -> DynamicForagingParas:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this part to a separate python file? Foraging.py is already quite large. And this part is relatively independent. The idea is to make AindBehaviorTaskLogicModel relatively independent and modular.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jan 15, 2025

It seems that the current modification logic is like this:

  1. Copy parameters to behavior_task_logic_model -> update these parameters if parameters are changed
  2. Copy parameters to behavior_task_logic_model -> replacing existing parameters using behavior_task_logic_model (like replacing self.warmup.currentText() using self.behavior_task_logic_model.task_parameters.warmup)

What is the entire logic and purpose here in terms of step 1 and step 2? How is this related to the curriculum?

@micahwoodard micahwoodard marked this pull request as draft January 15, 2025 19:35
@micahwoodard
Copy link
Collaborator Author

I don't think this is ready to merge. I prematurely thought this is what it would look like but I think this will change as I figure out how the curriculum works with this

@micahwoodard
Copy link
Collaborator Author

micahwoodard commented Jan 15, 2025

What is the entire logic and purpose here in terms of step 1 and step 2? How is this related to the curriculum?

For number 1, the intent was so changes in gui would be reflected in the task logic. Number 2 makes it so we are not using the gui state as a reference of how the task was run but rather a defined schema.

For how this is related to curriculum, the stages in the curriculum require a task logic model. We can adopt some of Bruno's architecture hare and leverage it in the curriculum.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jan 15, 2025

Can we create a task logic model at the end of the session? Here the step 2 is circular. For curriculum, we only need a to set the parameters? Just like what we are doing now.

@micahwoodard
Copy link
Collaborator Author

micahwoodard commented Jan 16, 2025

This would be a great discussion to loop @alexpiet and @hanhou into. The task parameters (same ones we are putting in the task logic model) are part of the Stage class in the aind-behavior-curriculum. In my mind, when a mouse is loaded, the gui will query slims for the trainer state of this mouse. The trainer state will include the stage of this mouse, and therefore the task parameters for the session. We can use the stage task parameters to update the task logic model and this is what the gui will use to set up and run the session. If a mouse is loaded in, that will disable the task parameter widgets so mice are limited to the session outlined in slims. Integrating the task logic model and using it to run a session rather than the widgets will make it easier to use the trainer state from slims and also provides better documentation on how the session was run. That is the workflow and benefits as I see them. If we're not all on the same page, let me know and I can update my approach

@alexpiet
Copy link
Collaborator

Yes, thats right @micahwoodard. The task parameters will already be determined at the start of the session by the curriculum, so we should make the task model at the start of the session.

@hanhou
Copy link
Collaborator

hanhou commented Jan 16, 2025

This would be a great discussion to loop @alexpiet and @hanhou into. The task parameters (same ones we are putting in the task logic model) are part of the Stage class in the aind-behavior-curriculum. In my mind, when a mouse is loaded, the gui will query slims for the trainer state of this mouse. The trainer state will include the stage of this mouse, and therefore the task parameters for the session. We can use the stage task parameters to update the task logic model and this is what the gui will use to set up and run the session. If a mouse is loaded in, that will disable the task parameter widgets so mice are limited to the session outlined in slims. Integrating the task logic model and using it to run a session rather than the widgets will make it easier to use the trainer state from slims and also provides better documentation on how the session was run. That is the workflow and benefits as I see them. If we're not all on the same page, let me know and I can update my approach

Agreed.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jan 16, 2025

" We can use the stage task parameters to update the task logic model and this is what the gui will use to set up and run the session."

Why do we need to use the stage task parameters to update the task logic model and then update the GUI parameters instead of updating the GUI parameters directly?

@micahwoodard
Copy link
Collaborator Author

@hanhou @alexpiet Would the idea be to use only the task logic parameters instead of the TP_ parameters to run a session? So we're not updating the gui parameters, but we're only using the task logic parameters to run the session, increasing readability and reproducibility of code.

@micahwoodard micahwoodard marked this pull request as ready for review January 16, 2025 23:55
@micahwoodard micahwoodard marked this pull request as draft January 16, 2025 23:56
@micahwoodard
Copy link
Collaborator Author

Okay this is ready for rereview using external task logic repo, using pythonic naming conventions, and replacing widgets and TP parameters with task logic. I also changed the LineEdits to Spinboxes when applicable to simplify logic

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.

Implement AindBehaviorTaskLogicModel
4 participants