class GSL::Vector
Means that inspect
, eval, Marshal.dump etc all work in the expected way
Public Class Methods
_load(string)
click to toggle source
# File lib/gsl_extras.rb, line 31 def self._load(string) return self.alloc(Marshal.load(string)) end
Public Instance Methods
_dump(depth)
click to toggle source
# File lib/gsl_extras.rb, line 28 def _dump(depth) return Marshal.dump(self.to_a) end
gaussian_smooth(sigma)
click to toggle source
# File lib/gsl_extras.rb, line 1100 def gaussian_smooth(sigma) npix = (3.0*sigma).floor smooth = dup smooth.set_all(0.0) kernel = GaussianSmoothKernel.alloc(sigma)# gaussian_smooth_kernel(sigma) # p kernel for i in 0...smooth.size range = [([i - npix, 0].max), ([i + npix, smooth.size - 1].min)] ke = kernel.subvector(range[0] - i + npix, range[1] - range[0] + 1) ke = kernel / ke.sum for j in range[0]..range[1] smooth[i] += self[j] * ke[j - i + npix] end end smooth end
gaussian_smooth!(sigma)
click to toggle source
# File lib/gsl_extras.rb, line 1093 def gaussian_smooth!(sigma) new = gaussian_smooth(sigma) for i in 0...size do i self[i] = new[i] end return nil end
inspect()
click to toggle source
# File lib/gsl_extras.rb, line 23 def inspect "GSL::Vector.alloc(#{to_a.inspect})" end
join(*args)
click to toggle source
# File lib/gsl_extras.rb, line 20 def join(*args) to_a.join(*args) end
mean_no_outliers(nstd=1.0)
click to toggle source
# File lib/gsl_extras.rb, line 1118 def mean_no_outliers(nstd=1.0) av = mean std = sd self.dup.delete_if{|val| (val - mean).abs > nstd * std}.mean end
rectangular_smooth()
click to toggle source
# File lib/gsl_extras.rb, line 1083 def rectangular_smooth smooth = dup for i in 1...(self.size-1) smooth[i] = (self[i-1] + self[i] + self[i+1]) / 3.0 end smooth end
to_gslv()
click to toggle source
aliold :join
# File lib/gsl_extras.rb, line 17 def to_gslv self end