This file is indexed.

/usr/share/doc/ruby-gsl/examples/fit/gaussian_2peaks.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env ruby
require("gsl")

# Create data
r = GSL::Rng.alloc("knuthran")
amp1 = 5.0
x01 = 1.0
sigma1 = 1.5

amp2 = 2.0
x02 = 5.0
sigma2 = 0.5

y0 = 2.0
N = 300
x = GSL::Vector.linspace(-4, 9, N)
y = y0 + amp1*GSL::Ran::gaussian_pdf(x - x01, sigma1) + amp2*GSL::Ran::gaussian_pdf(x - x02, sigma2) + 0.05*GSL::Ran::gaussian(r, 1.0, N)

coef, err, chi2, dof =  GSL::MultiFit::FdfSolver.fit(x, y, "gaussian_2peak", [2, 4, 0.9, 1, 1, 4, 1])

p coef
y01 = coef[0]

amp1 = coef[1]*Math::sqrt(2*Math::PI)*sigma1
x01 = coef[2]
sigma1 = Math::sqrt(coef[3])

amp2 = coef[4]*Math::sqrt(2*Math::PI)*sigma2
x02 = coef[5]
sigma2 = Math::sqrt(coef[6])

y2 = y01 + amp1*GSL::Ran::gaussian_pdf(x - x01, sigma1) + amp2*GSL::Ran::gaussian_pdf(x - x02, sigma2)

GSL::graph(x, y, y2, "-C -g 3")