Skip to content

Commit

Permalink
Put y_range in bokeh figure call rather than circle call
Browse files Browse the repository at this point in the history
  • Loading branch information
bhilbert4 committed Aug 21, 2024
1 parent 5fb8cd2 commit 0bc9d73
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions jwql/website/apps/jwql/monitor_pages/monitor_readnoise_bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ def plot_readnoise_amplifers(self):
self.amp_plots = []
for amp in ['1', '2', '3', '4']:

amp_plot = figure(title='Amp {}'.format(amp), width=280, height=280, x_axis_type='datetime')
amp_plot.xaxis[0].ticker.desired_num_ticks = 4

if self.db.query_results:
readnoise_vals = np.array([getattr(result, 'amp{}_mean'.format(amp)) for result in self.db.query_results])
else:
Expand All @@ -148,21 +145,23 @@ def plot_readnoise_amplifers(self):
ngroups=ngroups,
readnoise=readnoise_vals))

amp_plot.add_tools(HoverTool(tooltips=[("file", "@file"),
("time", "@expstarts"),
("nints", "@nints"),
("ngroups", "@ngroups"),
("readnoise", "@readnoise")]))

min_rn = np.min(readnoise_vals)
max_rn = np.max(readnoise_vals)
delta_rn = max_rn - min_rn
plot_max = max_rn + 0.5 * delta_rn
plot_min = min_rn - 0.5 * delta_rn
circle_radius = 0.01 * (plot_max - plot_min)

amp_plot.circle(x='expstarts', y='readnoise', radius=circle_radius, radius_dimension='y', source=source,
y_range=(plot_min, plot_max))
amp_plot = figure(title='Amp {}'.format(amp), width=280, height=280, x_axis_type='datetime', y_range=(plot_min, plot_max))
amp_plot.xaxis[0].ticker.desired_num_ticks = 4

amp_plot.add_tools(HoverTool(tooltips=[("file", "@file"),
("time", "@expstarts"),
("nints", "@nints"),
("ngroups", "@ngroups"),
("readnoise", "@readnoise")]))

amp_plot.circle(x='expstarts', y='readnoise', radius=circle_radius, radius_dimension='y', source=source)

amp_plot.xaxis.axis_label = 'Date'
amp_plot.yaxis.axis_label = 'Mean Readnoise [DN]'
Expand Down Expand Up @@ -212,7 +211,7 @@ def plot_readnoise_histogram(self):

self.readnoise_histogram.add_tools(HoverTool(tooltips=[("Data (x, y)", "(@x, @y)"), ]))

circle_radius = 0.01 * (hist_xr_end - hist_xr_start)
circle_radius = 0.005 * (hist_xr_end - hist_xr_start)
self.readnoise_histogram.circle(x='x', y='y', radius=circle_radius, radius_dimension='x', source=source)

self.readnoise_histogram.xaxis.axis_label = 'Readnoise Difference [DN]'
Expand Down

0 comments on commit 0bc9d73

Please sign in to comment.