-
Notifications
You must be signed in to change notification settings - Fork 16
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
added option to display calibration plot within expServer #245
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -39,6 +39,7 @@ function expServer(useTimelineOverride, bgColour) | |||||||||
rewardToggleKey = KbName('w'); | ||||||||||
rewardPulseKey = KbName('space'); | ||||||||||
rewardCalibrationKey = KbName('m'); | ||||||||||
viewCalibrationKey = KbName('k'); | ||||||||||
gammaCalibrationKey = KbName('g'); | ||||||||||
timelineToggleKey = KbName('t'); | ||||||||||
toggleBackground = KbName('b'); | ||||||||||
|
@@ -119,6 +120,7 @@ function expServer(useTimelineOverride, bgColour) | |||||||||
end | ||||||||||
|
||||||||||
running = true; | ||||||||||
calibration_displayed = false; | ||||||||||
|
||||||||||
%% Main loop for service | ||||||||||
while running | ||||||||||
|
@@ -162,8 +164,21 @@ function expServer(useTimelineOverride, bgColour) | |||||||||
|
||||||||||
% check for reward calibration | ||||||||||
if firstPress(rewardCalibrationKey) > 0 | ||||||||||
log('Performing a reward delivery calibration'); | ||||||||||
calibrateWaterDelivery(); | ||||||||||
log('Performing a reward delivery calibration'); | ||||||||||
calibrateWaterDelivery(); | ||||||||||
end | ||||||||||
|
||||||||||
% check for view calibration | ||||||||||
if firstPress(viewCalibrationKey) > 0 | ||||||||||
if ~calibration_displayed | ||||||||||
log('Displaying calibration'); | ||||||||||
viewCalibration(); | ||||||||||
calibration_displayed = true; | ||||||||||
else | ||||||||||
log('Un-displaying calibration'); | ||||||||||
Screen('Flip', rig.stimWindow.PtbHandle); | ||||||||||
calibration_displayed = false; | ||||||||||
end | ||||||||||
end | ||||||||||
|
||||||||||
% check for gamma calibration | ||||||||||
|
@@ -345,6 +360,29 @@ function calibrateWaterDelivery() | |||||||||
save(rigHwFile, 'daqController', '-append'); | ||||||||||
end | ||||||||||
|
||||||||||
function viewCalibration() | ||||||||||
|
||||||||||
k1o0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
calib = rig.daqController.SignalGenerators(rewardId).Calibrations(end); | ||||||||||
k1o0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
fig = figure; hold on | ||||||||||
plot([calib.measuredDeliveries.durationSecs],... | ||||||||||
[calib.measuredDeliveries.volumeMicroLitres],'x-') | ||||||||||
if isfield(calib, 'dateTime') | ||||||||||
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. Is there a case where 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. It was coming up for me, but I think it's an issue that's specific to some things I had done on my branch that re fixed now. I think in dev it's safe to assume dateTime will always be there if a calibration in. 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. Okay, I removed the if statement because on master there would be an error thrown beforehand, here: Lines 54 to 57 in 7d6b601
|
||||||||||
title(datestr(calib.dateTime)) | ||||||||||
end | ||||||||||
|
||||||||||
xlabel('Duration (sec)'); ylabel('Volume (uL)') | ||||||||||
ylim([0, 5]) | ||||||||||
set(gca, 'fontsize', 16) | ||||||||||
|
||||||||||
plot_values = getframe(fig); | ||||||||||
imageDisplay = Screen('MakeTexture', rig.stimWindow.PtbHandle, plot_values.cdata); | ||||||||||
Screen('DrawTexture', rig.stimWindow.PtbHandle, imageDisplay); | ||||||||||
Screen('Flip', rig.stimWindow.PtbHandle); | ||||||||||
WaitSecs(0.5); | ||||||||||
k1o0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
end | ||||||||||
|
||||||||||
function whiteScreen() | ||||||||||
% WHITESCREEN Changes screen background to white | ||||||||||
rig.stimWindow.BackgroundColour = rig.stimWindow.White; | ||||||||||
|
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.
What do you think about changing this to a 'v' and including the gamma calibrations in the display?
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.
That seems reasonable to me! I think the water calibration is the thing the techs look at the most, but making more information more accessible seems like a good thing.
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.
Great, I'll change it to 'v' and make an issue about adding other plots in the future.