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/nwbarendregt/AdaptNormThresh
12 July 2025, 11:20:19 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • 2878a3d9f5a3b9b89a0084a897bef3414e9de4a2
    No releases to show
  • bbb89f8
  • /
  • Figure 6 -- Tokens Task Data Analysis
  • /
  • MCMC_UGM.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 ...

Permalinks

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:74aed5a6a22448744d788518f0245a2cf6ff0546
origin badgedirectory badge Iframe embedding
swh:1:dir:d615f04e1fe23058870cce8c51d6ba6cdac3dbd8
origin badgerevision badge
swh:1:rev:2878a3d9f5a3b9b89a0084a897bef3414e9de4a2
origin badgesnapshot badge
swh:1:snp:a568cc5cff39965992895669038ed8c43a59eedd
Citations

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: 2878a3d9f5a3b9b89a0084a897bef3414e9de4a2 authored by nwbarendregt on 03 May 2022, 15:08:29 UTC
Add files via upload
Tip revision: 2878a3d
MCMC_UGM.m
% MCMC_UGM.m
% Evolves parameter chains for UGM using MCMC from Barendregt et al., 2022.

function [theta,L] = MCMC_UGM(theta_p,L_p,Nt,Sub_T,stim,S,prior)

% Draw proposed new state from Gaussian proposal distribution:
theta = mvnrnd(theta_p,S);
if (theta(1) > prior(1)) && (theta(2) > prior(2)) &&...
        (theta(3) > prior(3)) && (theta(4) > prior(4)) &&...
        (theta(5) > prior(5)) % Reject new state if parameters are negative.

    % Pre-allocate storage of average synthetic data generated from 
    % sampled model:
    Synth_Data = zeros(1,Nt+1);
    for n = 1:50

        % Pre-allocate storage of synthetic data generated from sampled 
        % model: 
        T_Data = NaN(1,length(Sub_T));

        % Generage synthetic response data using sampled model and subject
        % stimulus:
        for l = 1:length(Sub_T)
            [T,~] = tok_sim_UGM(Nt,theta(1),theta(2),theta(3),theta(4),stim(l,:));
            T_Data(l) = round(theta(5)*randn+T);
            while (T_Data(l) > Nt) || (T_Data(l) < 0)
                T_Data(l) = round(theta(5)*randn+T);
            end
        end

        % Average synthetic data over many (50, found experimentally by 
        % tuning) realizations:
        Synth_Data = Synth_Data+histcounts(T_Data,-0.5:1:(Nt+0.5),'normalization','probability');
    end

    % Add small non-zero entries to compute likelihood of proposed sampled:
    Synth_Data(Synth_Data == 0) = eps; Synth_Data = Synth_Data/sum(Synth_Data,'all');

    % Compute likelihood of proposed sample:
    L = sum(log(Synth_Data(Sub_T+1)));

    % Compute Hastings ratio and determine if proposed sample is accepted:
    h = exp(L-L_p); U = rand;
    if U > h
        theta = theta_p; L = L_p;
    end
else
    theta = theta_p; L = L_p;
end
end

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— Contact— JavaScript license information— Web API