mwdust 1.5.post0__cp311-cp311-macosx_11_0_arm64.whl → 1.6__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mwdust might be problematic. Click here for more details.
- healpix_c.cpython-311-darwin.so +0 -0
- mwdust/DustMap3D.py +4 -3
- mwdust/HierarchicalHealpixMap.py +4 -4
- mwdust/Marshall06.py +1 -1
- mwdust/Zucker25.py +107 -0
- mwdust/__init__.py +5 -2
- mwdust/util/fortranfile.py +6 -5
- mwdust/util/healpix.py +39 -21
- mwdust/util/read_SFD.py +67 -61
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info}/METADATA +16 -2
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info}/RECORD +16 -15
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info}/WHEEL +2 -1
- sfd_c.cpython-311-darwin.so +0 -0
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info/licenses}/AUTHORS.txt +0 -0
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info/licenses}/LICENSE +0 -0
- {mwdust-1.5.post0.dist-info → mwdust-1.6.dist-info}/top_level.txt +0 -0
healpix_c.cpython-311-darwin.so
CHANGED
|
Binary file
|
mwdust/DustMap3D.py
CHANGED
|
@@ -11,9 +11,9 @@ try:
|
|
|
11
11
|
except ImportError:
|
|
12
12
|
_BOVY_PLOT_LOADED= False
|
|
13
13
|
|
|
14
|
-
class DustMap3D:
|
|
14
|
+
class DustMap3D(object):
|
|
15
15
|
"""top-level class for a 3D dust map; all other dust maps inherit from this"""
|
|
16
|
-
def __init__(self,filter=None):
|
|
16
|
+
def __init__(self, filter=None, **download_kwargs):
|
|
17
17
|
"""
|
|
18
18
|
NAME:
|
|
19
19
|
__init__
|
|
@@ -26,7 +26,8 @@ class DustMap3D:
|
|
|
26
26
|
2013-11-24 - Started - Bovy (IAS)
|
|
27
27
|
"""
|
|
28
28
|
self._filter= filter
|
|
29
|
-
self
|
|
29
|
+
if hasattr(self, "download"):
|
|
30
|
+
self.download(**download_kwargs) # download the map
|
|
30
31
|
|
|
31
32
|
def __call__(self,*args,**kwargs):
|
|
32
33
|
"""
|
mwdust/HierarchicalHealpixMap.py
CHANGED
|
@@ -14,7 +14,7 @@ _DEGTORAD= numpy.pi/180.
|
|
|
14
14
|
class HierarchicalHealpixMap(DustMap3D):
|
|
15
15
|
"""General class for extinction maps given as a hierarchical HEALPix
|
|
16
16
|
pixelation (e.g., Green et al. 2015) """
|
|
17
|
-
def __init__(self,filter=None,sf10=True):
|
|
17
|
+
def __init__(self,filter=None,sf10=True, **download_kwargs):
|
|
18
18
|
"""
|
|
19
19
|
NAME:
|
|
20
20
|
__init__
|
|
@@ -28,8 +28,8 @@ class HierarchicalHealpixMap(DustMap3D):
|
|
|
28
28
|
HISTORY:
|
|
29
29
|
2015-07-28 - Started - Bovy (UofT)
|
|
30
30
|
"""
|
|
31
|
-
|
|
32
|
-
self._sf10= sf10
|
|
31
|
+
super(HierarchicalHealpixMap, self).__init__(filter=filter, **download_kwargs)
|
|
32
|
+
self._sf10 = sf10
|
|
33
33
|
return None
|
|
34
34
|
|
|
35
35
|
|
|
@@ -221,4 +221,4 @@ class HierarchicalHealpixMap(DustMap3D):
|
|
|
221
221
|
format=r'$%g$',
|
|
222
222
|
cmap='gist_yarg',
|
|
223
223
|
**kwargs)
|
|
224
|
-
return None
|
|
224
|
+
return None
|
mwdust/Marshall06.py
CHANGED
|
@@ -80,7 +80,7 @@ class Marshall06(DustMap3D):
|
|
|
80
80
|
2013-12-12 - Started - Bovy (IAS)
|
|
81
81
|
"""
|
|
82
82
|
if isinstance(l,numpy.ndarray) or isinstance(b,numpy.ndarray):
|
|
83
|
-
raise NotImplementedError("array input for l and b for
|
|
83
|
+
raise NotImplementedError("array input for l and b for Marshall06 dust map not implemented")
|
|
84
84
|
lbIndx= self._lbIndx(l,b)
|
|
85
85
|
if self._intps[lbIndx] != 0:
|
|
86
86
|
out= self._intps[lbIndx](d)
|
mwdust/Zucker25.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# DECaPS25: extinction model from Zucker et al. (2025)
|
|
4
|
+
#
|
|
5
|
+
###############################################################################
|
|
6
|
+
import os, os.path
|
|
7
|
+
import numpy
|
|
8
|
+
import h5py
|
|
9
|
+
from mwdust.util.download import dust_dir, downloader
|
|
10
|
+
from mwdust.HierarchicalHealpixMap import HierarchicalHealpixMap
|
|
11
|
+
|
|
12
|
+
_DEGTORAD = numpy.pi/180.
|
|
13
|
+
_decapsdir = os.path.join(dust_dir, 'zucker25')
|
|
14
|
+
|
|
15
|
+
class Zucker25(HierarchicalHealpixMap):
|
|
16
|
+
"""DECaPS 3D dust-reddening map (Zucker et al. 2025)"""
|
|
17
|
+
def __init__(self, filter=None, sf10=True, load_samples=False, interpk=1):
|
|
18
|
+
"""
|
|
19
|
+
NAME:
|
|
20
|
+
__init__
|
|
21
|
+
PURPOSE:
|
|
22
|
+
Initialize the DECaPS (2025) dust map
|
|
23
|
+
INPUT:
|
|
24
|
+
filter= filter to return the extinction in
|
|
25
|
+
sf10= (True) if True, use the Schlafly & Finkbeiner calibrations
|
|
26
|
+
load_samples= (False) if True, also load the samples
|
|
27
|
+
interpk= (1) interpolation order
|
|
28
|
+
OUTPUT:
|
|
29
|
+
object
|
|
30
|
+
HISTORY:
|
|
31
|
+
2025-10-01 - Adopted
|
|
32
|
+
"""
|
|
33
|
+
HierarchicalHealpixMap.__init__(self, filter=filter, sf10=sf10, samples=load_samples)
|
|
34
|
+
if not os.path.isdir(_decapsdir):
|
|
35
|
+
os.mkdir(_decapsdir)
|
|
36
|
+
fname = 'decaps_mean_and_samples.h5' if load_samples else 'decaps_mean.h5'
|
|
37
|
+
fpath = os.path.join(_decapsdir, fname)
|
|
38
|
+
if not os.path.exists(fpath):
|
|
39
|
+
self.download(samples=load_samples)
|
|
40
|
+
self._f = h5py.File(fpath, 'r')
|
|
41
|
+
self._best_fit = self._f['/mean'][:, 0, :]
|
|
42
|
+
p = self._f['/pixel_info']
|
|
43
|
+
hpx = p['healpix_index'][:]
|
|
44
|
+
nside_attr = int(p.attrs['nside'])
|
|
45
|
+
pix_dtype = numpy.dtype([('healpix_index', hpx.dtype), ('nside', numpy.int64)])
|
|
46
|
+
self._pix_info = numpy.empty(hpx.shape[0], dtype=pix_dtype)
|
|
47
|
+
self._pix_info['healpix_index'] = hpx
|
|
48
|
+
self._pix_info['nside'] = nside_attr
|
|
49
|
+
dm = numpy.array(p.attrs['DM_bin_edges'], dtype=numpy.float64)
|
|
50
|
+
if dm.shape[0] != self._best_fit.shape[1]:
|
|
51
|
+
raise RuntimeError("DM_bin_edges length does not match radial dimension")
|
|
52
|
+
self._distmods = dm
|
|
53
|
+
if load_samples:
|
|
54
|
+
if 'samples' not in self._f:
|
|
55
|
+
raise RuntimeError("Requested load_samples=True, but 'samples' dataset not found.")
|
|
56
|
+
self._samples_dset = self._f['/samples']
|
|
57
|
+
else:
|
|
58
|
+
self._samples_dset = None
|
|
59
|
+
self._minnside = numpy.amin(self._pix_info['nside'])
|
|
60
|
+
self._maxnside = numpy.amax(self._pix_info['nside'])
|
|
61
|
+
nlevels = int(numpy.log2(self._maxnside // self._minnside)) + 1
|
|
62
|
+
self._nsides = [self._maxnside // 2**ii for ii in range(nlevels)]
|
|
63
|
+
self._indexArray = numpy.arange(len(self._pix_info['healpix_index']))
|
|
64
|
+
self._intps = numpy.zeros(len(self._pix_info['healpix_index']), dtype='object')
|
|
65
|
+
self._interpk = interpk
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
def substitute_sample(self, samplenum):
|
|
69
|
+
"""
|
|
70
|
+
NAME:
|
|
71
|
+
substitute_sample
|
|
72
|
+
PURPOSE:
|
|
73
|
+
substitute a sample for the best fit to get the extinction from a sample with the same tools; need to have setup the instance with load_samples=True
|
|
74
|
+
INPUT:
|
|
75
|
+
samplenum - sample's index to load
|
|
76
|
+
OUTPUT:
|
|
77
|
+
(none; just resets the instance to use the sample rather than the best fit)
|
|
78
|
+
HISTORY:
|
|
79
|
+
2025-10-01 - Adopted
|
|
80
|
+
"""
|
|
81
|
+
if self._samples_dset is None:
|
|
82
|
+
raise RuntimeError('No samples present in DECaPS file')
|
|
83
|
+
self._best_fit = self._samples_dset[:, samplenum, :]
|
|
84
|
+
self._intps = numpy.zeros(len(self._pix_info['healpix_index']), dtype='object')
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def download(cls, samples=False, test=False):
|
|
89
|
+
subdir = os.path.join(dust_dir, "decaps25")
|
|
90
|
+
if not os.path.exists(subdir):
|
|
91
|
+
os.mkdir(subdir)
|
|
92
|
+
if samples:
|
|
93
|
+
target = os.path.join(subdir, "decaps_mean_and_samples.h5")
|
|
94
|
+
url = "https://dataverse.harvard.edu/api/access/datafile/11840498"
|
|
95
|
+
else:
|
|
96
|
+
target = os.path.join(subdir, "decaps_mean.h5")
|
|
97
|
+
url = "https://dataverse.harvard.edu/api/access/datafile/11838924"
|
|
98
|
+
if not os.path.exists(target):
|
|
99
|
+
downloader(url, target, cls.__name__, test=test)
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
def __del__(self):
|
|
103
|
+
try:
|
|
104
|
+
if hasattr(self, "_f") and self._f:
|
|
105
|
+
self._f.close()
|
|
106
|
+
except Exception:
|
|
107
|
+
pass
|
mwdust/__init__.py
CHANGED
|
@@ -7,18 +7,21 @@ from mwdust.Green17 import Green17
|
|
|
7
7
|
from mwdust.Green19 import Green19
|
|
8
8
|
from mwdust.Combined15 import Combined15
|
|
9
9
|
from mwdust.Combined19 import Combined19
|
|
10
|
+
from mwdust.Zucker25 import Zucker25
|
|
10
11
|
from mwdust.Zero import Zero
|
|
11
12
|
|
|
12
|
-
__version__ = "1.
|
|
13
|
+
__version__ = "1.6"
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def download_all(test=False):
|
|
16
17
|
SFD.download(test=test)
|
|
17
18
|
Marshall06.download(test=test)
|
|
18
19
|
Drimmel03.download(test=test)
|
|
19
|
-
|
|
20
|
+
if not test:
|
|
21
|
+
Sale14.download(test=test)
|
|
20
22
|
Green15.download(test=test)
|
|
21
23
|
Green17.download(test=test)
|
|
22
24
|
Green19.download(test=test)
|
|
23
25
|
Combined15.download(test=test)
|
|
24
26
|
Combined19.download(test=test)
|
|
27
|
+
Zucker25.download(test=test)
|
mwdust/util/fortranfile.py
CHANGED
|
@@ -138,9 +138,10 @@ class FortranFile(file):
|
|
|
138
138
|
data += read_data
|
|
139
139
|
|
|
140
140
|
def _read_check(self):
|
|
141
|
-
return numpy.
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
return numpy.frombuffer(
|
|
142
|
+
self._read_exactly(self._header_length),
|
|
143
|
+
dtype=self.ENDIAN + self.HEADER_PREC,
|
|
144
|
+
)[0]
|
|
144
145
|
|
|
145
146
|
def _write_check(self, number_of_bytes):
|
|
146
147
|
"""Write the header for the given number of bytes"""
|
|
@@ -205,7 +206,7 @@ class FortranFile(file):
|
|
|
205
206
|
raise ValueError('Not an appropriate precision')
|
|
206
207
|
|
|
207
208
|
data_str = self.readRecord()
|
|
208
|
-
return numpy.
|
|
209
|
+
return numpy.frombuffer(data_str, dtype=self.ENDIAN + prec)
|
|
209
210
|
|
|
210
211
|
def writeReals(self, reals, prec='f'):
|
|
211
212
|
"""Write an array of floats in given precision
|
|
@@ -240,7 +241,7 @@ class FortranFile(file):
|
|
|
240
241
|
raise ValueError('Not an appropriate precision')
|
|
241
242
|
|
|
242
243
|
data_str = self.readRecord()
|
|
243
|
-
return numpy.
|
|
244
|
+
return numpy.frombuffer(data_str, dtype=self.ENDIAN + prec)
|
|
244
245
|
|
|
245
246
|
def writeInts(self, ints, prec='i'):
|
|
246
247
|
"""Write an array of integers in given precision
|
mwdust/util/healpix.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
import
|
|
2
|
+
import sysconfig
|
|
3
3
|
import ctypes
|
|
4
4
|
import ctypes.util
|
|
5
5
|
from numpy.ctypeslib import ndpointer
|
|
@@ -7,7 +7,7 @@ import numpy as np
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
# healpy number to represent bad numbers
|
|
10
|
-
UNSEEN = -1.
|
|
10
|
+
UNSEEN = -1.6375e30
|
|
11
11
|
|
|
12
12
|
# Find and load the library
|
|
13
13
|
_lib = None
|
|
@@ -37,13 +37,18 @@ if _lib is None:
|
|
|
37
37
|
def check_nside(nside, nest=False):
|
|
38
38
|
"""
|
|
39
39
|
Utility function
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
Check if healpix map with nside is valid in general
|
|
42
42
|
"""
|
|
43
43
|
# nside can only be a power of 2 for nest, but generally less than 2**29
|
|
44
44
|
nside_arr = np.array(nside).astype(np.int64)
|
|
45
45
|
is_ok = True
|
|
46
|
-
if np.all(
|
|
46
|
+
if np.all(
|
|
47
|
+
np.logical_and(
|
|
48
|
+
np.logical_and(nside == nside_arr, np.all(np.less(0, nside))),
|
|
49
|
+
nside_arr <= 2**29,
|
|
50
|
+
)
|
|
51
|
+
):
|
|
47
52
|
if nest:
|
|
48
53
|
is_ok = (nside_arr & (nside_arr - 1)) == 0
|
|
49
54
|
else:
|
|
@@ -55,7 +60,7 @@ def check_nside(nside, nest=False):
|
|
|
55
60
|
def check_npix(npix):
|
|
56
61
|
"""
|
|
57
62
|
Utility function
|
|
58
|
-
|
|
63
|
+
|
|
59
64
|
Check if total pixel number of a healpix map are valid in general
|
|
60
65
|
"""
|
|
61
66
|
# check if npix is a valid value for healpix map size
|
|
@@ -67,7 +72,7 @@ def check_npix(npix):
|
|
|
67
72
|
def check_ipix_nside(ipix, nside):
|
|
68
73
|
"""
|
|
69
74
|
Utility function
|
|
70
|
-
|
|
75
|
+
|
|
71
76
|
Check if pixel number(s) are valid in a healpix map with nside
|
|
72
77
|
"""
|
|
73
78
|
# check if all ipix are valid for a healpix map size
|
|
@@ -144,7 +149,7 @@ def ang2pix(nside, theta, phi, nest=False, lonlat=False):
|
|
|
144
149
|
else:
|
|
145
150
|
ang2pix_c = _lib.ang2pix_nest
|
|
146
151
|
ndarrayFlags = ("C_CONTIGUOUS", "WRITEABLE")
|
|
147
|
-
|
|
152
|
+
|
|
148
153
|
ang2pix_c.argtypes = [
|
|
149
154
|
ctypes.c_long,
|
|
150
155
|
ndpointer(dtype=np.float64, flags=ndarrayFlags),
|
|
@@ -182,7 +187,7 @@ def ang2vec(theta, phi, lonlat=False):
|
|
|
182
187
|
Angular coordinates to unit 3-vector direction
|
|
183
188
|
INPUT:
|
|
184
189
|
theta - colatitude
|
|
185
|
-
phi - longitude
|
|
190
|
+
phi - longitude
|
|
186
191
|
lonlat - input in longitude and latitude (deg)?
|
|
187
192
|
OUTPUT:
|
|
188
193
|
x, y, z - unit 3-vector direction
|
|
@@ -196,7 +201,7 @@ def ang2vec(theta, phi, lonlat=False):
|
|
|
196
201
|
|
|
197
202
|
ang2vec_c = _lib.ang2vec
|
|
198
203
|
ndarrayFlags = ("C_CONTIGUOUS", "WRITEABLE")
|
|
199
|
-
|
|
204
|
+
|
|
200
205
|
ang2vec_c.argtypes = [
|
|
201
206
|
ndpointer(dtype=np.float64, flags=ndarrayFlags),
|
|
202
207
|
ndpointer(dtype=np.float64, flags=ndarrayFlags),
|
|
@@ -213,7 +218,7 @@ def ang2vec(theta, phi, lonlat=False):
|
|
|
213
218
|
phi.astype(np.float64, order="C", copy=False),
|
|
214
219
|
ctypes.c_long(nstars),
|
|
215
220
|
)
|
|
216
|
-
result = np.fromiter(res, dtype=np.float64, count=nstars*3)
|
|
221
|
+
result = np.fromiter(res, dtype=np.float64, count=nstars * 3)
|
|
217
222
|
result = result.reshape(nstars, 3)
|
|
218
223
|
|
|
219
224
|
# Reset input arrays
|
|
@@ -224,6 +229,7 @@ def ang2vec(theta, phi, lonlat=False):
|
|
|
224
229
|
|
|
225
230
|
return result
|
|
226
231
|
|
|
232
|
+
|
|
227
233
|
def pix2vec(nside, ipix, nest=False):
|
|
228
234
|
"""
|
|
229
235
|
NAME:
|
|
@@ -266,7 +272,7 @@ def pix2vec(nside, ipix, nest=False):
|
|
|
266
272
|
npix,
|
|
267
273
|
ipix.astype(np.int64, order="C", copy=False),
|
|
268
274
|
)
|
|
269
|
-
result = np.fromiter(res, dtype=np.float64, count=npix*3)
|
|
275
|
+
result = np.fromiter(res, dtype=np.float64, count=npix * 3)
|
|
270
276
|
result = result.reshape(npix, 3)
|
|
271
277
|
|
|
272
278
|
# Reset input arrays
|
|
@@ -320,7 +326,7 @@ def pix2ang(nside, ipix, nest=False, lonlat=False):
|
|
|
320
326
|
npix,
|
|
321
327
|
ipix.astype(np.int64, order="C", copy=False),
|
|
322
328
|
)
|
|
323
|
-
result = np.fromiter(res, dtype=np.float64, count=npix*2)
|
|
329
|
+
result = np.fromiter(res, dtype=np.float64, count=npix * 2)
|
|
324
330
|
result = result.reshape(npix, 2)
|
|
325
331
|
|
|
326
332
|
# Reset input arrays
|
|
@@ -348,7 +354,7 @@ def nside2pixarea(nside):
|
|
|
348
354
|
HISTORY:
|
|
349
355
|
2023-03-01 - Written - Henry Leung (Toronto)
|
|
350
356
|
"""
|
|
351
|
-
return np.pi / (3 * nside
|
|
357
|
+
return np.pi / (3 * nside**2)
|
|
352
358
|
|
|
353
359
|
|
|
354
360
|
def nside2npix(nside):
|
|
@@ -367,7 +373,15 @@ def nside2npix(nside):
|
|
|
367
373
|
return 12 * nside * nside
|
|
368
374
|
|
|
369
375
|
|
|
370
|
-
def ud_grade(
|
|
376
|
+
def ud_grade(
|
|
377
|
+
map_in,
|
|
378
|
+
nside_plot,
|
|
379
|
+
pess=False,
|
|
380
|
+
order_in="RING",
|
|
381
|
+
order_out=None,
|
|
382
|
+
power=None,
|
|
383
|
+
dtype=None,
|
|
384
|
+
):
|
|
371
385
|
"""
|
|
372
386
|
NAME:
|
|
373
387
|
dust_vals_disk
|
|
@@ -383,29 +397,33 @@ def ud_grade(map_in, nside_plot, pess=False, order_in="RING", order_out=None, po
|
|
|
383
397
|
"""
|
|
384
398
|
# check if arguements are implemented
|
|
385
399
|
if order_in != "NEST" or (order_out is not None and order_out != "NEST"):
|
|
386
|
-
raise NotImplementedError(
|
|
400
|
+
raise NotImplementedError(
|
|
401
|
+
"order_in and order_out for RING scheme is not implemented for now"
|
|
402
|
+
)
|
|
387
403
|
if power is not None:
|
|
388
404
|
raise NotImplementedError("power is not implemented for now")
|
|
389
405
|
if pess is not False:
|
|
390
406
|
raise NotImplementedError("pess=True is not implemented for now")
|
|
391
407
|
if dtype is not False:
|
|
392
|
-
raise NotImplementedError(
|
|
408
|
+
raise NotImplementedError(
|
|
409
|
+
"dtype is implemented for now, output map always has the same dtype as input map"
|
|
410
|
+
)
|
|
393
411
|
check_nside(nside_plot, nest=order_in != "RING")
|
|
394
412
|
map_in = np.asarray(map_in)
|
|
395
413
|
|
|
396
414
|
num_of_map = len(np.atleast_2d(map_in))
|
|
397
415
|
if num_of_map != 1:
|
|
398
416
|
raise ValueError("This function only support one map at each time")
|
|
399
|
-
|
|
417
|
+
|
|
400
418
|
nside_in = npix2nside(len(map_in))
|
|
401
419
|
npix_in = nside2npix(nside_in)
|
|
402
420
|
npix_out = nside2npix(nside_in)
|
|
403
421
|
|
|
404
|
-
if nside_plot > nside_in:
|
|
422
|
+
if nside_plot > nside_in: # upgrade
|
|
405
423
|
rat2 = npix_out // npix_in
|
|
406
424
|
fact = np.ones(rat2, dtype=map_in.dtype)
|
|
407
425
|
map_out = np.outer(map_in, fact).reshape(npix_out)
|
|
408
|
-
elif nside_plot < nside_in:
|
|
426
|
+
elif nside_plot < nside_in: # degrade
|
|
409
427
|
rat2 = npix_in // npix_out
|
|
410
428
|
mr = map_in.reshape(npix_out, rat2)
|
|
411
429
|
goods = ~(np.isclose(mr, UNSEEN) | (~np.isfinite(mr)) | (~np.isnan(mr)))
|
|
@@ -418,5 +436,5 @@ def ud_grade(map_in, nside_plot, pess=False, order_in="RING", order_out=None, po
|
|
|
418
436
|
pass
|
|
419
437
|
else:
|
|
420
438
|
map_out = map_in
|
|
421
|
-
|
|
422
|
-
return map_out
|
|
439
|
+
|
|
440
|
+
return map_out
|
mwdust/util/read_SFD.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
import
|
|
2
|
+
import sysconfig
|
|
3
3
|
import ctypes
|
|
4
4
|
import ctypes.util
|
|
5
5
|
from numpy.ctypeslib import ndpointer
|
|
@@ -10,15 +10,15 @@ import platform
|
|
|
10
10
|
import tqdm
|
|
11
11
|
from mwdust.util.download import dust_dir
|
|
12
12
|
|
|
13
|
-
WIN32= platform.system() ==
|
|
14
|
-
#Find and load the library
|
|
13
|
+
WIN32 = platform.system() == "Windows"
|
|
14
|
+
# Find and load the library
|
|
15
15
|
_lib = None
|
|
16
|
-
_libname = ctypes.util.find_library(
|
|
17
|
-
PY3= sys.version >
|
|
18
|
-
if PY3:
|
|
19
|
-
_ext_suffix= sysconfig.get_config_var(
|
|
16
|
+
_libname = ctypes.util.find_library("sfd_c")
|
|
17
|
+
PY3 = sys.version > "3"
|
|
18
|
+
if PY3: # pragma: no cover
|
|
19
|
+
_ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
|
|
20
20
|
else:
|
|
21
|
-
_ext_suffix= sysconfig.get_config_var(
|
|
21
|
+
_ext_suffix = sysconfig.get_config_var("SO")
|
|
22
22
|
if _libname:
|
|
23
23
|
_lib = ctypes.CDLL(_libname)
|
|
24
24
|
if _lib is None:
|
|
@@ -36,13 +36,14 @@ if _lib is None:
|
|
|
36
36
|
else:
|
|
37
37
|
break
|
|
38
38
|
if _lib is None:
|
|
39
|
-
raise IOError(
|
|
39
|
+
raise IOError("SFD/C module not found")
|
|
40
40
|
|
|
41
|
-
#MAP path names
|
|
42
|
-
ebvFileN= os.path.join(dust_dir,
|
|
43
|
-
ebvFileS= os.path.join(dust_dir,
|
|
41
|
+
# MAP path names
|
|
42
|
+
ebvFileN = os.path.join(dust_dir, "maps", "SFD_dust_4096_ngp.fits")
|
|
43
|
+
ebvFileS = os.path.join(dust_dir, "maps", "SFD_dust_4096_sgp.fits")
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
def read_SFD_EBV(glon, glat, interp=True, noloop=False, verbose=False, pbar=True):
|
|
46
47
|
"""
|
|
47
48
|
NAME:
|
|
48
49
|
read_SFD_EBV
|
|
@@ -60,64 +61,69 @@ def read_SFD_EBV(glon,glat,interp=True,noloop=False,verbose=False,pbar=True):
|
|
|
60
61
|
HISTORY:
|
|
61
62
|
2013-11-23 - Written - Bovy (IAS)
|
|
62
63
|
"""
|
|
63
|
-
#Parse input
|
|
64
|
-
if isinstance(glon,(int,float,numpy.float32,numpy.float64)):
|
|
65
|
-
glon= numpy.array([glon])
|
|
66
|
-
if isinstance(glat,(int,float,numpy.float32,numpy.float64)):
|
|
67
|
-
glat= numpy.array([glat])
|
|
64
|
+
# Parse input
|
|
65
|
+
if isinstance(glon, (int, float, numpy.float32, numpy.float64)):
|
|
66
|
+
glon = numpy.array([glon])
|
|
67
|
+
if isinstance(glat, (int, float, numpy.float32, numpy.float64)):
|
|
68
|
+
glat = numpy.array([glat])
|
|
68
69
|
|
|
69
70
|
nstar = len(glon)
|
|
70
71
|
if nstar > 1 and pbar:
|
|
71
|
-
pbar= tqdm.tqdm(total=nstar, leave=False)
|
|
72
|
-
pbar_func_ctype= ctypes.CFUNCTYPE(None)
|
|
73
|
-
pbar_c= pbar_func_ctype(pbar.update)
|
|
74
|
-
else:
|
|
75
|
-
pbar_c= None
|
|
72
|
+
pbar = tqdm.tqdm(total=nstar, leave=False)
|
|
73
|
+
pbar_func_ctype = ctypes.CFUNCTYPE(None)
|
|
74
|
+
pbar_c = pbar_func_ctype(pbar.update)
|
|
75
|
+
else: # pragma: no cover
|
|
76
|
+
pbar_c = None
|
|
76
77
|
|
|
77
|
-
#Set up the C code
|
|
78
|
-
ndarrayFlags= (
|
|
79
|
-
evalFunc= _lib.lambert_getval
|
|
80
|
-
evalFunc.argtypes= [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
# Set up the C code
|
|
79
|
+
ndarrayFlags = ("C_CONTIGUOUS", "WRITEABLE")
|
|
80
|
+
evalFunc = _lib.lambert_getval
|
|
81
|
+
evalFunc.argtypes = [
|
|
82
|
+
ctypes.c_char_p,
|
|
83
|
+
ctypes.c_char_p,
|
|
84
|
+
ctypes.c_long,
|
|
85
|
+
ndpointer(dtype=numpy.float32, flags=ndarrayFlags),
|
|
86
|
+
ndpointer(dtype=numpy.float32, flags=ndarrayFlags),
|
|
87
|
+
ctypes.c_int,
|
|
88
|
+
ctypes.c_int,
|
|
89
|
+
ctypes.c_int,
|
|
90
|
+
ndpointer(dtype=numpy.int32, flags=ndarrayFlags),
|
|
91
|
+
ctypes.c_void_p,
|
|
92
|
+
]
|
|
93
|
+
evalFunc.restype = ctypes.POINTER(ctypes.c_float)
|
|
91
94
|
|
|
92
|
-
#Array requirements, first store old order
|
|
93
|
-
f_cont= [glon.flags[
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
err= numpy.require(0,dtype=numpy.int32,requirements=['C','W'])
|
|
95
|
+
# Array requirements, first store old order
|
|
96
|
+
f_cont = [glon.flags["F_CONTIGUOUS"], glat.flags["F_CONTIGUOUS"]]
|
|
97
|
+
glon = numpy.require(glon, dtype=numpy.float64, requirements=["C", "W"])
|
|
98
|
+
glat = numpy.require(glat, dtype=numpy.float64, requirements=["C", "W"])
|
|
99
|
+
err = numpy.require(0, dtype=numpy.int32, requirements=["C", "W"])
|
|
98
100
|
|
|
99
101
|
# Check that the filename isn't too long for the SFD code
|
|
100
|
-
if len(ebvFileN.encode(
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
if len(ebvFileN.encode("ascii")) >= 120 or len(ebvFileS.encode("ascii")) >= 120:
|
|
103
|
+
raise RuntimeError(
|
|
104
|
+
f"The path of the file that contains the SFD dust maps is too long ({len(ebvFileN.encode('ascii'))}); please shorten the path of DUST_DIR"
|
|
105
|
+
)
|
|
103
106
|
|
|
104
|
-
res= evalFunc(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
res = evalFunc(
|
|
108
|
+
ctypes.c_char_p(ebvFileN.encode("ascii")),
|
|
109
|
+
ctypes.c_char_p(ebvFileS.encode("ascii")),
|
|
110
|
+
ctypes.c_long(nstar),
|
|
111
|
+
glon.astype(numpy.float32, order="C", copy=False),
|
|
112
|
+
glat.astype(numpy.float32, order="C", copy=False),
|
|
113
|
+
ctypes.c_int(interp),
|
|
114
|
+
ctypes.c_int(noloop),
|
|
115
|
+
ctypes.c_int(verbose),
|
|
116
|
+
err,
|
|
117
|
+
pbar_c,
|
|
118
|
+
)
|
|
115
119
|
if numpy.any(err == -10):
|
|
116
120
|
raise KeyboardInterrupt("Interrupted by CTRL-C (SIGINT)")
|
|
117
|
-
result= numpy.fromiter(res,dtype=float,count=nstar)
|
|
121
|
+
result = numpy.fromiter(res, dtype=float, count=nstar)
|
|
118
122
|
|
|
119
|
-
#Reset input arrays
|
|
120
|
-
if f_cont[0]:
|
|
121
|
-
|
|
123
|
+
# Reset input arrays
|
|
124
|
+
if f_cont[0]:
|
|
125
|
+
glon = numpy.asfortranarray(glon)
|
|
126
|
+
if f_cont[1]:
|
|
127
|
+
glat = numpy.asfortranarray(glat)
|
|
122
128
|
|
|
123
129
|
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mwdust
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6
|
|
4
4
|
Summary: Dust in the Milky Way
|
|
5
5
|
Home-page: https://github.com/jobovy/mwdust
|
|
6
6
|
Author: Jo Bovy
|
|
@@ -24,6 +24,15 @@ Requires-Dist: h5py
|
|
|
24
24
|
Requires-Dist: tqdm
|
|
25
25
|
Requires-Dist: requests
|
|
26
26
|
Requires-Dist: healpy
|
|
27
|
+
Dynamic: author
|
|
28
|
+
Dynamic: author-email
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: license
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: summary
|
|
27
36
|
|
|
28
37
|
mwdust
|
|
29
38
|
======
|
|
@@ -98,6 +107,9 @@ roughly the following lay-out::
|
|
|
98
107
|
bayestar2017.h5
|
|
99
108
|
green19/
|
|
100
109
|
bayestar2019.h5
|
|
110
|
+
zucker25/
|
|
111
|
+
decaps_mean.h5
|
|
112
|
+
decaps_mean_and_samples.h5
|
|
101
113
|
maps/
|
|
102
114
|
SFD_dust_4096_ngp.fits
|
|
103
115
|
SFD_dust_4096_sgp.fits
|
|
@@ -238,6 +250,8 @@ map that you use:
|
|
|
238
250
|
|
|
239
251
|
* **mwdust.Green19**: `Green et al. (2019) <https://ui.adsabs.harvard.edu/abs/2019arXiv190502734G>`__ (added by `@jan-rybizki <https://github.com/jan-rybizki>`__)
|
|
240
252
|
|
|
253
|
+
* **mwdust.Zucker25**: `Zucker et al. (2025) <https://ui.adsabs.harvard.edu/abs/2025arXiv250302657Z>`__
|
|
254
|
+
|
|
241
255
|
* **mwdust.Combined15**: Combination of
|
|
242
256
|
|
|
243
257
|
* `Marshall et al. (2006) <http://adsabs.harvard.edu/abs/2006A%26A...453..635M>`__ (**mwdust.Marshall06**),
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
healpix_c.cpython-311-darwin.so,sha256=
|
|
2
|
-
sfd_c.cpython-311-darwin.so,sha256=
|
|
3
|
-
mwdust/Marshall06.py,sha256=
|
|
4
|
-
mwdust/DustMap3D.py,sha256=
|
|
1
|
+
healpix_c.cpython-311-darwin.so,sha256=iCeaMLs0RI9104PBv2f5A_SqKYXTNrfjWqQr54KhdBw,52688
|
|
2
|
+
sfd_c.cpython-311-darwin.so,sha256=_nwf-efj76c_emExfO0C6FpGISGym8TNQ9zv7GX6UQQ,108024
|
|
3
|
+
mwdust/Marshall06.py,sha256=YuwZ6t4Qq5PUbBS-xQ6hM8JtCALxlxL0OJRiJ6kjfUM,11169
|
|
4
|
+
mwdust/DustMap3D.py,sha256=pOFUBcGHE7cMQgnWmbIEQgBtfTwRlwKUgK91F-nla5Q,3376
|
|
5
5
|
mwdust/Green19.py,sha256=jIIyjV1L-r-tcrHLAexwryKza31WucWZoUqHYJeK9ag,3714
|
|
6
6
|
mwdust/Green17.py,sha256=ycGNlrzfTcXB6pEre889FjyWrthPAxjuh_Yi-Z6wq-s,3761
|
|
7
7
|
mwdust/SFD.py,sha256=ikaMJ2KU1KpOqaDI5TGBfc2j7PeI2BOjfwCcpzazlPs,2734
|
|
8
|
-
mwdust/HierarchicalHealpixMap.py,sha256=
|
|
9
|
-
mwdust/__init__.py,sha256=
|
|
8
|
+
mwdust/HierarchicalHealpixMap.py,sha256=iPngVe6z5p5hkkI1c1ne5MF4IF1ZQ4avUEqSM8MtqMI,10324
|
|
9
|
+
mwdust/__init__.py,sha256=y_lzwtz3i9jQgx_jkzVhDckLm5nhu_Tr2M0U-9YdlVA,794
|
|
10
10
|
mwdust/Combined19.py,sha256=H0qzRP2-HhfPT7ScaeDe_OrtR-YOF5qoeHP4E5iRLgA,2831
|
|
11
11
|
mwdust/Zero.py,sha256=EbYTq739rlPi79lkoFgQus_EJZxY0laElAWxkcKEY1A,1949
|
|
12
12
|
mwdust/Green15.py,sha256=daSzGojQw4QsGYUl7dfYF_FGU9NC7iqsVbdlqM4Mgvk,3685
|
|
13
|
+
mwdust/Zucker25.py,sha256=wNT_f719-PV_DnU07uxubtoz5mBCQ0pXlJjh_qRvVXo,4500
|
|
13
14
|
mwdust/Combined15.py,sha256=MsiS3sNe6kpgzY1WJYRwufeeTeaoKUyeVViDWDO6eoo,2819
|
|
14
15
|
mwdust/Drimmel03.py,sha256=qVcXKrDELzf3btiCDU_LdPbGfohzYBkgB36C1l5Czjg,12166
|
|
15
16
|
mwdust/Sale14.py,sha256=TbDYf-FdajMlyuDexF7PwFI8iJpft4MerjY92t9As7Q,9115
|
|
16
|
-
mwdust/util/fortranfile.py,sha256=
|
|
17
|
+
mwdust/util/fortranfile.py,sha256=NYghSGLMBZnmiFYkelw0PZ6TPoMPNGprOXQp6-Pyv3g,8799
|
|
17
18
|
mwdust/util/extCurves.py,sha256=1bO3-MYAxDEbz0t6jutrOO-6vPBVus4jpcibCxf8szQ,2102
|
|
18
19
|
mwdust/util/download.py,sha256=6TzlCwYTAOmmAigKM4y83mjZWT_a-uAxU8gHdiMGvFI,1106
|
|
19
20
|
mwdust/util/tools.py,sha256=F_86rb71azFw5JmE4S0QSxJX_HHXjRqs1BhVbHm3c4o,921
|
|
20
21
|
mwdust/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
22
|
mwdust/util/combine_dustmaps19.py,sha256=ha3OPAWJpRgQgtUkCLDSf3OmY0sRs2E3wx2hbXHA3hg,9137
|
|
22
|
-
mwdust/util/healpix.py,sha256=
|
|
23
|
-
mwdust/util/read_SFD.py,sha256=
|
|
23
|
+
mwdust/util/healpix.py,sha256=zjy-ToIOeln5mnHCv4Hh3ClYReqEMjPGc3aECRlSnCI,12759
|
|
24
|
+
mwdust/util/read_SFD.py,sha256=_Gdn9NCFoTyqbyKx2VjA7KuiAt3oLRkmPjrmMAscP8o,4366
|
|
24
25
|
mwdust/util/read_Drimmel.py,sha256=-rXQHvaozSWLwb9c_GGfjUSO6B58cHp8aDGK0i6aqCg,2487
|
|
25
26
|
mwdust/util/extCurves/extinction.tbl,sha256=YxMdJ8MIryxcFktWOn7Sd_Ro3VOXxjs6j8cm0NY4J9A,4385
|
|
26
27
|
mwdust/util/extCurves/apj398709t6_ascii.txt,sha256=WEE5Z93xpw5MErEbSpH7LEVyv1xkRe_o0Qbp5m3zliw,4228
|
|
27
|
-
mwdust-1.
|
|
28
|
-
mwdust-1.
|
|
29
|
-
mwdust-1.
|
|
30
|
-
mwdust-1.
|
|
31
|
-
mwdust-1.
|
|
32
|
-
mwdust-1.
|
|
28
|
+
mwdust-1.6.dist-info/RECORD,,
|
|
29
|
+
mwdust-1.6.dist-info/WHEEL,sha256=sunMa2yiYbrNLGeMVDqEA0ayyJbHlex7SCn1TZrEq60,136
|
|
30
|
+
mwdust-1.6.dist-info/top_level.txt,sha256=Np8Osh_Yamek_ExIk8NZPvP02xYOChGgGHHyth4l2GY,35
|
|
31
|
+
mwdust-1.6.dist-info/METADATA,sha256=gUA21Ie0K3kASDeTaWnzWFJwPra6Bmjc0cTdklaELNc,8611
|
|
32
|
+
mwdust-1.6.dist-info/licenses/LICENSE,sha256=-c8EkMS9umaZ5szXj3P1AtBCbq7saCaDWZDR2GsHFEE,1488
|
|
33
|
+
mwdust-1.6.dist-info/licenses/AUTHORS.txt,sha256=9sv1C5aD1kGrUyto3icM1b4T6v3etsS4-ooHrTYSRfk,333
|
sfd_c.cpython-311-darwin.so
CHANGED
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|