Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision ccfd5efa4ee6fd4da85acf9f478b8270aaa6eceb authored by Kellen Vu on 13 April 2023, 22:09:16 UTC, committed by Kellen Vu on 13 April 2023, 22:09:16 UTC
[Eye Calibration] Add scrollbar to window, and fix a bug in the lowpass filter
1 parent 3c5722b
  • Files
  • Changes
  • a26049b
  • /
  • Tools
  • /
  • Program_Maestro_and_CX
  • /
  • alignCXandMaestro.m
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:ccfd5efa4ee6fd4da85acf9f478b8270aaa6eceb
directory badge
swh:1:dir:3db2a6f22021f847e10e9dde59f2f07371f5ba82
content badge
swh:1:cnt:6240b9cb1bf5c849def20ccf08aa5a0bfc1cf203

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
alignCXandMaestro.m
function [behaviorDat, shiftAmt, shiftConfidence] = alignCXandMaestro(behaviorDat, ephysData, plotOn)

    % Don't plot by default
    if ~exist('plotOn','var')
        plotOn = 0;
    end
    
    shiftConfidence = 0;
    shiftAmt = 0;
    
    eSamplerate = 50000;%ephysDat.samplerate;
    %ephysData = datchandata(ephysDat,'Ephys');
    timeEphys = 0:1/eSamplerate:(length(ephysData)-1)/eSamplerate;
    
    %% Allign Ephys Data
    spikesForAlignment = 100:120;
    
    timeofsimplespikes = datchandata(behaviorDat,'ss');    
    eventsSampleTime = timeofsimplespikes * eSamplerate;
    eventsSampleTime = eventsSampleTime(spikesForAlignment);
    eventsSampleTime = round(eventsSampleTime);
    eventsSampleTime = eventsSampleTime - eventsSampleTime(1);
    
    sumofthingsInitial = nan(length(ephysData),length(eventsSampleTime));
    ephysData = ephysData - mean(ephysData);
    for x = 1:length(ephysData)
        if max(eventsSampleTime + x) > length(ephysData)/2%min([150000, length(ephysData)])
            break
        end
        sumofthingsInitial(x,:) = sum(ephysData(eventsSampleTime + x));
    end
    
    sumofthings = sum(sumofthingsInitial,2);
    if ~sum(~isnan(sumofthings))
        return
    end
    
    %% Modify ephys
    maxMatchValue = max(abs(sumofthings));
    maxSumLoc = timeEphys(find(abs(sumofthings) == maxMatchValue));
    maxSumLoc = maxSumLoc(1);
    
    if maxMatchValue > 30
        shiftAmt = -(maxSumLoc - timeofsimplespikes(100));
        timeEphys = timeEphys + shiftAmt;
        shiftConfidence = maxMatchValue;
        
        if plotOn
            figure(9); clf
            plot(timeEphys, abs(sumofthings))
            %ylim([0 100])
            if ~isempty(maxSumLoc)
                vline(maxSumLoc + shiftAmt, ':r')
                %xlim([timeEphys(1) timeEphys(1)+1])
            end

            figure(10); clf
            plot(timeEphys, ephysData);
            vline(timeofsimplespikes(1:100), '--r')
            xlim([timeEphys(1) timeEphys(1)+1])
            
            figure(11); clf
            csLocs = zeros(length(ephysData),1);
            behaviorDat(9).data(behaviorDat(9).data < 0) = [];
            
            for k = 1:length(behaviorDat(9).data)
                csLocs(round(behaviorDat(9).data(k)*eSamplerate)) = 1;
            end
            [c,lags] = xcorr(ephysData,csLocs);
            plot(lags/50000, c);
            xCorrShiftVal = lags(find(c == max(c)))/eSamplerate;
            disp(xCorrShiftVal)
            disp(shiftAmt)
            shiftAmt = xCorrShiftVal;
        end
        

    else
        shiftAmt = 0;
        shiftConfidence = 0;
    end
    
    %% add shifted ephys channel to behavior structure
    behaviorDat(end+1) = dat(ephysData, 'Ephys', length(behaviorDat)+1, eSamplerate, timeEphys(1),timeEphys(end),'mV?');
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API