Commit 115b12d6465ae10c613d1420d669beaed093d9be
1 parent
e950b6d6
Add LMC survey
Showing
1 changed file
with
63 additions
and
4 deletions
examples/make_pointings.py
| @@ -240,6 +240,59 @@ def set_gc(lst=True): | @@ -240,6 +240,59 @@ def set_gc(lst=True): | ||
| 240 | return obsdef | 240 | return obsdef |
| 241 | 241 | ||
| 242 | 242 | ||
| 243 | +# ============= # | ||
| 244 | +# Setup LMC KSP # | ||
| 245 | +# ============= # | ||
| 246 | +def set_lmc(hours=250.0, lst=True): | ||
| 247 | + """ | ||
| 248 | + Setup LMC KSP. | ||
| 249 | + """ | ||
| 250 | + # Initialise observation definition | ||
| 251 | + obsdef = [] | ||
| 252 | + | ||
| 253 | + # Set LMC centre | ||
| 254 | + centre = gammalib.GSkyDir() | ||
| 255 | + centre.radec_deg(80.0, -69.0) | ||
| 256 | + | ||
| 257 | + # Set offset angle and number of pointings | ||
| 258 | + offset = 1.0 # degrees | ||
| 259 | + n_pnt = 12 | ||
| 260 | + | ||
| 261 | + # Prepare computations | ||
| 262 | + dphi = 360.0/n_pnt | ||
| 263 | + duration = hours*3600.0/float(n_pnt) | ||
| 264 | + | ||
| 265 | + # Loop over pointings | ||
| 266 | + for ipnt in range(n_pnt): | ||
| 267 | + | ||
| 268 | + # Compute pointing direction | ||
| 269 | + pnt = centre.copy() | ||
| 270 | + pnt.rotate_deg(ipnt*dphi, offset) | ||
| 271 | + lon = pnt.l_deg() | ||
| 272 | + lat = pnt.b_deg() | ||
| 273 | + | ||
| 274 | + # Set positions and duration | ||
| 275 | + obs = {'lon': lon, 'lat': lat, 'duration': duration} | ||
| 276 | + | ||
| 277 | + # Add IRF | ||
| 278 | + caldb = "aar" | ||
| 279 | + if lst: | ||
| 280 | + irf = "DESY20140105_50h" | ||
| 281 | + else: | ||
| 282 | + irf = "DESY20140105_50h_noLST" | ||
| 283 | + obs['caldb'] = caldb | ||
| 284 | + obs['irf'] = irf | ||
| 285 | + | ||
| 286 | + # Append observation | ||
| 287 | + obsdef.append(obs) | ||
| 288 | + | ||
| 289 | + # Dump statistics | ||
| 290 | + print("Number of pointings: %d (%.2f sec)" % (n_pnt,duration)) | ||
| 291 | + | ||
| 292 | + # Return observation definition | ||
| 293 | + return obsdef | ||
| 294 | + | ||
| 295 | + | ||
| 243 | # ======================================= # | 296 | # ======================================= # |
| 244 | # Write observation definition dictionary # | 297 | # Write observation definition dictionary # |
| 245 | # ======================================= # | 298 | # ======================================= # |
| @@ -302,13 +355,14 @@ if __name__ == '__main__': | @@ -302,13 +355,14 @@ if __name__ == '__main__': | ||
| 302 | if need_help: | 355 | if need_help: |
| 303 | print("Usage: make_pointing.py [OPTIONS]") | 356 | print("Usage: make_pointing.py [OPTIONS]") |
| 304 | print(" -h Display this usage message") | 357 | print(" -h Display this usage message") |
| 305 | - print(" gps Galactic plane scan (2 row scheme)") | ||
| 306 | - print(" gps3 Galactic plane scan (3 row scheme)") | 358 | + print(" gps Galactic plane survey (2 row scheme)") |
| 359 | + print(" gps3 Galactic plane survey (3 row scheme)") | ||
| 307 | print(" extgal Extragalactic survey") | 360 | print(" extgal Extragalactic survey") |
| 308 | - print(" gc Galactic centre") | 361 | + print(" gc Galactic centre survey") |
| 362 | + print(" lmc LMC survey") | ||
| 309 | sys.exit() | 363 | sys.exit() |
| 310 | 364 | ||
| 311 | - # Galactic plane scan | 365 | + # Galactic plane survey |
| 312 | if obsname == "gps": | 366 | if obsname == "gps": |
| 313 | obsdef = set_gps(lst=True) | 367 | obsdef = set_gps(lst=True) |
| 314 | write_obsdef("gps.dat", obsdef) | 368 | write_obsdef("gps.dat", obsdef) |
| @@ -326,6 +380,11 @@ if __name__ == '__main__': | @@ -326,6 +380,11 @@ if __name__ == '__main__': | ||
| 326 | obsdef = set_gc(lst=True) | 380 | obsdef = set_gc(lst=True) |
| 327 | write_obsdef("gc.dat", obsdef) | 381 | write_obsdef("gc.dat", obsdef) |
| 328 | 382 | ||
| 383 | + # LMC | ||
| 384 | + elif obsname == "lmc": | ||
| 385 | + obsdef = set_lmc(lst=True) | ||
| 386 | + write_obsdef("lmc.dat", obsdef) | ||
| 387 | + | ||
| 329 | # Invalid pattern | 388 | # Invalid pattern |
| 330 | else: | 389 | else: |
| 331 | print("Unknown option \""+obsname+"\"") | 390 | print("Unknown option \""+obsname+"\"") |