Skip to content

Commit

Permalink
reduce slug size
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconazzaro committed Apr 16, 2021
1 parent f4eec74 commit 09f8c05
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
6 changes: 1 addition & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ def explore_regions(country):
st.title('COVID-19: Situazione in Italia')
st.text("")
try:
vaccine_repo = import_data.RepoReference(
repo_path='covid19-opendata-vaccini',
repo_url='https://github.com/italia/covid19-opendata-vaccini.git'
)
vaccines = import_data.vaccines(vaccine_repo, DATA)
vaccines = import_data.vaccines(DATA)
demography = import_data.demography(vaccines)
except:
st.error("L'applicazione è in fase di aggiornamento. Prova a [riaggiornare](/) la pagina tra qualche secondo.")
Expand Down
56 changes: 28 additions & 28 deletions plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import numpy as np
import plotly
import plotly.graph_objects as go
import scipy.optimize
import scipy.stats
# import scipy.optimize
# import scipy.stats
import streamlit as st
from matplotlib import cm
from plotly.subplots import make_subplots
Expand Down Expand Up @@ -89,41 +89,41 @@ def get_default_palette(alpha=False):
return itertools.cycle(rgb_palette)


def linear_fit(data, start=None, stop=None, p0=P0):
t_0_guess, T_d_guess = p0
data_fit = data[start:stop]
x_norm = linear(data_fit.index.values, t_0_guess, T_d_guess)
y_fit = data_fit.values
# def linear_fit(data, start=None, stop=None, p0=P0):
# t_0_guess, T_d_guess = p0
# data_fit = data[start:stop]
# x_norm = linear(data_fit.index.values, t_0_guess, T_d_guess)
# y_fit = data_fit.values

x_fit = x_norm[np.isfinite(y_fit)]
# x_fit = x_norm[np.isfinite(y_fit)]

m, y, r2, _, _ = scipy.stats.linregress(x_fit, y_fit)
t_0_norm = -y / m
T_d_norm = 1 / m
# m, y, r2, _, _ = scipy.stats.linregress(x_fit, y_fit)
# t_0_norm = -y / m
# T_d_norm = 1 / m

T_d = T_d_norm * T_d_guess
t_0 = t_0_guess + t_0_norm * T_d_guess
return t_0, T_d, r2
# T_d = T_d_norm * T_d_guess
# t_0 = t_0_guess + t_0_norm * T_d_guess
# return t_0, T_d, r2


def fit(data, start=None, stop=None, p0=P0):
t_0_guess, T_d_guess = p0
data_fit = data[start:stop]
# def fit(data, start=None, stop=None, p0=P0):
# t_0_guess, T_d_guess = p0
# data_fit = data[start:stop]

x_norm = linear(data_fit.index.values, t_0_guess, T_d_guess)
log2_y = np.log2(data_fit.values)
# x_norm = linear(data_fit.index.values, t_0_guess, T_d_guess)
# log2_y = np.log2(data_fit.values)

t_fit = data_fit.index.values[np.isfinite(log2_y)]
x_fit = x_norm[np.isfinite(log2_y)]
log2_y_fit = log2_y[np.isfinite(log2_y)]
# t_fit = data_fit.index.values[np.isfinite(log2_y)]
# x_fit = x_norm[np.isfinite(log2_y)]
# log2_y_fit = log2_y[np.isfinite(log2_y)]

m, y, r2, _, _ = scipy.stats.linregress(x_fit, log2_y_fit)
t_0_norm = -y / m
T_d_norm = 1 / m
# m, y, r2, _, _ = scipy.stats.linregress(x_fit, log2_y_fit)
# t_0_norm = -y / m
# T_d_norm = 1 / m

T_d = T_d_norm * T_d_guess
t_0 = t_0_guess + t_0_norm * T_d_guess
return t_0, T_d, r2
# T_d = T_d_norm * T_d_guess
# t_0 = t_0_guess + t_0_norm * T_d_guess
# return t_0, T_d, r2


def plot_fit(data, fig, start=None, stop=None, label=None, shift=5, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
matplotlib==3.1.3
streamlit==0.80.0
pandas==1.0.1
scipy==1.4.1
# scipy==1.4.1
lxml==4.6.2
numpy==1.18.1
plotly==4.12.0
Expand Down

0 comments on commit 09f8c05

Please sign in to comment.