modules/cij/xlsx.py
def gen_data_sheet(self, datafile, para_meter, scale=1.75, steady_time=300):
        """
        datafile, sheetname, x_axis_name, y_axis_name, title,
        Function:
            Turn realtime bw data into picture, and save into specific sheet
        Input:
            sheetname: If already exists, new chart will be added continuely.
                       Otherwise, it would create new sheet;
            x_axis_name: x_axis name;
            y_axis_name: y_axis name;
            title: picure name;
            scale； size of picture.
        """
        filename = os.path.splitext(os.path.split(datafile)[1])[0][:-5]
        para_meter['filename'] = filename
        source_data = np.loadtxt(datafile, dtype=int, delimiter=',')[:, :3]
        is_bw = 'bw'in para_meter['title'].lower()
        file_data = process_rt_data(source_data, is_bw)
        pic_path = generate_rt_pic(file_data, para_meter, scale)
        pic_path_steady = generate_steady_rt_pic(file_data, para_meter, scale, steady_time)
        if para_meter['sheetname'] in self.sheetname_dict.keys():
            self.sheetname_dict[para_meter['sheetname']] = \
                self.sheetname_dict[para_meter['sheetname']] + 1
            chart_sheet = self.workbook.get_worksheet_by_name(para_meter['sheetname'])
        else:
            self.sheetname_dict[para_meter['sheetname']] = 1
            chart_sheet = self.workbook.add_worksheet(para_meter['sheetname'])
        chart_sheet.insert_image('B%d' %
                                 (5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30),
                                 pic_path)
        chart_sheet.insert_image('Q%d' %
                                 (5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30),
                                 pic_path_steady)
        self.__insert_value(chart_sheet, file_data,
                            5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30,
                            steady_time)
        self.pic_list.append(pic_path)
        self.pic_list.append(pic_path_steady)
def gen_data_sheet(self, datafile, para_meter, scale=1.75, steady_time=300):
        """
        datafile, sheetname, x_axis_name, y_axis_name, title,
        Function:
            Turn realtime bw data into picture, and save into specific sheet
        Input:
            sheetname: If already exists, new chart will be added continuely.
                       Otherwise, it would create new sheet;
            x_axis_name: x_axis name;
            y_axis_name: y_axis name;
            title: picure name;
            scale； size of picture.
        """
        filename = os.path.splitext(os.path.split(datafile)[1])[0][:-5]
        para_meter['filename'] = filename
        source_data = np.loadtxt(datafile, dtype=int, delimiter=',')[:, :3]
        is_bw = 'bw'in para_meter['title'].lower()
        file_data = process_rt_data(source_data, is_bw)
        pic_path = generate_rt_pic(file_data, para_meter, scale)
        pic_path_steady = generate_steady_rt_pic(file_data, para_meter, scale, steady_time)
        if para_meter['sheetname'] in self.sheetname_dict.keys():
            self.sheetname_dict[para_meter['sheetname']] = \
                self.sheetname_dict[para_meter['sheetname']] + 1
            chart_sheet = self.workbook.get_worksheet_by_name(para_meter['sheetname'])
        else:
            self.sheetname_dict[para_meter['sheetname']] = 1
            chart_sheet = self.workbook.add_worksheet(para_meter['sheetname'])
        chart_sheet.insert_image('B%d' %
                                 (5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30),
                                 pic_path)
        chart_sheet.insert_image('Q%d' %
                                 (5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30),
                                 pic_path_steady)
        self.__insert_value(chart_sheet, file_data,
                            5 + (self.sheetname_dict[para_meter['sheetname']] - 1) * 30,
                            steady_time)
        self.pic_list.append(pic_path)
        self.pic_list.append(pic_path_steady)
def gen_data_sheet ( self , datafile , para_meter , scale = 1.75 , steady_time = 300 ) : filename = os . path . splitext ( os . path . split ( datafile ) [ 1 ] ) [ 0 ] [ : - 5 ] para_meter [ 'filename' ] = filename source_data = np . loadtxt ( datafile , dtype = int , delimiter = ',' ) [ : , : 3 ] is_bw = 'bw' in para_meter [ 'title' ] . lower ( ) file_data = process_rt_data ( source_data , is_bw ) pic_path = generate_rt_pic ( file_data , para_meter , scale ) pic_path_steady = generate_steady_rt_pic ( file_data , para_meter , scale , steady_time ) if para_meter [ 'sheetname' ] in self . sheetname_dict . keys ( ) : self . sheetname_dict [ para_meter [ 'sheetname' ] ] = self . sheetname_dict [ para_meter [ 'sheetname' ] ] + 1 chart_sheet = self . workbook . get_worksheet_by_name ( para_meter [ 'sheetname' ] ) else : self . sheetname_dict [ para_meter [ 'sheetname' ] ] = 1 chart_sheet = self . workbook . add_worksheet ( para_meter [ 'sheetname' ] ) chart_sheet . insert_image ( 'B%d' % ( 5 + ( self . sheetname_dict [ para_meter [ 'sheetname' ] ] - 1 ) * 30 ) , pic_path ) chart_sheet . insert_image ( 'Q%d' % ( 5 + ( self . sheetname_dict [ para_meter [ 'sheetname' ] ] - 1 ) * 30 ) , pic_path_steady ) self . __insert_value ( chart_sheet , file_data , 5 + ( self . sheetname_dict [ para_meter [ 'sheetname' ] ] - 1 ) * 30 , steady_time ) self . pic_list . append ( pic_path ) self . pic_list . append ( pic_path_steady )
datafile, sheetname, x_axis_name, y_axis_name, title,
        Function:
            Turn realtime bw data into picture, and save into specific sheet
        Input:
            sheetname: If already exists, new chart will be added continuely.
                       Otherwise, it would create new sheet;
            x_axis_name: x_axis name;
            y_axis_name: y_axis name;
            title: picure name;
            scale； size of picture.
datafile sheetname x_axis_name y_axis_name title Function : Turn realtime bw data into picture and save into specific sheet Input : sheetname : If already exists new chart will be added continuely . Otherwise it would create new sheet ; x_axis_name : x_axis name ; y_axis_name : y_axis name ; title : picure name ; scale； size of picture .