""" template = SkyImage.read(filename, **kwargs) return cls(template) def evaluate(self, x, y, amplitude): # TODO: don't hardcode Galactic frame!!! coord = SkyCoord(x, y, frame='galactic', unit='deg') x_pix, y_pix = self.image.wcs_skycoord_to_pixel(coord) values = self._interpolate_data(y_pix, x_pix) return amplitude * values @property def bounding_box(self): width = self.image.width.deg height = self.image.height.deg center = self.image.center x_0 = center.data.lon.wrap_at('180d').deg y_0 = center.data.lat.deg return ((y_0 - height / 2, y_0 + height / 2), (x_0 - width, x_0 + height / 2)) # TODO: change this to a model registry morph_types = OrderedDict() morph_types.__doc__ = """Spatial model registry (`~collections.OrderedDict`).""" morph_types['delta2d'] = Delta2D morph_types['gauss2d'] = Gaussian2D morph_types['shell2d'] = Shell2D morph_types['sphere2d'] = Sphere2D morph_types['template2d'] = Template2D
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Location of gamma-ray observatories.""" from __future__ import absolute_import, division, print_function, unicode_literals from collections import OrderedDict from astropy.coordinates import EarthLocation __all__ = [ 'observatory_locations', ] observatory_locations = OrderedDict() observatory_locations.__doc__ = """Gamma-ray observatory locations (`~collections.OrderedDict`). This is an `~collections.OrderedDict` with string keys nd values of type `~astropy.coordinates.EarthLocation`. Not that with ``EarthLocation`` the orientation of angles is as follows: - longitude is east for positive values and west for negative values - latitude is north for positive values and south for negative values Available observatories (alphabetical order): - ``cta_south`` and ``cta_north`` for CTA, see `Website <https://www.cta-observatory.org/>`__ and `Wikipedia <https://en.wikipedia.org/wiki/Cherenkov_Telescope_Array>`__ - ``hawc`` for HAWC, see `Website <https://www.hawc-observatory.org/>`__ and `Wikipedia <https://en.wikipedia.org/wiki/High_Altitude_Water_Cherenkov_Experiment>`__ - ``hegra`` for HEGRA, see `Wikipedia <https://en.wikipedia.org/wiki/HEGRA>`__ - ``hess`` for HESS, see
.. math :: f(v) = A\\frac{4}{\\pi} \\frac{1}{v_0 \\left[1 + (v / v_0) ^ 2 \\right] ^ 2} Reference: http://adsabs.harvard.edu/abs/1990ApJ...348..485P (Formula (3)) Parameters ---------- amplitude : float Value of the integral v_0 : float Velocity parameter (km s^-1) """ amplitude = Parameter() v_0 = Parameter() def __init__(self, amplitude=1, v_0=560, **kwargs): super(Paczynski1990Velocity, self).__init__(amplitude=amplitude, v_0=v_0, **kwargs) @staticmethod def evaluate(v, amplitude, v_0): """One dimensional Paczynski 1990 velocity model function.""" return amplitude * 4. / (np.pi * v_0 * (1 + (v / v_0) ** 2) ** 2) velocity_distributions = OrderedDict() velocity_distributions.__doc__ = """Velocity distributions (dict mapping names to classes).""" velocity_distributions['H05'] = FaucherKaspi2006VelocityMaxwellian velocity_distributions['F06B'] = FaucherKaspi2006VelocityBimodal velocity_distributions['F06P'] = Paczynski1990Velocity
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Location of gamma-ray observatories.""" from __future__ import absolute_import, division, print_function, unicode_literals from collections import OrderedDict from astropy.coordinates import EarthLocation __all__ = [ 'observatory_locations', ] observatory_locations = OrderedDict() observatory_locations.__doc__ = """Gamma-ray observatory locations (`~collections.OrderedDict`). This is an `~collections.OrderedDict` with string keys nd values of type `~astropy.coordinates.EarthLocation`. Not that with ``EarthLocation`` the orientation of angles is as follows: - longitude is east for positive values and west for negative values - latitude is north for positive values and south for negative values Available observatories (alphabetical order): - ``cta_south`` and ``cta_north`` for CTA, see `Website <https://www.cta-observatory.org/>`__ and `Wikipedia <https://en.wikipedia.org/wiki/Cherenkov_Telescope_Array>`__ - ``hawc`` for HAWC, see `Website <https://www.hawc-observatory.org/>`__ and `Wikipedia <https://en.wikipedia.org/wiki/High_Altitude_Water_Cherenkov_Experiment>`__ - ``hegra`` for HEGRA, see `Wikipedia <https://en.wikipedia.org/wiki/HEGRA>`__
""" # Model parameters p = Quantity(12.8, 'deg') # pitch angle in deg m = 4 # number of spiral arms r_sun = Quantity(7.6, 'kpc') # distance sun to Galactic center in kpc r_0 = Quantity(2.1, 'kpc') # spiral inner radius in kpc theta_0 = Quantity(-20, 'deg') # Norma spiral arm start angle bar_radius = Quantity(3.0, 'kpc') # Radius of the galactic bar (not equal r_0!) spiralarms = np.array(['Norma', 'Perseus', 'Carina Sagittarius', 'Crux Scutum']) def __init__(self): self.r_0 = self.r_0 * np.ones(4) self.theta_0 = self.theta_0 + Quantity([0, 90, 180, 270], 'deg') self.k = Quantity(1. / np.tan(np.radians(self.p.value)) * np.ones(4), 'rad') # Compute start and end point of the bar x_0, y_0 = self.xy_position(radius=self.bar_radius, spiralarm_index=0) x_1, y_1 = self.xy_position(radius=self.bar_radius, spiralarm_index=2) self.bar = dict(x=Quantity([x_0, x_1]), y=Quantity([y_0, y_1])) radial_distributions = OrderedDict() radial_distributions.__doc__ = """Radial distribution (dict mapping names to classes).""" radial_distributions['CB98'] = CaseBattacharya1998 radial_distributions['F06'] = FaucherKaspi2006 radial_distributions['L06'] = Lorimer2006 radial_distributions['P90'] = Paczynski1990 radial_distributions['YK04'] = YusifovKucuk2004 radial_distributions['YK04B'] = YusifovKucuk2004B