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/cmu-ci-lab/mcspeckle
30 June 2024, 09:00:48 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • a850fae
  • /
  • examples
  • /
  • memoryEffectMeasurements
  • /
  • memoryEffectMeasurements.m
Raw File Download
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 Iframe embedding
swh:1:cnt:8d6d2b810b3bba2f6f12055fffcb2319086d3f0d
origin badgedirectory badge Iframe embedding
swh:1:dir:7006a6198c3b8f7fa9fba55add7f9f7befb79174
origin badgerevision badge
swh:1:rev:c4ecf78f32558cba5e45ab0c43a0995a20f2c85b
origin badgesnapshot badge
swh:1:snp:3a35cdb24ad67a89d2a1abf099040aff3c71b7b4

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: c4ecf78f32558cba5e45ab0c43a0995a20f2c85b authored by igkiou on 05 September 2019, 11:00:35 UTC
first commit
Tip revision: c4ecf78
memoryEffectMeasurements.m
%% Define the expirements we want to run

% Delta between light to view (in order to avoid CBS)
theta0 = 0.002;

% light
theta = deg2rad((0:0.001:0.02) + theta0);

% phantom width
L = 2000;

% HG parameters
g = 0;
g0 = 0;

% OD
OD = 10;

% backward scattering
bws = false;

% view which will be squee
viewsVec = deg2rad(-1:0.1:-0.1);
vecNum = numel(viewsVec);

% sectors of cov matrix
sec_1 = 1:1:vecNum;
sec_2 = vecNum+1:1:2*vecNum;

% results
c_measured = zeros(1,numel(theta));

%% Run the expirements
    
% prepare the config
boxTargetArea = boxArea( ...
    1 ,             ... wavelength
    L/OD,           ... MFP
    [0,L],          ... z
    [-50000,50000], ... half of x axis
    [-50000,50000]  ... half of x axis
);

scatter = HGScatter(g,g0);

tic
% Run seperatly for each two directions
for idx1 = 1:1:numel(theta)
    theta_1 = theta(1);
    theta_2 = theta(idx1);

    dtheta = theta_2 - theta_1;
    phi_1 = viewsVec;
    phi_2 = viewsVec - dtheta;

    % If backward scattering
    if(bws)
        phi_1 = phi_1 + pi;
        phi_2 = phi_2 + pi;
    end
        
    % Run expirements
    mulres = scmc(boxTargetArea,                  ...
        farFieldSource([phi_1,phi_2],0),     ...
        farFieldSource([theta_1,theta_2],0), ...
        scatter,1e3, ... 1e5 for more accurate result
        'CBS',false, ... The light and the view are never the same direction
        'uniformFirstScatter',false, ... for more effitient sampling
        'parforIters', 12);

     % Get the intensity correlation
     sigma = zeros(2);
     sigma(1,1) = mean(diag(mulres.C(sec_1,sec_1,1,1)));
     sigma(2,2) = mean(diag(mulres.C(sec_2,sec_2,2,2)));
     
     % Check wich diagonal has higher values
     diagA = mean(diag(mulres.C(sec_2,sec_1,1,2)));
     diagB = mean(diag(mulres.C(sec_1,sec_2,1,2)));
     
     if(abs(diagA) > abs(diagB))
        sigma(1,2) = mean(diag(mulres.C(sec_2,sec_1,1,2)));
        sigma(2,1) = mean(diag(mulres.C(sec_1,sec_2,2,1)));
     else
        sigma(1,2) = mean(diag(mulres.C(sec_1,sec_2,1,2)));
        sigma(2,1) = mean(diag(mulres.C(sec_2,sec_1,2,1)));
     end

     sigma_I = zeros(2);
     sigma_I(1,1) = (sigma(1,1))^2;
     sigma_I(2,2) = (sigma(2,2))^2;
     sigma_I(1,2) = sigma(1,2) * sigma(2,1);

     sigma_I = real(sigma_I);

     % Calculate the memory effect
     c_measured(idx1) = (sigma_I(1,2)/(sqrt(sigma_I(2,2)*sigma_I(1,1))));
end
toc

%% Compare between the calculated and theoreric ME graphs
% The theoretic ME is true for the diffusive region
dtheta = theta - theta(1);
c_theory = (2*pi*L*dtheta./sinh(2*pi*L*dtheta)).^2;
c_theory(dtheta == 0) = 1;

figure
hold on
plot(rad2deg(dtheta),c_measured,'lineWidth',2);
plot(rad2deg(dtheta),c_theory,'k--','lineWidth',2);

xlabel('\theta[deg]');
ylim([0,1]);
legend('Measured','Theoretic')

back to top

Software Heritage — Copyright (C) 2015–2025, 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