-
Notifications
You must be signed in to change notification settings - Fork 5
Feat fast retract #1543
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
Merged
Merged
Feat fast retract #1543
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
fb2a5a8
outlines fast retract for stage
micahwoodard 405b033
initializes timers
micahwoodard fa1bea9
fixes qtimer
micahwoodard ffc2f8b
debugs
micahwoodard ec255a3
connects signals'
micahwoodard 13df210
debugs
micahwoodard 6e08783
removes double signal
micahwoodard 9899e0a
fixes timer bug
micahwoodard 00f501c
debugs
micahwoodard 0ec73ad
fixes stage widget
micahwoodard 6e15161
degugs
micahwoodard b1ea235
debugs
micahwoodard 5837066
inits timer with dummy timeout
micahwoodard 53e0053
debugs
micahwoodard 70dcf1c
debugs
micahwoodard b1385a4
debugs
micahwoodard d7a711a
debugs
micahwoodard 7f47da6
debugs
micahwoodard 0ebca0f
debugs
micahwoodard 92ede10
debugs
micahwoodard 252b818
changes stage widget release
micahwoodard 4d540a5
disconnects signals
micahwoodard 316869e
reconnects if retraction off
micahwoodard 2466011
sets stage to normal speed after unretract
micahwoodard 3ed7d75
comments out setting stage to normal speed
micahwoodard 985a4e6
disconnects finished signal
micahwoodard ef31ffe
handles disconnects better
micahwoodard b2058fb
formats gui better
micahwoodard 748d449
moves lick emit
micahwoodard eb51cd6
debugging
micahwoodard 946ac29
debugging
micahwoodard 9bc2f48
puts irregular timestamp in thread
micahwoodard 43acfd2
removes simulation
micahwoodard a813165
create lick bonsai signal
micahwoodard 5a614bb
catch lick at RigClient
micahwoodard f2fbcc8
reverting layout file
micahwoodard d31f473
removes extra folder
micahwoodard 7522660
adds connection upon channel2 initialization
micahwoodard d1905ec
updates bonsai workflow
micahwoodard 7be1775
try except to disconnect signals
micahwoodard e38f90c
adds conditional to bonsai workflow
micahwoodard e561638
checks if stage is at origin
micahwoodard 999c12e
adds checks for connecting and disconnect mouse licked signals
micahwoodard d21b189
check y pos of lickspout
micahwoodard f1f8ac2
moves connection in start function
micahwoodard dea892f
adds logic for lickety split lickspout
micahwoodard 568106c
reverts layout file
micahwoodard 545ee42
Merge branch 'curriculum-dev-branch' into feat-fast-retract
micahwoodard 75b824d
removes super init
micahwoodard 5124f12
adds more info to log and passes in lickspout retracted
micahwoodard 3f43e1c
debugs
micahwoodard 7e94bec
debugs
micahwoodard 0ba0f02
retracts
micahwoodard 35d2698
simulating licks with keyboard
micahwoodard 5160a07
adds debuging
micahwoodard 8b85682
adds logs
micahwoodard 4cbadf0
does not skip moving stage when stage is busy
micahwoodard 201b981
formats
micahwoodard 20679f3
reverts bonsai and layout file
micahwoodard f2c3b60
merges with curriculum bug branch
micahwoodard dc047c6
fixes merge issues
micahwoodard 0127cc5
Revert "formats"
micahwoodard ac0ba6d
adds back lick subjects in bonsai workflow
micahwoodard 8bfd571
don't enforce unique connection on setting stage speed back to normal
micahwoodard cfbcf19
changes logic for changing stage speed
micahwoodard 185b608
changes logic to account for monument position
micahwoodard 3c3e4cf
increases delta to 10
micahwoodard b2631e9
resets stage speed and fast retract once stage has stopped moving
micahwoodard e7ffa74
corrects wrong function name
micahwoodard 1053780
creates thread to query if stage has made it back to original position
micahwoodard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| from datetime import datetime | ||
| from itertools import accumulate | ||
| from sys import platform as PLATFORM | ||
| from threading import Lock | ||
|
|
||
| import numpy as np | ||
| import requests | ||
|
|
@@ -2883,7 +2884,7 @@ def _add_one_trial(self): | |
| self.BlockLenHistory[i][-1] + 1 | ||
| ) | ||
|
|
||
| def _GetAnimalResponse(self, Channel1, Channel3, data_lock): | ||
| def _GetAnimalResponse(self, Channel1, Channel3, data_lock: Lock): | ||
| """Get the animal's response""" | ||
| self._CheckSimulationSession() | ||
| if self.CurrentSimulation: | ||
|
|
@@ -3114,67 +3115,88 @@ def _GiveRight(self, channel3): | |
| channel3.ManualWater_Right(int(1)) | ||
| channel3.RightValue1(float(self.win.right_valve_open_time * 1000)) | ||
|
|
||
| def _get_irregular_timestamp(self, Channel2): | ||
| def _get_irregular_timestamp(self, Channel2, data_lock: Lock): | ||
| """Get timestamps occurred irregularly (e.g. licks and reward delivery time)""" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addd data_lock here since these variables are saved during the experiment |
||
|
|
||
| while not Channel2.msgs.empty(): | ||
| Rec = Channel2.receive() | ||
|
|
||
| if Rec[0].address == "/LeftLickTime": | ||
| self.B_LeftLickTime = np.append( | ||
| self.B_LeftLickTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_LeftLickTime = np.append( | ||
| self.B_LeftLickTime, Rec[1][1][0] | ||
| ) | ||
|
|
||
| elif Rec[0].address == "/RightLickTime": | ||
| self.B_RightLickTime = np.append( | ||
| self.B_RightLickTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_RightLickTime = np.append( | ||
| self.B_RightLickTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/LeftRewardDeliveryTime": | ||
| self.B_LeftRewardDeliveryTime = np.append( | ||
| self.B_LeftRewardDeliveryTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_LeftRewardDeliveryTime = np.append( | ||
| self.B_LeftRewardDeliveryTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/RightRewardDeliveryTime": | ||
| self.B_RightRewardDeliveryTime = np.append( | ||
| self.B_RightRewardDeliveryTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_RightRewardDeliveryTime = np.append( | ||
| self.B_RightRewardDeliveryTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/LeftRewardDeliveryTimeHarp": | ||
| self.B_LeftRewardDeliveryTimeHarp = np.append( | ||
| self.B_LeftRewardDeliveryTimeHarp, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_LeftRewardDeliveryTimeHarp = np.append( | ||
| self.B_LeftRewardDeliveryTimeHarp, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/RightRewardDeliveryTimeHarp": | ||
| self.B_RightRewardDeliveryTimeHarp = np.append( | ||
| self.B_RightRewardDeliveryTimeHarp, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_RightRewardDeliveryTimeHarp = np.append( | ||
| self.B_RightRewardDeliveryTimeHarp, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/PhotometryRising": | ||
| self.B_PhotometryRisingTimeHarp = np.append( | ||
| self.B_PhotometryRisingTimeHarp, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_PhotometryRisingTimeHarp = np.append( | ||
| self.B_PhotometryRisingTimeHarp, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/PhotometryFalling": | ||
| self.B_PhotometryFallingTimeHarp = np.append( | ||
| self.B_PhotometryFallingTimeHarp, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_PhotometryFallingTimeHarp = np.append( | ||
| self.B_PhotometryFallingTimeHarp, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/OptogeneticsTimeHarp": | ||
| self.B_OptogeneticsTimeHarp = np.append( | ||
| self.B_OptogeneticsTimeHarp, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_OptogeneticsTimeHarp = np.append( | ||
| self.B_OptogeneticsTimeHarp, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/ManualLeftWaterStartTime": | ||
| self.B_ManualLeftWaterStartTime = np.append( | ||
| self.B_ManualLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_ManualLeftWaterStartTime = np.append( | ||
| self.B_ManualLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/ManualRightWaterStartTime": | ||
| self.B_ManualRightWaterStartTime = np.append( | ||
| self.B_ManualRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_ManualRightWaterStartTime = np.append( | ||
| self.B_ManualRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/EarnedLeftWaterStartTime": | ||
| self.B_EarnedLeftWaterStartTime = np.append( | ||
| self.B_EarnedLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_EarnedLeftWaterStartTime = np.append( | ||
| self.B_EarnedLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/EarnedRightWaterStartTime": | ||
| self.B_EarnedRightWaterStartTime = np.append( | ||
| self.B_EarnedRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_EarnedRightWaterStartTime = np.append( | ||
| self.B_EarnedRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/AutoLeftWaterStartTime": | ||
| self.B_AutoLeftWaterStartTime = np.append( | ||
| self.B_AutoLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| with data_lock: | ||
| self.B_AutoLeftWaterStartTime = np.append( | ||
| self.B_AutoLeftWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| elif Rec[0].address == "/AutoRightWaterStartTime": | ||
| with data_lock: | ||
| self.B_AutoRightWaterStartTime = np.append( | ||
| self.B_AutoRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
| self.B_AutoRightWaterStartTime = np.append( | ||
| self.B_AutoRightWaterStartTime, Rec[1][1][0] | ||
| ) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these were duplicated imports so that's why they were removed