Coder Social home page Coder Social logo

ruizca / gdpyc Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 2.05 MB

Gas and Dust Python Calculator

Home Page: https://gdpyc.readthedocs.io

License: BSD 3-Clause Clear License

Python 100.00%
astronomy astronomy-library xray dust extinction reddening python27 python3

gdpyc's Introduction

gdpyc ─ Gas and Dust Python Calculator

gdpyc is a Python 2/3 package for calculating Hydrogen column density and optical extinction. gdpyc offers functionalities similar to the nh tool included in HEASoft, or on-line web services like HEASARC's nH or IRSA's Galactic Dust Reddening and Extinction.

This package uses HEALpix maps provided by NASA's LAMBDA service. Please cite the original papers and authors of the surveys if you use this tool for your research (see sections Surveys and References below).

astropy DOI

Dependencies

gdpyc depends on:

  • numpy
  • astropy
  • astropy-healpix
  • regions

Certain functionalities also requiere:

  • healpix
  • matplotlib

Installation

gdpyc can be easily installed using pip:

pip install gdpyc

Example

A simple example of using gdpyc:

>>> from gdpyc import GasMap, DustMap
>>> from astropy.coordinates import SkyCoord

>>> coords = SkyCoord(34.0, -5.0, unit='deg')
>>> GasMap.nh(coords, nhmap='DL')

<Quantity 1.9278499e+20 1 / cm2>

>>> GasMap.nh(coords, nhmap='LAB')

<Quantity 1.9802036e+20 1 / cm2>

>>> DustMap.ebv(coords, dustmap='Planck13')

'0.027179038520908336'

>>> DustMap.extinction(coords, dustmap='SFD', filters='SDSS_r')

<Table length=1>
       SDSS_r       
      float64       
--------------------
0.049108389441137615

>>> GasMap.plot_map('HI4PI')

Surveys

gdpyc includes several HI and dust surveys with nH and E(B - V) estimations. We created low resolution HEALPix maps for all surveys (NSIDE=64 ~ 1 degree pixels) by degrading the original maps using the ud_grade tool from healpy. Only low resolution maps are included in the installation. If the user asks for high resolution maps (hires parameter, see API documentation), they are downloaded as needed and stored for future use.

HI surveys

DL: Composite all-sky map of neutral Hydrogen column density (NHI), formed from the Leiden/Dwingeloo survey data1 and the composite NHI map of2. The two datasets are not matched in sensitivity or resolution; note that discontinuities exist in the constructed composite map.

DL high resolution data (oversampled), NSIDE=512 ~ 0.11 deg.

LAB: Observations of 21-cm emission from Galactic neutral Hydrogen over the entire sky, merging the Leiden/Dwingeloo Survey3 of the sky north of -30° with the Instituto Argentino de Radioastronomia Survey 4,5 of the sky south of -25°.6

LAB high resolution data (oversampled), NSIDE=512 ~ 0.11 deg.7

HI4PI: The HI 4-PI Survey (HI4PI) is a 21-cm all-sky survey of neutral atomic Hydrogen. It is constructed from the Effelsberg-Bonn HI Survey (EBHIS) and the Galactic All-Sky Survey (GASS).8

HI4PI high resolution data, NSIDE=1024 ~ 0.06 deg.

Dust surveys

SFD: All-sky map of Galactic reddening, E(B - V), from a composite 100 micron map formed from IRAS/ISSA maps calibrated using DIRBE observations.9

SFD high resolution data (undersampled), NSIDE=512 ~ 0.11 deg.

Planck13: All-sky map of Galactic reddening, E(B - V), using Planck-HFI and IRAS data, for extra-galactic studies.10

Planck13 high resolution data, NSIDE=2048 ~ 0.03 deg.

Extinction values for different filters are estimated using the E(B - V) conversion factors presented in11, assuming an extinction to reddening ratio R=3.1 Additional factors for 2MASS, Spitzer-IRAC and WISE filters are from IRSA's Galactic Dust Reddening and Extinction service.

References


  1. Hartmann & Burton 1997, Cambridge University Press.

  2. Dickey & Lockman 1990, Ann. Rev. A&A, 28, 215.

  3. Hartmann & Burton 1997, Cambridge University Press.

  4. Arnal et al. 2000, A&AS, 142.

  5. Bajaja et al. 2005, A&A, 440, 2

  6. Kalberla et al. 2005, A&A, 440, 775.

  7. Land & Slosar 2007, Phys. Rev. D, 76, 8.

  8. HI4PI Collaboration et al. 2016, A&A, 594, A116.

  9. Schlegel, Finkbeiner & Davis 1998, ApJ, 500, 2.

  10. Planck Collaboration et al. 2013, A&A, 571, A11.

  11. Schlafly & Finkbeiner 2011, ApJ, 737, 2, 103.

gdpyc's People

Contributors

ruizca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gdpyc's Issues

Make get_map return healpix map

Hi!
I think it would be very handy and cool to have a healpix map returned when one uses plot_map function from 'data' module. Also the hires data should be included if needed.

it requires a modification only of a few lines in core.py, as below


    @classmethod
    def plot_map(cls, map_name, plotname=None, hires=False):
        """
        Full-sky plot (mollweide projection) of the map.

        **Note:** this method needs ``healpy`` and ``matplotlib``.

        Parameters
        ----------
        map_name : ``str``
            Name of the map to be plotted. Use ``show_maps`` method
            to see a list of all available maps.
        plotname : ``str`` or ``None``, optional
            Name of the file where the plot will be saved. If ``None``,
            the plot is shown but not saved. Defaults to ``None``.
        hires : bool
            whether to use high resolution map
        Returns
        -------
        plot : ``numpy.ndarray``
            2D numpy array with the plot.
        hpmap : ``numpy.ndarray``
            1D numpy array with the healpix map being plot.
        """
        import healpy as hp
        import matplotlib.pyplot as plt

        cls._check_map(map_name)

        if not hires:
            hpmapfile = "{}_{}_healpix_lowres.fits".format(
                cls._map_type, map_name)
        else:
            hpmapfile = "{}_{}_healpix_hires.fits".format(
                cls._map_type, map_name)

        hpmapfile = os.path.join(cls._data_path, hpmapfile)
        hpmap = hp.read_map(hpmapfile)

        title = "{} ({})".format(map_name, cls._maps[map_name])
        if cls._map_type == "h1_nh":
            unit_label = "cm-2"
            minval, maxval = 1e19, 3e22
        else:
            unit_label = "mag"
            minval, maxval = 0, hpmap.max()

        plot = hp.mollview(
            hpmap,
            title=title,
            norm="hist",
            min=minval,
            max=maxval,
            unit=unit_label,
            return_projected_map=True,
        )

        if plotname is None:
            plt.show()
        else:
            plt.savefig(plotname)

        return plot, hpmap

And for this reason, returning low/hi resolution map should be an argument.
Healpix NH maps are useful for creating masks for, say, X-ray surveys.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.