/
__init__.py
75 lines (57 loc) · 2.17 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Gammapy: A Python package for gamma-ray astronomy.
* Code: https://github.com/gammapy/gammapy
* Docs: https://docs.gammapy.org/
The top-level `gammapy` namespace is almost empty,
it only contains this:
::
test --- Run Gammapy unit tests
__version__ --- Gammapy version string
The Gammapy functionality is available for import from
the following sub-packages (e.g. `gammapy.makers`):
::
astro --- Astrophysical source and population models
catalog --- Source catalog tools
makers --- Data reduction functionality
data --- Data and observation handling
irf --- Instrument response functions (IRFs)
maps --- Sky map data structures
modeling --- Models and fitting
estimators --- High level flux estimation
stats --- Statistics tools
utils --- Utility functions and classes
"""
__all__ = ["__version__", "song"]
import pkg_resources
try:
__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
# package is not installed
pass
def song(karaoke=False):
"""
Listen to the Gammapy song.
Make sure you listen on good headphones or speakers. You'll be not disappointed!
Parameters
----------
karaoke : bool
Print lyrics to sing along.
"""
import sys
import webbrowser
webbrowser.open("https://gammapy.org/gammapy_song.mp3")
if karaoke:
lyrics = (
"\nGammapy Song Lyrics\n"
"-------------------\n\n"
"Gammapy, gamma-ray data analysis package\n"
"Gammapy, prototype software CTA science tools\n\n"
"Supernova remnants, pulsar winds, AGN, Gamma, Gamma, Gammapy\n"
"Galactic plane survey, pevatrons, Gammapy, Gamma, Gammapy\n"
"Gammapy, github, continuous integration, readthedocs, travis, "
"open source project\n\n"
"Gammapy, Gammapy\n\n"
"Supernova remnants, pulsar winds, AGN, Gamma, Gamma, Gammapy\n"
)
centered = "\n".join(f"{s:^80}" for s in lyrics.split("\n"))
sys.stdout.write(centered)