-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHome.py
70 lines (47 loc) · 1.7 KB
/
Home.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import warnings
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from numpy import ComplexWarning
from helpers import load_css, text_from_markdown, find_me_buttons
from planck import Planck
st.set_page_config(layout="centered", page_title="Planck",
page_icon=":rainbow:")
load_css("pages/styles.css")
PAGE_TEXT_FILE = 'pages/01_Home.md'
content = text_from_markdown(PAGE_TEXT_FILE)
st.title("Planck's Law")
st.markdown(""":warning: Move the slider to change the temperature! :warning:""")
temperature = st.slider("temperature", 200, 8_000, 300, 400)
lambda_array = np.linspace(1.0e-9, 2.0e-6, 1000)
fig, ax = plt.subplots()
Planck.plot_interactive(lambda_array, temperature, ax=ax, transparency=0.15)
st.pyplot(fig)
lambda_peak = Planck.wien_peak(temperature)
for classification in Planck.spectral_categories(lambda_peak):
categories = [classification.category]
subcategories = [classification.subcategory]
columns = st.columns(4)
with columns[0]:
st.metric('Temperature / K', temperature)
with columns[1]:
st.metric('Wavelength peak / nm', f'{lambda_peak / 1E-9:.0f}')
with columns[2]:
for category in categories:
st.metric('Peak category', category)
with columns[3]:
for subcategory in subcategories:
st.metric('Peak subcategory', subcategory)
st.markdown(''.join(content[0]))
columns = st.columns([1, 1, 1.2, 1, 1])
sites = ("linkedin", "portfolio", "github", "github_sponsors")
links = (
"flsbustamante",
"https://franciscobustamante.com.br",
"chicolucio",
"chicolucio",
)
with columns[2]:
st.write('Developed by: Francisco Bustamante')
for site, link in zip(sites, links):
find_me_buttons(site, link)