lorenzsp commited on
Commit
3e8d296
·
1 Parent(s): 1f74b39

interactive plot description

Browse files
Files changed (2) hide show
  1. app.py +11 -7
  2. scatter_plot_snr.py +8 -21
app.py CHANGED
@@ -13,17 +13,21 @@ def plot_interactive(snr_list, alpha, y_axis, x_axis, colorbar_var):
13
  import io
14
  import PIL.Image
15
  buf = io.BytesIO()
16
- fig.savefig(buf, format='png')
17
  buf.seek(0)
18
  img = PIL.Image.open(buf)
19
  return img
20
 
21
  with gr.Blocks() as demo:
22
  gr.Markdown("""
23
- ## EMRI Mass vs Distance/Redshift Interactive Plot
24
-
25
- This visualization shows the results of the search pipeline for detecting Extreme Mass Ratio Inspirals (EMRIs) in simulated LISA data presented in [Ab uno disce omnes: Single-harmonic search for extreme mass-ratio inspirals](https://arxiv.org/abs/2510.20891).
26
-
 
 
 
 
27
  For a quick, simplified EMRI search, open and run [QuickStartEMRIsearch.ipynb](examples/QuickStartEMRIsearch.ipynb). The notebook walks through the pipeline and produces example outputs, including:
28
 
29
  If you use this code, please cite the [paper](https://ui.adsabs.harvard.edu/abs/2026PhRvD.113b4061S)
@@ -36,8 +40,8 @@ with gr.Blocks() as demo:
36
  y_axis_input = gr.Radio(["Redshift", "Luminosity Distance"], label="Y Axis", value="Redshift")
37
  x_axis_input = gr.Radio(["Primary Mass", "Secondary Mass"], label="X Axis", value="Primary Mass")
38
 
39
- colorbar_input = gr.Dropdown(["Final eccentricity $e_f$", "Initial eccentricity $e_0$",
40
- "Primary mass $m_1$", "Secondary mass $m_2$"], label="Colorbar Variable", value="ef")
41
  plot_btn = gr.Button("Click here to plot")
42
  plot_output = gr.Image(type="pil")
43
 
 
13
  import io
14
  import PIL.Image
15
  buf = io.BytesIO()
16
+ fig.savefig(buf, format='png', dpi=300)
17
  buf.seek(0)
18
  img = PIL.Image.open(buf)
19
  return img
20
 
21
  with gr.Blocks() as demo:
22
  gr.Markdown("""
23
+ ## EMRI Search Mass vs Distance/Redshift Interactive Plot
24
+
25
+ This visualization shows the sources detected by the search pipeline presented in [Ab uno disce omnes: Single-harmonic search for extreme mass-ratio inspirals](https://arxiv.org/abs/2510.20891).
26
+ On the x-axis, you can choose to plot either the primary or secondary mass of the detected sources.
27
+ On the y-axis, you can choose to plot either the redshift or luminosity distance.
28
+ The color of the points corresponds to a variable of your choice (initial eccentricity, final eccentricity, primary mass, or secondary mass).
29
+ Since the injection was performed in the detector frame, the masses are plotted in the source frame by dividing by (1+z).
30
+
31
  For a quick, simplified EMRI search, open and run [QuickStartEMRIsearch.ipynb](examples/QuickStartEMRIsearch.ipynb). The notebook walks through the pipeline and produces example outputs, including:
32
 
33
  If you use this code, please cite the [paper](https://ui.adsabs.harvard.edu/abs/2026PhRvD.113b4061S)
 
40
  y_axis_input = gr.Radio(["Redshift", "Luminosity Distance"], label="Y Axis", value="Redshift")
41
  x_axis_input = gr.Radio(["Primary Mass", "Secondary Mass"], label="X Axis", value="Primary Mass")
42
 
43
+ colorbar_input = gr.Dropdown([r"Final eccentricity", r"Initial eccentricity",
44
+ r"Primary mass", r"Secondary mass"], label="Colorbar Variable", value=r"Final eccentricity")
45
  plot_btn = gr.Button("Click here to plot")
46
  plot_output = gr.Image(type="pil")
47
 
scatter_plot_snr.py CHANGED
@@ -80,27 +80,14 @@ def plot_mass_vs_distance_or_redshift(
80
  filtered_ef = ef_values[det_mask]
81
  filtered_e0 = e0_values[det_mask]
82
 
83
- # Choose colorbar variable
84
- if colorbar_var == "ef":
85
- color_data = filtered_ef
86
- color_label = 'Final Eccentricity ($e_f$)'
87
- cmap = 'plasma'
88
- elif colorbar_var == "e0":
89
- color_data = filtered_e0
90
- color_label = 'Initial Eccentricity ($e_0$)'
91
- cmap = 'cividis'
92
- elif colorbar_var == "m1":
93
- color_data = filtered_m1
94
- color_label = 'Primary Mass [M$_\odot$]'
95
- cmap = 'viridis'
96
- elif colorbar_var == "m2":
97
- color_data = filtered_m2
98
- color_label = 'Secondary Mass [M$_\odot$]'
99
- cmap = 'viridis'
100
- else:
101
- color_data = filtered_ef
102
- color_label = 'Final Eccentricity ($e_f$)'
103
- cmap = 'plasma'
104
 
105
  fig, ax = plt.subplots(figsize=(7, 5))
106
  if x_axis == "Primary Mass":
 
80
  filtered_ef = ef_values[det_mask]
81
  filtered_e0 = e0_values[det_mask]
82
 
83
+ # Map app.py dropdown input to variable
84
+ colorbar_map = {
85
+ r"Final eccentricity": (filtered_ef, 'Final Eccentricity $e_f$', 'plasma'),
86
+ r"Initial eccentricity": (filtered_e0, 'Initial Eccentricity $e_0$', 'cividis'),
87
+ r"Primary mass": (filtered_m1, 'Primary Mass [M$_\odot$]', 'viridis'),
88
+ r"Secondary mass": (filtered_m2, 'Secondary Mass [M$_\odot$]', 'viridis'),
89
+ }
90
+ color_data, color_label, cmap = colorbar_map.get(colorbar_var, (filtered_ef, 'Final Eccentricity ($e_f$)', 'plasma'))
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  fig, ax = plt.subplots(figsize=(7, 5))
93
  if x_axis == "Primary Mass":