Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tickects/PREOPS-5067: Add basis function and survey rewards timeline plots that do not use python callbacks #84

Merged
merged 15 commits into from
Apr 24, 2024
Merged
11 changes: 10 additions & 1 deletion schedview/plot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"plot_polar_alt_az",
"plot_survey_rewards",
"create_survey_reward_plot",
"reward_timeline_for_tier",
"area_timeline_for_tier",
"reward_timeline_for_surveys",
"make_logger",
"BadSchedulerError",
"BadConditionsError",
Expand Down Expand Up @@ -33,7 +36,13 @@
from .nightbf import plot_infeasible, plot_rewards
from .nightly import plot_airmass_vs_time, plot_alt_vs_time, plot_polar_alt_az
from .overhead import create_overhead_histogram, create_overhead_summary_table, plot_overhead_vs_slew_distance
from .rewards import create_survey_reward_plot, plot_survey_rewards
from .rewards import (
area_timeline_for_tier,
create_survey_reward_plot,
plot_survey_rewards,
reward_timeline_for_surveys,
reward_timeline_for_tier,
)
from .scheduler import (
BadConditionsError,
BadSchedulerError,
Expand Down
14 changes: 11 additions & 3 deletions schedview/plot/nightly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Plots that summarize a night's visits and other parameters."""

import bokeh
import bokeh.models
import colorcet
import numpy as np

Expand Down Expand Up @@ -257,6 +258,13 @@ def plot_alt_vs_time(
fig : `bokeh.plotting.Figure`
Bokeh figure object
"""
for time_column in "start_date", "observationStartDatetime64":
if isinstance(visits, bokeh.models.ColumnDataSource):
if time_column in visits.data:
break
else:
if time_column in visits:
break

if figure is None:
fig = bokeh.plotting.figure(
Expand Down Expand Up @@ -294,10 +302,10 @@ def plot_alt_vs_time(
name="filter",
)

fig.line("start_date", "altitude", source=visits_ds, color="gray")
fig.line(time_column, "altitude", source=visits_ds, color="gray")
if too_many_note_values:
fig.scatter(
"start_date",
time_column,
"altitude",
source=visits_ds,
marker={"field": "filter", "transform": filter_marker_mapper},
Expand All @@ -307,7 +315,7 @@ def plot_alt_vs_time(
)
else:
fig.scatter(
"start_date",
time_column,
"altitude",
source=visits_ds,
color={"field": "note", "transform": note_color_mapper},
Expand Down
Loading
Loading