Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The dash plot in the plot example does also not compile correctly #311

Closed
mltja opened this issue Sep 22, 2022 · 1 comment
Closed
Assignees
Labels

Comments

@mltja
Copy link
Member

mltja commented Sep 22, 2022

The dash plot in the plot example does also not compile correctly. Maybe it needs to be excluded when the notebook is compiled by sphinx. You could e.g. try if "READTHEDOCS" not in os.environ .

@birgits: The dash plot also doesn't compile correctly when the notebook is executed regularly. I get the following error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [14], in <cell line: 1>()
----> 1 plot_dash(edisgo_objects=edisgo_analyzed)
      2 time.sleep(2)

File ~/Documents/PythonProjects/eDisGo_orig/eDisGo/edisgo/tools/plots.py:2143, in plot_dash(edisgo_objects, mode, debug, port)
   2110 def plot_dash(
   2111     edisgo_objects: EDisGo | dict[str, EDisGo],
   2112     mode: str = "inline",
   2113     debug: bool = False,
   2114     port: int = 8050,
   2115 ):
   2116     """
   2117     Shows the generated jupyter dash app from given eDisGo object(s).
   2118 
   (...)
   2141 
   2142     """
-> 2143     app = plot_dash_app(edisgo_objects, debug=debug)
   2144     log = logging.getLogger("werkzeug")
   2145     log.setLevel(logging.ERROR)

File ~/Documents/PythonProjects/eDisGo_orig/eDisGo/edisgo/tools/plots.py:1982, in plot_dash_app(edisgo_objects, debug)
   1869         return fig_1, fig_2
   1871 else:
   1872     app.layout = html.Div(
   1873         [
   1874             html.Div(
   1875                 [
   1876                     html.Div(
   1877                         [
   1878                             html.Label("Grid"),
   1879                             dcc.Dropdown(
   1880                                 id="dropdown_grid",
   1881                                 options=[
   1882                                     {"label": i, "value": i} for i in grid_name_list
   1883                                 ],
   1884                                 value=grid_name_list[1],
   1885                             ),
   1886                         ],
   1887                         style={"padding": padding, "flex": 1},
   1888                     ),
   1889                     html.Div(
   1890                         [
   1891                             html.Label("Line plot mode"),
   1892                             dcc.Dropdown(
   1893                                 id="dropdown_line_plot_mode",
   1894                                 options=[
   1895                                     {"label": i, "value": i}
   1896                                     for i in line_plot_modes
   1897                                 ],
   1898                                 value=line_plot_modes[0],
   1899                             ),
   1900                         ],
   1901                         style={"padding": padding, "flex": 1},
   1902                     ),
   1903                     html.Div(
   1904                         [
   1905                             html.Label("Line result selection"),
   1906                             dcc.Dropdown(
   1907                                 id="line_result_selection",
   1908                                 options=[
   1909                                     {"label": "Min", "value": "min"},
   1910                                     {"label": "Max", "value": "max"},
   1911                                 ],
   1912                                 value="max",
   1913                             ),
   1914                         ],
   1915                         style={"padding": padding, "flex": 1},
   1916                     ),
   1917                 ],
   1918                 style={
   1919                     "display": "flex",
   1920                     "flex-direction": "row",
   1921                     "padding": 0,
   1922                     "flex": 1,
   1923                 },
   1924             ),
   1925             html.Div(
   1926                 [
   1927                     html.Div(
   1928                         [
   1929                             html.Label("Pseudo coordinates"),
   1930                             dcc.RadioItems(
   1931                                 id="radioitems_pseudo_coordinates",
   1932                                 options=[
   1933                                     {"label": "False", "value": False},
   1934                                     {"label": "True", "value": True},
   1935                                 ],
   1936                                 value=False,
   1937                             ),
   1938                         ],
   1939                         style={"padding": padding, "flex": 1},
   1940                     ),
   1941                     html.Div(
   1942                         [
   1943                             html.Label("Node plot mode"),
   1944                             dcc.Dropdown(
   1945                                 id="dropdown_node_plot_mode",
   1946                                 options=[
   1947                                     {"label": i, "value": i}
   1948                                     for i in node_plot_modes
   1949                                 ],
   1950                                 value=node_plot_modes[0],
   1951                             ),
   1952                         ],
   1953                         style={"padding": padding, "flex": 1},
   1954                     ),
   1955                     html.Div(
   1956                         [
   1957                             html.Label("Node result selection"),
   1958                             dcc.Dropdown(
   1959                                 id="node_result_selection",
   1960                                 options=[
   1961                                     {"label": "Min", "value": "min"},
   1962                                     {"label": "Max", "value": "max"},
   1963                                 ],
   1964                                 value="max",
   1965                             ),
   1966                         ],
   1967                         style={"padding": padding, "flex": 1},
   1968                     ),
   1969                 ],
   1970                 style={
   1971                     "display": "flex",
   1972                     "flex-direction": "row",
   1973                     "padding": 0,
   1974                     "flex": 1,
   1975                 },
   1976             ),
   1977             html.Div(
   1978                 [
   1979                     html.Div(
   1980                         [
   1981                             html.Label("Time step mode"),
-> 1982                             dcc.RadioItems(
   1983                                 ["Single", "Range", "All"],
   1984                                 "All",
   1985                                 inline=True,
   1986                                 id="timestep_mode_radio",
   1987                             ),
   1988                         ],
   1989                         style={"padding": padding, "flex": 1},
   1990                     ),
   1991                     html.Div(
   1992                         [
   1993                             html.Label("Time step start"),
   1994                             dcc.Dropdown(
   1995                                 id="timestep_dropdown_start",
   1996                                 options=timestep_option,
   1997                                 value=timestep_option[0]["value"],
   1998                             ),
   1999                         ],
   2000                         style={"padding": padding, "flex": 1},
   2001                     ),
   2002                     html.Div(
   2003                         [
   2004                             html.Label("Time step end"),
   2005                             dcc.Dropdown(
   2006                                 id="timestep_dropdown_end",
   2007                                 options=timestep_option,
   2008                                 value=timestep_option[-1]["value"],
   2009                             ),
   2010                         ],
   2011                         style={"padding": padding, "flex": 1},
   2012                     ),
   2013                 ],
   2014                 style={
   2015                     "display": "flex",
   2016                     "flex-direction": "row",
   2017                     "padding": 0,
   2018                     "flex": 1,
   2019                 },
   2020             ),
   2021             html.Div(
   2022                 [html.Div([dcc.Graph(id="fig")], style={"flex": "auto"})],
   2023                 style={"display": "flex", "flex-direction": "row"},
   2024             ),
   2025         ],
   2026         style={"display": "flex", "flex-direction": "column"},
   2027     )
   2029     @app.callback(
   2030         Output("timestep_dropdown_start", "disabled"),
   2031         Output("timestep_dropdown_end", "disabled"),
   2032         Input("timestep_mode_radio", "value"),
   2033     )
   2034     def update_timestep_components_single(timestep_mode_radio):
   2035         if timestep_mode_radio == "Single":

File ~/Documents/PythonProjects/eDisGo_orig/d_py38_edisgo/lib/python3.8/site-packages/dash/development/base_component.py:388, in _explicitize_args.<locals>.wrapper(*args, **kwargs)
    386 if "self" in kwargs["_explicit_args"]:
    387     kwargs["_explicit_args"].remove("self")
--> 388 return func(*args, **kwargs)

TypeError: __init__() got multiple values for argument 'id'

Originally posted by @maike93he in #292 (comment)

@mltja mltja self-assigned this Sep 22, 2022
@mltja mltja changed the title > The dash plot in the plot example does also not compile correctly. Maybe it needs to be excluded when the notebook is compiled by sphinx. You could e.g. try if "READTHEDOCS" not in os.environ . BUG: The dash plot in the plot example does also not compile correctly Sep 22, 2022
@mltja mltja added the bug label Sep 22, 2022
@mltja mltja changed the title BUG: The dash plot in the plot example does also not compile correctly [BUG] The dash plot in the plot example does also not compile correctly Sep 23, 2022
@mltja
Copy link
Member Author

mltja commented Sep 26, 2022

Error was not reproducible after reinstalling edisgo.

@mltja mltja closed this as completed Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant