class MELTBASELINE::MeltCurve
Public Class Methods
getintercept(x,y,m)
click to toggle source
# File lib/melt_baseline.rb, line 88 def self.getintercept(x,y,m) b = y-(x*m) return b end
getpoint(m,x,b)
click to toggle source
# File lib/melt_baseline.rb, line 93 def self.getpoint(m,x,b) point = m*x+b return point end
getslope(t1,t2,f1,f2)
click to toggle source
# File lib/melt_baseline.rb, line 98 def self.getslope(t1,t2,f1,f2) slope = (f2-f1)/(t2-t1) return slope end
normalize(hs,ts,cw)
click to toggle source
# File lib/melt_baseline.rb, line 53 def self.normalize(hs,ts,cw) # Select a number of points that represents the region BEFORE melting tcstart = 0 tcend = cw # Select a number of points that represents the region AFTER melting bcstart = hs.length() - cw bcend = hs.length() - 1 #find slope of cursor regions m1 = self.getslope(ts[tcstart],ts[tcend],hs[tcstart],hs[tcend]) m2 = self.getslope(ts[bcstart],ts[bcend],hs[bcstart],hs[bcend]) #define intercepts b1 = self.getintercept(ts[tcend],hs[tcend],m1) b2 = self.getintercept(ts[bcstart],hs[bcstart],m2) newF = 1.000 a = [] for i in (0..hs.length()-1) topF=self.getpoint(m1,ts[i],b1); botF=self.getpoint(m2,ts[i],b2); newF = (hs[i].to_f - botF.to_f )/(topF.to_f - botF.to_f ); if(newF < 0 ) newF = 0 end if(newF > 1) newF = 1 end a.push(newF); end return a end