From c0b81f8caae22b7bf4445f69f010b4b155ef7860 Mon Sep 17 00:00:00 2001 From: Andrew Saydjari Date: Sat, 27 Apr 2024 20:41:20 -0400 Subject: [PATCH 1/6] add support for additional sfd maps --- dustmaps/sfd.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index 7bc7abe..bdb3471 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -99,7 +99,12 @@ class SFDQuery(SFDBase): map_name = 'sfd' map_name_long = "SFD'98" - def __init__(self, map_dir=None): + def __init__( + self, + map_dir=None, + whichparent='SFD', + which='dust' + ): """ Args: map_dir (Optional[str]): The directory containing the SFD map. @@ -110,7 +115,10 @@ def __init__(self, map_dir=None): if map_dir is None: map_dir = os.path.join(data_dir(), 'sfd') - base_fname = os.path.join(map_dir, 'SFD_dust_4096') + if whichparent == 'SFD': + base_fname = os.path.join(map_dir, '{}_{}_4096'.format(whichparent,which)) + else: + base_fname = os.path.join(map_dir, '{}_{}'.format(whichparent,which)) super(SFDQuery, self).__init__(base_fname) @@ -149,19 +157,30 @@ def __init__(self, api_url=None): map_name='sfd') -def fetch(): +def fetch(whichparent='SFD',which='dust'): """ Downloads the Schlegel, Finkbeiner & Davis (1998) dust map, placing it in the data directory for `dustmap`. + + Args: + which (Optional[:obj:`str`]): The name of the SFD data product to download. + Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap``. """ doi = '10.7910/DVN/EWCNL5' for pole in ['ngp', 'sgp']: - requirements = {'filename': 'SFD_dust_4096_{}.fits'.format(pole)} - local_fname = os.path.join( + if whichparent == 'SFD': + requirements = {'filename': '{}_{}_4096_{}.fits'.format(whichparent,which,pole)} + local_fname = os.path.join( + data_dir(), + 'sfd', '{}_{}_4096_{}.fits'.format(whichparent,which,pole)) + else: + requirements = {'filename': '{}_{}_{}.fits'.format(whichparent,which,pole)} + local_fname = os.path.join( data_dir(), - 'sfd', 'SFD_dust_4096_{}.fits'.format(pole)) - print('Downloading SFD data file to {}'.format(local_fname)) + 'sfd', '{}_{}_{}.fits'.format(whichparent,which,pole)) + + print('Downloading {} {} data file to {}'.format(whichparent,which,local_fname)) fetch_utils.dataverse_download_doi( doi, local_fname, From 9d7cc955ddae022887591e8fb5b12b8d0f22a809 Mon Sep 17 00:00:00 2001 From: Andrew Saydjari Date: Sat, 27 Apr 2024 20:50:49 -0400 Subject: [PATCH 2/6] fix temp and xmap SFD files --- dustmaps/sfd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index bdb3471..8d6cf17 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -115,7 +115,7 @@ def __init__( if map_dir is None: map_dir = os.path.join(data_dir(), 'sfd') - if whichparent == 'SFD': + if (whichparent == 'SFD') and (which == 'dust' or which == 'i100' or which == 'i60' or which == 'mask'): base_fname = os.path.join(map_dir, '{}_{}_4096'.format(whichparent,which)) else: base_fname = os.path.join(map_dir, '{}_{}'.format(whichparent,which)) @@ -169,7 +169,7 @@ def fetch(whichparent='SFD',which='dust'): doi = '10.7910/DVN/EWCNL5' for pole in ['ngp', 'sgp']: - if whichparent == 'SFD': + if (whichparent == 'SFD') and (which == 'dust' or which == 'i100' or which == 'i60' or which == 'mask'): requirements = {'filename': '{}_{}_4096_{}.fits'.format(whichparent,which,pole)} local_fname = os.path.join( data_dir(), From 3484776fd612be4ca2d60fb25a227ded3a420f4f Mon Sep 17 00:00:00 2001 From: Andrew Saydjari Date: Sun, 28 Apr 2024 00:17:03 -0400 Subject: [PATCH 3/6] initial pass at docs --- dustmaps/sfd.py | 55 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index 8d6cf17..64f0376 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -93,7 +93,7 @@ def query(self, coords, order=1): class SFDQuery(SFDBase): """ - Queries the Schlegel, Finkbeiner & Davis (1998) dust reddening map. + Queries maps stored in the same format as Schlegel, Finkbeiner & Davis (1998) dust reddening map, providing results from the Schlegel, Finkbeiner & Davis (1998) dust map by default. """ map_name = 'sfd' @@ -110,6 +110,10 @@ def __init__( map_dir (Optional[str]): The directory containing the SFD map. Defaults to `None`, which means that `dustmaps` will look in its default data directory. + whichparent (Optional[:obj:`str`]): The parent name of the SFD style data product to download. + Should be either ``SFD`` (the default), ``Synch``, ``FINK``, or ``Haslam``. + which (Optional[:obj:`str`]): The name of the SFD style data product to download. + Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with whichparent ``SFD``. Should be ``Beta`` for whichparent ``Synch``. Should be ``Rmap`` for whichparent ``FINK``. Should be ``clean`` for whichparent ``Haslam``. """ if map_dir is None: @@ -124,9 +128,37 @@ def __init__( def query(self, coords, order=1): """ - Returns E(B-V) at the specified location(s) on the sky. See Table 6 of - Schlafly & Finkbeiner (2011) for instructions on how to convert this - quantity to extinction in various passbands. + Returns value of SFD-style map defined by ``whichparent`` and ``which`` during the intialization of the `SFDQuery` object at the specified location(s) on the sky. + + Defaults return E(B-V) at the specified location(s) on the sky. See Table 6 of Schlafly & Finkbeiner (2011) for instructions on how to convert this quantity to extinction in various passbands. + + For whichparent ``SFD`` and which ``dust``, the map is the Schlegel, Finkbeiner & Davis (1998) dust reddening map (E(B-V)). + + For whichparent ``SFD`` and which ``i100``, the map is the Schlegel, Finkbeiner & Davis (1998) 100 micron intensity map (MJy/sr). + + For whichparent ``SFD`` and which ``i60``, the map is the Schlegel, Finkbeiner & Davis (1998) 60 micron intensity map (MJy/sr). + + # check bit 0/1 oddness ##FIXME + For whichparent ``SFD`` and which ``mask``, the map is the Schlegel, Finkbeiner & Davis (1998) bit mask map. + Bit 0, 1: Number of HCONs (0, 1, 2, or 3) + Bit 2: Asteroid removed + Bit 3: Small no-data region replaced + Bit 4: Source removed (any) + Bit 5: No source removal + Bit 6: Large objects - LMC, SMC or M31 + Bit 7: No IRAS data (excluded zone OR Saturn) + + For whichparent ``SFD`` and which ``temp``, the map is the Schlegel, Finkbeiner & Davis (1998) dust temperature map (K). + + For whichparent ``SFD`` and which ``xmap``, the map is the Schlegel, Finkbeiner & Davis (1998) X-factor map. This map contains a temperature correction factor derived from the 100mu/240mu ratio. Multiply the 100mu map by this factor to obtain temperature-corrected emission in regions that are expected to have an unusual dust temperature. In some cases (e.g. high Galactic latitude) this factor is poorly constrained and should be used with caution. The mean value for this quantity in "normal" parts of the sky is 1. + + For whichparent ``FINK`` and which ``Rmap``, the map is the Finkbeiner-Davis-Schlegel (1999) DIRBE 100/240mu RATIO map. This map is described in "Extrapolation of Galactic Dust Emission at 100 Microns to CMBR Frequencies using FIRAS" by Finkbeiner, Davis, & Schlegel (1999). Please note that this 100/240mu R map differs from the R map described in Schlegel, Finkbeiner, & Davis, ApJ 500, 525 (1998). + + # check citation ##FIXME + For whichparent ``Haslam`` and which ``clean``, the map is the Haslam et al. (1982) 408 MHz all-sky continuum survey, cleaned of bright sources (K).The map has bright point sources removed, and has been Fourier destriped using a method similar to that applied to the IRAS/ISSA data in Schlegel, Finkbeiner, & Davis 1998, Apj, 500, 525. Due to this reprocessing, the effective beam (PSF) of the map has increased from 0.85 deg to 1.0 deg. A CMB monopole (2.73K) has been subtracted from the map. + + # check citation ##FIXME + For whichparent ``Synch`` and which ``Beta``, the map is the Finkbeiner & Davis (1999) synchrotron spectral index map. This map is based on the 408 MHz Haslam et al. (1982) map, 1.42 GHz Reich & Reich (1986) map, and 2.326 GHz Jonas, Baart, & Nicolson (1998) map. Args: coords (`astropy.coordinates.SkyCoord`): The coordinates to query. @@ -134,8 +166,7 @@ def query(self, coords, order=1): for linear interpolation. Returns: - A float array containing the SFD E(B-V) at every input coordinate. - The shape of the output will be the same as the shape of the + A float array containing the values of SFD-style map at every input coordinate. The shape of the output will be the same as the shape of the coordinates stored by `coords`. """ return super(SFDQuery, self).query(coords, order=order) @@ -148,7 +179,8 @@ class SFDWebQuery(WebDustMap): This query object does not require a local version of the data, but rather an internet connection to contact the web API. The query functions have the - same inputs and outputs as their counterparts in ``SFDQuery``. + same inputs and outputs as their counterparts in ``SFDQuery``, but + are limited in keywords to the SFD dustmap. """ def __init__(self, api_url=None): @@ -159,12 +191,13 @@ def __init__(self, api_url=None): def fetch(whichparent='SFD',which='dust'): """ - Downloads the Schlegel, Finkbeiner & Davis (1998) dust map, placing it in - the data directory for `dustmap`. + Downloads maps in the format of the Schlegel, Finkbeiner & Davis (1998) dust map, placing them in the data directory for `dustmaps`. By default, it downloads the Schlegel, Finkbeiner & Davis (1998) dust map. Args: - which (Optional[:obj:`str`]): The name of the SFD data product to download. - Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap``. + whichparent (Optional[:obj:`str`]): The parent name of the SFD style data product to download. + Should be either ``SFD`` (the default), ``Synch``, ``FINK``, or ``Haslam``. + which (Optional[:obj:`str`]): The name of the SFD style data product to download. + Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with whichparent ``SFD``. Should be ``Beta`` for whichparent ``Synch``. Should be ``Rmap`` for whichparent ``FINK``. Should be ``clean`` for whichparent ``Haslam``. """ doi = '10.7910/DVN/EWCNL5' From 00e267efb0412b0a12f691f3bd9441280f19cc51 Mon Sep 17 00:00:00 2001 From: Andrew Saydjari Date: Sun, 28 Apr 2024 12:36:37 -0400 Subject: [PATCH 4/6] edit SFD bit mask description --- dustmaps/sfd.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index 64f0376..77fea23 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -138,9 +138,8 @@ def query(self, coords, order=1): For whichparent ``SFD`` and which ``i60``, the map is the Schlegel, Finkbeiner & Davis (1998) 60 micron intensity map (MJy/sr). - # check bit 0/1 oddness ##FIXME For whichparent ``SFD`` and which ``mask``, the map is the Schlegel, Finkbeiner & Davis (1998) bit mask map. - Bit 0, 1: Number of HCONs (0, 1, 2, or 3) + Bit 0, 1: The first two bits express (in binary) the number of HCONs (0, 1, 2, or 3) Bit 2: Asteroid removed Bit 3: Small no-data region replaced Bit 4: Source removed (any) From b70a45f829005bad581dc4787e3768281a74d9dd Mon Sep 17 00:00:00 2001 From: Andrew Saydjari Date: Sat, 4 May 2024 21:45:58 -0400 Subject: [PATCH 5/6] order 0 mask --- dustmaps/sfd.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index 77fea23..67fc2a0 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -125,7 +125,10 @@ def __init__( base_fname = os.path.join(map_dir, '{}_{}'.format(whichparent,which)) super(SFDQuery, self).__init__(base_fname) + self.which = which + self.whichparent = whichparent + #FIXME force order to 0 if bit mask (check CFSD) def query(self, coords, order=1): """ Returns value of SFD-style map defined by ``whichparent`` and ``which`` during the intialization of the `SFDQuery` object at the specified location(s) on the sky. @@ -153,11 +156,9 @@ def query(self, coords, order=1): For whichparent ``FINK`` and which ``Rmap``, the map is the Finkbeiner-Davis-Schlegel (1999) DIRBE 100/240mu RATIO map. This map is described in "Extrapolation of Galactic Dust Emission at 100 Microns to CMBR Frequencies using FIRAS" by Finkbeiner, Davis, & Schlegel (1999). Please note that this 100/240mu R map differs from the R map described in Schlegel, Finkbeiner, & Davis, ApJ 500, 525 (1998). - # check citation ##FIXME - For whichparent ``Haslam`` and which ``clean``, the map is the Haslam et al. (1982) 408 MHz all-sky continuum survey, cleaned of bright sources (K).The map has bright point sources removed, and has been Fourier destriped using a method similar to that applied to the IRAS/ISSA data in Schlegel, Finkbeiner, & Davis 1998, Apj, 500, 525. Due to this reprocessing, the effective beam (PSF) of the map has increased from 0.85 deg to 1.0 deg. A CMB monopole (2.73K) has been subtracted from the map. + For whichparent ``Haslam`` and which ``clean``, the map is an unpublished version of the Haslam et al. (1982) 408 MHz all-sky continuum survey, cleaned of bright sources (K). The map has bright point sources removed, and has been Fourier destriped using a method similar to that applied to the IRAS/ISSA data in Schlegel, Finkbeiner, & Davis 1998, Apj, 500, 525. Due to this reprocessing, the effective beam (PSF) of the map has increased from 0.85 deg to 1.0 deg. A CMB monopole (2.73K) has been subtracted from the map. - # check citation ##FIXME - For whichparent ``Synch`` and which ``Beta``, the map is the Finkbeiner & Davis (1999) synchrotron spectral index map. This map is based on the 408 MHz Haslam et al. (1982) map, 1.42 GHz Reich & Reich (1986) map, and 2.326 GHz Jonas, Baart, & Nicolson (1998) map. + For whichparent ``Synch`` and which ``Beta``, the map is an unpublished work by Finkbeiner & Davis (1999) to derive a synchrotron spectral index map. This map is based on the 408 MHz Haslam et al. (1982) map, 1.42 GHz Reich & Reich (1986) map, and 2.326 GHz Jonas, Baart, & Nicolson (1998) map. Args: coords (`astropy.coordinates.SkyCoord`): The coordinates to query. @@ -168,6 +169,8 @@ def query(self, coords, order=1): A float array containing the values of SFD-style map at every input coordinate. The shape of the output will be the same as the shape of the coordinates stored by `coords`. """ + if self.which == "mask": + order = 0 # interpolating a mask is not allowed! return super(SFDQuery, self).query(coords, order=order) From 75dbb4069cc989c8736000fc91108751b9df5d25 Mon Sep 17 00:00:00 2001 From: andrew-saydjari Date: Wed, 10 Jul 2024 11:44:02 -0400 Subject: [PATCH 6/6] change which variable names, pythonic sub on logic --- dustmaps/sfd.py | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/dustmaps/sfd.py b/dustmaps/sfd.py index 67fc2a0..82e67af 100644 --- a/dustmaps/sfd.py +++ b/dustmaps/sfd.py @@ -102,46 +102,46 @@ class SFDQuery(SFDBase): def __init__( self, map_dir=None, - whichparent='SFD', - which='dust' + map_variant='SFD', + component='dust' ): """ Args: map_dir (Optional[str]): The directory containing the SFD map. Defaults to `None`, which means that `dustmaps` will look in its default data directory. - whichparent (Optional[:obj:`str`]): The parent name of the SFD style data product to download. + map_variant (Optional[:obj:`str`]): The parent name of the SFD style data product to download. Should be either ``SFD`` (the default), ``Synch``, ``FINK``, or ``Haslam``. - which (Optional[:obj:`str`]): The name of the SFD style data product to download. - Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with whichparent ``SFD``. Should be ``Beta`` for whichparent ``Synch``. Should be ``Rmap`` for whichparent ``FINK``. Should be ``clean`` for whichparent ``Haslam``. + component (Optional[:obj:`str`]): The name of the SFD style data product to download. + Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with map_variant ``SFD``. Should be ``Beta`` for map_variant ``Synch``. Should be ``Rmap`` for map_variant ``FINK``. Should be ``clean`` for map_variant ``Haslam``. """ if map_dir is None: map_dir = os.path.join(data_dir(), 'sfd') - if (whichparent == 'SFD') and (which == 'dust' or which == 'i100' or which == 'i60' or which == 'mask'): - base_fname = os.path.join(map_dir, '{}_{}_4096'.format(whichparent,which)) + if (map_variant == 'SFD') and (component in ('dust', 'i100', 'i60', 'mask')): + base_fname = os.path.join(map_dir, '{}_{}_4096'.format(map_variant,component)) else: - base_fname = os.path.join(map_dir, '{}_{}'.format(whichparent,which)) + base_fname = os.path.join(map_dir, '{}_{}'.format(map_variant,component)) super(SFDQuery, self).__init__(base_fname) - self.which = which - self.whichparent = whichparent + self.component = component + self.map_variant = map_variant #FIXME force order to 0 if bit mask (check CFSD) def query(self, coords, order=1): """ - Returns value of SFD-style map defined by ``whichparent`` and ``which`` during the intialization of the `SFDQuery` object at the specified location(s) on the sky. + Returns value of SFD-style map defined by ``map_variant`` and ``component`` during the intialization of the `SFDQuery` object at the specified location(s) on the sky. Defaults return E(B-V) at the specified location(s) on the sky. See Table 6 of Schlafly & Finkbeiner (2011) for instructions on how to convert this quantity to extinction in various passbands. - For whichparent ``SFD`` and which ``dust``, the map is the Schlegel, Finkbeiner & Davis (1998) dust reddening map (E(B-V)). + For map_variant ``SFD`` and component ``dust``, the map is the Schlegel, Finkbeiner & Davis (1998) dust reddening map (E(B-V)). - For whichparent ``SFD`` and which ``i100``, the map is the Schlegel, Finkbeiner & Davis (1998) 100 micron intensity map (MJy/sr). + For map_variant ``SFD`` and component ``i100``, the map is the Schlegel, Finkbeiner & Davis (1998) 100 micron intensity map (MJy/sr). - For whichparent ``SFD`` and which ``i60``, the map is the Schlegel, Finkbeiner & Davis (1998) 60 micron intensity map (MJy/sr). + For map_variant ``SFD`` and component ``i60``, the map is the Schlegel, Finkbeiner & Davis (1998) 60 micron intensity map (MJy/sr). - For whichparent ``SFD`` and which ``mask``, the map is the Schlegel, Finkbeiner & Davis (1998) bit mask map. + For map_variant ``SFD`` and component ``mask``, the map is the Schlegel, Finkbeiner & Davis (1998) bit mask map. Bit 0, 1: The first two bits express (in binary) the number of HCONs (0, 1, 2, or 3) Bit 2: Asteroid removed Bit 3: Small no-data region replaced @@ -150,15 +150,15 @@ def query(self, coords, order=1): Bit 6: Large objects - LMC, SMC or M31 Bit 7: No IRAS data (excluded zone OR Saturn) - For whichparent ``SFD`` and which ``temp``, the map is the Schlegel, Finkbeiner & Davis (1998) dust temperature map (K). + For map_variant ``SFD`` and component ``temp``, the map is the Schlegel, Finkbeiner & Davis (1998) dust temperature map (K). - For whichparent ``SFD`` and which ``xmap``, the map is the Schlegel, Finkbeiner & Davis (1998) X-factor map. This map contains a temperature correction factor derived from the 100mu/240mu ratio. Multiply the 100mu map by this factor to obtain temperature-corrected emission in regions that are expected to have an unusual dust temperature. In some cases (e.g. high Galactic latitude) this factor is poorly constrained and should be used with caution. The mean value for this quantity in "normal" parts of the sky is 1. + For map_variant ``SFD`` and component ``xmap``, the map is the Schlegel, Finkbeiner & Davis (1998) X-factor map. This map contains a temperature correction factor derived from the 100mu/240mu ratio. Multiply the 100mu map by this factor to obtain temperature-corrected emission in regions that are expected to have an unusual dust temperature. In some cases (e.g. high Galactic latitude) this factor is poorly constrained and should be used with caution. The mean value for this quantity in "normal" parts of the sky is 1. - For whichparent ``FINK`` and which ``Rmap``, the map is the Finkbeiner-Davis-Schlegel (1999) DIRBE 100/240mu RATIO map. This map is described in "Extrapolation of Galactic Dust Emission at 100 Microns to CMBR Frequencies using FIRAS" by Finkbeiner, Davis, & Schlegel (1999). Please note that this 100/240mu R map differs from the R map described in Schlegel, Finkbeiner, & Davis, ApJ 500, 525 (1998). + For map_variant ``FINK`` and component ``Rmap``, the map is the Finkbeiner-Davis-Schlegel (1999) DIRBE 100/240mu RATIO map. This map is described in "Extrapolation of Galactic Dust Emission at 100 Microns to CMBR Frequencies using FIRAS" by Finkbeiner, Davis, & Schlegel (1999). Please note that this 100/240mu R map differs from the R map described in Schlegel, Finkbeiner, & Davis, ApJ 500, 525 (1998). - For whichparent ``Haslam`` and which ``clean``, the map is an unpublished version of the Haslam et al. (1982) 408 MHz all-sky continuum survey, cleaned of bright sources (K). The map has bright point sources removed, and has been Fourier destriped using a method similar to that applied to the IRAS/ISSA data in Schlegel, Finkbeiner, & Davis 1998, Apj, 500, 525. Due to this reprocessing, the effective beam (PSF) of the map has increased from 0.85 deg to 1.0 deg. A CMB monopole (2.73K) has been subtracted from the map. + For map_variant ``Haslam`` and component ``clean``, the map is an unpublished version of the Haslam et al. (1982) 408 MHz all-sky continuum survey, cleaned of bright sources (K). The map has bright point sources removed, and has been Fourier destriped using a method similar to that applied to the IRAS/ISSA data in Schlegel, Finkbeiner, & Davis 1998, Apj, 500, 525. Due to this reprocessing, the effective beam (PSF) of the map has increased from 0.85 deg to 1.0 deg. A CMB monopole (2.73K) has been subtracted from the map. - For whichparent ``Synch`` and which ``Beta``, the map is an unpublished work by Finkbeiner & Davis (1999) to derive a synchrotron spectral index map. This map is based on the 408 MHz Haslam et al. (1982) map, 1.42 GHz Reich & Reich (1986) map, and 2.326 GHz Jonas, Baart, & Nicolson (1998) map. + For map_variant ``Synch`` and component ``Beta``, the map is an unpublished work by Finkbeiner & Davis (1999) to derive a synchrotron spectral index map. This map is based on the 408 MHz Haslam et al. (1982) map, 1.42 GHz Reich & Reich (1986) map, and 2.326 GHz Jonas, Baart, & Nicolson (1998) map. Args: coords (`astropy.coordinates.SkyCoord`): The coordinates to query. @@ -169,7 +169,7 @@ def query(self, coords, order=1): A float array containing the values of SFD-style map at every input coordinate. The shape of the output will be the same as the shape of the coordinates stored by `coords`. """ - if self.which == "mask": + if self.component == "mask": order = 0 # interpolating a mask is not allowed! return super(SFDQuery, self).query(coords, order=order) @@ -191,31 +191,31 @@ def __init__(self, api_url=None): map_name='sfd') -def fetch(whichparent='SFD',which='dust'): +def fetch(map_variant='SFD',component='dust'): """ Downloads maps in the format of the Schlegel, Finkbeiner & Davis (1998) dust map, placing them in the data directory for `dustmaps`. By default, it downloads the Schlegel, Finkbeiner & Davis (1998) dust map. Args: - whichparent (Optional[:obj:`str`]): The parent name of the SFD style data product to download. + map_variant (Optional[:obj:`str`]): The parent name of the SFD style data product to download. Should be either ``SFD`` (the default), ``Synch``, ``FINK``, or ``Haslam``. - which (Optional[:obj:`str`]): The name of the SFD style data product to download. - Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with whichparent ``SFD``. Should be ``Beta`` for whichparent ``Synch``. Should be ``Rmap`` for whichparent ``FINK``. Should be ``clean`` for whichparent ``Haslam``. + component (Optional[:obj:`str`]): The name of the SFD style data product to download. + Should be either ``dust`` (the default), ``i100``, ``i60``, ``mask``, ``temp``, or ``xmap`` with map_variant ``SFD``. Should be ``Beta`` for map_variant ``Synch``. Should be ``Rmap`` for map_variant ``FINK``. Should be ``clean`` for map_variant ``Haslam``. """ doi = '10.7910/DVN/EWCNL5' for pole in ['ngp', 'sgp']: - if (whichparent == 'SFD') and (which == 'dust' or which == 'i100' or which == 'i60' or which == 'mask'): - requirements = {'filename': '{}_{}_4096_{}.fits'.format(whichparent,which,pole)} + if (map_variant == 'SFD') and (component in ('dust', 'i100', 'i60', 'mask')): + requirements = {'filename': '{}_{}_4096_{}.fits'.format(map_variant,component,pole)} local_fname = os.path.join( data_dir(), - 'sfd', '{}_{}_4096_{}.fits'.format(whichparent,which,pole)) + 'sfd', '{}_{}_4096_{}.fits'.format(map_variant,component,pole)) else: - requirements = {'filename': '{}_{}_{}.fits'.format(whichparent,which,pole)} + requirements = {'filename': '{}_{}_{}.fits'.format(map_variant,component,pole)} local_fname = os.path.join( data_dir(), - 'sfd', '{}_{}_{}.fits'.format(whichparent,which,pole)) + 'sfd', '{}_{}_{}.fits'.format(map_variant,component,pole)) - print('Downloading {} {} data file to {}'.format(whichparent,which,local_fname)) + print('Downloading {} {} data file to {}'.format(map_variant,component,local_fname)) fetch_utils.dataverse_download_doi( doi, local_fname,