def __set_time(self, time_list): """ @summary: Sets time-related properties of the data @param time_list: List of retention times @type time_list: ListType @author: Vladimir Likic """ # calculate the time step, its spreak, and along the way # check that retention times are increasing time_diff_list = [] for ii in range(len(time_list)-1): t1 = time_list[ii] t2 = time_list[ii+1] if not t2 > t1: error("problem with retention times detected") time_diff = t2 - t1 time_diff_list.append(time_diff) time_step = mean(time_diff_list) time_step_std = std(time_diff_list) self.__time_list = time_list self.__time_step = time_step self.__time_step_std = time_step_std self.__min_rt = min(time_list) self.__max_rt = max(time_list)
def info(self, print_scan_n=False): """ @summary: Prints some information about the data @param print_scan_n: If set to True will print the number of m/z values in each scan @type print_scan_n: BooleanType @author: Vladimir Likic """ # print the summary of simply attributes print " Data retention time range: %.3f min -- %.3f min" % \ (self.__min_rt/60.0, self.__max_rt/60) print " Time step: %.3f s (std=%.3f s)" % ( self.__time_step, \ self.__time_step_std ) print " Number of scans: %d" % ( len(self.__scan_list) ) print " Minimum m/z measured: %.3f" % ( self.__min_mass ) print " Maximum m/z measured: %.3f" % ( self.__max_mass ) # calculate median number of m/z values measured per scan n_list = [] for ii in range(len(self.__scan_list)): scan = self.__scan_list[ii] n = len(scan) n_list.append(n) if print_scan_n: print n mz_mean = mean(n_list) mz_median = median(n_list) print " Mean number of m/z values per scan: %d" % ( mz_mean ) print " Median number of m/z values per scan: %d" % ( mz_median )