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

https://github.com/RaymondLab/Code
25 June 2024, 13:39:08 UTC
  • Code
  • Branches (12)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/Calibration
    • refs/heads/Calibration2
    • refs/heads/Master
    • refs/heads/VerticalTracking
    • refs/heads/code_generalization
    • refs/heads/consolidation_project_241B
    • refs/heads/local_configuration_241B
    • refs/heads/revert-2-consolidation_project_241B
    • refs/heads/rig241b_driftfix_sign
    • refs/heads/smr_to_smrx
    • refs/heads/tracking_dev
    • refs/tags/v1.0.0
    No releases to show
  • 32066d8
  • /
  • Projects
  • /
  • Ruth - Photometry Analysis
  • /
  • ruthDataEventChanVisual.m
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

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.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:f2823071ff3a5497ba44ba1b2ff71cc61bfe0d13
origin badgedirectory badge
swh:1:dir:1cd73dafba7696cbdc6ded009e7ef03af4628044
origin badgerevision badge
swh:1:rev:f1bbec0954829ba566764dc99cbca5614c527a01
origin badgesnapshot badge
swh:1:snp:5000b5dcf61aa2cac987bbe6af9204d011668dda

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.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: f1bbec0954829ba566764dc99cbca5614c527a01 authored by Kellen Vu on 13 April 2023, 22:40:57 UTC
Merge branch 'VerticalTracking' of https://github.com/RaymondLab/Code into VerticalTracking
Tip revision: f1bbec0
ruthDataEventChanVisual.m
tic
%% open/read file and set up Environment
%clear;clc;close all
activateCEDS64
% Wavelength
WAVELENGTH = 1999;
file = 'Z:\1_Maxwell_Gagnon\RuthProjectData\01_10_18\apples.smr';
fhand1 = CEDS64Open(file);
 
 %% Read Channel information
 load('jan12Workspace.mat')
 % sineWave channel (8)
 %[ ~, sineWave, ~ ] = CEDS64ReadWaveF(fhand1, 1, 600000000, 0);
 % smoothed donor channel
 %[ ~, smoothDonor, ~ ] = CEDS64ReadWaveF(fhand1, 17, 600000000, 0);
 % smoothed acceptor channel
 %[ ~, smoothAccept, ~ ] = CEDS64ReadWaveF(fhand1, 18, 600000000, 0);
 % Peak Smoothed Donor EVENTS
 %[~, dEvents] = CEDS64ReadEvents(fhand1, 13, 600000000, 0);
 % Peak Smoothed Acceptor EVENTS
 %[~, aEvents] = CEDS64ReadEvents(fhand1, 15, 600000000, 0);
 
% conversion
dEvents = dEvents ./ 100;
aEvents = aEvents ./ 100;




 

















% segment data
segments = [34.4071319 80.417285 1 0.099389695
             94.4198554 140.4404009 1 0.073845455         
             151.2009841 195.6984 1 0.075338549
             195.6984 495.2002536 0 0.08428348  
             506.2521841 550.7570 1 0.076105695
             550.7570 850.2618112 0 0.052867484   
             861.2737529  905.7913 1 0.059607717
             905.7913 1205.2772104 0 0.052621968
             1216.2876268 1260.7934 1 0.072681073
             1260.7934 1560.2979148 0 0.049920258
             1571.3062592 1615.7874 1 0.079747682
             1615.7874 1915.3113427 0 0.044458184
             1926.309162 1970.8137 1 0.091103762
             1970.8137 2270.3144864 0 0.043255639
             2279.5597266 2325.5662944 1 0.08406521
             2339.6987457 2385.695773 1 0.125541727
             2396.3908364 2440.4018015 1 0.068322224
             2751.4312707 2795.4422358 1 0.045031675
             ];
         
%% EVENTS
for i = 1:length(segments)
    
    segStart = floor(segments(i,1) * 1000);
    segEnd = floor(segments(i,2) * 1000);
    
    % remove incorrect events
    if i == 1
        dEvents(dEvents < segStart) = [];
        aEvents(aEvents < segStart) = [];
    elseif i == length(segments)
        dEvents(dEvents > segEnd) = [];
        aEvents(aEvents > segEnd) = [];
    else
        dEvents(dEvents > segEnd & dEvents < (floor(segments(i+1,1) * 1000))) = [];
        aEvents(aEvents > segEnd & aEvents < (floor(segments(i+1,1) * 1000))) = [];
    end    
end

% find the dEvents that create windows that contain an aEvent
good_dEvents = [];
for i = 1:length(dEvents)
    if sum((aEvents < (dEvents(i) + 5) & aEvents > (dEvents(i) - 5))) > 0
        good_dEvents = [good_dEvents; aEvents((aEvents < (dEvents(i) + 5) & aEvents > (dEvents(i) - 5)))];
    end
end
% NOTE: When looking for the windows, you might 'find' a match, when the match is
% OUT of the sinewave section! This causes the next section to lose a few
% windows!
eventcountON = [];
eventcountOFF = [];
VORON = [];
VOROFF = [];
EPSON = [];
EPSOFF = [];
%% 
for i = 1:length(segments)
    
    segStart = floor(segments(i,1) * 1000);
    segEnd = floor(segments(i,2) * 1000);
    
    % EVENT DATA
    % find current segment's window starters
    winInSeg = good_dEvents(good_dEvents > segStart & good_dEvents < segEnd); 
    % make the start time of the segment '0'
    winInSeg = winInSeg - segStart;
    % take modulo to find relative placement
    winInSeg = mod(winInSeg, WAVELENGTH);
    
    % SINE DATA
    waveCount = floor((segEnd - segStart) / WAVELENGTH);
    waveStart = segStart;
    sineSlices = zeros(WAVELENGTH+1, waveCount);
    donorSlices = zeros(WAVELENGTH+1, waveCount);
    acceptorSlices= zeros(WAVELENGTH+1, waveCount);
    
    for j=1:waveCount
        % extract slices of data from stim, donor, & acceptor
        sineSlices(:,j) = sineWave(waveStart:(waveStart+WAVELENGTH));
        donorSlices(:,j) = smoothDonor(waveStart:(waveStart+WAVELENGTH));
        acceptorSlices(:,j) = smoothAccept(waveStart:(waveStart+WAVELENGTH));
        % update wave start time
        waveStart = waveStart + WAVELENGTH + 1;
    end
    
    % plotting! 

    if segments(i,3) == 1
        
        figure(1)
        title('Dark: Stimulus')
        plot(sineSlices)
        hold on
        
        figure(2)
        title('Dark: Donor Signal')
        plot(donorSlices)
        hold on
        
        figure(3)
        title('Dark: Acceptor Signal')
        plot(acceptorSlices)
        hold on
        
        figure(4)
        title('Dark: Good Donor Events')
        histogram(winInSeg, 200)
        hold on
        
        eventcountOFF = [eventcountOFF; i length(winInSeg)];
        EPSOFF = [EPSOFF; i length(winInSeg) / ((segEnd - segStart) / 1000)];
        VOROFF = [VOROFF; i segments(i, 4)];    
    else 

        figure(7)
        title('Light: Stimulus')
        plot(sineSlices)
        hold on
        
        figure(8)
        title('Light: Donor Signal')
        plot(donorSlices)
        hold on
        
        figure(9)
        title('Light: Acceptor Signal')
        plot(acceptorSlices)
        hold on
        
        figure(10)
        title('Light: Good Donor Events')
        histogram(winInSeg, 200)
        hold on
        
        eventcountON = [eventcountON; i length(winInSeg)];
        EPSON = [EPSON; i length(winInSeg) / ((segEnd - segStart) / 1000)];
        VORON = [VORON; i segments(i, 4)];
    end    
end


figure(5)
title('Event count')
scatter(eventcountOFF(:,1), eventcountOFF(:,2), 'r', '*')
hold on
plot(eventcountOFF(:,1), eventcountOFF(:,2), 'r')
hold on
scatter(eventcountON(:,1), eventcountON(:,2), 'K')
hold on
plot(eventcountON(:,1), eventcountON(:,2), 'K')
xlabel('Segment Number')
ylabel('# of Events')
hold on

figure(6)
title('Events / s')
scatter(EPSOFF(:,1), EPSOFF(:,2), 'r')
hold on
plot(EPSOFF(:,1), EPSOFF(:,2), 'r')
hold on
scatter(EPSON(:,1), EPSON(:,2), 'K')
hold on
plot(EPSON(:,1), EPSON(:,2), 'K')
xlabel('Segment Number')
ylabel('Events per second')
hold on

figure(11)
title('VOR')
scatter(VOROFF(:,1), VOROFF(:,2), 'r')
hold on
plot(VOROFF(:,1), VOROFF(:,2), 'r')
hold on
scatter(VORON(:,1), VORON(:,2), 'K')
hold on
plot(VORON(:,1), VORON(:,2), 'K')
xlabel('Segment Number')
ylabel('eyeHGain')
hold on

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