示例#1
0
    def test_tpid_eval_full_scan(self):
        """
        Test the full scan

        @return:
        @rtype:
        """
        data = self.data_csv
        steps = self.steps_csv

        res_wb = tpidmany.tpid_eval_full_scan(data, steps, 7)
        self.xl_need_closing.append(res_wb.Parent)

        xl, wb, ws, cells = xlObjs(self.exp_full_result, visible=False)
        self.xl_need_closing.append(xl)

        result = res_wb.Worksheets(1).UsedRange.Value2
        expected = wb.Worksheets(1).UsedRange.Value2

        # Include excel cell address of any mismatch
        # start = 1 for 1 based index
        addr = cellStr
        for r, (exp_row, result_row) in enumerate(zip_longest(result, expected), 1):
            for c, (exp_cell, result_cell) in enumerate(zip_longest(exp_row, result_row), 1):
                self.assertEqual(exp_cell, result_cell, msg=addr(r, c))
示例#2
0
    def __init__(self, files=(), savepath='', savename="Compiled KLA Data"):
        self._tests = []
        files = files or ()
        for file in files:
            self.add_file(file)

        self._xl, self._wb, self._ws, self._cells = xlObjs()
        self._ws.Name = "Data"
        self._path = savepath or "C:\\Users\\Public\\Documents\\PBSSS\\KLA Testing\\" + pretty_date() + "\\"
        if not self._path.endswith("\\"):
            self._path += "\\"
        self._ln_chart = None
        self._linear_chart = None
        self._current_col = 1
        self._savename = savename
示例#3
0
    def process_csv(self, file, chart_name="KLA"):
        """
        Analyzing data is ugly. Analyze 'file', where 'file' is a csv file
         corresponding to a batch data report with KLA data.
        """
        print("Opening new worksheet")
        xl, wb, ws, cells = xlObjs(file, visible=False)
        with HiddenXl(xl, True):
            # XXX what if cell not found?
            do_cell = cells.Find(What="DOPV(%)", After=cells(1, 1), SearchOrder=xlByRows)
            xcol = do_cell.Column + 1
            end_row = do_cell.End(xlDown).Row
            print("Performing data analysis")
            self._insert_time_col(ws, cells, xcol)
            self._insert_ln_col(ws, cells, xcol + 2)

            print("Creating data plot")

            # XXX possible in one call?
            ws.Columns(xcol + 3).Insert(Shift=xlToRight)
            ws.Columns(xcol + 3).Insert(Shift=xlToRight)

            ln_x, ln_y, lin_x, lin_y = _MakeNamedRanges(wb, ws, cells, 2, end_row, xcol - 1).get_ranges()

            # ln v time for specific chart
            chart = CreateChart(ws, xlXYScatter)
            CreateDataSeries(chart, ln_x, ln_y)
            FormatChart(chart, None, chart_name + "-LN(100-DOPV)", "Time(hour)", "-LN(DO PV (%))", True, False)

            # do v time
            chart2 = CreateChart(ws, xlXYScatter)
            CreateDataSeries(chart2, lin_x, lin_y)
            FormatChart(chart2, None, chart_name + "DO PV", "Time(hour)", "DO (%)", True, False)

            # uncomment to move to move chart to new sheet
            # xlLocationAsNewSheet = 1
            # chart.Location(1)

            save_name = file.replace(file[file.rfind("."):], '.xlsx')

            # uncomment to save in raw data  folder
            # wb.SaveAs(save_name, AddToMru=False)

            wb.SaveAs(self._path + path_split(save_name)[1], AddToMru=False, FileFormat=xlOpenXMLWorkbook)

        return save_name
示例#4
0
def main(fpath):
    """
    @param fpath: str
    @type fpath: str
    @return: str
    @rtype: str
    """
    from xllib.xlcom import xlObjs, HiddenXl
    # report = open_report(fpath)
    # for param in report:
    #     print(param)
    xl, wb, ws, cells = xlObjs(fpath, visible=False)
    with HiddenXl(xl):

        make_elapsed_times(cells, "LevelPV(L)")
        make_elapsed_times(cells, "FilterOvenPV(C)")

        level_pv = find_chart_info(cells, "LevelPV(L)")
        exhaust_temp = find_chart_info(cells, "FilterOvenPV(C)")

        level_chart = make_chart(ws, level_pv)
        exhaust_chart = make_chart(ws, exhaust_temp)
示例#5
0
    def add_to_compiled(self, file, series_name):
        xl, wb, ws, cells = xlObjs(file, visible=False)

        # copy data to new ws
        with HiddenXl(xl, True):
            do_cell = cells.Find("DOPV(%)", cells(1, 1), SearchOrder=xlByRows)
            fleft = do_cell.Column
            fright = fleft + 3
            fbottom = do_cell.End(xlDown).Row

            value = cells.Range(cells(1, fleft), cells(fbottom, fright)).Value
            trng = self._cells.Range(self._cells(2, self._current_col),
                                     self._cells(fbottom + 1, self._current_col + fright - fleft))
            trng.Value = value

            # column titles + identifying name
            self._cells(1, self._current_col).Value = series_name
            self._cells(2, self._current_col + 1).Value = "Elapsed Time"
            self._cells(2, self._current_col + 3).Value = "-LN(100-DOPV)"

            ln_x, ln_y, lin_x, lin_y = _MakeNamedRanges(self._wb, self._ws, self._cells, 3, fbottom + 1,
                                                        self._current_col).get_ranges()

            series_name = ("='%s'!" % self._ws.Name) + cellStr(1, self._current_col)

            # add LN chart
            if self._ln_chart is None:
                self._init_ln_chart()
            chart = self._ln_chart
            CreateDataSeries(chart, ln_x, ln_y, series_name)

            # add linear chart
            if self._linear_chart is None:
                self._init_linear_chart()
            chart = self._linear_chart
            CreateDataSeries(chart, lin_x, lin_y, series_name)

        self._current_col += fright - fleft + 2 + 2  # +2 space, + 2 regression columns