Exemple #1
0
def UpdateCharTableField(Conditions,
                         Value,
                         Table='ACcharacts',
                         Field='Comments'):

    Conditions = CheckConditionsCharTable(Conditions, Table)

    MyDb = PyFETdb.PyFETdb()

    out = '{}.id{}'.format(Table, Table)
    re = MyDb.GetCharactInfo(Table=Table,
                             Conditions=Conditions,
                             Output=(out, ))

    print(re)
    text = "Do you wan to update {} in {} for {} y/n ?".format(
        Field, Table, Value)
    inText = input(text)
    if inText == 'y':
        print('Updated')
        field = '{}.{}'.format(Table, Field)
        fields = {field: Value}
        for r in re:
            condition = ('{}.id{}='.format(Table, Table), list(r.values())[0])
            MyDb.UpdateRow(Table=Table, Fields=fields, Condition=condition)
    else:
        print('Cancelled')

    MyDb.db.commit()
Exemple #2
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)

        uipath = os.path.join(os.path.dirname(__file__), 'GuiDBView.ui')
        uic.loadUi(uipath, self)

        self.setWindowTitle('PyFETdb Viewer')

        self.DB = PyFETdb.PyFETdb()

        self.InitMenu()
        self.ConnectLst()

        self.ButResetSearch.clicked.connect(self.ButResetSearchClick)
        self.ButSetData.clicked.connect(self.ButSetDataClick)

        self.ButViewDC.clicked.connect(self.ButViewDCClick)
        self.ButExportDC.clicked.connect(self.ButExportDCClick)

        self.ButAnalyzeAC.clicked.connect(self.ButAnalyzeACClick)
        self.ButExportAC.clicked.connect(self.ButExportACClick)
        self.ButViewAC.clicked.connect(self.ButViewACClick)

        self.ButDeleteAC.clicked.connect(self.ButDeleteACClick)
        self.TblAC.cellChanged.connect(self.TblACCellChanged)
        self.TblDC.cellChanged.connect(self.TblDCCellChanged)
        self.TblTrts.cellChanged.connect(self.TblTrtsCellChanged)

        self.ButDeleteDC.clicked.connect(self.ButDeleteDCClick)
        self.ButAnalyzeDC.clicked.connect(self.ButAnalyzeDCClick)

        # Init Tables
        self.TblTrts.setColumnCount(len(self.TrtFields))
        for c in self.TrtFields.values():
            self.TblTrts.setHorizontalHeaderItem(
                c[1], QtWidgets.QTableWidgetItem(c[0]))
        header = self.TblTrts.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)

        # Init Tables
        self.TblDC.setColumnCount(len(self.DCFields))
        for c in self.DCFields.values():
            self.TblDC.setHorizontalHeaderItem(
                c[1], QtWidgets.QTableWidgetItem(c[0]))
        header = self.TblDC.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)

        # Init Tables
        self.TblAC.setColumnCount(len(self.ACFields))
        for c in self.ACFields.values():
            self.TblAC.setHorizontalHeaderItem(
                c[1], QtWidgets.QTableWidgetItem(c[0]))
        header = self.TblAC.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.ResizeToContents)

        # Init
        self.ButResetSearchClick()
Exemple #3
0
def FindCommonValues(Parameter, Conditions, Table='ACcharacts', **kwargs):
    Conditions = CheckConditionsCharTable(Conditions, Table)

    if Parameter.startswith('CharTable'):
        Parameter = Parameter.replace('CharTable', Table)

    MyDb = PyFETdb.PyFETdb()
    #    MyDb = PyFETdb.PyFETdb()

    Output = (Parameter, )
    Res = MyDb.GetCharactInfo(Table=Table,
                              Conditions=Conditions,
                              Output=Output)

    del (MyDb)
    #  Generate a list of tupples with devices Names and comments
    Values = []
    for Re in Res:
        Values.append(Re[Parameter])

    return set(Values)
Exemple #4
0
def GetFromDB(Conditions,
              Table='ACcharacts',
              Last=True,
              GetGate=True,
              OutilerFilter=None,
              DataSelectionConfig=None):
    """
    Get data from data base

    This function returns data which meets with "Conditions" dictionary for sql
    selct query constructor.

    Parameters
    ----------
    Conditions : dictionary, conditions to construct the sql select query.
        The dictionary should follow this structure:\n
        {'Table.Field <sql operator>' : iterable type of values}
        \nExample:\n
        {'Wafers.Name = ':(B10803W17, B10803W11),
        'CharTable.IsOK > ':(0,)}
    Table : string, optional. Posible values 'ACcharacts' or 'DCcharacts'.
        The default value is 'ACcharacts'. Characterization table to get data
        \n
        The characterization table of Conditions dictionary can be indicated
        as 'CharTable'. In that case 'CharTable' will be replaced by Table
        value. 
    Last : bolean, optional. If True (default value) just the last measured
        data for each transistor is returned. If False, all measured data is
        returned
    Last : bolean, optional. If True (default value) the gate measured data
        is also obtained
    OutilerFilter : dictionary, optional. (default 'None'),
        If defined, dictionary to perform a statistical pre-evaluation of the
        data. The data that are not between the p25 and p75 percentile are
        not returned. The dictionary should follow this structure:
        {'Param':Value, --> Characterization parameter, ie. 'Ids', 'Vrms'...
         'Vgs':Value,   --> Vgs evaluation point
         'Vds':Value,   --> Vds evaluationd point
         'Ud0Norm':Boolean} --> Indicates if Vgs is normalized to CNP

    Returns
    -------
    Return : tupple of (Data, Trts)
    Data: Dictionary with the data arranged as follows:
        {'Transistor Name':list of PyGFET.DataClass.DataCharAC classes}

    Trts: List of transistors

    Examples
    --------

    """

    Conditions = CheckConditionsCharTable(Conditions, Table)

    MyDb = PyFETdb.PyFETdb()

    DataD, Trts = MyDb.GetData2(Conditions=Conditions,
                                Table=Table,
                                Last=Last,
                                GetGate=GetGate)

    del (MyDb)
    Trts = list(Trts)
    Total = float(len(Trts))

    Data = {}
    for Trtn, Cys in DataD.items():
        Chars = []
        for Cyn, Dat in sorted(Cys.items()):
            Char = DataCharAC(Dat)
            Chars.append(Char)
        Data[Trtn] = Chars

    logging.debug('Getting Data from %s', Conditions)
    print('Trts Found ->', len(Trts))

    if OutilerFilter is not None:
        logging.debug('Look for Outliers %s', OutilerFilter)
        Data = RemoveOutilers(Data, OutilerFilter)
        Trts = Data.keys()
        logging.debug('Input Trts %d Output Trts d', Total, len(Trts))
        print('Outlier filter Yield -> ', len(Trts) / Total)

    if DataSelectionConfig is not None:
        Trts = {}
        Trts['Total'] = Data.keys()
        for DataSel in DataSelectionConfig:
            logging.debug('Look for data in range %s', DataSel)
            if 'Name' not in DataSel:
                DataSel['Name'] = DataSel['Param']
            Data = DataSelection(Data, **DataSel)
            Trts[DataSel['Name']] = Data.keys()
            logging.debug('Input Trts %d Output Trts %d', Total, len(Trts))

        Trts['Final'] = Data.keys()
        for DataSel in DataSelectionConfig:
            name = DataSel['Name']
            v = float(len(Trts[name]))
            if Total > 0:
                print(name, ' Yield -> ', v / Total)

    return Data, Trts