From 0024ad37af1d4f2acdf6140707fa5af9c3d8c7f3 Mon Sep 17 00:00:00 2001 From: kartikmandar Date: Mon, 2 Sep 2024 21:17:00 +0530 Subject: [PATCH] add help section in homepage --- .gitignore | 1 + modules/Home/HomeContent.py | 83 +-------------------------------- modules/QuickLook/LightCurve.py | 49 ++++++++++++++----- utils/strings.py | 54 +++++++++++++++++++++ 4 files changed, 95 insertions(+), 92 deletions(-) diff --git a/.gitignore b/.gitignore index 81cab33..e650f54 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .idea/ __pycache__/ files/loaded-data/ +.vscode/ diff --git a/modules/Home/HomeContent.py b/modules/Home/HomeContent.py index ecf497d..3a04d02 100644 --- a/modules/Home/HomeContent.py +++ b/modules/Home/HomeContent.py @@ -28,6 +28,7 @@ HOME_OUTPUT_BOX_STRING, HOME_WARNING_BOX_STRING, HOME_HELP_BOX_STRING, + DASHBOARD_HELP_CONTENT ) from stingray import EventList @@ -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 """ @@ -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") diff --git a/modules/QuickLook/LightCurve.py b/modules/QuickLook/LightCurve.py index 46c30bf..ee22b02 100644 --- a/modules/QuickLook/LightCurve.py +++ b/modules/QuickLook/LightCurve.py @@ -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", ] @@ -34,6 +50,7 @@ def create_warning_handler(): """ Header Section """ + def create_quicklook_lightcurve_header( header_container, main_area_container, @@ -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, @@ -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})**"), @@ -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) @@ -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 @@ -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() - diff --git a/utils/strings.py b/utils/strings.py index 5aed6c4..f5f030f 100644 --- a/utils/strings.py +++ b/utils/strings.py @@ -4,6 +4,60 @@

Welcome to the Stingray Explorer Dashboard

""" +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: + + + +### 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! +

+""" + HOME_WELCOME_MESSAGE_STRING = """

This dashboard is designed to provide a comprehensive toolset for X-ray astronomy data analysis. Here are the main features: