Spaces:
Running
Running
File size: 10,619 Bytes
f2ed98e 44c7452 f0e5acf 44c7452 dd91b0c f0e5acf 44c7452 6de55c8 dd91b0c f0e5acf f59f1fe 8cf134c f59f1fe dd91b0c 8cf134c dd91b0c 9fc6fc6 33ba22f 79a213a f2ed98e f59f1fe 8cf134c f59f1fe f2ed98e 33ba22f 9fc6fc6 33ba22f f2ed98e d9ab531 f0e5acf d9ab531 f2ed98e f0e5acf f2ed98e 79a213a f2ed98e d9ab531 44c7452 8cf134c f0e5acf d9ab531 f2ed98e f59f1fe 8cf134c f59f1fe 8cf134c f59f1fe 44c7452 6de55c8 8cf134c f0e5acf f2ed98e f0e5acf f2ed98e f59f1fe 8cf134c f59f1fe 8cf134c f59f1fe 8cf134c f59f1fe 8cf134c f59f1fe 8cf134c dd91b0c 8cf134c dd91b0c 8cf134c dd91b0c 8cf134c dd91b0c 8cf134c f2ed98e 9fc6fc6 33ba22f f2ed98e 79a213a f0e5acf f2ed98e 79a213a f2ed98e |
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
import panel as pn
import importlib
from modules.Home.HomeContent import (
create_home_header,
create_home_main_area,
create_home_output_box,
create_home_warning_box,
create_home_help_area,
create_home_footer,
create_home_plots_area,
)
from modules.DataLoading.DataIngestion import (
create_loadingdata_header,
create_loadingdata_main_area,
create_loadingdata_output_box,
create_loadingdata_warning_box,
create_loadingdata_help_area,
create_loadingdata_plots_area,
)
from modules.QuickLook.LightCurve import (
create_quicklook_lightcurve_header,
create_quicklook_lightcurve_main_area,
create_quicklook_lightcurve_plots_area,
)
from modules.QuickLook.PowerSpectrum import (
create_quicklook_powerspectrum_header,
create_quicklook_powerspectrum_main_area,
create_quicklook_powerspectrum_area,
)
from modules.QuickLook.AveragePowerSpectrum import (
create_quicklook_avg_powerspectrum_header,
create_quicklook_avg_powerspectrum_main_area,
create_quicklook_avg_powerspectrum_area,
)
from modules.QuickLook.CrossSpectrum import (
create_quicklook_cross_spectrum_header,
create_quicklook_cross_spectrum_main_area,
create_quicklook_cross_spectrum_area,
)
from modules.QuickLook.AverageCrossSpectrum import (
create_quicklook_avg_cross_spectrum_header,
create_quicklook_avg_cross_spectrum_main_area,
create_quicklook_avg_cross_spectrum_area,
)
from assets.icons.svg import HOME_ICON_SVG, LOAD_DATA_ICON_SVG
def create_sidebar(
main_area, header, footer, output_box, warning_box, help_box, plots_container, float_panel_container
):
menu_items_quicklook_stingray = [
("Light Curve", "QuickLookLightCurve"),
("Power Spectrum", "QuickLookPowerspectra"),
("Averaged Power Spectrum", "QuickLookAvgPowerspectra"),
("Cross Spectrum", "QuickLookCrossSpectrum"),
("Averaged Cross Spectrum", "QuickLookAvgCrossSpectrum"),
]
# Home Button
home_button = pn.widgets.Button(
icon=HOME_ICON_SVG,
icon_size="20px",
name="",
button_type="default",
styles={"width": "50"},
description="Back to Home",
)
# Load Button
load_data_button = pn.widgets.Button(
icon=LOAD_DATA_ICON_SVG,
icon_size="20px",
name="Load Data",
button_type="warning",
styles={"width": "100"},
description="Loading EventList",
)
# Create MenuButtons
quicklook_stingray_button = pn.widgets.MenuButton(
name="Quicklook",
items=menu_items_quicklook_stingray,
button_type="primary",
styles={"width": "90%"},
)
def handle_home_button_selection(event):
header[:] = [create_home_header()]
main_area[:] = [create_home_main_area()]
output_box[:] = [create_home_output_box()]
warning_box[:] = [create_home_warning_box()]
help_box[:] = [create_home_help_area()]
footer[:] = [create_home_footer()]
plots_container[:] = [create_home_plots_area()]
home_button.on_click(handle_home_button_selection)
# Load Button changing main content
def load_data(event):
header[:] = [
create_loadingdata_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
main_area[:] = [
create_loadingdata_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
output_box[:] = [create_home_output_box()]
warning_box[:] = [create_home_warning_box()]
help_box[:] = [create_loadingdata_help_area()]
plots_container[:] = [create_loadingdata_plots_area()]
load_data_button.on_click(load_data)
# Quicklook Button changing main content
def handle_quicklook_button_selection(event):
clicked = event.new
if clicked == "QuickLookLightCurve":
header[:] = [
create_quicklook_lightcurve_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
main_area[:] = [
create_quicklook_lightcurve_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
plots_container[:] = [create_quicklook_lightcurve_plots_area()]
elif clicked == "QuickLookPowerspectra":
header[:] = [
create_quicklook_powerspectrum_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
main_area[:] = [
create_quicklook_powerspectrum_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
plots_container[:] = [create_quicklook_powerspectrum_area()]
elif clicked == "QuickLookAvgPowerspectra":
header[:] = [
create_quicklook_avg_powerspectrum_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
main_area[:] = [
create_quicklook_avg_powerspectrum_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
plots_container[:] = [create_quicklook_avg_powerspectrum_area()]
elif clicked == "QuickLookCrossSpectrum":
header[:] = [
create_quicklook_cross_spectrum_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
main_area[:] = [
create_quicklook_cross_spectrum_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
plots_container[:] = [create_quicklook_cross_spectrum_area()]
elif clicked == "QuickLookAvgCrossSpectrum":
header[:] = [
create_quicklook_avg_cross_spectrum_header(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
)
]
main_area[:] = [
create_quicklook_avg_cross_spectrum_main_area(
header_container=header,
main_area_container=main_area,
output_box_container=output_box,
warning_box_container=warning_box,
plots_container=plots_container,
help_box_container=help_box,
footer_container=footer,
float_panel_container=float_panel_container,
)
]
plots_container[:] = [create_quicklook_avg_cross_spectrum_area()]
quicklook_stingray_button.on_click(handle_quicklook_button_selection)
sidebar = pn.FlexBox(
pn.pane.Markdown("<h1> Navigation </h1>"),
pn.FlexBox(
home_button,
load_data_button,
flex_direction="row",
justify_content="center",
align_items="center",
),
quicklook_stingray_button,
flex_direction="column",
align_items="flex-start",
justify_content="flex-start",
)
return sidebar
|