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/maartenpaul/DBD_tracking
14 May 2026, 16:49:09 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/development
    • refs/heads/master
    No releases to show
  • 0f93134
  • /
  • R
  • /
  • MSD.R
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:6b13fdb48b58daa9c61707d118d2bef559c8c0e3
origin badgedirectory badge
swh:1:dir:a6d89e0252db3a6a19f9ac1be7bc96db69d87251
origin badgerevision badge
swh:1:rev:36f032f51402940b51db3b5835153ca6552ce15b
origin badgesnapshot badge
swh:1:snp:f14cfe52ad9e74434b7288f4e59ba10f11fe3d0f

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: 36f032f51402940b51db3b5835153ca6552ce15b authored by Maarten Paul on 07 March 2022, 11:26:44 UTC
Update README.md
Tip revision: 36f032f
MSD.R
track_msd <- function(x,n=5,framerate=0.1,pxsize=100,truncate=F,dim=2){
  if (dim==2){ #for 2D data
    x$X <- (x$X*pxsize)/1000 #convert pixelsize to um
    x$Y <- (x$Y*pxsize)/1000
  } else if (dim==3){ #for 3D data
    x$X <- (x$X*pxsize[1])/1000 #convert pixelsize to um
    x$Y <- (x$Y*pxsize[2])/1000
    x$Z <- (x$Z*pxsize[3])/1000
  }
  #calculate MSD for n time intervals
  coef <- ddply(x,.variables = "track",.fun= function(x) {
    result <- vector(length = n)
    #put first frame of track at zero
    x$frame  <- x$frame-x$frame[1]+1
    if(nrow(x)>n+1){ #test effect of truncating tracks to first number of steps, skipped by default
      if(truncate){
        x <- x[1:6,]
      }
      #loop over different time intervals
      sapply(1:n,function(j){
        #loop over all steps of tracks
        sum <- unlist(sapply(1:nrow(x),simplify = F,function(k){
          if (is.element(x[k,1]+j,x[,1])){ #check if point is present in track, this deals with gaps
            which_point <- which(x[,1]==x[k,1]+j)
            if (dim==2){
              sum <- ((x[k,2]-x[which_point,2])^2+(x[k,3]-x[which_point,3])^2) #determine squared displacement between points
            } else if (dim==3){
              sum <- ((x[k,2]-x[which_point,2])^2+(x[k,3]-x[which_point,3])^2+(x[k,5]-x[which_point,5])^2)
            }
            return(sum)

        }}))

        result[j] <<- mean(sum) #calculate MSD for j time interval

    })
      return(result) #return MSD for different time intervals as vector

    }
  })
  return(coef)
}


TRACK_MSD <- function(x,n=5,framerate=0.1,pxsize=100,truncate=F,dim=2){
  UseMethod("TRACK_MSD")
}

TRACK_MSD.default <- function(x,n=5,framerate=0.1,pxsize=100,truncate=F,dim=2){
  stop("MSD requires data frame")
}

TRACK_MSD.data.frame <-  function(x,n=5,framerate=0.1,pxsize=100,truncate=F,dim=2){
  track_msd(x,n,framerate,pxsize,truncate,dim)

}

TRACK_MSD.list <-  function(x,n=5,framerate=0.1,pxsize=100,truncate=F,dim=2){

  llply(x,function(x){
    out <- TRACK_MSD(x,n,framerate,pxsize,truncate,dim)
    out$cellID <- x$cellID[1]
    return(out)
  })

}

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