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

Raw File Download

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
content badge
swh:1:cnt:6b13fdb48b58daa9c61707d118d2bef559c8c0e3

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
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
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