Ejemplo n.º 1
0
def test_render_hm(dash_duo):

    with open('tests/data/hm_data.json', 'r') as f:
        hm_data = f.read()

    app = dash.Dash(__name__)

    app.layout = html.Div([
        webviz_subsurface_components.HistoryMatch(id='parameters',
                                                  data=hm_data),
    ])

    dash_duo.start_server(app)

    # Get text of first data series
    my_component = dash_duo.wait_for_element_by_css_selector(
        '#g_history_matching_plot > text', timeout=4)

    assert 'Misfit overview for Iteration 0' == my_component.text
Ejemplo n.º 2
0
def test_render_hm(dash_duo):

    with open("tests/data/hm_data.json", "r") as json_file:
        hm_data = json.load(json_file)

    app = dash.Dash(__name__)

    app.layout = html.Div([
        webviz_subsurface_components.HistoryMatch(id="parameters",
                                                  data=hm_data),
    ])

    dash_duo.start_server(app)

    # Get text of first data series
    my_component = dash_duo.wait_for_element_by_css_selector(
        "#g_history_matching_plot > text", timeout=4)

    assert my_component.text == "Misfit overview for Iteration 0"
Ejemplo n.º 3
0
    def _iterations_to_dict(self, iterations, labels):
        retval = []

        for iteration, label in zip(iterations, labels):
            retval.append(
                {
                    "name": label,
                    "positive": iteration["avg_pos"].tolist(),
                    "negative": iteration["avg_neg"].tolist(),
                    "labels": iteration.index.tolist(),
                }
            )

        return retval


data = generate_synthetic_data(num_groups=50, num_iter=4, num_realizations=100)

app = dash.Dash(__name__)

app.layout = html.Div(
    children=[
        webviz_subsurface_components.HistoryMatch(
            id="parameters", data=HistoryMatch(data).get_data()
        )
    ]
)

if __name__ == "__main__":
    app.run_server(debug=True)
Ejemplo n.º 4
0
 def layout(self):
     return html.Div([wsc.HistoryMatch(id=self.hm_id, data=self.hm_data)])
Ejemplo n.º 5
0
                                 sorted_df['avg_neg']).sort_values(
                                     'f', ascending=False).drop('f', axis=1))

        return sorted_data

    def _iterations_to_dict(self, iterations, labels):
        retval = []

        for iteration, label in zip(iterations, labels):
            retval.append({
                'name': label,
                'positive': iteration['avg_pos'].tolist(),
                'negative': iteration['avg_neg'].tolist(),
                'labels': iteration.index.tolist()
            })

        return retval


data = generate_synthetic_data(num_groups=50, num_iter=4, num_realizations=100)

hm_data = (json.dumps(HistoryMatch(data).get_data()))

app = dash.Dash(__name__)

app.layout = html.Div(children=[
    webviz_subsurface_components.HistoryMatch(id='parameters', data=hm_data)
])

if __name__ == '__main__':
    app.run_server(debug=True)