From fd3fa1e826e97a0c87933926147861706f81691c Mon Sep 17 00:00:00 2001 From: Michele Peresano Date: Thu, 31 Oct 2024 17:56:38 +0100 Subject: [PATCH] Update example notebook for observability heatmap --- docs/source/example.ipynb | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/docs/source/example.ipynb b/docs/source/example.ipynb index dcd45c1..2dbe897 100644 --- a/docs/source/example.ipynb +++ b/docs/source/example.ipynb @@ -34,11 +34,13 @@ " source_detection,\n", " calculate,\n", ")\n", + "from iact_estimator.observability import define_constraints, get_days_in_this_year\n", "from iact_estimator.plots import (\n", " plot_spectrum,\n", " plot_sed,\n", " plot_transit,\n", " plot_altitude_airmass,\n", + " create_observability_heatmap,\n", ")" ] }, @@ -242,7 +244,36 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "constraints = define_constraints(config)\n", + "\n", + "start_datetime = (\n", + " Time(config[\"observation\"][\"start_datetime\"])\n", + " if config[\"observation\"][\"start_datetime\"] is not None\n", + " else Time(datetime.now(tz=observer.timezone))\n", + ")\n", + "year_days = get_days_in_this_year()\n", + "end_datetime = (\n", + " Time(config[\"observation\"][\"end_datetime\"])\n", + " if config[\"observation\"][\"end_datetime\"] is not None\n", + " else start_datetime + year_days\n", + ")\n", + "\n", + "create_observability_heatmap(\n", + " target_source,\n", + " observer,\n", + " constraints,\n", + " start_datetime,\n", + " end_datetime,\n", + " time_resolution=1 * u.hour,\n", + " cmap=\"YlGnBu\",\n", + " sns_plotting_context=\"paper\",\n", + " sns_axes_style=\"whitegrid\",\n", + " savefig=True,\n", + " output_path=None,\n", + " save_format=\"png\",\n", + ")" + ] } ], "metadata": {