/usr/share/doc/ruby-gsl/examples/ntuple/project.rb is in ruby-gsl 1.15.3+dfsg-2+b1.
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 | #!/usr/bin/env ruby
require("gsl")
sel_func = GSL::Ntuple::SelectFn.alloc { |data, params|
x = data[0]; y = data[1]; z = data[2]
scale = params
e2 = x*x + y*y + z*z
e2 > scale
}
lower = 1.5
sel_func.set_params(lower)
val_func = GSL::Ntuple::ValueFn.alloc { |data|
x = data[0]; y = data[1]; z = data[2]
x*x + y*y + z*z
}
v = GSL::Vector.alloc(3)
n = GSL::Ntuple.open("test.dat", v)
h = GSL::Histogram.alloc(100)
h.set_ranges_uniform(0, 10.0)
#Ntuple.project(h, n, val_func, sel_func)
n.project(h, val_func, sel_func)
h.graph("-C -X 'E2' -Y 'n' -L 'GSL::Ntuple, Select E2 > 1.5'")
File.delete("test.dat")
|