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
  • /
  • ruthDataPlotVisual2.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:367a3889123cc85e4ee53a2f2c9ec61e0349d109
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
ruthDataPlotVisual2.m
tic
%% open/read file and set up Environment
%clear;clc;close all
activateCEDS64

% Start Time
START_TIME = 0;
%AstSamples = floor(START_TIME * 1000);
AstSamples = 1;
% Wavelength
WAVELENGTH = 999;
% path to file


files = [
    %"Z:\1_Ruth Empson\151217 VOR\segment_1.smr"
    %"Z:\1_Ruth Empson\151217 VOR\segment_2.smr"
    %"Z:\1_Ruth Empson\151217 VOR\segment_3.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_4.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_5.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_6.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_7.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_8.smr"
    "Z:\1_Ruth Empson\151217 VOR\segment_9.smr"
    %"Z:\1_Ruth Empson\151217 VOR\segment_10.smr"
    ];

% Pre-allocate Vectors
offTotal = zeros(WAVELENGTH + 1, 1);
offCount = 0;
onTotal = zeros(WAVELENGTH + 1, 1);
onCount = 0;
badCount = 0;
sineTotal = zeros(WAVELENGTH + 1,1);

for q = 1:length(files)
    fhand1 = CEDS64Open(files{q});
    fprintf('\nSTARTING PART: %d\n', q)
    %% Gather data from specific channels
    % sineWave channel (8)
    [ ~, sineWave, ~ ] = CEDS64ReadWaveF(fhand1, 1, 600000000, 0);

    % ePhys channel (11)
    [ ~, ePhys, ~ ] = CEDS64ReadWaveF(fhand1,32, 600000000, 0);

    % light / dark channel (9)
    [ ~, tickTimes] = CEDS64ReadMarkers(fhand1, 9, 200, 0);


    %% CREATE TIMELINE OF 1s & 0s FOR ON/OFF LIGHT

    lightonoff = zeros(length(ePhys),1);

    for j = 1:length(tickTimes)
        if tickTimes(j).m_Code1 == 1
            windowStart = tickTimes(j).m_Time / 100;
            % if the file ends with the light on, then use end of file
            try
                windowEnd = tickTimes(j+1).m_Time / 100;
            catch
                windowEnd = length(lightonoff);
            end
            oneVec = ones(windowEnd - windowStart, 1);
            lightonoff(windowStart:windowEnd-1) = oneVec;
        end
    end



    %% PLOT EACH WAVE

    % how many sine waves can we use? 
    waveCount = floor((length(sineWave) - AstSamples) / WAVELENGTH);

    currentLocation = AstSamples;

    


    for i = 1:(waveCount - 1)

        hold on
        % get the proper ephys and sinewave slice
        waveform = ePhys( currentLocation : ( currentLocation + WAVELENGTH ));
        sineWaveSlice = sineWave( currentLocation : ( currentLocation + WAVELENGTH ));
        sineTotal = sineTotal + sineWaveSlice;

        % plot the slice
        figure(1)
        plot(sineWaveSlice, 'k')


        % light on?
        if lightonoff(currentLocation, 1) == 1
            if lightonoff(currentLocation + WAVELENGTH, 1) == 1
                onTotal = onTotal + waveform;
                onCount = onCount + 1;
                figure(2)
                plot(waveform,'k')
            else
                badCount = badCount + 1;
            end
        % light off?
        elseif lightonoff(currentLocation, 1) == 0
            if lightonoff(currentLocation + WAVELENGTH, 1) == 0
                offTotal = offTotal + waveform;
                offCount = offCount + 1;
                figure(3)
                plot(waveform,'k')
            else
                badCount = badCount + 1;
            end
        end

        currentLocation = currentLocation + WAVELENGTH + 1;
    end
end


% Calculate means
onMean = onTotal ./ onCount;
offMean = offTotal ./ offCount;

figure(1)
title('All Sine Waves')

figure(3)
plot(offMean,'r')
title('All Light OFF Waveforms and Their Mean')

figure(2)
plot(onMean,'r')
title('All Light ON Waveforms and Their Mean')

figure(5)
plot(onMean)
title('Light ON Mean')

figure(6)
plot(offMean)
title('Light OFF Mean')

figure(7)
hold on
plot(offMean, 'r')
plot(onMean, 'b')
title('Light OFF Mean & Light ON Mean')
legend('Light OFF Mean', 'Light ON Mean')


fprintf('There were:\n%d bad waveforms\n%d good waveforms\n\n', badCount, (offCount + onCount))
toc

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