sgbaird commited on
Commit
4a792e5
1 Parent(s): 113b2f8

refactor: Refactor plot_spectra function in app.py for improved readability and performance

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -99,7 +99,7 @@ def send_and_receive(client, command_topic, msg, queue_timeout=60):
99
  return sensor_data
100
 
101
 
102
- # Function to plot spectra
103
  def plot_spectra(sensor_data):
104
  """https://chatgpt.com/share/210d2fee-ca64-45a5-866e-e6df6e56bd1c"""
105
  wavelengths = np.array([410, 440, 470, 510, 550, 583, 620, 670])
@@ -155,7 +155,7 @@ def plot_spectra(sensor_data):
155
  ax.set_ylabel("Intensity")
156
  ax.set_title("Spectral Intensity vs. Wavelength")
157
 
158
- plt.show()
159
 
160
 
161
  # Publish button
 
99
  return sensor_data
100
 
101
 
102
+ # helper function to plot discrete spectral sensor data
103
  def plot_spectra(sensor_data):
104
  """https://chatgpt.com/share/210d2fee-ca64-45a5-866e-e6df6e56bd1c"""
105
  wavelengths = np.array([410, 440, 470, 510, 550, 583, 620, 670])
 
155
  ax.set_ylabel("Intensity")
156
  ax.set_title("Spectral Intensity vs. Wavelength")
157
 
158
+ st.pyplot(fig)
159
 
160
 
161
  # Publish button