Skip to content

Commit cfe1e87

Browse files
nsteinmek1o0
authored andcommitted
Fix gamma calibration (#164)
* use the correct channels for gamma cal as specified * label output plots correctly
1 parent d174c76 commit cfe1e87

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

+hw/+ptb/Window.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ function applyCalibration(obj, cal)
645645
[light, clock, acqRate] = obj.measuredStim(colours, dev, lightIn, clockIn, clockOut);
646646

647647
%% assess the delay between digital and analog
648+
648649
[xc, lags ] = xcorr(light, clock, 1000, 'coeff');
649650
% figure; plot(lags,xc)
650651
[~,imax] = max(xc);
@@ -661,6 +662,7 @@ function applyCalibration(obj, cal)
661662
tt = (1:ns)/acqRate;
662663

663664
figure; plot(tt,clock);
665+
ylabel('clock signal'); title('Clock');
664666

665667
upCrossings = find(diff( clock > 1 ) == 1);
666668
dnCrossings = find(diff( clock > 1 ) == -1);
@@ -672,7 +674,7 @@ function applyCalibration(obj, cal)
672674
end
673675
plot( tt, light ); hold on
674676
xlabel('Time (s)');
675-
ylabel('Signal (Volts)');
677+
ylabel('Photodiode Signal (Volts)');
676678
set(gca,'ylim',[0 1.1*max(light)]);
677679
title(sprintf('In this plot. digital has been delayed by %2.2f ms', delay));
678680

+srv/expServer.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,14 @@ function whiteScreen()
365365
function calibrateGamma()
366366
stimWindow = rig.stimWindow;
367367
DaqDev = rig.daqController.DaqIds;
368-
lightIn = 'ai0'; % defaults from hw.ptb.Window
369-
clockIn = 'ai1';
370-
clockOut = 'port1/line0 (PFI4)';
371-
log(['Please connect photodiode to %s, clockIn to %s and clockOut to %s.\r'...
372-
'Press any key to contiue\n'],lightIn,clockIn,clockOut);
368+
lightIn = 'ai1'; % defaults from hw.ptb.Window
369+
clockIn = 'ai0';
370+
clockOut = 'port1/line0';
371+
clockOutHint = 'PFI4';
372+
log(['Please connect photodiode to %s, clockIn to %s and clockOut to %s (%s).\r'...
373+
'Press any key to contiue\n'],lightIn,clockIn,clockOut,clockOutHint);
373374
pause; % wait for keypress
374-
stimWindow.Calibration = stimWindow.calibration(DaqDev); % calibration
375+
stimWindow.Calibration = stimWindow.calibration(DaqDev,lightIn, clockIn, clockOut); % calibration
375376
pause(1);
376377
saveGamma(stimWindow.Calibration);
377378
stimWindow.applyCalibration(stimWindow.Calibration);

0 commit comments

Comments
 (0)