Tarskin / LaCyTools

A high-throughput data extraction package for LC-MS data.
Apache License 2.0
9 stars 5 forks source link

LaCyTools crashes upon looking for a calibrant in an empty region #21

Closed Tarskin closed 8 years ago

Tarskin commented 8 years ago

This bug was fixed by implementing a try/except scheme

            try:
                f = InterpolatedUnivariateSpline(x_points,y_points)
                ySPLINE = f(newX)
                for index, j in enumerate(ySPLINE):
                    if j > maximum[1]:
                        maximum = (newX[index],j)
            except ValueError:
                data = zip(x_points,y_points)
                if self.log == True:
                    with open('LaCyTools.log', 'a') as flog:
                        flog.write(str(datetime.now())+ "\tGuassian Curve Fit failed for analyte: "+str(i[0])+", reverting to non fitted local maximum\n")
                for j in data:
                    if j[1] > maximum[1]:
                        maximum = (j[0],j[1])
            except:
                print "Analyte: "+str(i[0])+" is being troublesome, kill it"