Skip to content

Commit

Permalink
add instructions for generating rewards data for prenight
Browse files Browse the repository at this point in the history
  • Loading branch information
ehneilsen committed Oct 6, 2023
1 parent 6ee1b87 commit 56f9eb5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,31 @@ You can also supply an initial set of data files to show on startup:
> --scheduler /sdf/data/rubin/user/neilsen/devel/schedview/schedview/data/sample_scheduler.pickle.xz \
> --rewards /sdf/data/rubin/user/neilsen/devel/schedview/schedview/data/sample_rewards.h5 \
> --port 8080

The (optional) rewards data, used in the "Rewards plot" tab, can be generated
by adding an extra option to ``sim_runner`` when running the simulation that
creates the opsim database being examined.
For example, to return the data when running ``sim_runner``:

::

>>> from rubin_sim.scheduler import sim_runner
>>> observatory, scheduler, observations, reward_df, obs_rewards = sim_runner(
... observatory,
... scheduler,
... mjd_start=mjd_start,
... survey_length=night_duration,
... record_rewards=True,
... )

The returned ``reward_df`` and ``obs_rewards`` data can then be saved to an `h5`
file that can then be loaded by ``prenight``:

::

>>> rewards_fname = "my_rewards.h5"
>>> reward_df.to_hdf(rewards_fname, "reward_df")
>>> obs_rewards.to_hdf(rewards_fname, "obs_rewards")

To be valid, the rewards data *must* be generated by the same execution of
``sim_runner`` that generates the opsim database being examined.

0 comments on commit 56f9eb5

Please sign in to comment.