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
  • /
  • renderSpecklesImages
  • /
  • renderSpecklesImages.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:4394981727145a77031d9c13543c9159d821762d
origin badgedirectory badge
swh:1:dir:121c802a55991977d418295b3b5730b8933fc59b
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
renderSpecklesImages.m
%% Render speckles images
% Show how to use the rendering algorithm, and demonstrate the memory
% effect

% Build the target area
boxTargetArea = boxArea( ...
    1 ,             ... wavelength
    200,            ... MFP
    [0,2000],       ... z
    [-50000,50000], ... x
    [-50000,50000]  ... y
);

% g = 0.9 for strong ME. g = 0 will give weak ME.
scatter = HGScatter(0.9, 0.8);

% Light directions number, each direction is a different image
lightsNum = 5;

% Delta beween each direction (in degrees)
lightDelta = 0.0025;

lights = (0:1:(lightsNum-1)) * lightDelta;

% Create 101x101 image
pixNum = 101;

% For each lighting direction, we will set up 20 sensors
% The more sensorsToLight is bigger, the bigger speckles are, but less
% speckles will appear.
% It is also the numbet of pixels each speckle will move between lightings.
sensorsToLight = 20;

viewsVector = (-((pixNum-1)/2):1:((pixNum-1)/2)) * ...
    (lightDelta/sensorsToLight);

% Make views image
[X,Y] = meshgrid(viewsVector);

% The directions will be auto-normalized in the code
views = [sind(X(:).');sind(Y(:).');ones(1,numel(X))];

%% Run the code and get the rendered image
% Be careful not render the correlation matrix, since it has huge memory
% consuption

tic;
mulres = scmc(boxTargetArea, ...
    farFieldSource(views), ...
    farFieldSource(deg2rad(lights),0), ...
    scatter,1e3, ...
    'renderCov', false, ... Avoid from making the correlation matrix
    'CBS',false, ... Since we forward, the CBS is not necessary
    'uniformFirstScatter', false, ... For more efficient sampling
    'renderField', true, ... In order to actually render the image
    'parforIters', 12);
toc;

% put back the resolt into an image
u = reshape(mulres.field,pixNum,pixNum,lightsNum);

%% Plot the images
f = figure;
f.Position = [0,0,1400,250];

maxVal = max(abs(u(:)));

for lNum = 1:1:lightsNum
    subplot(1,lightsNum,lNum)
    imagesc(abs(u(:,:,lNum)),[0,maxVal]);
    
    colormap hot
    xticks([]);
    yticks([]);
    
    title([num2str(lights(lNum)),'\circ'])
end

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