| 
29 | 29 |     "from iact_estimator import RESOURCES_PATH\n",  | 
30 | 30 |     "from iact_estimator.io import read_yaml\n",  | 
31 | 31 |     "from iact_estimator.core import (\n",  | 
32 |  | -    "\n",  | 
33 | 32 |     "    initialize_model,\n",  | 
34 | 33 |     "    prepare_data,\n",  | 
35 | 34 |     "    source_detection,\n",  | 
36 | 35 |     "    calculate,\n",  | 
37 | 36 |     ")\n",  | 
38 |  | -    "from iact_estimator.plots import plot_spectrum, plot_sed, plot_transit, plot_altitude_airmass"  | 
 | 37 | +    "from iact_estimator.plots.physics import plot_spectrum, plot_sed\n",  | 
 | 38 | +    "from iact_estimator.plots.observability import plot_transit, plot_altitude_airmass\n",  | 
 | 39 | +    "from iact_estimator.plots.wobble_skymap import plot_skymap_with_wobbles, load_wobbles"  | 
39 | 40 |    ]  | 
40 | 41 |   },  | 
41 | 42 |   {  | 
 | 
46 | 47 |    },  | 
47 | 48 |    "outputs": [],  | 
48 | 49 |    "source": [  | 
49 |  | -    "output_path=Path.cwd()\n",  | 
50 |  | -    "config = read_yaml(RESOURCES_PATH/\"config.yml\")\n",  | 
 | 50 | +    "output_path = Path.cwd()\n",  | 
 | 51 | +    "config = read_yaml(RESOURCES_PATH / \"config.yml\")\n",  | 
51 | 52 |     "source_name = \"Crab\"\n",  | 
52 | 53 |     "\n",  | 
53 | 54 |     "observer = Observer.at_site(\"Roque de los Muchachos\")\n",  | 
 | 
97 | 98 |     "observer = Observer.at_site(\"Roque de los Muchachos\")\n",  | 
98 | 99 |     "\n",  | 
99 | 100 |     "date_time = DatetimePicker(\n",  | 
100 |  | -    "    value=datetime.now(timezone.utc),\n",  | 
101 |  | -    "    description='Select a datetime',\n",  | 
102 |  | -    "    disabled=False\n",  | 
 | 101 | +    "    value=datetime.now(timezone.utc), description=\"Select a datetime\", disabled=False\n",  | 
103 | 102 |     ")\n",  | 
104 | 103 |     "\n",  | 
105 | 104 |     "crab = FixedTarget.from_name(\"Crab\")\n",  | 
106 | 105 |     "plot_crab = True if (crab.coord == target_source.coord) else False\n",  | 
107 | 106 |     "\n",  | 
 | 107 | +    "\n",  | 
108 | 108 |     "def interactive_plot_transit(date_time):\n",  | 
109 |  | -    "        with quantity_support():\n",  | 
110 |  | -    "                plot_transit(\n",  | 
111 |  | -    "                        config,\n",  | 
112 |  | -    "                        source_name,\n",  | 
113 |  | -    "                        target_source,\n",  | 
114 |  | -    "                        observer,\n",  | 
115 |  | -    "                        time = Time(date_time).utc,\n",  | 
116 |  | -    "                        merge_profiles=True,\n",  | 
117 |  | -    "                        plot_crab=False,\n",  | 
118 |  | -    "                        savefig=False,\n",  | 
119 |  | -    "                )\n",  | 
 | 109 | +    "    with quantity_support():\n",  | 
 | 110 | +    "        plot_transit(\n",  | 
 | 111 | +    "            config,\n",  | 
 | 112 | +    "            source_name,\n",  | 
 | 113 | +    "            target_source,\n",  | 
 | 114 | +    "            observer,\n",  | 
 | 115 | +    "            time=Time(date_time).utc,\n",  | 
 | 116 | +    "            merge_profiles=True,\n",  | 
 | 117 | +    "            plot_crab=False,\n",  | 
 | 118 | +    "            savefig=False,\n",  | 
 | 119 | +    "        )\n",  | 
 | 120 | +    "\n",  | 
120 | 121 |     "\n",  | 
121 | 122 |     "interact(interactive_plot_transit, date_time=date_time)\n",  | 
122 | 123 |     "plt.show()"  | 
 | 
136 | 137 |    "outputs": [],  | 
137 | 138 |    "source": [  | 
138 | 139 |     "date_time = DatetimePicker(\n",  | 
139 |  | -    "    value=datetime.now(timezone.utc),\n",  | 
140 |  | -    "    description='Select a datetime',\n",  | 
141 |  | -    "    disabled=False\n",  | 
 | 140 | +    "    value=datetime.now(timezone.utc), description=\"Select a datetime\", disabled=False\n",  | 
142 | 141 |     ")\n",  | 
143 | 142 |     "\n",  | 
144 |  | -    "def plot_alt(date_time):\n",  | 
145 | 143 |     "\n",  | 
 | 144 | +    "def plot_alt(date_time):\n",  | 
146 | 145 |     "    print(date_time)\n",  | 
147 | 146 |     "\n",  | 
148 | 147 |     "    plot_altitude_airmass(\n",  | 
149 |  | -    "                config,\n",  | 
150 |  | -    "                source_name,\n",  | 
151 |  | -    "                target_source,\n",  | 
152 |  | -    "                observer,\n",  | 
153 |  | -    "                time=Time(date_time).utc,\n",  | 
154 |  | -    "                brightness_shading=True,\n",  | 
155 |  | -    "                airmass_yaxis=True,\n",  | 
156 |  | -    "                savefig=False,\n",  | 
157 |  | -    "            )\n",  | 
 | 148 | +    "        config,\n",  | 
 | 149 | +    "        source_name,\n",  | 
 | 150 | +    "        target_source,\n",  | 
 | 151 | +    "        observer,\n",  | 
 | 152 | +    "        time=Time(date_time).utc,\n",  | 
 | 153 | +    "        brightness_shading=True,\n",  | 
 | 154 | +    "        airmass_yaxis=True,\n",  | 
 | 155 | +    "        savefig=False,\n",  | 
 | 156 | +    "    )\n",  | 
 | 157 | +    "\n",  | 
158 | 158 |     "\n",  | 
159 | 159 |     "interact(plot_alt, date_time=date_time)\n",  | 
160 | 160 |     "plt.show()"  | 
 | 
174 | 174 |    "outputs": [],  | 
175 | 175 |    "source": [  | 
176 | 176 |     "plot_spectrum(\n",  | 
177 |  | -    "            config,\n",  | 
178 |  | -    "        plot_energy_bounds,\n",  | 
179 |  | -    "        assumed_spectrum,\n",  | 
180 |  | -    "        source_name,\n",  | 
181 |  | -    "        plotting_options,\n",  | 
182 |  | -    "        savefig=False,\n",  | 
183 |  | -    "        )"  | 
 | 177 | +    "    config,\n",  | 
 | 178 | +    "    plot_energy_bounds,\n",  | 
 | 179 | +    "    assumed_spectrum,\n",  | 
 | 180 | +    "    source_name,\n",  | 
 | 181 | +    "    plotting_options,\n",  | 
 | 182 | +    "    savefig=False,\n",  | 
 | 183 | +    ")"  | 
184 | 184 |    ]  | 
185 | 185 |   },  | 
186 | 186 |   {  | 
 | 
204 | 204 |     "    energy_bins, gamma_rate, background_rate, config, assumed_spectrum\n",  | 
205 | 205 |     ")\n",  | 
206 | 206 |     "\n",  | 
207 |  | -    "combined_significance = source_detection(\n",  | 
208 |  | -    "    sigmas, u.Quantity(config[\"observation_time\"])\n",  | 
209 |  | -    ")"  | 
 | 207 | +    "combined_significance = source_detection(sigmas, u.Quantity(config[\"observation_time\"]))"  | 
210 | 208 |    ]  | 
211 | 209 |   },  | 
212 | 210 |   {  | 
 | 
215 | 213 |    "metadata": {},  | 
216 | 214 |    "outputs": [],  | 
217 | 215 |    "source": [  | 
218 |  | -    "annotation_options = {\"rotation\": 45,\n",  | 
219 |  | -    "        \"xytext\": (10, 10),\n",  | 
220 |  | -    "        \"size\": 15}\n",  | 
 | 216 | +    "annotation_options = {\"rotation\": 45, \"xytext\": (10, 10), \"size\": 15}\n",  | 
221 | 217 |     "\n",  | 
222 | 218 |     "with quantity_support():\n",  | 
223 | 219 |     "    plot_sed(\n",  | 
224 |  | -    "            config,\n",  | 
225 |  | -    "            sigmas,\n",  | 
226 |  | -    "            combined_significance,\n",  | 
227 |  | -    "            source_name,\n",  | 
228 |  | -    "            assumed_spectrum,\n",  | 
229 |  | -    "            en,\n",  | 
230 |  | -    "            sed,\n",  | 
231 |  | -    "            dsed,\n",  | 
232 |  | -    "            detected,\n",  | 
233 |  | -    "            savefig=False,\n",  | 
234 |  | -    "            annotation_options=annotation_options,\n",  | 
235 |  | -    "            )\n",  | 
236 |  | -    "    plt.ylim(1.e-12, 2.e-10)"  | 
 | 220 | +    "        config,\n",  | 
 | 221 | +    "        sigmas,\n",  | 
 | 222 | +    "        combined_significance,\n",  | 
 | 223 | +    "        source_name,\n",  | 
 | 224 | +    "        assumed_spectrum,\n",  | 
 | 225 | +    "        en,\n",  | 
 | 226 | +    "        sed,\n",  | 
 | 227 | +    "        dsed,\n",  | 
 | 228 | +    "        detected,\n",  | 
 | 229 | +    "        savefig=False,\n",  | 
 | 230 | +    "        annotation_options=annotation_options,\n",  | 
 | 231 | +    "    )\n",  | 
 | 232 | +    "    plt.ylim(1.0e-12, 2.0e-10)"  | 
237 | 233 |    ]  | 
238 | 234 |   },  | 
239 | 235 |   {  | 
240 | 236 |    "cell_type": "code",  | 
241 | 237 |    "execution_count": null,  | 
242 | 238 |    "metadata": {},  | 
243 | 239 |    "outputs": [],  | 
244 |  | -   "source": []  | 
 | 240 | +   "source": [  | 
 | 241 | +    "instrument_fov = u.Quantity(config[\"fov\"])\n",  | 
 | 242 | +    "wobble_offsets, wobble_angles = load_wobbles(config[\"wobbles\"])\n",  | 
 | 243 | +    "plot_skymap_with_wobbles(\n",  | 
 | 244 | +    "    target_source,\n",  | 
 | 245 | +    "    observer,\n",  | 
 | 246 | +    "    instrument_fov,\n",  | 
 | 247 | +    "    wobble_angles,\n",  | 
 | 248 | +    "    wobble_offsets,\n",  | 
 | 249 | +    "    config,\n",  | 
 | 250 | +    ")"  | 
 | 251 | +   ]  | 
245 | 252 |   }  | 
246 | 253 |  ],  | 
247 | 254 |  "metadata": {  | 
 | 
0 commit comments