SpiralMap 0.0.22__py3-none-any.whl → 0.19__py3-none-any.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.
- SpiralMap/datafiles/flim.pkl +0 -0
- SpiralMap/datafiles/flim_all.pkl +0 -0
- SpiralMap/datafiles/spiral.bib +16 -0
- SpiralMap/figdir_primer/map_0png.png +0 -0
- SpiralMap/figdir_primer/map_1png.png +0 -0
- SpiralMap/figdir_primer/map_2png.png +0 -0
- SpiralMap/figdir_primer/map_3png.png +0 -0
- SpiralMap/figdir_primer/map_4png.png +0 -0
- SpiralMap/figdir_primer/map_5png.png +0 -0
- SpiralMap/figdir_primer/map_6png.png +0 -0
- SpiralMap/figdir_primer/map_9png.png +0 -0
- SpiralMap/models_.py +232 -33
- SpiralMap/movie_.gif +0 -0
- SpiralMap/mytools.py +4 -1
- SpiralMap/test.py +86 -8
- {spiralmap-0.0.22.dist-info → spiralmap-0.19.dist-info}/METADATA +15 -6
- {spiralmap-0.0.22.dist-info → spiralmap-0.19.dist-info}/RECORD +19 -18
- SpiralMap/figdir_primer/map_8png.png +0 -0
- {spiralmap-0.0.22.dist-info → spiralmap-0.19.dist-info}/WHEEL +0 -0
- {spiralmap-0.0.22.dist-info → spiralmap-0.19.dist-info}/licenses/LICENSE.md +0 -0
SpiralMap/datafiles/flim.pkl
CHANGED
|
Binary file
|
SpiralMap/datafiles/flim_all.pkl
CHANGED
|
Binary file
|
SpiralMap/datafiles/spiral.bib
CHANGED
|
@@ -12,6 +12,22 @@
|
|
|
12
12
|
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
@ARTICLE{1995ApJ...454..119V,
|
|
16
|
+
author = {{Vallee}, J.~P.},
|
|
17
|
+
title = "{The Milky Way's Spiral Arms Traced by Magnetic Fields, Dust, Gas, and Stars}",
|
|
18
|
+
journal = {\apj},
|
|
19
|
+
keywords = {GALAXY: STRUCTURE, GALAXIES: SPIRAL, ISM: MAGNETIC FIELDS},
|
|
20
|
+
year = 1995,
|
|
21
|
+
month = nov,
|
|
22
|
+
volume = {454},
|
|
23
|
+
pages = {119},
|
|
24
|
+
doi = {10.1086/176470},
|
|
25
|
+
adsurl = {https://ui.adsabs.harvard.edu/abs/1995ApJ...454..119V},
|
|
26
|
+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
15
31
|
@ARTICLE{Drimmel_NIR_2000,
|
|
16
32
|
author = {{Drimmel}, R.},
|
|
17
33
|
title = "{Evidence for a two-armed spiral in the Milky Way}",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
SpiralMap/models_.py
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
# SpiralMap: a library of the Milky Way's spiral arms
|
|
3
3
|
# History:
|
|
4
4
|
# May 2025: Prusty (IISER Kolkata) & Shourya Khanna (INAF Torino)
|
|
5
|
+
# Feb 2026: Following updates:
|
|
6
|
+
# 1) Missing Local arm (logarithmic) added to Hou-Han 2014 model.
|
|
7
|
+
# 2) Vallee 1995 model included.
|
|
8
|
+
# 3) added dependencies to .toml
|
|
5
9
|
#######################################################################
|
|
6
10
|
|
|
7
11
|
|
|
@@ -9,6 +13,7 @@
|
|
|
9
13
|
# import utilities package / set root
|
|
10
14
|
import os
|
|
11
15
|
from os.path import dirname
|
|
16
|
+
|
|
12
17
|
root_ = dirname(__file__)
|
|
13
18
|
dataloc = root_+'/datafiles'
|
|
14
19
|
exec(open(root_+"/mytools.py").read())
|
|
@@ -59,6 +64,7 @@ class spiral_poggio_maps(object):
|
|
|
59
64
|
func_ = lambda s: 'yval' in s
|
|
60
65
|
yval_file = list(filter(func_,flist1))[0]
|
|
61
66
|
|
|
67
|
+
|
|
62
68
|
# # read overdensity contours
|
|
63
69
|
xvalues_overdens=np.load(self.loc+'/'+xval_file)
|
|
64
70
|
yvalues_overdens=np.load(self.loc+'/'+yval_file)
|
|
@@ -67,6 +73,8 @@ class spiral_poggio_maps(object):
|
|
|
67
73
|
Rvalues_dens=sqrtsum(ds=[xvalues_overdens, yvalues_overdens])
|
|
68
74
|
Rgcvalues_dens=sqrtsum(ds=[xvalues_overdens+xsun, yvalues_overdens])
|
|
69
75
|
|
|
76
|
+
self.over_dens_grid = over_dens_grid
|
|
77
|
+
|
|
70
78
|
fl = pickleread(self.loc+'/'+self.model_+'_pproj_contours.pkl')
|
|
71
79
|
self.dout = {'xhc':xvalues_overdens,'yhc':yvalues_overdens,'xgc':xvalues_overdens+xsun,'ygc':yvalues_overdens}
|
|
72
80
|
self.dout['phi4'] =fl['phi4'].copy()
|
|
@@ -105,6 +113,177 @@ class spiral_poggio_maps(object):
|
|
|
105
113
|
plotattrs['linestyle'] = '.'
|
|
106
114
|
_polarproj(self,plotattrs)
|
|
107
115
|
|
|
116
|
+
|
|
117
|
+
class spiral_vallee(object):
|
|
118
|
+
"""
|
|
119
|
+
Vallee et al (1995) logarithmic spiral arm model for the Milky Way.
|
|
120
|
+
Based on multi-tracer analysis including magnetic fields, dust, gas, and stars.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
def __init__(self):
|
|
124
|
+
self.getarmlist()
|
|
125
|
+
|
|
126
|
+
def getarmlist(self):
|
|
127
|
+
"""Set arm names """
|
|
128
|
+
self.arms = np.array(['Sagittarius', 'Scutum', '3-kpc', 'Perseus'])
|
|
129
|
+
self.armcolour = {
|
|
130
|
+
'Sagittarius': 'red', # red
|
|
131
|
+
'Perseus': 'orange', # orange
|
|
132
|
+
'Scutum': 'purple', #
|
|
133
|
+
'3-kpc': 'green' # brown
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
self.getparams()
|
|
137
|
+
self.armcolours = [self.armcolour[ky] for ky in self.arms]
|
|
138
|
+
|
|
139
|
+
def info(self):
|
|
140
|
+
d = {'Arm list': self.arms, 'Colour': self.armcolours}
|
|
141
|
+
dfmodlist = pd.DataFrame(d)
|
|
142
|
+
print(tabulate(dfmodlist, headers='keys', tablefmt='psql'))
|
|
143
|
+
|
|
144
|
+
def getparams(self):
|
|
145
|
+
"""
|
|
146
|
+
Return parameters for each arm.
|
|
147
|
+
|
|
148
|
+
Parameters from Vallee 1995:
|
|
149
|
+
- Pitch angle: 12° ± 1° (inward, absolute value used here)
|
|
150
|
+
- Number of arms: 4
|
|
151
|
+
- Arm start radius: 2.5 kpc
|
|
152
|
+
- Solar position: 8 kpc from Galactic center
|
|
153
|
+
- Arm separation: ~3 kpc near Sun
|
|
154
|
+
|
|
155
|
+
Note: phi0 is set to produce 4 equally spaced arms starting at 2.5 kpc
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
self.arms_model = {
|
|
159
|
+
'Scutum': {'pitch': 12.5, 'phi0': 0, 'r0': 2.5},
|
|
160
|
+
'3-kpc': {'pitch': 12.5, 'phi0': 90, 'r0': 2.5},
|
|
161
|
+
'Perseus': {'pitch': 12.5, 'phi0': 180, 'r0': 2.5},
|
|
162
|
+
'Sagittarius': {'pitch': 12.5, 'phi0': 270, 'r0': 2.5}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
def model_(self, arm_name, R_max=13, n_points=1000):
|
|
166
|
+
"""Generate logarithmic spiral coordinates for specified arm.
|
|
167
|
+
|
|
168
|
+
Parameters
|
|
169
|
+
----------
|
|
170
|
+
arm_name : str
|
|
171
|
+
Name of arm to model
|
|
172
|
+
R_max : float, optional
|
|
173
|
+
Maximum galactocentric radius to model (kpc), default=13
|
|
174
|
+
(Vallee 1995 limits to r_gal < 13 kpc)
|
|
175
|
+
n_points : int, optional
|
|
176
|
+
Number of points to sample along the spiral, default=1000
|
|
177
|
+
|
|
178
|
+
Returns
|
|
179
|
+
-------
|
|
180
|
+
tuple
|
|
181
|
+
(x_hc, y_hc, x_gc, y_gc) coordinate arrays where:
|
|
182
|
+
- x_hc, y_hc: Heliocentric coordinates (kpc)
|
|
183
|
+
- x_gc, y_gc: Galactocentric coordinates (kpc)
|
|
184
|
+
|
|
185
|
+
Model limited to 3 kpc < r_gal < 13 kpc per Vallee 1995 constraints
|
|
186
|
+
"""
|
|
187
|
+
self.R0 = -self.xsun # 8.0 kpc
|
|
188
|
+
params = self.arms_model[arm_name]
|
|
189
|
+
pitch_rad = np.radians(params['pitch'])
|
|
190
|
+
phi0_rad = np.radians(params['phi0'])
|
|
191
|
+
r0 = params['r0']
|
|
192
|
+
|
|
193
|
+
# Calculate maximum phi to reach R_max, starting from r0
|
|
194
|
+
phi_max = phi0_rad + (np.log(R_max/r0) / np.tan(pitch_rad))
|
|
195
|
+
|
|
196
|
+
# Generate angular range starting from phi0
|
|
197
|
+
phi = np.linspace(phi0_rad, phi_max, n_points)
|
|
198
|
+
|
|
199
|
+
# Logarithmic spiral equation (Vallee 1995 eq. 5a)
|
|
200
|
+
R = r0 * np.exp((phi - phi0_rad) * np.tan(pitch_rad))
|
|
201
|
+
|
|
202
|
+
# Apply Vallee 1995 constraints: exclude r_gal < 3 kpc
|
|
203
|
+
mask = R >= 3.0
|
|
204
|
+
R = R[mask]
|
|
205
|
+
phi = phi[mask]
|
|
206
|
+
|
|
207
|
+
# Convert to Cartesian coordinates (Galactocentric)
|
|
208
|
+
x_gc = R * np.cos(phi)
|
|
209
|
+
y_gc = R * np.sin(phi)
|
|
210
|
+
|
|
211
|
+
# Convert to Heliocentric coordinates (Sun at x=8, y=0 in galactocentric)
|
|
212
|
+
# In heliocentric: x_hc = x_gc - (-8) = x_gc + 8, y_hc = y_gc - 0 = y_gc
|
|
213
|
+
x_hc = x_gc + self.R0
|
|
214
|
+
y_hc = y_gc # Sun at y=0 in galactocentric, so y_hc = y_gc
|
|
215
|
+
|
|
216
|
+
return x_hc, y_hc, x_gc, y_gc
|
|
217
|
+
|
|
218
|
+
def output_(self, arm):
|
|
219
|
+
"""Get arm coordinates
|
|
220
|
+
|
|
221
|
+
Parameters
|
|
222
|
+
----------
|
|
223
|
+
arm : str
|
|
224
|
+
Arm identifier (e.g., 'Sagittarius')
|
|
225
|
+
|
|
226
|
+
Returns
|
|
227
|
+
-------
|
|
228
|
+
dict
|
|
229
|
+
Dictionary with keys:
|
|
230
|
+
- 'xhc': Heliocentric x coordinates
|
|
231
|
+
- 'yhc': Heliocentric y coordinates
|
|
232
|
+
- 'xgc': Galactocentric x coordinates
|
|
233
|
+
- 'ygc': Galactocentric y coordinates
|
|
234
|
+
"""
|
|
235
|
+
|
|
236
|
+
xhc, yhc, xgc, ygc = self.model_(arm)
|
|
237
|
+
self.dout = {
|
|
238
|
+
'xhc': xhc,
|
|
239
|
+
'yhc': yhc,
|
|
240
|
+
'xgc': xgc,
|
|
241
|
+
'ygc': ygc
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
return self.dout
|
|
245
|
+
|
|
246
|
+
def df_plot(self, coord='GC', R_max=13):
|
|
247
|
+
rows = []
|
|
248
|
+
|
|
249
|
+
for arm in self.arms:
|
|
250
|
+
x_hc, y_hc, x_gc, y_gc = self.model_(arm, R_max)
|
|
251
|
+
|
|
252
|
+
if coord.upper() == 'GC':
|
|
253
|
+
x, y = x_gc, y_gc
|
|
254
|
+
else:
|
|
255
|
+
x, y = x_hc, y_hc
|
|
256
|
+
|
|
257
|
+
for xi, yi in zip(x, y):
|
|
258
|
+
rows.append([arm, xi, yi])
|
|
259
|
+
|
|
260
|
+
return pd.DataFrame(rows, columns=['arm', 'x', 'y'])
|
|
261
|
+
|
|
262
|
+
def plot(self, coord='GC', R_max=13):
|
|
263
|
+
df = self.df_plot(coord, R_max)
|
|
264
|
+
|
|
265
|
+
plt.figure(figsize=(6, 6))
|
|
266
|
+
|
|
267
|
+
for arm in self.arms:
|
|
268
|
+
d = df[df['arm'] == arm]
|
|
269
|
+
plt.plot(d['x'], d['y'], color=self.armcolour[arm], label=arm)
|
|
270
|
+
|
|
271
|
+
if coord.upper() == 'GC':
|
|
272
|
+
plt.plot(0, 0, 'r*', ms=12, label='GC')
|
|
273
|
+
plt.plot(-self.R0, 0, 'o', color='orange', label='Sun')
|
|
274
|
+
plt.xlabel('X_gc [kpc]')
|
|
275
|
+
plt.ylabel('Y_gc [kpc]')
|
|
276
|
+
else:
|
|
277
|
+
plt.plot(0, 0, 'o', color='orange', label='Sun')
|
|
278
|
+
plt.xlabel('X_hc [kpc]')
|
|
279
|
+
plt.ylabel('Y_hc [kpc]')
|
|
280
|
+
|
|
281
|
+
plt.axhline(0, ls='--', lw=0.5)
|
|
282
|
+
plt.axvline(0, ls='--', lw=0.5)
|
|
283
|
+
plt.axis('equal')
|
|
284
|
+
plt.legend()
|
|
285
|
+
plt.tight_layout()
|
|
286
|
+
plt.show()
|
|
108
287
|
|
|
109
288
|
class TaylorCordesSpiral(object):
|
|
110
289
|
"""
|
|
@@ -203,13 +382,15 @@ class spiral_houhan(object):
|
|
|
203
382
|
Implements the Milky Way spiral structure model from:
|
|
204
383
|
"The spiral structure of the Milky Way from classical Cepheids" (Hou & Han 2014)
|
|
205
384
|
using polynomial-logarithmic spiral functions. Provides 6 major arm segments.
|
|
385
|
+
Additionally, the local arm is implemented as a logarithmic spiral.
|
|
206
386
|
"""
|
|
207
387
|
def __init__(self):
|
|
208
388
|
self.getarmlist()
|
|
209
389
|
def getarmlist(self):
|
|
210
|
-
"""Set arm names and colours"""
|
|
211
|
-
self.arms = np.array(['
|
|
212
|
-
self.armcolour = {'
|
|
390
|
+
"""Set arm names and colours"""
|
|
391
|
+
self.arms = np.array(['Arm1','Arm2','Arm3','Arm4','Arm5','Arm6','local'])
|
|
392
|
+
self.armcolour = {'Arm1':'black','Arm2':'red','Arm3':'green','Arm4':'blue','Arm5':'purple','Arm6':'gold','local':'cyan'}
|
|
393
|
+
|
|
213
394
|
self.armcolours= [self.armcolour[ky] for ky in self.arms ]
|
|
214
395
|
def info(self):
|
|
215
396
|
d = {'Arm list': self.arms, 'Colour': self.armcolours}
|
|
@@ -218,25 +399,30 @@ class spiral_houhan(object):
|
|
|
218
399
|
|
|
219
400
|
def getparams(self):
|
|
220
401
|
"""
|
|
221
|
-
Load spiral parameters from Hou & Han (2014) Table 4 (vcirc=239, Z =0.
|
|
222
|
-
|
|
402
|
+
Load spiral parameters from Hou & Han (2014) Table 4 (vcirc=239, Z =0.17), all tracers.
|
|
403
|
+
|
|
223
404
|
:return: params ( Nested dictionary containing for each arm).
|
|
224
405
|
|
|
225
406
|
a, b, c, d: Polynomial coefficients.
|
|
226
407
|
|
|
227
408
|
θ_start: Start angle in degrees (Galactic longitude).
|
|
228
409
|
|
|
229
|
-
θ_end: End angle in degrees.
|
|
410
|
+
θ_end: End angle in degrees.
|
|
411
|
+
|
|
412
|
+
ri,thetai,psi,ymin,ymax: logarithmic spiral (local arm only)
|
|
230
413
|
:rtype: dict
|
|
231
414
|
"""
|
|
232
415
|
params = {
|
|
233
|
-
'
|
|
234
|
-
'
|
|
235
|
-
'
|
|
236
|
-
'
|
|
237
|
-
'
|
|
238
|
-
'
|
|
416
|
+
'Arm1': {'a': 1.1320, 'b': 0.1233, 'c': 0.003488, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
|
|
417
|
+
'Arm2': {'a': 5.8243, 'b': -1.8196, 'c': 0.2350, 'd': -0.009011, 'θ_start': 275, 'θ_end': 620},
|
|
418
|
+
'Arm3': {'a': 4.2767, 'b': -1.1507, 'c': 0.1570, 'd': -0.006078, 'θ_start': 275, 'θ_end': 575},
|
|
419
|
+
'Arm4': {'a': 1.1280, 'b': 0.1282, 'c': 0.002617, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
|
|
420
|
+
'Arm5': {'a': 1.7978, 'b': -0.04738, 'c': 0.01684, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
|
|
421
|
+
'Arm6': {'a': 2.4225, 'b': -0.1636, 'c': 0.02494, 'd': 0.0, 'θ_start': 280, 'θ_end': 405},
|
|
422
|
+
'local': {'ri': 8.17, 'thetai': 57.8, 'psi':2.84,'ymin':-4.,'ymax':7.5}
|
|
239
423
|
}
|
|
424
|
+
|
|
425
|
+
|
|
240
426
|
return params
|
|
241
427
|
def polynomial_log_spiral(self, θ, a, b, c, d):
|
|
242
428
|
"""Calculate radius using polynomial-logarithmic spiral equation.
|
|
@@ -264,19 +450,31 @@ class spiral_houhan(object):
|
|
|
264
450
|
def model_(self, arm_name, n_points=500):
|
|
265
451
|
|
|
266
452
|
params_ = self.getparams()
|
|
267
|
-
params = params_[arm_name]
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
453
|
+
params = params_[arm_name]
|
|
454
|
+
|
|
455
|
+
if arm_name == 'local':
|
|
456
|
+
θ = np.linspace(0., 180., n_points)
|
|
457
|
+
tmp1 = np.radians(θ - params['thetai'])
|
|
458
|
+
tmp2 = np.tan(np.radians(params['psi']))
|
|
459
|
+
R = params['ri']*np.exp( tmp1*tmp2 )
|
|
460
|
+
else:
|
|
461
|
+
θ = np.linspace(params['θ_start'], params['θ_end'], n_points)
|
|
462
|
+
R = self.polynomial_log_spiral(θ, params['a'], params['b'], params['c'], params['d'])
|
|
463
|
+
|
|
273
464
|
# Convert to Cartesian coordinates (Galactocentric)
|
|
274
465
|
y_gc = R*np.cos(np.radians(θ))
|
|
275
466
|
x_gc = -R * np.sin(np.radians(θ))
|
|
276
467
|
|
|
277
468
|
# Convert to Heliocentric coordinates
|
|
278
469
|
x_hc = (x_gc + self.R0)
|
|
279
|
-
|
|
470
|
+
|
|
471
|
+
if arm_name == 'local':
|
|
472
|
+
ind_mask = np.where((y_gc < params['ymin'])|(y_gc > params['ymax']))[0]
|
|
473
|
+
y_gc[ind_mask] = np.nan
|
|
474
|
+
x_gc[ind_mask] = np.nan
|
|
475
|
+
x_hc[ind_mask] = np.nan
|
|
476
|
+
|
|
477
|
+
|
|
280
478
|
return x_hc, y_gc, x_gc, y_gc
|
|
281
479
|
|
|
282
480
|
def output_(self, arm):
|
|
@@ -311,9 +509,9 @@ class spiral_houhan_HII(object):
|
|
|
311
509
|
def __init__(self):
|
|
312
510
|
self.getarmlist()
|
|
313
511
|
def getarmlist(self):
|
|
314
|
-
"""Set arm names and colours"""
|
|
315
|
-
self.arms = np.array(['
|
|
316
|
-
self.armcolour = {'
|
|
512
|
+
"""Set arm names and colours"""
|
|
513
|
+
self.arms = np.array(['Arm1','Arm2','Arm3','Arm4','Arm5','Arm6'])
|
|
514
|
+
self.armcolour = {'Arm1':'black','Arm2':'red','Arm3':'green','Arm4':'blue','Arm5':'purple','Arm6':'gold'}
|
|
317
515
|
self.armcolours= [self.armcolour[ky] for ky in self.arms ]
|
|
318
516
|
def info(self):
|
|
319
517
|
d = {'Arm list': self.arms, 'Colour': self.armcolours}
|
|
@@ -335,12 +533,12 @@ class spiral_houhan_HII(object):
|
|
|
335
533
|
"""
|
|
336
534
|
|
|
337
535
|
params = {
|
|
338
|
-
'
|
|
339
|
-
'
|
|
340
|
-
'
|
|
341
|
-
'
|
|
342
|
-
'
|
|
343
|
-
'
|
|
536
|
+
'Arm1': {'a': 1.1668, 'b': 0.1198, 'c': 0.002557, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
|
|
537
|
+
'Arm2': {'a': 5.8002, 'b': -1.8188, 'c': 0.2352, 'd': -0.008999, 'θ_start': 275, 'θ_end': 620},
|
|
538
|
+
'Arm3': {'a': 4.2300, 'b': -1.1505, 'c': 0.1561, 'd': -0.005898, 'θ_start': 275, 'θ_end': 570},
|
|
539
|
+
'Arm4': {'a': 0.9744, 'b': 0.1405, 'c': 0.003995, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
|
|
540
|
+
'Arm5': {'a': 0.9887, 'b': 0.1714, 'c': 0.004358, 'd': 0.0, 'θ_start': 280, 'θ_end': 475},
|
|
541
|
+
'Arm6': {'a': 3.3846, 'b': -0.6554, 'c': 0.08170, 'd': 0.0, 'θ_start': 280, 'θ_end': 355}
|
|
344
542
|
}
|
|
345
543
|
|
|
346
544
|
return params
|
|
@@ -925,7 +1123,7 @@ class main_(object):
|
|
|
925
1123
|
Constructs dictionaries to initialise individual model classes
|
|
926
1124
|
"""
|
|
927
1125
|
|
|
928
|
-
self.models = ['Taylor_Cordes_1992','Drimmel_NIR_2000',
|
|
1126
|
+
self.models = ['Taylor_Cordes_1992','Vallee_1995','Drimmel_NIR_2000',
|
|
929
1127
|
'Levine_2006','Hou_Han_2014','Hou_Han_HII_2014','Reid_2019',
|
|
930
1128
|
'Poggio_cont_2021','GaiaPVP_cont_2022','Drimmel_Ceph_2024']
|
|
931
1129
|
self.models_class = {'Reid_2019':reid_spiral(),
|
|
@@ -936,9 +1134,10 @@ class main_(object):
|
|
|
936
1134
|
'Taylor_Cordes_1992':TaylorCordesSpiral(),
|
|
937
1135
|
'Hou_Han_2014':spiral_houhan(),
|
|
938
1136
|
'Hou_Han_HII_2014':spiral_houhan_HII(),
|
|
1137
|
+
'Vallee_1995':spiral_vallee(),
|
|
939
1138
|
'Drimmel_Ceph_2024':spiral_drimmel_cepheids()}
|
|
940
1139
|
|
|
941
|
-
self.models_desc = ['HII','NIR emission',
|
|
1140
|
+
self.models_desc = ['HII','Bfield/Dust/gas','NIR emission',
|
|
942
1141
|
'HI','HII/GMC/Masers','HII','MASER parallax',
|
|
943
1142
|
'Upper main sequence (map)','OB stars (map)','Cepheids']
|
|
944
1143
|
def getinfo(self,model='',print_=True):
|
|
@@ -997,11 +1196,11 @@ class main_(object):
|
|
|
997
1196
|
if plotattrs_['plot'] and plotattrs_['polarproj']==False :
|
|
998
1197
|
plt.plot(spimod.dout['x'+plotattrs_['coordsys'].lower()],
|
|
999
1198
|
spimod.dout['y'+plotattrs_['coordsys'].lower()],
|
|
1000
|
-
plotattrs_['linestyle'],color=plotattrs_['armcolour'])
|
|
1199
|
+
plotattrs_['linestyle'],linewidth=plotattrs_['linewidth'],color=plotattrs_['armcolour'])
|
|
1001
1200
|
if 'xhc_ex' in spimod.dout.keys():
|
|
1002
1201
|
plt.plot(spimod.dout['x'+plotattrs_['coordsys'].lower()+'_ex'],
|
|
1003
1202
|
spimod.dout['y'+plotattrs_['coordsys'].lower()+'_ex'],
|
|
1004
|
-
'--',color=plotattrs_['armcolour'])
|
|
1203
|
+
'--',linewidth=plotattrs_['linewidth'],color=plotattrs_['armcolour'])
|
|
1005
1204
|
|
|
1006
1205
|
plt.xlabel('X$_{'+plotattrs_['coordsys']+'}$ [Kpc]')
|
|
1007
1206
|
plt.ylabel('Y$_{'+plotattrs_['coordsys']+'}$ [Kpc]')
|
|
@@ -1234,4 +1433,4 @@ class _make_supportfiles(object):
|
|
|
1234
1433
|
|
|
1235
1434
|
|
|
1236
1435
|
|
|
1237
|
-
#
|
|
1436
|
+
# _make_supportfiles()
|
SpiralMap/movie_.gif
CHANGED
|
Binary file
|
SpiralMap/mytools.py
CHANGED
SpiralMap/test.py
CHANGED
|
@@ -44,8 +44,35 @@ if initialise_:
|
|
|
44
44
|
spirals.getinfo(model=use_model)
|
|
45
45
|
plotattrs = {'plot':False}
|
|
46
46
|
spirals.readout(plotattrs,model=use_model,arm='Sag-Car')
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
impl_vallee_ = False
|
|
50
|
+
if impl_vallee_ :
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# spirals = sp.main_(Rsun=Rsun)
|
|
54
|
+
# spirals.getinfo()
|
|
55
|
+
# spirals.getinfo(model='Vallee_1995')
|
|
56
|
+
# spirals.plotattrs_default
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
#################
|
|
47
60
|
|
|
61
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
62
|
+
use_model = 'Vallee_1995'
|
|
63
|
+
spirals.getinfo(model=use_model)
|
|
64
|
+
plotattrs = {'plot':True,'coordsys':'GC'}
|
|
65
|
+
spirals.readout(plotattrs,model=use_model,arm='all')
|
|
66
|
+
|
|
67
|
+
plt.savefig(figdir_primer+'/test_vallee_gc.png')
|
|
48
68
|
|
|
69
|
+
|
|
70
|
+
plt.close('all')
|
|
71
|
+
plotattrs = {'plot':True,'coordsys':'HC'}
|
|
72
|
+
spirals.readout(plotattrs,model=use_model,arm='all')
|
|
73
|
+
|
|
74
|
+
plt.savefig(figdir_primer+'/test_vallee_hc.png')
|
|
75
|
+
|
|
49
76
|
single_model_single_arm = False
|
|
50
77
|
if single_model_single_arm:
|
|
51
78
|
|
|
@@ -81,7 +108,8 @@ if single_model_all_arms:
|
|
|
81
108
|
|
|
82
109
|
Rsun=8.277
|
|
83
110
|
spirals = sp.main_(Rsun=Rsun)
|
|
84
|
-
use_model = 'Drimmel_Ceph_2024'
|
|
111
|
+
# use_model = 'Drimmel_Ceph_2024'
|
|
112
|
+
use_model = 'Vallee_1995'
|
|
85
113
|
use_arm = 'all'
|
|
86
114
|
spirals.getinfo(model=use_model)
|
|
87
115
|
|
|
@@ -162,7 +190,7 @@ if single_model_polar_hou:
|
|
|
162
190
|
Rsun=8.277
|
|
163
191
|
spirals = sp.main_(Rsun=Rsun)
|
|
164
192
|
use_model = 'Hou_Han_2014'
|
|
165
|
-
use_arm = '
|
|
193
|
+
use_arm = 'Arm2'
|
|
166
194
|
|
|
167
195
|
spirals.getinfo(model=use_model)
|
|
168
196
|
|
|
@@ -260,7 +288,7 @@ if hou_han_test:
|
|
|
260
288
|
Rsun=8.277
|
|
261
289
|
spirals = sp.main_(Rsun=Rsun)
|
|
262
290
|
use_model = 'Hou_Han_2014'
|
|
263
|
-
use_model3 = '
|
|
291
|
+
use_model3 = 'Hou_Han_2014'
|
|
264
292
|
use_arm = 'all'
|
|
265
293
|
use_model2 = 'Poggio_cont_2021'
|
|
266
294
|
|
|
@@ -273,11 +301,11 @@ if hou_han_test:
|
|
|
273
301
|
|
|
274
302
|
ax = plt.subplot(121, projection='polar')
|
|
275
303
|
|
|
276
|
-
plotattrs = {'plot':True,'coordsys':'
|
|
304
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polarproj':True,'linewidth':5}
|
|
277
305
|
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
278
|
-
plotattrs = {'plot':True,'coordsys':'
|
|
306
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':3,'polarproj':True}
|
|
279
307
|
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
280
|
-
polar_style(ax,title=use_model+' (
|
|
308
|
+
polar_style(ax,title=use_model+' (HC)')
|
|
281
309
|
|
|
282
310
|
ax = plt.subplot(122, projection='polar')
|
|
283
311
|
|
|
@@ -292,7 +320,7 @@ if hou_han_test:
|
|
|
292
320
|
|
|
293
321
|
plt.savefig(figdir_primer+'/test_houhan.png')
|
|
294
322
|
|
|
295
|
-
makegif =
|
|
323
|
+
makegif = True
|
|
296
324
|
if makegif:
|
|
297
325
|
|
|
298
326
|
plt.close('all')
|
|
@@ -318,14 +346,64 @@ if makegif:
|
|
|
318
346
|
spirals.readout(plotattrs,model=use_model2,arm=use_arm)
|
|
319
347
|
polar_style(ax,title=use_model+' (GC)')
|
|
320
348
|
ax.set_ylim([0.,15])
|
|
321
|
-
|
|
349
|
+
plt.legend()
|
|
322
350
|
plt.savefig(figdir_primer+'/map_'+str(inum)+'png')
|
|
323
351
|
|
|
324
352
|
import mytools
|
|
325
353
|
curdir = os.getcwd()
|
|
326
354
|
mytools.png2movie(figdir_primer,curdir,flname='movie_',duration=3.5,fmt='gif')
|
|
327
355
|
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
templot = False
|
|
359
|
+
if templot:
|
|
360
|
+
|
|
361
|
+
# grab data (poggio and ceph)
|
|
362
|
+
plotattrs = {'plot':False,'coordsys':'GC','markersize':3,'polarproj':True,'armcolour':''}
|
|
363
|
+
pg = spiral_poggio_maps()
|
|
364
|
+
pg.xsun = 8.277
|
|
365
|
+
pg.output_(plotattrs)
|
|
366
|
+
xvalues = pg.dout['xhc']
|
|
367
|
+
yvalues = pg.dout['yhc']
|
|
368
|
+
overdens_grid = pg.over_dens_grid
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':5,'linewidth':4,'linestyle':'-','polargrid':False}
|
|
372
|
+
Rsun=8.277
|
|
373
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
374
|
+
use_model2 = 'Drimmel_Ceph_2024'
|
|
375
|
+
use_arm = 'all'
|
|
376
|
+
|
|
377
|
+
plt.close('all')
|
|
378
|
+
|
|
379
|
+
fgsize=(6.5,5.)
|
|
380
|
+
fig = plt.figure(figsize=fgsize, dpi=150)
|
|
381
|
+
|
|
382
|
+
ax = fig.gca()
|
|
383
|
+
|
|
384
|
+
iniz=-1.18
|
|
385
|
+
fin=1.18
|
|
386
|
+
N_levels=50
|
|
387
|
+
levels=np.linspace(iniz,fin,N_levels)
|
|
388
|
+
cset1 = ax.contourf(xvalues, yvalues,overdens_grid.T, levels=levels, cmap='seismic',vmin=-1.18,vmax=1.18)
|
|
389
|
+
|
|
390
|
+
cbar=plt.colorbar(mappable=cset1,orientation="vertical",ticks=[-1,-0.5, 0, 0.5, 1])
|
|
391
|
+
|
|
392
|
+
cbar.set_label('Overdensity', fontsize=18)
|
|
393
|
+
cbar.ax.tick_params(labelsize=18)
|
|
394
|
+
|
|
395
|
+
spirals.readout(plotattrs,model=use_model2,arm=use_arm)
|
|
396
|
+
|
|
397
|
+
ax.set_xlabel('X (kpc)', fontsize=18)
|
|
398
|
+
ax.set_ylabel('Y (kpc)', fontsize=18)
|
|
399
|
+
|
|
400
|
+
ax.set_xlim([-5.5,5.1])
|
|
401
|
+
ax.set_ylim([-5.8,5.5])
|
|
402
|
+
ax.tick_params(axis="x", labelsize=15)
|
|
403
|
+
ax.tick_params(axis="y", labelsize=15)
|
|
404
|
+
plt.tight_layout()
|
|
328
405
|
|
|
406
|
+
# # plt.show()
|
|
329
407
|
|
|
330
408
|
|
|
331
409
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SpiralMap
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19
|
|
4
4
|
Summary: Python Library of Milky Way's Spiral Arms
|
|
5
5
|
Project-URL: Homepage, https://github.com/Abhaypru/SpiralMap
|
|
6
6
|
Project-URL: Issues, https://github.com/Abhaypru/SpiralMap/issues
|
|
@@ -10,6 +10,13 @@ License-File: LICENSE.md
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.9
|
|
13
|
+
Requires-Dist: astropy
|
|
14
|
+
Requires-Dist: matplotlib
|
|
15
|
+
Requires-Dist: numpy
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: tabulate
|
|
19
|
+
Requires-Dist: update-checker
|
|
13
20
|
Provides-Extra: docs
|
|
14
21
|
Requires-Dist: sphinx; extra == 'docs'
|
|
15
22
|
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
|
|
@@ -24,16 +31,18 @@ A Python library of the Milky Way's spiral arms.
|
|
|
24
31
|
|
|
25
32
|
The detailed documentation is hosted on [Read the docs](https://spiralmap.readthedocs.io/en/latest/#api-docs).
|
|
26
33
|
|
|
27
|
-
For a quickstart please refer to the accompanying [Jupyter notebook](https://github.com/Abhaypru/SpiralMap/blob/main/demo_spiralmap.ipynb)
|
|
34
|
+
For a quickstart please refer to the accompanying [Jupyter notebook](https://github.com/Abhaypru/SpiralMap/blob/main/demo_spiralmap.ipynb).
|
|
28
35
|
|
|
36
|
+
Read the preprint at [arxiv](https://www.arxiv.org/abs/2506.11383).
|
|
29
37
|
## Features
|
|
30
|
-
+ Access
|
|
38
|
+
+ Access 9 independent spiral arm models from literature. We are open to requests for including other spiral arm models.
|
|
31
39
|
+ Extract the 2D trace of individual or all spiral arms from a particular model.
|
|
32
40
|
+ Directly overplot spiral arms with choice of Cartesian or Polar coordinates, and in Heliocentric or Galactocentric frames.
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
## Updates
|
|
43
|
+
+ Missing Local arm (logarithmic) added to Hou-Han 2014 model.
|
|
44
|
+
+ Vallee 1995 model included.
|
|
45
|
+
+ Dependencies included
|
|
37
46
|
|
|
38
47
|
Installation
|
|
39
48
|
-------------
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
SpiralMap/__init__.py,sha256=7F5e52HrtZpHq8kNmLG8e1jtNlf6jkufCDgoIKlKZGs,100
|
|
2
|
-
SpiralMap/models_.py,sha256=
|
|
3
|
-
SpiralMap/movie_.gif,sha256=
|
|
4
|
-
SpiralMap/mytools.py,sha256=
|
|
5
|
-
SpiralMap/test.py,sha256=
|
|
2
|
+
SpiralMap/models_.py,sha256=6QOZcwnU24n352wfA2o8nvpLJHQ7oEzZWdCz8CambWY,45779
|
|
3
|
+
SpiralMap/movie_.gif,sha256=E6-0Gzo9IgcfrsgGUTnj47a2Fw2WApD6AmjcnwzHXEQ,260591
|
|
4
|
+
SpiralMap/mytools.py,sha256=rfdCNeTniBmY32mjWJiLNuN27NQxVg7AU994u4btisQ,7394
|
|
5
|
+
SpiralMap/test.py,sha256=GgjSEStYWHEfbOodkVlq41sVZge8wSyukmtQgbCKRiI,11888
|
|
6
6
|
SpiralMap/version.py,sha256=G_9nHD5j8EWxdjfiRE8uUrh0l_FRWN5WAnCM9wjLIJw,78
|
|
7
|
-
SpiralMap/datafiles/flim.pkl,sha256=
|
|
8
|
-
SpiralMap/datafiles/flim_all.pkl,sha256=
|
|
9
|
-
SpiralMap/datafiles/spiral.bib,sha256=
|
|
7
|
+
SpiralMap/datafiles/flim.pkl,sha256=STMsqda-8G046xAa3t-BcA-EhS3mfKjXLSTLXkyBYdA,12210
|
|
8
|
+
SpiralMap/datafiles/flim_all.pkl,sha256=iBo9l30ky9F0m-ckBl6fHzdBEaFvx42QdtSOLE9AM7w,2362
|
|
9
|
+
SpiralMap/datafiles/spiral.bib,sha256=nfsaATK6NKYRgYSIBOgTtTB_ky8V-SKEgZ3awm8fMZc,14146
|
|
10
10
|
SpiralMap/datafiles/Drimmel2024_cepheids/ArmAttributes_dyoungW1_bw025.pkl,sha256=F4pUfUSEg7_BBC9jpMjFeuWFHj4dYKszrpMt8wKW0ds,6571
|
|
11
11
|
SpiralMap/datafiles/Drimmel_NIR/Drimmel2armspiral.fits,sha256=jJ2k0yddyIUbMxGRGszD6cwlleUrGMtkrMByc_hU5bA,14400
|
|
12
12
|
SpiralMap/datafiles/Drimmel_NIR/Readme_spiral_m2_147.txt,sha256=h2aA4V9T8RQRBlG_GYDJRfLswnqrK6AmdCleFR-NLSE,395
|
|
@@ -27,14 +27,15 @@ SpiralMap/datafiles/Poggio_cont_2021/Poggio_cont_2021_pproj_contours.pkl,sha256=
|
|
|
27
27
|
SpiralMap/datafiles/Poggio_cont_2021/overdens_grid_locscale03.npy,sha256=peM4jyLQsE8X4bMTCCe-7UD3Hayi2qmRcOQzCudBfHM,117256
|
|
28
28
|
SpiralMap/datafiles/Poggio_cont_2021/xvalues.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
29
29
|
SpiralMap/datafiles/Poggio_cont_2021/yvalues.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
30
|
-
SpiralMap/figdir_primer/map_0png.png,sha256=
|
|
31
|
-
SpiralMap/figdir_primer/map_1png.png,sha256=
|
|
32
|
-
SpiralMap/figdir_primer/map_2png.png,sha256=
|
|
33
|
-
SpiralMap/figdir_primer/map_3png.png,sha256=
|
|
34
|
-
SpiralMap/figdir_primer/map_4png.png,sha256=
|
|
35
|
-
SpiralMap/figdir_primer/map_5png.png,sha256=
|
|
36
|
-
SpiralMap/figdir_primer/
|
|
37
|
-
|
|
38
|
-
spiralmap-0.
|
|
39
|
-
spiralmap-0.
|
|
40
|
-
spiralmap-0.
|
|
30
|
+
SpiralMap/figdir_primer/map_0png.png,sha256=1IKLOY9V19QdEZmu2ivwHb5G6tkooYPc7npQckNAots,76129
|
|
31
|
+
SpiralMap/figdir_primer/map_1png.png,sha256=NgFySlWjEtO3NX2zROgBfqryxQ1wZt25IAX6hIkAXj4,87154
|
|
32
|
+
SpiralMap/figdir_primer/map_2png.png,sha256=1kncc1jc3tk90Fjq97_qJrvJVgh1KwrTwet2nlqVMm8,84220
|
|
33
|
+
SpiralMap/figdir_primer/map_3png.png,sha256=C2KygHiWyW3allmSX5Fn-gg2wK_4RkjjSaIOx7VUGFc,71840
|
|
34
|
+
SpiralMap/figdir_primer/map_4png.png,sha256=2cSJXNZNkwNmzCiki8NqZAwpIWn0ZDZt6aPqRbgfO60,87668
|
|
35
|
+
SpiralMap/figdir_primer/map_5png.png,sha256=2HTSFtUpg1SiP4tWhwqOCLma36hQKoB-khqgzsnPTVE,85117
|
|
36
|
+
SpiralMap/figdir_primer/map_6png.png,sha256=_11fChqGIz8cEpLsLSMwJPeO2ivR8XYOAOHR2oeCvQk,72499
|
|
37
|
+
SpiralMap/figdir_primer/map_9png.png,sha256=IQ6x6lgFZEwEcGja4Hn_XT_8t3PjY6c84-Bc6KazU9U,75444
|
|
38
|
+
spiralmap-0.19.dist-info/METADATA,sha256=ESG8_tTRcriget93ThIwZeXfFURQsweqStvjkdUihSI,2515
|
|
39
|
+
spiralmap-0.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
40
|
+
spiralmap-0.19.dist-info/licenses/LICENSE.md,sha256=5w1L9A7eVMqU0wNIsBTTZA8K2JBIK0KKbqMSaQ1z9m0,1076
|
|
41
|
+
spiralmap-0.19.dist-info/RECORD,,
|
|
Binary file
|
|
File without changes
|
|
File without changes
|