Skip to content

Commit

Permalink
add help section in homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikmandar committed Sep 2, 2024
1 parent 2d5de28 commit 0024ad3
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 92 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea/
__pycache__/
files/loaded-data/
.vscode/
83 changes: 2 additions & 81 deletions modules/Home/HomeContent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
HOME_OUTPUT_BOX_STRING,
HOME_WARNING_BOX_STRING,
HOME_HELP_BOX_STRING,
DASHBOARD_HELP_CONTENT
)

from stingray import EventList
Expand Down Expand Up @@ -95,86 +96,6 @@ def create_home_plots_area_initial():
text = pn.pane.Markdown("Not displaying the NICER analysis plots on first load as it takes time to load. Move around the dashboard and come back to home page, to see the analysis plots. The buttons to navigate are in the sidebar.")
return PlotsContainer(text)

# # Define the function to create demo plots
# def create_floating_plot_demo(floating_plot_container):
# # Define different plots with independent axes
# hv_plot = hv.Curve([1, 2, 3, 4, 5], label='Simple Line Plot').opts(
# title="Simple Line Plot",
# width=400,
# height=300,
# color='blue',
# tools=['hover'],
# shared_axes=False # Prevent sharing axes
# )

# scatter_plot = hv.Scatter(
# [(1, 2), (2, 3), (3, 4), (4, 5), (5, 6)],
# kdims=['x'], vdims=['y']
# ).opts(
# title="Simple Scatter Plot",
# width=400,
# height=300,
# color='green',
# size=10,
# tools=['hover'],
# shared_axes=False # Prevent sharing axes
# )

# button = pn.widgets.Button(name='Click me', button_type='primary')
# markdown = pn.pane.Markdown("This is a floating plot demo. Click the button to create a new plot.")

# # Create and add different FloatPanel instances to the container
# floating_plot = pn.layout.FloatPanel(
# pn.panel(hv_plot),
# name="NICER Analysis Plots",
# contained=False,
# position="center",
# width=500,
# height=300,
# margin=20,
# config={"headerControls": {"close": "remove"}} # Example config
# )

# new_plot = pn.layout.FloatPanel(
# button,
# name="Button Panel",
# contained=False,
# position="center",
# width=500,
# height=300,
# margin=20,
# config={"headerControls": {"close": "remove"}} # Example config
# )

# new_newplot = pn.layout.FloatPanel(
# markdown,
# name="Markdown Panel",
# contained=False,
# position="center",
# width=500,
# height=300,
# margin=20,
# config={"headerControls": {"close": "remove"}} # Example config
# )

# scatter_plot_panel = pn.layout.FloatPanel(
# pn.panel(scatter_plot),
# name="Scatter Plot Panel",
# contained=False,
# position="center",
# width=500,
# height=300,
# margin=20,
# config={"headerControls": {"close": "remove"}} # Example config
# )

# # Append panels to the container
# floating_plot_container.append(floating_plot)
# floating_plot_container.append(new_plot)
# floating_plot_container.append(new_newplot)
# floating_plot_container.append(scatter_plot_panel)

# return


""" Plots Area Section """
Expand Down Expand Up @@ -300,7 +221,7 @@ def create_home_plots_area():


def create_home_help_area():
help_content = HOME_HELP_BOX_STRING
help_content = f"{HOME_HELP_BOX_STRING}\n\n{DASHBOARD_HELP_CONTENT}"
return HelpBox(help_content=help_content, title="Help Section")


Expand Down
49 changes: 38 additions & 11 deletions modules/QuickLook/LightCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,26 @@
)

colors = [
"#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
"#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf",
"#aec7e8", "#ffbb78", "#98df8a", "#ff9896", "#c5b0d5",
"#c49c94", "#f7b6d2", "#c7c7c7", "#dbdb8d", "#9edae5"
"#1f77b4",
"#ff7f0e",
"#2ca02c",
"#d62728",
"#9467bd",
"#8c564b",
"#e377c2",
"#7f7f7f",
"#bcbd22",
"#17becf",
"#aec7e8",
"#ffbb78",
"#98df8a",
"#ff9896",
"#c5b0d5",
"#c49c94",
"#f7b6d2",
"#c7c7c7",
"#dbdb8d",
"#9edae5",
]


Expand All @@ -34,6 +50,7 @@ def create_warning_handler():

""" Header Section """


def create_quicklook_lightcurve_header(
header_container,
main_area_container,
Expand All @@ -54,18 +71,21 @@ def create_quicklook_lightcurve_header(

""" Output Box Section """


def create_loadingdata_output_box(content):
return OutputBox(output_content=content)


""" Warning Box Section """


def create_loadingdata_warning_box(content):
return WarningBox(warning_content=content)


""" Main Area Section """


def create_lightcurve_tab(
output_box_container,
warning_box_container,
Expand Down Expand Up @@ -106,13 +126,16 @@ def create_holoviews_panes(plot):
return pn.pane.HoloViews(plot, width=600, height=600, linked_axes=False)

def create_holoviews_plots(df, label, dt, color_key=None):
plot = df.hvplot(x="Time", y="Counts", shared_axes=False, label=f"{label} (dt={dt})")
plot = df.hvplot(
x="Time", y="Counts", shared_axes=False, label=f"{label} (dt={dt})"
)
if color_key:
return hd.datashade(plot, aggregator=hd.ds.mean("Counts"), color_key=color_key)
return hd.datashade(
plot, aggregator=hd.ds.mean("Counts"), color_key=color_key
)
else:
return hd.datashade(plot, aggregator=hd.ds.mean("Counts"))


def create_dataframe_panes(df, title, dt):
return pn.FlexBox(
pn.pane.Markdown(f"**{title} (dt={dt})**"),
Expand Down Expand Up @@ -230,15 +253,18 @@ def combine_selected_plots(event=None):
combined_title = []

# Define a color key for distinct colors
color_key = {index: color for index, color in zip(selected_event_list_indices, colors)}

color_key = {
index: color for index, color in zip(selected_event_list_indices, colors)
}

for index in selected_event_list_indices:
dt = dt_input.value
df = create_dataframe(index, dt)
if df is not None:
event_list_name = loaded_event_data[index][0]
plot_hv = create_holoviews_plots(df, label=event_list_name, dt=dt, color_key={0: color_key[index]})
plot_hv = create_holoviews_plots(
df, label=event_list_name, dt=dt, color_key={0: color_key[index]}
)
combined_plots.append(plot_hv)
combined_title.append(event_list_name)

Expand All @@ -247,6 +273,8 @@ def combine_selected_plots(event=None):
combined_pane = create_holoviews_panes(combined_plot)

combined_title_str = " + ".join(combined_title)
# The line `if floatpanel_plots_checkbox.value:` is checking the value of a checkbox
# widget named `floatpanel_plots_checkbox`.
if floatpanel_plots_checkbox.value:
new_floatpanel = create_floating_plot_container(
content=combined_pane, title=combined_title_str
Expand Down Expand Up @@ -324,4 +352,3 @@ def create_quicklook_lightcurve_plots_area():
PlotsContainer: An instance of PlotsContainer with the plots for the quicklook lightcurve tab.
"""
return PlotsContainer()

54 changes: 54 additions & 0 deletions utils/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,60 @@
<h1>Welcome to the Stingray Explorer Dashboard</h1>
"""

DASHBOARD_HELP_CONTENT = """
## Stingray Explorer Dashboard
Welcome to the Stingray Explorer Dashboard! This tool is designed to provide quick and easy access to various X-ray astronomy data analysis techniques using the Stingray library.
### How to Use the Dashboard
1. **Navigation:**
- Use the sidebar to navigate between different sections like Light Curves, Power Spectra, Cross Spectra, etc.
- The home button will take you back to the main overview.
2. **Loading Data:**
- Go to the 'Data Ingestion' section to load your event list files. You can select files from your local system, and specify formats if needed.
- Once loaded, the data will be available for analysis in other sections of the dashboard.
3. **Generating Plots:**
- Each section (e.g., Light Curves, Power Spectra) provides options to generate and visualize different types of plots.
- You can adjust parameters like time binning (dt) and combine multiple event lists for analysis.
- The generated plots can be added to floating panels for more flexible viewing.
4. **Output & Warnings:**
- The Output Box displays the results and messages from your analysis operations.
- The Warning Box alerts you of any issues encountered during data processing.
5. **Help & Documentation:**
- Each section has a help area that provides guidance on how to use the tools within that section.
- This dashboard is equipped with floating panels, meaning plots and data frames can be moved around and resized independently.
6. **Saving and Managing Data:**
- The 'Data Ingestion' section also allows you to save loaded event data to disk in various formats.
- Manage your data effectively using the clear and delete options provided in the data ingestion section.
7. **Advanced Features:**
- The dashboard includes modules for advanced analysis, such as cross-spectra and averaged power spectra.
- Customize plots with different color schemes, and overlay multiple data sets for comparative analysis.
### Video Tutorial
Watch the video tutorial below for a detailed walkthrough:
<iframe width="560" height="315" src="https://www.youtube.com/embed/G_-OyY3B1cA" frameborder="0" allowfullscreen></iframe>
### Additional Resources
- [Stingray Library Documentation](https://stingray.readthedocs.io/)
- [Holoviz Documentation](https://holoviz.org/)
- [Dashboard additonal information](https://www.kartikmandar.com/gsoc-2024/stingray-explorer)
For any issues or queries, feel free to reach out via the Stingray Slack channel or by email.
Happy exploring!
<br><br>
"""

HOME_WELCOME_MESSAGE_STRING = """
<div>
<p>This dashboard is designed to provide a comprehensive toolset for X-ray astronomy data analysis. Here are the main features:</p>
Expand Down

0 comments on commit 0024ad3

Please sign in to comment.