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

  • fb709cd
  • /
  • elab
  • /
  • fit_sigmoid.sh
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
  • directory
content badge
swh:1:cnt:5399accd86c60bda730fd55e0080ff78943fc535
directory badge
swh:1:dir:dfa713e6b38d381303f13440b8e2620e52d74c39

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
fit_sigmoid.sh
#!/usr/bin/env Rscript

args = commandArgs(trailingOnly=TRUE)

if (length(args) != 7)
{
  stop("Seven arguments required: filename init_a init_b init_c filename_out intersection_file_out oculus_first_file", call. = FALSE)
}

filename = args[1]
init_a = args[2]
init_b = args[3]
init_c = args[4]
filename_out = args[5]
intersection_file_out = args[6]
oculus_first_file = args[7]

init_b = as.double(init_b)
init_c = as.double(init_c)

print(paste("Processing file: ", filename, sep=""))

data = read.csv(filename, header = FALSE, colClasses = c("numeric", "numeric", "numeric"), sep="\t")
names(data) <- c('x','y','tot')
if (substr(init_a, 1, 1) != "f")
{
  init_a = as.double(init_a)
  #result = nls((y/tot) ~ a/(1 + exp(-b * (x - m))), start=list(a=init_a, b=init_b, m=init_c), data=data, trace=TRUE)
  result = nls((y/tot) ~ a * (1 - exp(-(x*b)**c)), start=list(a=init_a, b=init_b, c=init_c), data=data, trace=TRUE)
  myvector <- coef(result)
  a <- myvector[1]
  b <- myvector[2]
  c <- myvector[3]
} else
{
  forced_a = substr(init_a, 2, 100000)
  forced_a <- as.double(forced_a)
  print(paste("Parsing used forced a = ", forced_a, sep=""))
  #result = nls((y/tot) ~ forced_a/(1 + exp(-b * (x - m))), start=list(b=init_b, m=init_c), data=data, trace=TRUE)
  result = nls((y/tot) ~ forced_a * (1 - exp(-(x*b)**c)), start=list(b=init_b, c=init_c), data=data, trace=TRUE)
  myvector <- coef(result)
  a <- forced_a
  b <- myvector[1]
  c <- myvector[2]
}

print(myvector)

fout <- file(filename_out, "w")
writeLines(sprintf("%f %f %f", a, b, c), con = fout)
close(fout)

inters_data = read.csv(oculus_first_file, header = FALSE, colClasses = c("numeric", "numeric"), sep="\t")
inters = inters_data[1] / inters_data[2]

yinters = inters
#xinters = -log(a / yinters - 1)/b + c
xinters = (-log(-(yinters / a - 1)))**(1/c)/b

fout <- file(intersection_file_out, "w")
writeLines(sprintf("%f %f", xinters, yinters), con = fout)
close(fout)

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