Пример #1
0
    def generate_statistic(datatype):
        dbvalue = __DUT_DB__.format(product_choice)
        if not test_choice:
            return {'data': []}
        testtype = str(".*," + test_choice + ",.*")

        query = {
            "$and": [{
                "_id": {
                    "$regex": testtype
                }
            }, {
                "_id": {
                    "$regex": datatype
                }
            }]
        }
        query_result = utils.query_statistic(query, dbvalue, qual_choice)
        xaxisUser = {'type': 'category', 'tickangle': 45}
        yaxisUser = {'type': 'linear', 'title': datatype}
        if normalize_choice['dut']:
            yaxisUser['range'] = [
                0,
                utils.statistic_upper_limit(dbvalue, qual_choice, test_choice)
            ]

        return {
            'data': [
                go.Scattergl(
                    x=[row['_id_pair']['dut'] for row in query_result],
                    y=[row[series] for row in query_result],
                    text=[
                        row['_id_pair']['dut'] + '<br>' +
                        row['_id_pair']['pcname'] for row in query_result
                    ],
                    opacity=0.85,
                    legendgroup=series,
                    name=series,
                ) for series in __STATS_COLUMN__
            ],
            'layout':
            go.Layout(
                xaxis=xaxisUser,
                yaxis=yaxisUser,
                margin={
                    'b': 40,
                    't': 25,
                    'r': 5
                },
                showlegend=True,
                # legend={'x': 1, 'y': 1},
                # legend=dict(orientation="h"),
                #legend={'orientation': 'h',
                #        'xanchor': 'center',
                #        'y': 1.2,
                #        'x': 0.5
                #        },
                hovermode='closest',
            )
        }
Пример #2
0
def update_figure(product_choice, qual_choice, test_choice, normalize_choice,
                  layer_choice, manual_refresh):
    if not test_choice:
        return []
    xaxisUser = {'title': 'FBC'}
    yaxisUser = {'type': 'log', 'title': 'Sector Count'}

    testtype = str(".*," + test_choice + ".*")
    if normalize_choice['dut']:  #else __DEFAULT_UPPER_LIMIT__[layer]
        xaxisUser['range'] = [
            0,
            utils.statistic_upper_limit(__BLK_DB__.format(product_choice),
                                        qual_choice, testtype)
        ]

    def generate_figure(layer):

        dbvalue = __DUT_DB__.format(product_choice)

        query = {
            "$and": [{
                "_id": {
                    "$regex": testtype
                }
            }, {
                "_id": {
                    "$regex": ".*,{}.*".format(layer)
                }
            }]
        }

        query_result = utils.query_histogram(query, dbvalue, qual_choice)
        #upper_limit = utils.statistic_upper_limit(__BLK_DB__.format(product_choice), qual_choice, normalize_choice, testtype) if normalize_choice['dut'] else __DEFAULT_UPPER_LIMIT__[layer]

        return {
            'data': [
                go.Scattergl(
                    #x=tuple(reversed(row['value'][0])),
                    #y=tuple(accumulate(row['value'][1])),
                    x=tuple(
                        y for x, y in enumerate(reversed(row['value'][0]))
                        if x == 0 or x in range(
                            len(row['value'][0]) - 1, 0, -__SAMPLE_STEP__)),
                    y=tuple(
                        y for x, y in enumerate(
                            reverse_accumulate(row['value'][1]))
                        if x == 0 or x in range(
                            len(row['value'][1]) - 1, 0, -__SAMPLE_STEP__)),
                    text=row['_id_pair']['dut'] + '<br>' +
                    row['_id_pair']['pcname'] + '<br>' +
                    'S{}, G{}'.format(row['_id_pair'].get('setno', 0),
                                      row['_id_pair'].get('groupno', 0)),
                    mode='lines+markers',
                    opacity=0.7,
                    marker={
                        'size': 5,
                        'line': {
                            'width': 0.5,
                            'color': 'white'
                        }
                    },
                    name=row['_id_pair']['dut'] + '<br>' +
                    row['_id_pair']['pcname'] + '<br>' +
                    'S{}, G{}'.format(row['_id_pair'].get('setno', 0),
                                      row['_id_pair'].get('groupno', 0)),
                ) for row in query_result
            ],
            'layout':
            go.Layout(xaxis=xaxisUser,
                      yaxis=yaxisUser,
                      margin={
                          'b': 40,
                          't': 25,
                          'r': 15
                      },
                      showlegend=False,
                      legend={
                          'x': 1,
                          'y': 1
                      },
                      hovermode='closest')
        }

    chart_title = {
        'LP': 'Lower Page Histogram',
        'MP': 'Middle Page Histogram',
        'UP': 'Upper Page Histogram',
        'SLC': 'Single Page Histogram'
    }
    return [
        html.Div([
            html.Div(
                html.B(chart_title[layer]),
                className='row container theme-color-tertiary',
            ),
            html.Div(
                dcc.Graph(id='R1' + layer,
                          figure=generate_figure(layer),
                          className='row'))
        ],
                 className="{} columns".format(
                     utils.number_to_word(int(12 / len(layer_choice)))))
        for layer in layer_choice
    ]
Пример #3
0
    def generate_statistic(datatype):
        dbvalue = __BLK_DB__.format(product_choice)
        if not dut_choice:
            return {'data': []}
        if not die_choice:
            return {'data': []}
        testtype = str(".*," + test_choice + ".*")
        duttype = str(".*," + dut_choice + ".*")
        dietype = str(".*," + die_choice.split(',')[0].split('X')[1] + "," +
                      die_choice.split(',')[1].split('Y')[1] + ".*")

        query = {
            "$and": [{
                "_id": {
                    "$regex": testtype
                }
            }, {
                "_id": {
                    "$regex": duttype
                }
            }, {
                "_id": {
                    "$regex": dietype
                }
            }, {
                "_id": {
                    "$regex": datatype
                }
            }]
        }

        query_result = utils.query_statistic(query, dbvalue, qual_choice)
        #upper_limit = utils.statistic_upper_limit(__BLK_DB__.format(product_choice), qual_choice, normalize_choice, test_choice, dut_choice, die_choice)
        xaxisUser = {'title': 'Block', 'type': 'category', 'tickangle': 45}
        yaxisUser = {'type': 'linear', 'title': datatype}
        if normalize_choice['blk']:  #else __DEFAULT_UPPER_LIMIT__[layer]
            yaxisUser['range'] = [
                0,
                utils.statistic_upper_limit(dbvalue, qual_choice, test_choice,
                                            dut_choice, die_choice)
            ]

        return {
            'data': [
                go.Scattergl(
                    x=[row['_id_pair']['blk_dec'] for row in query_result],
                    y=[row[series] for row in query_result],
                    text=[
                        dut_choice + "<br>" + die_choice + "<br>" +
                        str(row['_id_pair']['blk_dec']) for row in query_result
                    ],
                    opacity=0.85,
                    legendgroup=series,
                    name=series,
                ) for series in __STATS_COLUMN__
            ],
            'layout':
            go.Layout(
                xaxis=xaxisUser,
                yaxis=yaxisUser,
                margin={
                    'b': 40,
                    't': 25,
                    'r': 5
                },
                showlegend=True,
                #legend={'x': 1, 'y': 1},
                #legend=dict(orientation="h"),
                #legend={'orientation': 'h',
                #        'xanchor': 'center',
                #        'y': 1.2,
                #        'x': 0.5
                #        },
                hovermode='closest',
                barmode='overlay')
        }
Пример #4
0
def update_figure(product_choice, qual_choice, test_choice, dut_choice,
                  die_choice, normalize_choice, layer_choice, manual_refresh):
    if not die_choice:
        return []

    testtype = str(".*," + test_choice + ".*")
    duttype = str(".*," + dut_choice + ".*")
    dietype = str(".*," + die_choice.split(',')[0].split('X')[1] + "," +
                  die_choice.split(',')[1].split('Y')[1] + ".*")
    xaxisUser = {'title': 'BlockNo', 'type': 'category', 'tickangle': 45}
    yaxisUser = {'type': 'linear', 'title': 'Stats'}
    if normalize_choice['blk']:  #else __DEFAULT_UPPER_LIMIT__[layer]
        yaxisUser['range'] = [
            0,
            utils.statistic_upper_limit(__BLK_DB__.format(product_choice),
                                        qual_choice, testtype, duttype,
                                        dietype)
        ]

    def generate_figure(layer):
        dbvalue = __BLK_DB__.format(product_choice)

        query = {
            "$and": [{
                "_id": {
                    "$regex": testtype
                }
            }, {
                "_id": {
                    "$regex": duttype
                }
            }, {
                "_id": {
                    "$regex": dietype
                }
            }, {
                "_id": {
                    "$regex": ".*,{}.*".format(layer)
                }
            }]
        }

        query_result = utils.query_statistic(query, dbvalue, qual_choice)
        #upper_limit = utils.statistic_upper_limit(__BLK_DB__.format(product_choice), qual_choice, normalize_choice, test_choice, dut_choice, die_choice)

        return {
            'data': [
                go.Scatter(
                    x=[row['_id_pair']['blk_dec'] for row in query_result],
                    y=[row[series] for row in query_result],
                    text=[
                        str(row['_id_pair']['blk_dec']) + '<br>' +
                        'S{}, G{}'.format(row['_id_pair'].get('setno', 0),
                                          row['_id_pair'].get('groupno', 0))
                        for row in query_result
                    ],
                    opacity=0.7,
                    legendgroup=series,
                    name=series,
                ) for series in __STATS_COLUMN__
            ],
            'layout':
            go.Layout(
                xaxis=xaxisUser,
                yaxis=yaxisUser,
                margin={
                    'b': 40,
                    't': 25,
                    'r': 5
                },
                showlegend=True,
                # legend={'x': 1, 'y': 1},
                # legend=dict(orientation="h"),
                #legend={'orientation': 'h',
                #        'xanchor': 'center',
                #        'y': 1.2,
                #        'x': 0.5
                #        },
                hovermode='closest',
            )
        }

    chart_title = {
        'LP': 'Lower Page Statistics',
        'MP': 'Middle Page Statistics',
        'UP': 'Upper Page Statistics',
        'SLC': 'Single Page Statistics'
    }
    return [
        html.Div([
            html.Div(
                html.B(chart_title[layer]),
                className='row container theme-color-tertiary',
            ),
            html.Div(
                dcc.Graph(id='R3' + layer,
                          figure=generate_figure(layer),
                          className='row'))
        ],
                 className="{} columns".format(
                     utils.number_to_word(int(12 / len(layer_choice)))))
        for layer in layer_choice
    ]