Skip to content

Commit

Permalink
Updating structure for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrizsaldana committed Jun 17, 2024
1 parent f758160 commit bede9a5
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ dmypy.json
# Cython debug symbols
cython_debug/

# VScode
.vscode/
.vscode

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

12 changes: 12 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import dash
import dash_bootstrap_components as dbc
from layout import serve_layout

app = dash.Dash(__name__, external_stylesheets = [dbc.themes.BOOTSTRAP])

server = app.server

app.layout = serve_layout()

if __name__ == '__main__':
app.run_server(debug=True)
4 changes: 2 additions & 2 deletions functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from . import sequence_class
from . import find_repeating_sequence
from . import polar_figure_functions
from . import polar_figure_callbacks
from . import many_polar_figures_functions
from . import many_polar_figures_callbacks
from . import polar_figure_callbacks
from . import many_polar_figures_callbacks
2 changes: 1 addition & 1 deletion functions/find_repeating_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def validate_perfect_repeating_sequence(repeating_sequence: List[int], sequence:
sequence: 1,2,3,4,1,2,3,4,1,2,3,4
repeating sequence: 1,2,3,4
This each chunk of sequence of len(repeating_sequence)
Each chunk of sequence of len(repeating_sequence)
is equal to the repeating sequence, then return True,
otherwise return False.
For example:
Expand Down
12 changes: 0 additions & 12 deletions functions/global_functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import plotly.graph_objects as go
from global_files.app import app
from dash import Input, Output


Expand All @@ -10,14 +9,3 @@ def blank_figure() -> go.Figure:
fig.update_yaxes(showgrid=False, scaleanchor='x', showticklabels=False, zeroline=False)
return fig


@app.callback(
Output('information_modal', 'is_open'),
[
Input('information_button', 'n_clicks')
],
prevent_initial_call=True
)
def open_information_modal(information_button_click):
return True

6 changes: 2 additions & 4 deletions functions/many_polar_figures_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from global_files.app import app
from functions.sequence_class import Series
from functions.many_polar_figures_functions import create_many_polar_plots
from functions.get_sequences_functions import get_fibonacci_sequence

from dash import Input, Output
from dash import Input, Output, callback

from assets.config import SERIES_LENGTH, NUMBER_OF_PLOTS


@app.callback(
@callback(
Output('many_polar_figures', 'figure'),
[
Input('series_select', 'value')
Expand All @@ -17,4 +16,3 @@
def update_polar_figure(selected_series):
series = Series.from_known_sequence(name=selected_series, length=SERIES_LENGTH)
return create_many_polar_plots(series=series, number_of_plots=NUMBER_OF_PLOTS)

5 changes: 3 additions & 2 deletions functions/many_polar_figures_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ def create_single_polar_plot(sequence: List[int]) -> go.Scatterpolar:
marker_size = 2
)


def create_empty_polar_plot() -> go.Scatterpolar:
return go.Scatterpolar(
r = [],
theta = []
)


def create_many_polar_plots(series: Series, number_of_plots: int = 80) -> go.Figure:
number_of_columns = 10
number_of_rows, final_row_plot_num = divmod(number_of_plots, number_of_columns)
Expand Down Expand Up @@ -62,7 +64,6 @@ def create_many_polar_plots(series: Series, number_of_plots: int = 80) -> go.Fig
)
divisor+=1


fig.update_layout(
template='simple_white',
showlegend = False,
Expand All @@ -82,4 +83,4 @@ def create_many_polar_plots(series: Series, number_of_plots: int = 80) -> go.Fig
showticklabels=False,
)
)
return fig
return fig
6 changes: 2 additions & 4 deletions functions/polar_figure_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from global_files.app import app
from functions.sequence_class import Series
from functions.polar_figure_functions import create_polar_plot
from functions.get_sequences_functions import get_fibonacci_sequence

from dash import Input, Output
from dash import Input, Output, callback

from assets.config import SERIES_LENGTH


@app.callback(
@callback(
Output('polar_figure', 'figure'),
[
Input('series_select', 'value'),
Expand All @@ -19,4 +18,3 @@ def update_polar_figure(selected_series, divisor):
series = Series.from_known_sequence(name=selected_series, length=SERIES_LENGTH)
mod_sequence = series.get_mod_sequence(divisor=divisor)
return create_polar_plot(sequence=mod_sequence, divisor=divisor)

2 changes: 0 additions & 2 deletions global_files/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions global_files/app.py

This file was deleted.

4 changes: 0 additions & 4 deletions global_files/layout.py → layout.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from dash import html, dcc
import dash_bootstrap_components as dbc

from global_files.app import app
from pages import polar_figure_layout, many_polar_figures_layout


Expand Down Expand Up @@ -80,6 +79,3 @@ def serve_layout():
store_components
]
)


app.layout = serve_layout()
3 changes: 2 additions & 1 deletion pages/many_polar_figures_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from assets.config import NUMBER_OF_PLOTS, MANY_POLAR_FIGURES_START_VH
from functions.global_functions import blank_figure

def get_vh(start_vh: int = MANY_POLAR_FIGURES_START_VH, numbe_of_plots: int = NUMBER_OF_PLOTS):
def get_vh(start_vh: int = MANY_POLAR_FIGURES_START_VH, numbe_of_plots: int = NUMBER_OF_PLOTS) -> str:
'''Get the vertical height of the compotent containing the figures'''
vh = start_vh
if numbe_of_plots > 40:
x = numbe_of_plots - 40
Expand Down
3 changes: 2 additions & 1 deletion pages/polar_figure_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from assets.config import KNOWN_SERIES
from functions.global_functions import blank_figure


def create_options():
return [{'label': x.capitalize(), 'value': x} for x in KNOWN_SERIES]

Expand Down Expand Up @@ -47,4 +48,4 @@ def create_figure_layout():
layout = html.Div([
create_toolbar(),
create_figure_layout()
])
])
6 changes: 0 additions & 6 deletions run.py

This file was deleted.

0 comments on commit bede9a5

Please sign in to comment.