SpiralMap 0.0.22__py3-none-any.whl → 0.16__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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
SpiralMap/models_.py CHANGED
@@ -2,17 +2,23 @@
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
 
8
12
  #--------------------------------------------
9
13
  # import utilities package / set root
10
14
  import os
15
+ import version
11
16
  from os.path import dirname
17
+ from update_checker import update_check
12
18
  root_ = dirname(__file__)
13
19
  dataloc = root_+'/datafiles'
14
20
  exec(open(root_+"/mytools.py").read())
15
-
21
+ update_check('spiralmap', version.__version__)
16
22
  #--------------------------------------------
17
23
 
18
24
 
@@ -59,6 +65,7 @@ class spiral_poggio_maps(object):
59
65
  func_ = lambda s: 'yval' in s
60
66
  yval_file = list(filter(func_,flist1))[0]
61
67
 
68
+
62
69
  # # read overdensity contours
63
70
  xvalues_overdens=np.load(self.loc+'/'+xval_file)
64
71
  yvalues_overdens=np.load(self.loc+'/'+yval_file)
@@ -67,6 +74,8 @@ class spiral_poggio_maps(object):
67
74
  Rvalues_dens=sqrtsum(ds=[xvalues_overdens, yvalues_overdens])
68
75
  Rgcvalues_dens=sqrtsum(ds=[xvalues_overdens+xsun, yvalues_overdens])
69
76
 
77
+ self.over_dens_grid = over_dens_grid
78
+
70
79
  fl = pickleread(self.loc+'/'+self.model_+'_pproj_contours.pkl')
71
80
  self.dout = {'xhc':xvalues_overdens,'yhc':yvalues_overdens,'xgc':xvalues_overdens+xsun,'ygc':yvalues_overdens}
72
81
  self.dout['phi4'] =fl['phi4'].copy()
@@ -105,6 +114,177 @@ class spiral_poggio_maps(object):
105
114
  plotattrs['linestyle'] = '.'
106
115
  _polarproj(self,plotattrs)
107
116
 
117
+
118
+ class spiral_vallee(object):
119
+ """
120
+ Vallee et al (1995) logarithmic spiral arm model for the Milky Way.
121
+ Based on multi-tracer analysis including magnetic fields, dust, gas, and stars.
122
+ """
123
+
124
+ def __init__(self):
125
+ self.getarmlist()
126
+
127
+ def getarmlist(self):
128
+ """Set arm names """
129
+ self.arms = np.array(['Sagittarius', 'Scutum', '3-kpc', 'Perseus'])
130
+ self.armcolour = {
131
+ 'Sagittarius': 'red', # red
132
+ 'Perseus': 'orange', # orange
133
+ 'Scutum': 'purple', #
134
+ '3-kpc': 'green' # brown
135
+ }
136
+
137
+ self.getparams()
138
+ self.armcolours = [self.armcolour[ky] for ky in self.arms]
139
+
140
+ def info(self):
141
+ d = {'Arm list': self.arms, 'Colour': self.armcolours}
142
+ dfmodlist = pd.DataFrame(d)
143
+ print(tabulate(dfmodlist, headers='keys', tablefmt='psql'))
144
+
145
+ def getparams(self):
146
+ """
147
+ Return parameters for each arm.
148
+
149
+ Parameters from Vallee 1995:
150
+ - Pitch angle: 12° ± 1° (inward, absolute value used here)
151
+ - Number of arms: 4
152
+ - Arm start radius: 2.5 kpc
153
+ - Solar position: 8 kpc from Galactic center
154
+ - Arm separation: ~3 kpc near Sun
155
+
156
+ Note: phi0 is set to produce 4 equally spaced arms starting at 2.5 kpc
157
+ """
158
+
159
+ self.arms_model = {
160
+ 'Scutum': {'pitch': 12.5, 'phi0': 0, 'r0': 2.5},
161
+ '3-kpc': {'pitch': 12.5, 'phi0': 90, 'r0': 2.5},
162
+ 'Perseus': {'pitch': 12.5, 'phi0': 180, 'r0': 2.5},
163
+ 'Sagittarius': {'pitch': 12.5, 'phi0': 270, 'r0': 2.5}
164
+ }
165
+
166
+ def model_(self, arm_name, R_max=13, n_points=1000):
167
+ """Generate logarithmic spiral coordinates for specified arm.
168
+
169
+ Parameters
170
+ ----------
171
+ arm_name : str
172
+ Name of arm to model
173
+ R_max : float, optional
174
+ Maximum galactocentric radius to model (kpc), default=13
175
+ (Vallee 1995 limits to r_gal < 13 kpc)
176
+ n_points : int, optional
177
+ Number of points to sample along the spiral, default=1000
178
+
179
+ Returns
180
+ -------
181
+ tuple
182
+ (x_hc, y_hc, x_gc, y_gc) coordinate arrays where:
183
+ - x_hc, y_hc: Heliocentric coordinates (kpc)
184
+ - x_gc, y_gc: Galactocentric coordinates (kpc)
185
+
186
+ Model limited to 3 kpc < r_gal < 13 kpc per Vallee 1995 constraints
187
+ """
188
+ self.R0 = -self.xsun # 8.0 kpc
189
+ params = self.arms_model[arm_name]
190
+ pitch_rad = np.radians(params['pitch'])
191
+ phi0_rad = np.radians(params['phi0'])
192
+ r0 = params['r0']
193
+
194
+ # Calculate maximum phi to reach R_max, starting from r0
195
+ phi_max = phi0_rad + (np.log(R_max/r0) / np.tan(pitch_rad))
196
+
197
+ # Generate angular range starting from phi0
198
+ phi = np.linspace(phi0_rad, phi_max, n_points)
199
+
200
+ # Logarithmic spiral equation (Vallee 1995 eq. 5a)
201
+ R = r0 * np.exp((phi - phi0_rad) * np.tan(pitch_rad))
202
+
203
+ # Apply Vallee 1995 constraints: exclude r_gal < 3 kpc
204
+ mask = R >= 3.0
205
+ R = R[mask]
206
+ phi = phi[mask]
207
+
208
+ # Convert to Cartesian coordinates (Galactocentric)
209
+ x_gc = R * np.cos(phi)
210
+ y_gc = R * np.sin(phi)
211
+
212
+ # Convert to Heliocentric coordinates (Sun at x=8, y=0 in galactocentric)
213
+ # In heliocentric: x_hc = x_gc - (-8) = x_gc + 8, y_hc = y_gc - 0 = y_gc
214
+ x_hc = x_gc + self.R0
215
+ y_hc = y_gc # Sun at y=0 in galactocentric, so y_hc = y_gc
216
+
217
+ return x_hc, y_hc, x_gc, y_gc
218
+
219
+ def output_(self, arm):
220
+ """Get arm coordinates
221
+
222
+ Parameters
223
+ ----------
224
+ arm : str
225
+ Arm identifier (e.g., 'Sagittarius')
226
+
227
+ Returns
228
+ -------
229
+ dict
230
+ Dictionary with keys:
231
+ - 'xhc': Heliocentric x coordinates
232
+ - 'yhc': Heliocentric y coordinates
233
+ - 'xgc': Galactocentric x coordinates
234
+ - 'ygc': Galactocentric y coordinates
235
+ """
236
+
237
+ xhc, yhc, xgc, ygc = self.model_(arm)
238
+ self.dout = {
239
+ 'xhc': xhc,
240
+ 'yhc': yhc,
241
+ 'xgc': xgc,
242
+ 'ygc': ygc
243
+
244
+ }
245
+ return self.dout
246
+
247
+ def df_plot(self, coord='GC', R_max=13):
248
+ rows = []
249
+
250
+ for arm in self.arms:
251
+ x_hc, y_hc, x_gc, y_gc = self.model_(arm, R_max)
252
+
253
+ if coord.upper() == 'GC':
254
+ x, y = x_gc, y_gc
255
+ else:
256
+ x, y = x_hc, y_hc
257
+
258
+ for xi, yi in zip(x, y):
259
+ rows.append([arm, xi, yi])
260
+
261
+ return pd.DataFrame(rows, columns=['arm', 'x', 'y'])
262
+
263
+ def plot(self, coord='GC', R_max=13):
264
+ df = self.df_plot(coord, R_max)
265
+
266
+ plt.figure(figsize=(6, 6))
267
+
268
+ for arm in self.arms:
269
+ d = df[df['arm'] == arm]
270
+ plt.plot(d['x'], d['y'], color=self.armcolour[arm], label=arm)
271
+
272
+ if coord.upper() == 'GC':
273
+ plt.plot(0, 0, 'r*', ms=12, label='GC')
274
+ plt.plot(-self.R0, 0, 'o', color='orange', label='Sun')
275
+ plt.xlabel('X_gc [kpc]')
276
+ plt.ylabel('Y_gc [kpc]')
277
+ else:
278
+ plt.plot(0, 0, 'o', color='orange', label='Sun')
279
+ plt.xlabel('X_hc [kpc]')
280
+ plt.ylabel('Y_hc [kpc]')
281
+
282
+ plt.axhline(0, ls='--', lw=0.5)
283
+ plt.axvline(0, ls='--', lw=0.5)
284
+ plt.axis('equal')
285
+ plt.legend()
286
+ plt.tight_layout()
287
+ plt.show()
108
288
 
109
289
  class TaylorCordesSpiral(object):
110
290
  """
@@ -203,13 +383,15 @@ class spiral_houhan(object):
203
383
  Implements the Milky Way spiral structure model from:
204
384
  "The spiral structure of the Milky Way from classical Cepheids" (Hou & Han 2014)
205
385
  using polynomial-logarithmic spiral functions. Provides 6 major arm segments.
386
+ Additionally, the local arm is implemented as a logarithmic spiral.
206
387
  """
207
388
  def __init__(self):
208
389
  self.getarmlist()
209
390
  def getarmlist(self):
210
- """Set arm names and colours"""
211
- self.arms = np.array(['Norma','Scutum-Centaurus','Sagittarius-Carina','Perseus','Local','Outer'])
212
- self.armcolour = {'Norma':'black','Scutum-Centaurus':'red','Sagittarius-Carina':'green','Perseus':'blue','Local':'purple','Outer':'gold'}
391
+ """Set arm names and colours"""
392
+ self.arms = np.array(['Arm1','Arm2','Arm3','Arm4','Arm5','Arm6','local'])
393
+ self.armcolour = {'Arm1':'black','Arm2':'red','Arm3':'green','Arm4':'blue','Arm5':'purple','Arm6':'gold','local':'cyan'}
394
+
213
395
  self.armcolours= [self.armcolour[ky] for ky in self.arms ]
214
396
  def info(self):
215
397
  d = {'Arm list': self.arms, 'Colour': self.armcolours}
@@ -218,25 +400,30 @@ class spiral_houhan(object):
218
400
 
219
401
  def getparams(self):
220
402
  """
221
- Load spiral parameters from Hou & Han (2014) Table 4 (vcirc=239, Z =0.16), all tracers.
222
-
403
+ Load spiral parameters from Hou & Han (2014) Table 4 (vcirc=239, Z =0.17), all tracers.
404
+
223
405
  :return: params ( Nested dictionary containing for each arm).
224
406
 
225
407
  a, b, c, d: Polynomial coefficients.
226
408
 
227
409
  θ_start: Start angle in degrees (Galactic longitude).
228
410
 
229
- θ_end: End angle in degrees.
411
+ θ_end: End angle in degrees.
412
+
413
+ ri,thetai,psi,ymin,ymax: logarithmic spiral (local arm only)
230
414
  :rtype: dict
231
415
  """
232
416
  params = {
233
- 'Norma': {'a': 1.1320, 'b': 0.1233, 'c': 0.003488, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
234
- 'Scutum-Centaurus': {'a': 5.8243, 'b': -1.8196, 'c': 0.2350, 'd': -0.009011, 'θ_start': 275, 'θ_end': 620},
235
- 'Sagittarius-Carina': {'a': 4.2767, 'b': -1.1507, 'c': 0.1570, 'd': -0.006078, 'θ_start': 275, 'θ_end': 575},
236
- 'Perseus': {'a': 1.1280, 'b': 0.1282, 'c': 0.002617, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
237
- 'Local': {'a': 1.7978, 'b': -0.04738, 'c': 0.01684, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
238
- 'Outer': {'a': 2.4225, 'b': -0.1636, 'c': 0.02494, 'd': 0.0, 'θ_start': 280, 'θ_end': 405}
417
+ 'Arm1': {'a': 1.1320, 'b': 0.1233, 'c': 0.003488, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
418
+ 'Arm2': {'a': 5.8243, 'b': -1.8196, 'c': 0.2350, 'd': -0.009011, 'θ_start': 275, 'θ_end': 620},
419
+ 'Arm3': {'a': 4.2767, 'b': -1.1507, 'c': 0.1570, 'd': -0.006078, 'θ_start': 275, 'θ_end': 575},
420
+ 'Arm4': {'a': 1.1280, 'b': 0.1282, 'c': 0.002617, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
421
+ 'Arm5': {'a': 1.7978, 'b': -0.04738, 'c': 0.01684, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
422
+ 'Arm6': {'a': 2.4225, 'b': -0.1636, 'c': 0.02494, 'd': 0.0, 'θ_start': 280, 'θ_end': 405},
423
+ 'local': {'ri': 8.17, 'thetai': 57.8, 'psi':2.84,'ymin':-4.,'ymax':7.5}
239
424
  }
425
+
426
+
240
427
  return params
241
428
  def polynomial_log_spiral(self, θ, a, b, c, d):
242
429
  """Calculate radius using polynomial-logarithmic spiral equation.
@@ -264,19 +451,31 @@ class spiral_houhan(object):
264
451
  def model_(self, arm_name, n_points=500):
265
452
 
266
453
  params_ = self.getparams()
267
- params = params_[arm_name]
268
-
269
-
270
- θ = np.linspace(params['θ_start'], params['θ_end'], n_points)
271
- R = self.polynomial_log_spiral(θ, params['a'], params['b'], params['c'], params['d'])
272
-
454
+ params = params_[arm_name]
455
+
456
+ if arm_name == 'local':
457
+ θ = np.linspace(0., 180., n_points)
458
+ tmp1 = np.radians(θ - params['thetai'])
459
+ tmp2 = np.tan(np.radians(params['psi']))
460
+ R = params['ri']*np.exp( tmp1*tmp2 )
461
+ else:
462
+ θ = np.linspace(params['θ_start'], params['θ_end'], n_points)
463
+ R = self.polynomial_log_spiral(θ, params['a'], params['b'], params['c'], params['d'])
464
+
273
465
  # Convert to Cartesian coordinates (Galactocentric)
274
466
  y_gc = R*np.cos(np.radians(θ))
275
467
  x_gc = -R * np.sin(np.radians(θ))
276
468
 
277
469
  # Convert to Heliocentric coordinates
278
470
  x_hc = (x_gc + self.R0)
279
-
471
+
472
+ if arm_name == 'local':
473
+ ind_mask = np.where((y_gc < params['ymin'])|(y_gc > params['ymax']))[0]
474
+ y_gc[ind_mask] = np.nan
475
+ x_gc[ind_mask] = np.nan
476
+ x_hc[ind_mask] = np.nan
477
+
478
+
280
479
  return x_hc, y_gc, x_gc, y_gc
281
480
 
282
481
  def output_(self, arm):
@@ -311,9 +510,9 @@ class spiral_houhan_HII(object):
311
510
  def __init__(self):
312
511
  self.getarmlist()
313
512
  def getarmlist(self):
314
- """Set arm names and colours"""
315
- self.arms = np.array(['Norma','Scutum-Centaurus','Sagittarius-Carina','Perseus','Local','Outer'])
316
- self.armcolour = {'Norma':'black','Scutum-Centaurus':'red','Sagittarius-Carina':'green','Perseus':'blue','Local':'purple','Outer':'gold'}
513
+ """Set arm names and colours"""
514
+ self.arms = np.array(['Arm1','Arm2','Arm3','Arm4','Arm5','Arm6'])
515
+ self.armcolour = {'Arm1':'black','Arm2':'red','Arm3':'green','Arm4':'blue','Arm5':'purple','Arm6':'gold'}
317
516
  self.armcolours= [self.armcolour[ky] for ky in self.arms ]
318
517
  def info(self):
319
518
  d = {'Arm list': self.arms, 'Colour': self.armcolours}
@@ -335,12 +534,12 @@ class spiral_houhan_HII(object):
335
534
  """
336
535
 
337
536
  params = {
338
- 'Norma': {'a': 1.1668, 'b': 0.1198, 'c': 0.002557, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
339
- 'Scutum-Centaurus': {'a': 5.8002, 'b': -1.8188, 'c': 0.2352, 'd': -0.008999, 'θ_start': 275, 'θ_end': 620},
340
- 'Sagittarius-Carina': {'a': 4.2300, 'b': -1.1505, 'c': 0.1561, 'd': -0.005898, 'θ_start': 275, 'θ_end': 570},
341
- 'Perseus': {'a': 0.9744, 'b': 0.1405, 'c': 0.003995, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
342
- 'Local': {'a': 0.9887, 'b': 0.1714, 'c': 0.004358, 'd': 0.0, 'θ_start': 280, 'θ_end': 475},
343
- 'Outer': {'a': 3.3846, 'b': -0.6554, 'c': 0.08170, 'd': 0.0, 'θ_start': 280, 'θ_end': 355}
537
+ 'Arm1': {'a': 1.1668, 'b': 0.1198, 'c': 0.002557, 'd': 0.0, 'θ_start': 40, 'θ_end': 250},
538
+ 'Arm2': {'a': 5.8002, 'b': -1.8188, 'c': 0.2352, 'd': -0.008999, 'θ_start': 275, 'θ_end': 620},
539
+ 'Arm3': {'a': 4.2300, 'b': -1.1505, 'c': 0.1561, 'd': -0.005898, 'θ_start': 275, 'θ_end': 570},
540
+ 'Arm4': {'a': 0.9744, 'b': 0.1405, 'c': 0.003995, 'd': 0.0, 'θ_start': 280, 'θ_end': 500},
541
+ 'Arm5': {'a': 0.9887, 'b': 0.1714, 'c': 0.004358, 'd': 0.0, 'θ_start': 280, 'θ_end': 475},
542
+ 'Arm6': {'a': 3.3846, 'b': -0.6554, 'c': 0.08170, 'd': 0.0, 'θ_start': 280, 'θ_end': 355}
344
543
  }
345
544
 
346
545
  return params
@@ -925,7 +1124,7 @@ class main_(object):
925
1124
  Constructs dictionaries to initialise individual model classes
926
1125
  """
927
1126
 
928
- self.models = ['Taylor_Cordes_1992','Drimmel_NIR_2000',
1127
+ self.models = ['Taylor_Cordes_1992','Vallee_1995','Drimmel_NIR_2000',
929
1128
  'Levine_2006','Hou_Han_2014','Hou_Han_HII_2014','Reid_2019',
930
1129
  'Poggio_cont_2021','GaiaPVP_cont_2022','Drimmel_Ceph_2024']
931
1130
  self.models_class = {'Reid_2019':reid_spiral(),
@@ -936,9 +1135,10 @@ class main_(object):
936
1135
  'Taylor_Cordes_1992':TaylorCordesSpiral(),
937
1136
  'Hou_Han_2014':spiral_houhan(),
938
1137
  'Hou_Han_HII_2014':spiral_houhan_HII(),
1138
+ 'Vallee_1995':spiral_vallee(),
939
1139
  'Drimmel_Ceph_2024':spiral_drimmel_cepheids()}
940
1140
 
941
- self.models_desc = ['HII','NIR emission',
1141
+ self.models_desc = ['HII','Bfield/Dust/gas','NIR emission',
942
1142
  'HI','HII/GMC/Masers','HII','MASER parallax',
943
1143
  'Upper main sequence (map)','OB stars (map)','Cepheids']
944
1144
  def getinfo(self,model='',print_=True):
@@ -997,11 +1197,11 @@ class main_(object):
997
1197
  if plotattrs_['plot'] and plotattrs_['polarproj']==False :
998
1198
  plt.plot(spimod.dout['x'+plotattrs_['coordsys'].lower()],
999
1199
  spimod.dout['y'+plotattrs_['coordsys'].lower()],
1000
- plotattrs_['linestyle'],color=plotattrs_['armcolour'])
1200
+ plotattrs_['linestyle'],linewidth=plotattrs_['linewidth'],color=plotattrs_['armcolour'])
1001
1201
  if 'xhc_ex' in spimod.dout.keys():
1002
1202
  plt.plot(spimod.dout['x'+plotattrs_['coordsys'].lower()+'_ex'],
1003
1203
  spimod.dout['y'+plotattrs_['coordsys'].lower()+'_ex'],
1004
- '--',color=plotattrs_['armcolour'])
1204
+ '--',linewidth=plotattrs_['linewidth'],color=plotattrs_['armcolour'])
1005
1205
 
1006
1206
  plt.xlabel('X$_{'+plotattrs_['coordsys']+'}$ [Kpc]')
1007
1207
  plt.ylabel('Y$_{'+plotattrs_['coordsys']+'}$ [Kpc]')
@@ -1234,4 +1434,4 @@ class _make_supportfiles(object):
1234
1434
 
1235
1435
 
1236
1436
 
1237
- # # _make_supportfiles()
1437
+ # _make_supportfiles()
SpiralMap/movie_.gif CHANGED
Binary file
SpiralMap/mytools.py CHANGED
@@ -221,3 +221,4 @@ def polar_style(ax,title='',rticks=[3., 6.,9.,12,15.,20.]):
221
221
 
222
222
 
223
223
 
224
+
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 = 'Sagittarius-Carina'
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 = 'Hou_Han__HII_2014'
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':'GC','markersize':15,'markSunGC':True,'polarproj':True,'linewidth':5}
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':'GC','markersize':3,'polarproj':True}
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+' (GC)')
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 = False
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.0.22
3
+ Version: 0.16
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 8 independent spiral arm models from literature. We are open to requests for including other spiral arm models.
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
- ![image info](src/SpiralMap/movie_.gif).
35
-
36
- Shown above is a gallery of the spiral models & maps included in the current version.
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,11 +1,11 @@
1
1
  SpiralMap/__init__.py,sha256=7F5e52HrtZpHq8kNmLG8e1jtNlf6jkufCDgoIKlKZGs,100
2
- SpiralMap/models_.py,sha256=_1_l1AUv39EkEE7rF2-twOBDajvfO4k7LWdUY1DaqTE,40387
3
- SpiralMap/movie_.gif,sha256=famzvY320Jz8xjKjB0FndkXdGPZ4P8pJGlVKEHQuoto,125026
4
- SpiralMap/mytools.py,sha256=rmUT9Wsg3NhRHTlV-RvoZ3TWvYSEs5epX3zydEonnHM,7237
5
- SpiralMap/test.py,sha256=C7h_h-P1FFJlVv9CHGxO_2x_Zud12j1Xf-tUmmh0tdc,9987
2
+ SpiralMap/models_.py,sha256=fCyGsioaW3Ul2Iff5sjOKIA2jUlzqTtckcyAZGgkB6c,45881
3
+ SpiralMap/movie_.gif,sha256=E6-0Gzo9IgcfrsgGUTnj47a2Fw2WApD6AmjcnwzHXEQ,260591
4
+ SpiralMap/mytools.py,sha256=-IxDcNZwBb6k6VpqSjgXo8yvoGptF9jhppg9LhTyNjs,7238
5
+ SpiralMap/test.py,sha256=GgjSEStYWHEfbOodkVlq41sVZge8wSyukmtQgbCKRiI,11888
6
6
  SpiralMap/version.py,sha256=G_9nHD5j8EWxdjfiRE8uUrh0l_FRWN5WAnCM9wjLIJw,78
7
- SpiralMap/datafiles/flim.pkl,sha256=VmwuaFXQbAc0P3ey2sPrZa3BgpXk4KSlwZrb3aoKYzU,11235
8
- SpiralMap/datafiles/flim_all.pkl,sha256=HWjuVpmOfdtLqsZK6eMajoGGXTdUfF9nXodRMjKYHbU,2112
7
+ SpiralMap/datafiles/flim.pkl,sha256=STMsqda-8G046xAa3t-BcA-EhS3mfKjXLSTLXkyBYdA,12210
8
+ SpiralMap/datafiles/flim_all.pkl,sha256=iBo9l30ky9F0m-ckBl6fHzdBEaFvx42QdtSOLE9AM7w,2362
9
9
  SpiralMap/datafiles/spiral.bib,sha256=tOAgtQcbd4uFfcf-8twiEjpZGXjdV_ZE7VvlMLDn_jk,13614
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
@@ -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=OMkJAkxqk9a9rvwphY6cvboY7RmYylApkKXINLiQtUs,75636
31
- SpiralMap/figdir_primer/map_1png.png,sha256=tA2OgSICQlC0N7VxypEZDucHvCKq3HsFStgo0eq95rM,83668
32
- SpiralMap/figdir_primer/map_2png.png,sha256=kBvhJb4KZJ5We6wnLo0YdnWQHmys1BF-kaXweQCYto8,71296
33
- SpiralMap/figdir_primer/map_3png.png,sha256=J8MUzu100rOaWxd1LGvhNItXJdtvQpt_cecgebSDxOI,86123
34
- SpiralMap/figdir_primer/map_4png.png,sha256=IBBJYP7boTzGUhIDdOnjsjK549YWeoEQgZABB7Lu7FA,84457
35
- SpiralMap/figdir_primer/map_5png.png,sha256=DzqQO-CBwKpq1wW75yqi4msLA5hslsUs8f3qfI-jkY4,71955
36
- SpiralMap/figdir_primer/map_8png.png,sha256=YNKex-pu4Vo8ULBuGKNhWXuuvNOEd6Xl_2KXtPcfAUw,74856
37
- spiralmap-0.0.22.dist-info/METADATA,sha256=67HYgoq7yV1yUT6W_BaU3H_-JjSpXzv6MZ3DbvmnV14,2281
38
- spiralmap-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- spiralmap-0.0.22.dist-info/licenses/LICENSE.md,sha256=5w1L9A7eVMqU0wNIsBTTZA8K2JBIK0KKbqMSaQ1z9m0,1076
40
- spiralmap-0.0.22.dist-info/RECORD,,
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.16.dist-info/METADATA,sha256=UwKTxZOy7oAU8gVG8UqAetr75KkytTId3nLhvNfaNH8,2515
39
+ spiralmap-0.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
40
+ spiralmap-0.16.dist-info/licenses/LICENSE.md,sha256=5w1L9A7eVMqU0wNIsBTTZA8K2JBIK0KKbqMSaQ1z9m0,1076
41
+ spiralmap-0.16.dist-info/RECORD,,
Binary file