# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['sfdmap2']

package_data = \
{'': ['*']}

install_requires = \
['numpy>=1.24.2,<2.0.0']

extras_require = \
{'fits': ['astropy>=5.2.1,<6.0.0', 'fitsio>=1.1.8,<2.0.0']}

setup_kwargs = {
    'name': 'sfdmap2',
    'version': '0.2.0',
    'description': 'Get E(B-V) values from SFD dust map data',
    'long_description': '# sfdmap2\nThis is a fork of [sfdmap](https://github.com/kbarbary/sfdmap), as the original repository is no longer maintained.\n\n[![Build Status](https://github.com/simeonreusch/sfdmap2/actions/workflows/continous_integration.yml/badge.svg)](https://github.com/simeonreusch/sfdmap2/actions/workflows/continous_integration.yml)\n[![Coverage Status](https://coveralls.io/repos/github/simeonreusch/sfdmap2/badge.svg?branch=main)](https://coveralls.io/github/simeonreusch/sfdmap2?branch=main)\n[![PyPI](https://img.shields.io/pypi/v/sfdmap2.svg?style=flat-square)](https://pypi.python.org/pypi/sfdmap2)\n\nA minimal, fast, MIT-licensed Python module for getting E(B-V) values from\n[Schlegel, Finkbeiner & Davis (1998)](http://adsabs.harvard.edu/abs/1998ApJ...500..525S) dust map FITS files.\n\n```python\nfrom sfdmap2 import sfdmap\n\nm = sfdmap.SFDMap()\n\nm.ebv(100., 40.)  # Get E(B-V) value at RA=100 degrees, Dec=40 degrees\n0.10739716819557897\n```\n\n\n## Install\n\nRequirements: numpy and a FITS reader (either fitsio or astropy).\n\n```\npip install sfdmap2\n```\n\nThe FITS files comprising the map must be downloaded separately. Among other\nlocations, they are available from http://github.com/kbarbary/sfddata. On UNIX\nsystems, run the following to download the maps (93 MB download size):\n\n```\nwget https://github.com/kbarbary/sfddata/archive/master.tar.gz\ntar xzf master.tar.gz\n```\n\nA directory "sfddata-master" will be created. Move or rename as you like.\n\n\n## Detailed Usage\n\n#### Initialize map:\n\n```python\nfrom sfdmap2 import sfdmap\n\nm = sfdmap.SFDMap(\'/path/to/dustmap/files\')\nm = sfdmap.SFDMap()  # get directory from SFD_DIR environment variable\n```\n\nBy default, a scaling of 0.86 is applied to the map values to reflect\nthe recalibration by Schlafly & Finkbeiner (2011). To get the original\nvalues, use `scaling=1.0` when constructing the map:\n\n```python\nm = sfdmap.SFDMap(scaling=1.0)\n```\n\nGet E(B-V) value at RA, Dec = 0., 0. (ICRS frame)\n\n```python\nm.ebv(0., 0.)\n0.031814847141504288\n```\n\nGet E(B-V) at three locations (first argument is RA, second is Dec):\n\n```python\nm.ebv([0., 5., 10.], [0., 1.5, 2.1])\narray([ 0.03181879,  0.02374864,  0.01746732])\n```\n\nBy default the coordinates are assumed to be in degrees in the ICRS coordinate\nsystem (e.g., "J2000"). This can be changed with the `frame` and `unit`\nkeywords:\n\n```python\nm.ebv(1.68140, -1.0504884, frame=\'galactic\', unit=\'radian\')\n0.031820329230751863\n```\n\nThe dust map values are linearly interpolated by default. Change this with the\n`interpolate` keyword:\n\n```python\nm.ebv(1.68140, -1.0504884, frame=\'galactic\', unit=\'radian\', interpolate=False)\n0.031526423990726471\n```\n\n\nYou can pass an astropy `SkyCoord` instance:\n\n```python\nfrom astropy.coordinates import SkyCoord\n\ncoords = SkyCoord([0., 5., 10.], [0., 1.5, 2.1], frame=\'icrs\', unit=\'degree\')\n\nm.ebv(coords)\narray([ 0.03181879,  0.02374864,  0.01746732])\n```\n\nFinally, there is a convenience function in the module so that you\ndon\'t have to construct a `SFDMap` instance if you just want to query\nthe map once:\n\n```python\nsfdmap.ebv(0., 0.)  # get map directory from SFD_DIR environment variable\n0.031818788521008\n\nsfdmap.ebv(0., 0., mapdir=\'/path/to/dust/files\')\n0.031818788521008\n```\n\n### How do I get extinction at a specific wavelength or in a specific filter?\n\nThe E(B-V) values from the map give information about the *amplitude*\nof dust extinction in a given direction. To get the extinction at a\ngiven wavelength or through a given filter, one needs information\nabout the relative extinction between different wavelengths: an\n"extinction law". One can use the\n[extinction](http://extinction.readthedocs.io) package for this. For\nexample, the following code gets the extinction in magnitudes at RA,\nDec = (0., 0.) and wavelengths (4000, 5000):\n\n```python\nimport extinction\n\nebv = m.ebv(0., 0.)\n\nwave = np.array([4000., 5000.])\n\nextinction.fitzpatrick99(wave, 3.1 * ebv)\narray([ 0.12074424,  0.09513746])\n```\n\nTo get the extinction in a given bandpass, one needs to know the\nsource spectrum, as different wavelengths in the bandpass will have\ndifferent extinction. With an assumed source spectrum, one would\nintegrate the source spectrum with extinction applied through the\nbandpass and then compare to the unextincted spectrum integrated\nthrough the same bandpass. Some papers provide extinction values in a\nnumber of common bandpasses; these assume some source spectrum.\n\n\n### Performance Note\n\nNote that while passing an astropy `SkyCoord` object works, if you\nhave coordinates in the ICRS or FK5 (epoch 2000) (e.g., J2000) systems, it\nis far faster to pass latitute and longitude directly. This is particularly\ntrue for small numbers of coordinates or scalar coordinates:\n\n```python\nfrom astropy.coordinates import SkyCoord\n\nfrom sfdmap2 import sfdmap\n\nm = sfdmap.SFDMap()\n\nm.ebv(0., 0.)  # evaluate once to trigger reading the FITS file\n0.03181878852100873\n\ncoord = SkyCoord(0., 0., unit=\'degree\')\n\n%timeit m.ebv(coord)  # time with SkyCoord object\n100 loops, best of 3: 18.1 ms per loop\n\n%timeit m.ebv(0., 0., unit=\'degree\')  # pass ra, dec directly\n10000 loops, best of 3: 80 µs per loop\n```\n\n## Alternatives\n\nThere are a couple other packages that support getting dust\nvalues from this map. Both these packages have a bigger scope than\nthis one and include several other 2-d or 3-d galactic dust maps.\nCheck them out if you want to compare between different maps or need 3-d\nmaps. Below, I note a few relevant differences from this package.\n\n#### [mwdust](http://github.com/jobovy/mwdust) [[docs](https://pypi.python.org/pypi/mwdust)]\n\n`mwdust.SFD` gives the extinction in a given band rather than E(B-V).\nThe API is geared towards 3-d maps, so a distance must be given. Python 3\nis not currently supported. The license is BSD.\n\n#### [dustmaps](http://github.com/gregreen) [[docs](http://dustmaps.readthedocs.io/en/latest/)]\n\n`dustmaps.sfd.SFDQuery` uses astropy\'s SkyCoord for all coordinate\nconversions and therefore has suboptimal performance for small numbers\nof coordinates (see "Performance Note" above). The license is GPLv2.\n',
    'author': 'Kyle Barbary',
    'author_email': 'None',
    'maintainer': 'Simeon Reusch',
    'maintainer_email': 'simeon.reusch@desy.de',
    'url': 'https://github.com/simeonreusch/sfdmap2',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
