kartikmandar commited on
Commit
8cf134c
·
1 Parent(s): 5be3395

initialise plots container for all files

Browse files
explorer.py CHANGED
@@ -53,7 +53,7 @@ warning_box_container = pn.Column(warning_box)
53
  plots_container = pn.FlexBox(plots_area, flex_direction='row', align_content='space-evenly', align_items="center", justify_content="center", flex_wrap="wrap")
54
  help_box_container = pn.Column(help_box)
55
  footer_container = pn.Column(footer)
56
- floating_panel_container = pn.Column(pn.pane.Markdown("This is not a bug that this container is scrolling, it's a container to hold Floating Plots. You can ignore it completely."))
57
 
58
  # Floating Plot Demo
59
  # floating_plot_demo = create_floating_plot_demo(floating_panel_container)
@@ -65,8 +65,8 @@ sidebar = create_sidebar(
65
  output_box=output_box_container,
66
  warning_box=warning_box_container,
67
  help_box=help_box_container,
68
- plots_area=plots_container,
69
- floating_panel=floating_panel_container
70
  )
71
 
72
 
@@ -129,7 +129,7 @@ layout.main[33:55, 8:12] = warning_box_container
129
  layout.main[55:100, 0:12] = plots_container
130
  layout.main[100:140, 0:12] = help_box_container
131
  layout.main[140:170, 0:12] = footer_container
132
- layout.main[170:170, 0:12] = floating_panel_container
133
 
134
 
135
  # Serve the layout
 
53
  plots_container = pn.FlexBox(plots_area, flex_direction='row', align_content='space-evenly', align_items="center", justify_content="center", flex_wrap="wrap")
54
  help_box_container = pn.Column(help_box)
55
  footer_container = pn.Column(footer)
56
+ float_panel_container = pn.Column(pn.pane.Markdown("This is not a bug that this container is scrolling, it's a container to hold Floating Plots. You can ignore it completely."))
57
 
58
  # Floating Plot Demo
59
  # floating_plot_demo = create_floating_plot_demo(floating_panel_container)
 
65
  output_box=output_box_container,
66
  warning_box=warning_box_container,
67
  help_box=help_box_container,
68
+ plots_container=plots_container,
69
+ float_panel_container=float_panel_container,
70
  )
71
 
72
 
 
129
  layout.main[55:100, 0:12] = plots_container
130
  layout.main[100:140, 0:12] = help_box_container
131
  layout.main[140:170, 0:12] = footer_container
132
+ layout.main[170:170, 0:12] = float_panel_container
133
 
134
 
135
  # Serve the layout
modules/Home/HomeContent.py CHANGED
@@ -25,11 +25,8 @@ from utils.strings import (
25
  HOME_WARNING_BOX_STRING,
26
  HOME_HELP_BOX_STRING,
27
  )
28
- from stingray.gti import create_gti_from_condition, gti_border_bins, time_intervals_from_gtis, cross_two_gtis
29
- from stingray.utils import show_progress
30
- from stingray.fourier import avg_cs_from_events, avg_pds_from_events, poisson_level, get_average_ctrate
31
- from stingray import AveragedPowerspectrum, AveragedCrossspectrum, EventList, Lightcurve
32
- from stingray.modeling.parameterestimation import PSDLogLikelihood
33
 
34
 
35
  """ Header Section """
 
25
  HOME_WARNING_BOX_STRING,
26
  HOME_HELP_BOX_STRING,
27
  )
28
+
29
+ from stingray import EventList
 
 
 
30
 
31
 
32
  """ Header Section """
modules/QuickLook/LightCurve.py CHANGED
@@ -13,6 +13,7 @@ from utils.DashboardClasses import (
13
  Footer,
14
  WarningHandler,
15
  FloatingPlot,
 
16
  )
17
 
18
 
@@ -150,7 +151,7 @@ def create_lightcurve_tab(
150
  dataframe_output.object = df
151
 
152
  if dataframe_checkbox.value:
153
- header_container.append(
154
  pn.layout.FloatPanel(
155
  dataframe_output,
156
  contained=False,
@@ -274,3 +275,13 @@ def create_quicklook_lightcurve_main_area(
274
  }
275
 
276
  return MainArea(tabs_content=tabs_content)
 
 
 
 
 
 
 
 
 
 
 
13
  Footer,
14
  WarningHandler,
15
  FloatingPlot,
16
+ PlotsContainer,
17
  )
18
 
19
 
 
151
  dataframe_output.object = df
152
 
153
  if dataframe_checkbox.value:
154
+ float_panel_container.append(
155
  pn.layout.FloatPanel(
156
  dataframe_output,
157
  contained=False,
 
275
  }
276
 
277
  return MainArea(tabs_content=tabs_content)
278
+
279
+
280
+ def create_quicklook_lightcurve_plots_area():
281
+ """
282
+ Create the plots area for the quicklook lightcurve tab.
283
+
284
+ Returns:
285
+ PlotsContainer: An instance of PlotsContainer with the plots for the quicklook lightcurve tab.
286
+ """
287
+ return PlotsContainer()
modules/QuickLook/PowerSpectrum.py CHANGED
@@ -13,17 +13,21 @@ from utils.DashboardClasses import (
13
  Footer,
14
  WarningHandler,
15
  FloatingPlot,
 
16
  )
17
  from stingray import Powerspectrum
18
 
 
19
  # Create a warning handler
20
  def create_warning_handler():
21
  warning_handler = WarningHandler()
22
  warnings.showwarning = warning_handler.warn
23
  return warning_handler
24
 
 
25
  """ Header Section """
26
 
 
27
  def create_quicklook_powerspectrum_header(
28
  header_container,
29
  main_area_container,
@@ -40,29 +44,38 @@ def create_quicklook_powerspectrum_header(
40
 
41
  return MainHeader(heading=home_heading_input, subheading=home_subheading_input)
42
 
 
43
  """ Output Box Section """
44
 
 
45
  def create_loadingdata_output_box(content):
46
  return OutputBox(output_content=content)
47
 
 
48
  """ Warning Box Section """
49
 
 
50
  def create_loadingdata_warning_box(content):
51
  return WarningBox(warning_content=content)
52
 
 
53
  """ Float Panel """
54
 
 
55
  def create_floatpanel_area(content, title):
56
  return FloatingPlot(content, title)
57
 
 
58
  """ Main Area Section """
59
 
 
60
  def create_powerspectrum_tab(
61
  output_box_container,
62
  warning_box_container,
63
  warning_handler,
64
  plots_container,
65
  header_container,
 
66
  ):
67
  event_list_dropdown = pn.widgets.Select(
68
  name="Select Event List(s)",
@@ -81,16 +94,20 @@ def create_powerspectrum_tab(
81
  name="Combine with Existing Plot", value=False
82
  )
83
 
84
- floatpanel_plots_checkbox = pn.widgets.Checkbox(name="Add Plot to FloatingPanel", value=False)
 
 
85
 
86
  def create_holoviews_panes():
87
  return pn.pane.HoloViews(width=600, height=500)
88
 
89
  def create_holoviews_plots(ps):
90
  return hv.Curve((ps.freq, ps.power)).opts(
91
- xlabel='Frequency (Hz)', ylabel='Power',
92
- title='Power Spectrum',
93
- width=600, height=500
 
 
94
  )
95
 
96
  def create_dataframe_panes():
@@ -231,6 +248,7 @@ def create_powerspectrum_tab(
231
  )
232
  return tab1_content
233
 
 
234
  def create_quicklook_powerspectrum_main_area(
235
  header_container,
236
  main_area_container,
@@ -239,6 +257,7 @@ def create_quicklook_powerspectrum_main_area(
239
  plots_container,
240
  help_box_container,
241
  footer_container,
 
242
  ):
243
  warning_handler = create_warning_handler()
244
  tabs_content = {
@@ -248,7 +267,18 @@ def create_quicklook_powerspectrum_main_area(
248
  warning_handler=warning_handler,
249
  plots_container=plots_container,
250
  header_container=header_container,
 
251
  ),
252
  }
253
 
254
  return MainArea(tabs_content=tabs_content)
 
 
 
 
 
 
 
 
 
 
 
13
  Footer,
14
  WarningHandler,
15
  FloatingPlot,
16
+ PlotsContainer,
17
  )
18
  from stingray import Powerspectrum
19
 
20
+
21
  # Create a warning handler
22
  def create_warning_handler():
23
  warning_handler = WarningHandler()
24
  warnings.showwarning = warning_handler.warn
25
  return warning_handler
26
 
27
+
28
  """ Header Section """
29
 
30
+
31
  def create_quicklook_powerspectrum_header(
32
  header_container,
33
  main_area_container,
 
44
 
45
  return MainHeader(heading=home_heading_input, subheading=home_subheading_input)
46
 
47
+
48
  """ Output Box Section """
49
 
50
+
51
  def create_loadingdata_output_box(content):
52
  return OutputBox(output_content=content)
53
 
54
+
55
  """ Warning Box Section """
56
 
57
+
58
  def create_loadingdata_warning_box(content):
59
  return WarningBox(warning_content=content)
60
 
61
+
62
  """ Float Panel """
63
 
64
+
65
  def create_floatpanel_area(content, title):
66
  return FloatingPlot(content, title)
67
 
68
+
69
  """ Main Area Section """
70
 
71
+
72
  def create_powerspectrum_tab(
73
  output_box_container,
74
  warning_box_container,
75
  warning_handler,
76
  plots_container,
77
  header_container,
78
+ float_panel_container,
79
  ):
80
  event_list_dropdown = pn.widgets.Select(
81
  name="Select Event List(s)",
 
94
  name="Combine with Existing Plot", value=False
95
  )
96
 
97
+ floatpanel_plots_checkbox = pn.widgets.Checkbox(
98
+ name="Add Plot to FloatingPanel", value=False
99
+ )
100
 
101
  def create_holoviews_panes():
102
  return pn.pane.HoloViews(width=600, height=500)
103
 
104
  def create_holoviews_plots(ps):
105
  return hv.Curve((ps.freq, ps.power)).opts(
106
+ xlabel="Frequency (Hz)",
107
+ ylabel="Power",
108
+ title="Power Spectrum",
109
+ width=600,
110
+ height=500,
111
  )
112
 
113
  def create_dataframe_panes():
 
248
  )
249
  return tab1_content
250
 
251
+
252
  def create_quicklook_powerspectrum_main_area(
253
  header_container,
254
  main_area_container,
 
257
  plots_container,
258
  help_box_container,
259
  footer_container,
260
+ float_panel_container,
261
  ):
262
  warning_handler = create_warning_handler()
263
  tabs_content = {
 
267
  warning_handler=warning_handler,
268
  plots_container=plots_container,
269
  header_container=header_container,
270
+ float_panel_container=float_panel_container,
271
  ),
272
  }
273
 
274
  return MainArea(tabs_content=tabs_content)
275
+
276
+
277
+ def create_quicklook_powerspectrum_area():
278
+ """
279
+ Create the plots area for the quicklook lightcurve tab.
280
+
281
+ Returns:
282
+ PlotsContainer: An instance of PlotsContainer with the plots for the quicklook lightcurve tab.
283
+ """
284
+ return PlotsContainer()
utils/sidebar.py CHANGED
@@ -21,15 +21,17 @@ from modules.DataLoading.DataIngestion import (
21
  from modules.QuickLook.LightCurve import (
22
  create_quicklook_lightcurve_header,
23
  create_quicklook_lightcurve_main_area,
 
24
  )
25
  from modules.QuickLook.PowerSpectrum import (
26
  create_quicklook_powerspectrum_header,
27
  create_quicklook_powerspectrum_main_area,
 
28
  )
29
  from assets.icons.svg import HOME_ICON_SVG, LOAD_DATA_ICON_SVG
30
 
31
  def create_sidebar(
32
- main_area, header, footer, output_box, warning_box, help_box, plots_area, floating_panel
33
  ):
34
  menu_items_quicklook_stingray = [
35
  ("Light Curve", "QuickLookLightCurve"),
@@ -72,7 +74,7 @@ def create_sidebar(
72
  warning_box[:] = [create_home_warning_box()]
73
  help_box[:] = [create_home_help_area()]
74
  footer[:] = [create_home_footer()]
75
- plots_area[:] = [create_home_plots_area()]
76
 
77
  home_button.on_click(handle_home_button_selection)
78
 
@@ -84,7 +86,7 @@ def create_sidebar(
84
  main_area_container=main_area,
85
  output_box_container=output_box,
86
  warning_box_container=warning_box,
87
- plots_container=plots_area,
88
  help_box_container=help_box,
89
  footer_container=footer,
90
  )
@@ -95,7 +97,7 @@ def create_sidebar(
95
  main_area_container=main_area,
96
  output_box_container=output_box,
97
  warning_box_container=warning_box,
98
- plots_container=plots_area,
99
  help_box_container=help_box,
100
  footer_container=footer,
101
  )
@@ -103,7 +105,7 @@ def create_sidebar(
103
  output_box[:] = [create_home_output_box()]
104
  warning_box[:] = [create_home_warning_box()]
105
  help_box[:] = [create_loadingdata_help_area()]
106
- plots_area[:] = [create_loadingdata_plots_area()]
107
 
108
  load_data_button.on_click(load_data)
109
 
@@ -117,10 +119,10 @@ def create_sidebar(
117
  main_area_container=main_area,
118
  output_box_container=output_box,
119
  warning_box_container=warning_box,
120
- plots_container=plots_area,
121
  help_box_container=help_box,
122
  footer_container=footer,
123
- float_panel_container=floating_panel
124
  )
125
  ]
126
  main_area[:] = [
@@ -129,12 +131,14 @@ def create_sidebar(
129
  main_area_container=main_area,
130
  output_box_container=output_box,
131
  warning_box_container=warning_box,
132
- plots_container=plots_area,
133
  help_box_container=help_box,
134
  footer_container=footer,
135
- float_panel_container=floating_panel,
136
  )
137
  ]
 
 
138
  elif clicked == "QuickLookPowerspectra":
139
  header[:] = [
140
  create_quicklook_powerspectrum_header(
@@ -142,7 +146,7 @@ def create_sidebar(
142
  main_area_container=main_area,
143
  output_box_container=output_box,
144
  warning_box_container=warning_box,
145
- plots_container=plots_area,
146
  help_box_container=help_box,
147
  footer_container=footer,
148
  )
@@ -153,11 +157,13 @@ def create_sidebar(
153
  main_area_container=main_area,
154
  output_box_container=output_box,
155
  warning_box_container=warning_box,
156
- plots_container=plots_area,
157
  help_box_container=help_box,
158
  footer_container=footer,
 
159
  )
160
  ]
 
161
 
162
  quicklook_stingray_button.on_click(handle_quicklook_button_selection)
163
 
 
21
  from modules.QuickLook.LightCurve import (
22
  create_quicklook_lightcurve_header,
23
  create_quicklook_lightcurve_main_area,
24
+ create_quicklook_lightcurve_plots_area,
25
  )
26
  from modules.QuickLook.PowerSpectrum import (
27
  create_quicklook_powerspectrum_header,
28
  create_quicklook_powerspectrum_main_area,
29
+ create_quicklook_powerspectrum_area,
30
  )
31
  from assets.icons.svg import HOME_ICON_SVG, LOAD_DATA_ICON_SVG
32
 
33
  def create_sidebar(
34
+ main_area, header, footer, output_box, warning_box, help_box, plots_container, float_panel_container
35
  ):
36
  menu_items_quicklook_stingray = [
37
  ("Light Curve", "QuickLookLightCurve"),
 
74
  warning_box[:] = [create_home_warning_box()]
75
  help_box[:] = [create_home_help_area()]
76
  footer[:] = [create_home_footer()]
77
+ plots_container[:] = [create_home_plots_area()]
78
 
79
  home_button.on_click(handle_home_button_selection)
80
 
 
86
  main_area_container=main_area,
87
  output_box_container=output_box,
88
  warning_box_container=warning_box,
89
+ plots_container=plots_container,
90
  help_box_container=help_box,
91
  footer_container=footer,
92
  )
 
97
  main_area_container=main_area,
98
  output_box_container=output_box,
99
  warning_box_container=warning_box,
100
+ plots_container=plots_container,
101
  help_box_container=help_box,
102
  footer_container=footer,
103
  )
 
105
  output_box[:] = [create_home_output_box()]
106
  warning_box[:] = [create_home_warning_box()]
107
  help_box[:] = [create_loadingdata_help_area()]
108
+ plots_container[:] = [create_loadingdata_plots_area()]
109
 
110
  load_data_button.on_click(load_data)
111
 
 
119
  main_area_container=main_area,
120
  output_box_container=output_box,
121
  warning_box_container=warning_box,
122
+ plots_container=plots_container,
123
  help_box_container=help_box,
124
  footer_container=footer,
125
+ float_panel_container=float_panel_container,
126
  )
127
  ]
128
  main_area[:] = [
 
131
  main_area_container=main_area,
132
  output_box_container=output_box,
133
  warning_box_container=warning_box,
134
+ plots_container=plots_container,
135
  help_box_container=help_box,
136
  footer_container=footer,
137
+ float_panel_container=float_panel_container,
138
  )
139
  ]
140
+ plots_container[:] = [create_quicklook_lightcurve_plots_area()]
141
+
142
  elif clicked == "QuickLookPowerspectra":
143
  header[:] = [
144
  create_quicklook_powerspectrum_header(
 
146
  main_area_container=main_area,
147
  output_box_container=output_box,
148
  warning_box_container=warning_box,
149
+ plots_container=plots_container,
150
  help_box_container=help_box,
151
  footer_container=footer,
152
  )
 
157
  main_area_container=main_area,
158
  output_box_container=output_box,
159
  warning_box_container=warning_box,
160
+ plots_container=plots_container,
161
  help_box_container=help_box,
162
  footer_container=footer,
163
+ float_panel_container=float_panel_container,
164
  )
165
  ]
166
+ plots_container[:] = [create_quicklook_powerspectrum_area()]
167
 
168
  quicklook_stingray_button.on_click(handle_quicklook_button_selection)
169