SpiralMap 0.0.0.0.2__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/__init__.py +6 -0
- SpiralMap/datafiles/Drimmel2024_cepheids/ArmAttributes_dyoungW1_bw025.pkl +0 -0
- SpiralMap/datafiles/Drimmel_NIR/Drimmel2armspiral.fits +0 -0
- SpiralMap/datafiles/Drimmel_NIR/Readme_spiral_m2_147.txt +5 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm1_X_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm1_Y_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm2_X_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm2_Y_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm3_X_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm3_Y_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm4_X_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm4_Y_hel.npy +0 -0
- SpiralMap/datafiles/Drimmel_NIR/spiral_m2_147.dat +101 -0
- SpiralMap/datafiles/GaiaPVP_cont_2022/GaiaPVP_cont_2022_pproj_contours.pkl +0 -0
- SpiralMap/datafiles/GaiaPVP_cont_2022/over_dens_grid_threshold_0_003_dens.npy +0 -0
- SpiralMap/datafiles/GaiaPVP_cont_2022/xvalues_dens.npy +0 -0
- SpiralMap/datafiles/GaiaPVP_cont_2022/yvalues_dens.npy +0 -0
- SpiralMap/datafiles/Poggio_cont_2021/Poggio_cont_2021_pproj_contours.pkl +0 -0
- SpiralMap/datafiles/Poggio_cont_2021/overdens_grid_locscale03.npy +0 -0
- SpiralMap/datafiles/Poggio_cont_2021/xvalues.npy +0 -0
- SpiralMap/datafiles/Poggio_cont_2021/yvalues.npy +0 -0
- SpiralMap/datafiles/flim.pkl +0 -0
- SpiralMap/datafiles/flim_all.pkl +0 -0
- SpiralMap/datafiles/spiral.bib +136 -0
- SpiralMap/figdir_primer/polar_proj_multiple_models2.png +0 -0
- SpiralMap/models_.py +1127 -0
- SpiralMap/movie_.gif +0 -0
- SpiralMap/mytools.py +223 -0
- SpiralMap/test.py +297 -0
- SpiralMap/version.py +2 -0
- spiralmap-0.0.0.0.2.dist-info/METADATA +49 -0
- spiralmap-0.0.0.0.2.dist-info/RECORD +34 -0
- spiralmap-0.0.0.0.2.dist-info/WHEEL +4 -0
- spiralmap-0.0.0.0.2.dist-info/licenses/LICENSE.md +21 -0
SpiralMap/movie_.gif
ADDED
|
Binary file
|
SpiralMap/mytools.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
#######################################################################
|
|
2
|
+
# Helper functions
|
|
3
|
+
#######################################################################
|
|
4
|
+
|
|
5
|
+
import os, sys
|
|
6
|
+
import numpy as np
|
|
7
|
+
import matplotlib.pyplot as plt
|
|
8
|
+
import pandas as pd
|
|
9
|
+
from tabulate import tabulate
|
|
10
|
+
from astropy.table import Table
|
|
11
|
+
from scipy.interpolate import CubicSpline
|
|
12
|
+
|
|
13
|
+
def sqrtsum(ds=[],prnt=False):
|
|
14
|
+
|
|
15
|
+
if prnt:
|
|
16
|
+
print(len(ds))
|
|
17
|
+
mysum = 0
|
|
18
|
+
for i in range(len(ds)):
|
|
19
|
+
tmp = ds[i]**2.
|
|
20
|
+
mysum+=tmp
|
|
21
|
+
resval = np.sqrt(mysum)
|
|
22
|
+
return resval
|
|
23
|
+
|
|
24
|
+
def fcount(floc,flist=False,nlist=False,prnt=True):
|
|
25
|
+
cnt = []
|
|
26
|
+
for fl in os.listdir(floc):
|
|
27
|
+
cnt.append(fl)
|
|
28
|
+
cnt = np.array(cnt)
|
|
29
|
+
if prnt:
|
|
30
|
+
print(str(cnt.size)+' files in total')
|
|
31
|
+
if flist:
|
|
32
|
+
return cnt
|
|
33
|
+
elif nlist:
|
|
34
|
+
return cnt.size
|
|
35
|
+
else:
|
|
36
|
+
os.system('ls -lh '+floc)
|
|
37
|
+
return
|
|
38
|
+
|
|
39
|
+
def xyz2lbr(x,y,z):
|
|
40
|
+
rc2=x*x+y*y
|
|
41
|
+
return [np.degrees(np.arctan2(y,x)),np.degrees(np.arctan(z/np.sqrt(rc2))),np.sqrt(rc2+z*z)]
|
|
42
|
+
|
|
43
|
+
def fitsread(filename,ext=1):
|
|
44
|
+
|
|
45
|
+
from astropy.io import fits
|
|
46
|
+
|
|
47
|
+
data1=np.array(fits.getdata(filename,ext))
|
|
48
|
+
# data1=(fits.getdata(filename,ext))
|
|
49
|
+
data={}
|
|
50
|
+
for x in data1.dtype.names:
|
|
51
|
+
data[x.lower()]=data1[x]
|
|
52
|
+
|
|
53
|
+
return data
|
|
54
|
+
|
|
55
|
+
def picklewrite(data,nam,loc,prnt=True):
|
|
56
|
+
# # '''
|
|
57
|
+
# # write files using pickle
|
|
58
|
+
# # '''
|
|
59
|
+
import pickle
|
|
60
|
+
pickle.dump(data,open(loc+'/'+nam+'.pkl','wb'))
|
|
61
|
+
if prnt:
|
|
62
|
+
print(nam+' .pkl written to '+loc)
|
|
63
|
+
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
def pickleread(file1):
|
|
67
|
+
# # '''
|
|
68
|
+
# # read pickle files
|
|
69
|
+
# # input: fileloc+'/'+filename
|
|
70
|
+
# # '''
|
|
71
|
+
import pickle
|
|
72
|
+
data = pickle.load(open(file1,'rb'))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return data
|
|
76
|
+
|
|
77
|
+
def add_polargrid(plotattrs,rlevels=12,xmin=-10,xmax=10,ymin=-10,ymax=10,modrec=[],armrec=[],xorig = 0.,rmin = 3):
|
|
78
|
+
coordsys = plotattrs['coordsys']
|
|
79
|
+
|
|
80
|
+
if ((plotattrs['plot']==True)&(plotattrs['polarproj']==False)&(plotattrs['polargrid'])):
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if armrec == []:
|
|
84
|
+
flim = pickleread(plotattrs['dataloc']+'/flim_all.pkl')
|
|
85
|
+
xmins = [flim[model]['xmin'+'_'+coordsys] for model in modrec]
|
|
86
|
+
xmaxs = [flim[model]['xmax'+'_'+coordsys] for model in modrec]
|
|
87
|
+
ymins = [flim[model]['ymin'+'_'+coordsys] for model in modrec]
|
|
88
|
+
ymaxs = [flim[model]['ymax'+'_'+coordsys] for model in modrec]
|
|
89
|
+
else:
|
|
90
|
+
arm = armrec[0]
|
|
91
|
+
flim = pickleread(plotattrs['dataloc']+'/flim.pkl')
|
|
92
|
+
xmins = [flim[model][arm]['xmin'+'_'+coordsys] for model in modrec]
|
|
93
|
+
xmaxs = [flim[model][arm]['xmax'+'_'+coordsys] for model in modrec]
|
|
94
|
+
ymins = [flim[model][arm]['ymin'+'_'+coordsys] for model in modrec]
|
|
95
|
+
ymaxs = [flim[model][arm]['ymax'+'_'+coordsys] for model in modrec]
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
xmin1 = np.nanmin(xmins)
|
|
99
|
+
xmax1 = np.nanmax(xmaxs)
|
|
100
|
+
ymin1 = np.nanmin(ymins)
|
|
101
|
+
ymax1 = np.nanmax(ymaxs)
|
|
102
|
+
except ValueError:
|
|
103
|
+
xmin1 = xmins
|
|
104
|
+
xmax1 = xmaxs
|
|
105
|
+
ymin1 = ymins
|
|
106
|
+
ymax1 = ymaxs
|
|
107
|
+
|
|
108
|
+
rvals = np.array([rmin + rmin*i for i in range(rlevels)])
|
|
109
|
+
for r in rvals:
|
|
110
|
+
ang = np.radians(np.linspace(0.,360.,100))
|
|
111
|
+
x = r*np.cos(ang)
|
|
112
|
+
y = r*np.sin(ang)
|
|
113
|
+
indg = np.where((x>xmin)&(x<xmax)&(y>ymin)&(y<ymax))[0]
|
|
114
|
+
plt.plot(x + xorig,y,color='grey',linewidth=0.5)
|
|
115
|
+
|
|
116
|
+
rvals = np.array([0 + i for i in range(rlevels*10)])
|
|
117
|
+
for l in np.arange(0.,360.,30):
|
|
118
|
+
l=np.radians(l)
|
|
119
|
+
x = np.array([r*np.cos(l) for r in rvals])
|
|
120
|
+
y = np.array([r*np.sin(l) for r in rvals])
|
|
121
|
+
plt.plot(x + xorig,y,color='grey',linewidth=0.5)
|
|
122
|
+
plt.axis([xmin1,xmax1,ymin1,ymax1])
|
|
123
|
+
|
|
124
|
+
def _polarproj(spimod,plotattrs):
|
|
125
|
+
|
|
126
|
+
useclr = plotattrs['armcolour']
|
|
127
|
+
if plotattrs['armcolour'] == '':
|
|
128
|
+
useclr = 'grey'
|
|
129
|
+
|
|
130
|
+
if plotattrs['plot'] and plotattrs['polarproj'] and plotattrs['coordsys'].lower()=='gc':
|
|
131
|
+
|
|
132
|
+
plt.plot(0.,0.,marker='*',markersize=plotattrs['markersize'],color='black')
|
|
133
|
+
plt.plot(np.radians(180.),abs(spimod.xsun),marker=r'$\odot$',markersize=plotattrs['markersize'],color='black')
|
|
134
|
+
|
|
135
|
+
if plotattrs['linestyle'] == '-':
|
|
136
|
+
plt.plot(np.radians(spimod.dout['phi4']),spimod.dout['rgc'],plotattrs['linestyle'],linewidth=plotattrs['linewidth'],color=useclr)
|
|
137
|
+
if plotattrs['linestyle'] == '.':
|
|
138
|
+
plt.plot(np.radians(spimod.dout['phi4']),spimod.dout['rgc'],plotattrs['linestyle'],markersize=plotattrs['markersize'],color=useclr)
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
plt.plot(np.radians(spimod.dout['phi4_ex']),spimod.dout['rgc_ex'],'.',color=useclr)
|
|
142
|
+
except KeyError:
|
|
143
|
+
pass
|
|
144
|
+
if plotattrs['plot'] and plotattrs['polarproj'] and plotattrs['coordsys'].lower()=='hc':
|
|
145
|
+
plt.plot(np.radians(0.),abs(spimod.xsun),marker='*',markersize=plotattrs['markersize'],color='black')
|
|
146
|
+
plt.plot(0.,0.,marker=r'$\odot$',markersize=plotattrs['markersize'],color='black')
|
|
147
|
+
|
|
148
|
+
if plotattrs['linestyle'] == '-':
|
|
149
|
+
plt.plot(np.radians(spimod.dout['glon4']),spimod.dout['dhelio'],plotattrs['linestyle'],linewidth=plotattrs['linewidth'],color=useclr)
|
|
150
|
+
if plotattrs['linestyle'] == '.':
|
|
151
|
+
plt.plot(np.radians(spimod.dout['glon4']),spimod.dout['dhelio'],plotattrs['linestyle'],markersize=plotattrs['markersize'],color=useclr)
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
plt.plot(np.radians(spimod.dout['glon4_ex']),spimod.dout['dhelio_ex'],'--',color=useclr)
|
|
155
|
+
except KeyError:
|
|
156
|
+
pass
|
|
157
|
+
|
|
158
|
+
def getangular(spimod):
|
|
159
|
+
|
|
160
|
+
spimod.dout['rgc'] = sqrtsum(ds=[spimod.dout['xgc'],spimod.dout['ygc']])
|
|
161
|
+
spimod.dout['phi1'] = np.arctan2(spimod.dout['yhc'],-spimod.dout['xgc'])
|
|
162
|
+
spimod.dout['phi4'] = np.degrees(np.arctan2(spimod.dout['yhc'],spimod.dout['xgc']))%360.
|
|
163
|
+
spimod.dout['glon4'] = np.degrees(np.arctan2(spimod.dout['yhc'],spimod.dout['xhc']))%360.
|
|
164
|
+
spimod.dout['glon'],spimod.dout['glat'],spimod.dout['dhelio'] = xyz2lbr(spimod.dout['xhc'],spimod.dout['yhc'],0)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if 'xhc_ex' in spimod.dout.keys():
|
|
168
|
+
|
|
169
|
+
spimod.dout['rgc_ex'] = sqrtsum(ds=[spimod.dout['xgc_ex'],spimod.dout['ygc_ex']])
|
|
170
|
+
spimod.dout['phi1_ex'] = np.arctan2(spimod.dout['yhc_ex'],-spimod.dout['xgc_ex'])
|
|
171
|
+
spimod.dout['phi4_ex'] = np.degrees(np.arctan2(spimod.dout['yhc_ex'],spimod.dout['xgc_ex']))%360.
|
|
172
|
+
spimod.dout['glon4_ex'] = np.degrees(np.arctan2(spimod.dout['yhc_ex'],spimod.dout['xhc_ex']))%360.
|
|
173
|
+
spimod.dout['glon_ex'],spimod.dout['glat_ex'],spimod.dout['dhelio_ex'] = xyz2lbr(spimod.dout['xhc_ex'],spimod.dout['yhc_ex'],0)
|
|
174
|
+
|
|
175
|
+
def png2movie(readdir,savdir,flname='movie',fmt='gif',duration=1.):
|
|
176
|
+
####
|
|
177
|
+
# Note: works with the older version of imageio (2.27)
|
|
178
|
+
# Purpose: make a gif from set of images
|
|
179
|
+
# readdir = directory where set of images are
|
|
180
|
+
# savdir = directory where to save the final movie
|
|
181
|
+
# flname = filename
|
|
182
|
+
#dtools.png2movie(desktop+'/snaps/',desktop)
|
|
183
|
+
####
|
|
184
|
+
|
|
185
|
+
from PIL import Image as image
|
|
186
|
+
import imageio
|
|
187
|
+
print(imageio.__version__)
|
|
188
|
+
import natsort
|
|
189
|
+
from natsort import natsorted, ns
|
|
190
|
+
|
|
191
|
+
images = []
|
|
192
|
+
filenames = os.listdir(readdir)
|
|
193
|
+
filenames = natsorted(filenames)
|
|
194
|
+
filenames = np.array(filenames)
|
|
195
|
+
|
|
196
|
+
fps = 1./duration
|
|
197
|
+
|
|
198
|
+
for filename in filenames:
|
|
199
|
+
filename = readdir+'/'+filename
|
|
200
|
+
images.append(imageio.imread(filename))
|
|
201
|
+
|
|
202
|
+
if fmt == 'gif':
|
|
203
|
+
imageio.mimsave(savdir+'/'+flname+'.gif', images,duration=duration)
|
|
204
|
+
|
|
205
|
+
elif fmt == 'mp4':
|
|
206
|
+
imageio.mimsave(savdir+'/'+flname+'.mp4', images,fps=fps)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return
|
|
210
|
+
|
|
211
|
+
def polar_style(ax,title='',rticks=[3., 6.,9.,12,15.,20.]):
|
|
212
|
+
|
|
213
|
+
ax.set_rticks(rticks)
|
|
214
|
+
rlabels = ax.get_ymajorticklabels()
|
|
215
|
+
for label in rlabels:
|
|
216
|
+
label.set_color('blue')
|
|
217
|
+
label.set_size(fontsize=10)
|
|
218
|
+
ax.yaxis.grid(linewidth=1.5)
|
|
219
|
+
plt.title(title)
|
|
220
|
+
return
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
SpiralMap/test.py
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
#####################
|
|
2
|
+
# testing the scripts here...
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
from models_ import *
|
|
8
|
+
import models_ as sp
|
|
9
|
+
import matplotlib as mpl
|
|
10
|
+
Rsun= 8.277
|
|
11
|
+
|
|
12
|
+
figdir_primer = 'figdir_primer'
|
|
13
|
+
os.system('rm -rf '+figdir_primer); os.system('mkdir '+figdir_primer)
|
|
14
|
+
plt.ion()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
params = {'font.size':12,
|
|
19
|
+
'text.usetex':False,
|
|
20
|
+
'ytick.labelsize': 'medium',
|
|
21
|
+
'legend.fontsize': 'large',
|
|
22
|
+
'axes.linewidth': 1.0,
|
|
23
|
+
'xtick.labelsize': 'medium',
|
|
24
|
+
'font.family': 'sans-serif',
|
|
25
|
+
'axes.labelsize': 'medium'}
|
|
26
|
+
mpl.rcParams.update(params)
|
|
27
|
+
|
|
28
|
+
#------------------------------------------------------------
|
|
29
|
+
############## figures/code for documentation ####################
|
|
30
|
+
|
|
31
|
+
initialise_ = False
|
|
32
|
+
if initialise_:
|
|
33
|
+
|
|
34
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
35
|
+
spirals.getinfo()
|
|
36
|
+
spirals.getinfo(model='Drimmel_Ceph_2024')
|
|
37
|
+
spirals.plotattrs_default
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
#################
|
|
41
|
+
|
|
42
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
43
|
+
use_model = 'Drimmel_Ceph_2024'
|
|
44
|
+
spirals.getinfo(model=use_model)
|
|
45
|
+
plotattrs = {'plot':False}
|
|
46
|
+
spirals.readout(plotattrs,model=use_model,arm='Sag-Car')
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
single_model_single_arm = False
|
|
50
|
+
if single_model_single_arm:
|
|
51
|
+
|
|
52
|
+
Rsun=8.277
|
|
53
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
54
|
+
use_model = 'Drimmel_Ceph_2024'
|
|
55
|
+
use_arm = 'Sag-Car'
|
|
56
|
+
spirals.getinfo(model=use_model)
|
|
57
|
+
|
|
58
|
+
import matplotlib.gridspec as gridspec
|
|
59
|
+
|
|
60
|
+
plt.close('all')
|
|
61
|
+
fig = plt.figure(figsize=(8, 3))
|
|
62
|
+
|
|
63
|
+
fig.add_subplot(1,3,1)
|
|
64
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True}
|
|
65
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
66
|
+
|
|
67
|
+
fig.add_subplot(1,3,2)
|
|
68
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
69
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
70
|
+
|
|
71
|
+
fig.add_subplot(1,3,3)
|
|
72
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
73
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
74
|
+
|
|
75
|
+
fig.suptitle(use_model+'('+use_arm+')')
|
|
76
|
+
fig.tight_layout()
|
|
77
|
+
plt.savefig(figdir_primer+'/single_model_single_arm.png')
|
|
78
|
+
|
|
79
|
+
single_model_all_arms = False
|
|
80
|
+
if single_model_all_arms:
|
|
81
|
+
|
|
82
|
+
Rsun=8.277
|
|
83
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
84
|
+
use_model = 'Drimmel_Ceph_2024'
|
|
85
|
+
use_arm = 'all'
|
|
86
|
+
spirals.getinfo(model=use_model)
|
|
87
|
+
|
|
88
|
+
import matplotlib.gridspec as gridspec
|
|
89
|
+
|
|
90
|
+
plt.close('all')
|
|
91
|
+
fig = plt.figure(figsize=(8, 3))
|
|
92
|
+
|
|
93
|
+
fig.add_subplot(1,3,1)
|
|
94
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True}
|
|
95
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
96
|
+
|
|
97
|
+
fig.add_subplot(1,3,2)
|
|
98
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
99
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
100
|
+
|
|
101
|
+
fig.add_subplot(1,3,3)
|
|
102
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
103
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
104
|
+
|
|
105
|
+
fig.suptitle(use_model+'('+use_arm+')')
|
|
106
|
+
fig.tight_layout()
|
|
107
|
+
plt.savefig(figdir_primer+'/single_model_all_arms.png')
|
|
108
|
+
|
|
109
|
+
multiple_models_cartesian = False
|
|
110
|
+
if multiple_models_cartesian:
|
|
111
|
+
|
|
112
|
+
Rsun=8.277
|
|
113
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
114
|
+
use_model = 'Taylor_Cordes_1992'
|
|
115
|
+
use_arm = 'all'
|
|
116
|
+
use_model2 = 'Poggio_cont_2021'
|
|
117
|
+
|
|
118
|
+
spirals.getinfo(model=use_model)
|
|
119
|
+
|
|
120
|
+
plt.close('all')
|
|
121
|
+
fig = plt.figure(figsize=(7.,6.))
|
|
122
|
+
ax = plt.subplot(221)
|
|
123
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
124
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
125
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':2}
|
|
126
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
127
|
+
|
|
128
|
+
#
|
|
129
|
+
ax = plt.subplot(222)
|
|
130
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
131
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
132
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':2}
|
|
133
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
134
|
+
|
|
135
|
+
#
|
|
136
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
137
|
+
use_model = 'Drimmel_NIR_2000'
|
|
138
|
+
use_arm = 'all'
|
|
139
|
+
use_model2 = 'Poggio_cont_2021'
|
|
140
|
+
spirals.getinfo(model=use_model)
|
|
141
|
+
ax = plt.subplot(223)
|
|
142
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
143
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
144
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':1}
|
|
145
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
ax = plt.subplot(224)
|
|
150
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polargrid':True}
|
|
151
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
152
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':1}
|
|
153
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
154
|
+
plt.tight_layout()
|
|
155
|
+
|
|
156
|
+
plt.savefig(figdir_primer+'/multiple_models_cartesian.png')
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
single_model_polar_hou = False
|
|
160
|
+
if single_model_polar_hou:
|
|
161
|
+
|
|
162
|
+
Rsun=8.277
|
|
163
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
164
|
+
use_model = 'Hou_Han_2014'
|
|
165
|
+
use_arm = 'Sagittarius-Carina'
|
|
166
|
+
|
|
167
|
+
spirals.getinfo(model=use_model)
|
|
168
|
+
|
|
169
|
+
plt.close('all')
|
|
170
|
+
|
|
171
|
+
fig = plt.figure(figsize=(7,7.))
|
|
172
|
+
|
|
173
|
+
ax = plt.subplot(221, projection='polar')
|
|
174
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
175
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
176
|
+
polar_style(ax,title=use_model+' (HC)')
|
|
177
|
+
|
|
178
|
+
ax = plt.subplot(222, projection='polar')
|
|
179
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
180
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
181
|
+
polar_style(ax,title='(GC)')
|
|
182
|
+
|
|
183
|
+
ax = plt.subplot(223, projection='polar')
|
|
184
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
185
|
+
spirals.readout(plotattrs,model=use_model,arm='all')
|
|
186
|
+
polar_style(ax,title='(HC)')
|
|
187
|
+
|
|
188
|
+
ax = plt.subplot(224, projection='polar')
|
|
189
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
190
|
+
spirals.readout(plotattrs,model=use_model,arm='all')
|
|
191
|
+
polar_style(ax,title='(GC)')
|
|
192
|
+
|
|
193
|
+
plt.tight_layout()
|
|
194
|
+
|
|
195
|
+
plt.savefig(figdir_primer+'/polar_proj_single_model.png')
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
multiple_models_polar = True
|
|
199
|
+
if multiple_models_polar:
|
|
200
|
+
|
|
201
|
+
Rsun=8.277
|
|
202
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
203
|
+
use_model = 'Taylor_Cordes_1992'
|
|
204
|
+
use_arm = 'all'
|
|
205
|
+
use_model2 = 'Poggio_cont_2021'
|
|
206
|
+
|
|
207
|
+
spirals.getinfo(model=use_model)
|
|
208
|
+
|
|
209
|
+
plt.close('all')
|
|
210
|
+
fig = plt.figure(figsize=(7.,6.))
|
|
211
|
+
#
|
|
212
|
+
ax = plt.subplot(221, projection='polar')
|
|
213
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
214
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
215
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':3,'polarproj':True}
|
|
216
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
217
|
+
polar_style(ax,title=use_model+' (HC)')
|
|
218
|
+
ax.set_ylim([0.,8])
|
|
219
|
+
|
|
220
|
+
#
|
|
221
|
+
ax = plt.subplot(222, projection='polar')
|
|
222
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
223
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
224
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':3,'polarproj':True,'armcolour':'red'}
|
|
225
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
226
|
+
polar_style(ax,title='(GC)')
|
|
227
|
+
ax.set_ylim([4.,12])
|
|
228
|
+
|
|
229
|
+
#
|
|
230
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
231
|
+
use_model = 'Drimmel_NIR_2000'
|
|
232
|
+
use_arm = 'all'
|
|
233
|
+
use_model2 = 'Poggio_cont_2021'
|
|
234
|
+
spirals.getinfo(model=use_model)
|
|
235
|
+
ax = plt.subplot(223, projection='polar')
|
|
236
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
237
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
238
|
+
plotattrs = {'plot':True,'coordsys':'HC','markersize':3,'polarproj':True,'armcolour':'grey'}
|
|
239
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
240
|
+
|
|
241
|
+
polar_style(ax,title=use_model+' (HC)')
|
|
242
|
+
ax.set_ylim([0.,8])
|
|
243
|
+
|
|
244
|
+
#
|
|
245
|
+
ax = plt.subplot(224, projection='polar')
|
|
246
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':15,'markSunGC':True,'polarproj':True}
|
|
247
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
248
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':3,'polarproj':True,'armcolour':'grey'}
|
|
249
|
+
spirals.readout(plotattrs,model=use_model2,arm='all')
|
|
250
|
+
polar_style(ax,title='(GC)')
|
|
251
|
+
ax.set_ylim([4.,12])
|
|
252
|
+
plt.tight_layout()
|
|
253
|
+
|
|
254
|
+
plt.savefig(figdir_primer+'/polar_proj_multiple_models2.png')
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
makegif = False
|
|
259
|
+
if makegif:
|
|
260
|
+
|
|
261
|
+
plt.close('all')
|
|
262
|
+
|
|
263
|
+
Rsun=8.277
|
|
264
|
+
spirals = sp.main_(Rsun=Rsun)
|
|
265
|
+
use_model2 = 'Poggio_cont_2021'
|
|
266
|
+
use_arm = 'all'
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
for inum, use_model in enumerate(spirals.models):
|
|
270
|
+
|
|
271
|
+
if 'cont' not in use_model:
|
|
272
|
+
|
|
273
|
+
plt.close('all')
|
|
274
|
+
|
|
275
|
+
fig = plt.figure(figsize=(5,5.))
|
|
276
|
+
|
|
277
|
+
ax = plt.subplot(111, projection='polar')
|
|
278
|
+
plotattrs = {'plot':True,'coordsys':'GC','linewidth':5,'markersize':15,'markSunGC':True,'polarproj':True}
|
|
279
|
+
spirals.readout(plotattrs,model=use_model,arm=use_arm)
|
|
280
|
+
plotattrs = {'plot':True,'coordsys':'GC','markersize':3,'polarproj':True}
|
|
281
|
+
spirals.readout(plotattrs,model=use_model2,arm=use_arm)
|
|
282
|
+
polar_style(ax,title=use_model+' (GC)')
|
|
283
|
+
ax.set_ylim([0.,15])
|
|
284
|
+
|
|
285
|
+
plt.savefig(figdir_primer+'/map_'+str(inum)+'png')
|
|
286
|
+
|
|
287
|
+
import mytools
|
|
288
|
+
curdir = os.getcwd()
|
|
289
|
+
mytools.png2movie(figdir_primer,curdir,flname='movie_',duration=2.5,fmt='gif')
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
SpiralMap/version.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SpiralMap
|
|
3
|
+
Version: 0.0.0.0.2
|
|
4
|
+
Summary: Python Library of Milky Way's Spiral Arms
|
|
5
|
+
Project-URL: Homepage, https://github.com/Abhaypru/SpiralMap
|
|
6
|
+
Project-URL: Issues, https://github.com/Abhaypru/SpiralMap/issues
|
|
7
|
+
Author-email: Prusty & Khanna <shourya.khanna@inaf.it>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Provides-Extra: docs
|
|
14
|
+
Requires-Dist: sphinx; extra == 'docs'
|
|
15
|
+
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
|
|
16
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == 'docs'
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# SpiralMap
|
|
20
|
+
A Python library of the Milky Way's spiral arms.
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
[](https://spiralmap.readthedocs.io/en/latest/?badge=latest)
|
|
24
|
+
|
|
25
|
+
The package can be used to extract and/or plot the 2D trace of the major spiral arm models & maps in literature. The current release includes 8 independent models and we are open to requests for including other spiral arm models.
|
|
26
|
+
|
|
27
|
+
The detailed documentation is hosted on [Read the docs](https://spiralmap.readthedocs.io/en/latest/#api-docs).
|
|
28
|
+
|
|
29
|
+
For a quickstart please refer to the accompanying [Jupyter notebook](https://github.com/Abhaypru/SpiralMap/blob/main/demo_spiralmap.ipynb)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Installation
|
|
34
|
+
-------------
|
|
35
|
+
|
|
36
|
+
Install the latest released version using ``pip``:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
pip install SpiralMap
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
Acknowledging ``SpiralMap``
|
|
44
|
+
---------------------------------------
|
|
45
|
+
If you make use of our package, please cite the accompanying JOSS paper (link).
|
|
46
|
+
|
|
47
|
+
Additionally, please also cite the individual spiral model used. To facilitate this, we provide a BibTex file with the relevant citations in 'datafiles/spiral.bib' (here on GitHub),
|
|
48
|
+
or alternatively these are also available on [Read the docs](https://spiralmap.readthedocs.io/en/latest/#api-docs).
|
|
49
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
SpiralMap/__init__.py,sha256=7F5e52HrtZpHq8kNmLG8e1jtNlf6jkufCDgoIKlKZGs,100
|
|
2
|
+
SpiralMap/models_.py,sha256=aHSZh4XpdbewJsLltG-ETo0OwCQgJhXLhsESGpeC5X0,36681
|
|
3
|
+
SpiralMap/movie_.gif,sha256=9cjZHcbIwXVWyCzX3rETQWBNamF409iojpyVBX0Ec5M,190718
|
|
4
|
+
SpiralMap/mytools.py,sha256=rmUT9Wsg3NhRHTlV-RvoZ3TWvYSEs5epX3zydEonnHM,7237
|
|
5
|
+
SpiralMap/test.py,sha256=owAKSAyvCevvyKHptYf9S-i4p_8XMheRG0HO4Tkw4PI,8848
|
|
6
|
+
SpiralMap/version.py,sha256=G_9nHD5j8EWxdjfiRE8uUrh0l_FRWN5WAnCM9wjLIJw,78
|
|
7
|
+
SpiralMap/datafiles/flim.pkl,sha256=_UJxKjAjAjD6IlgmedN61NiCSA19qFjWWJOuu_HbHzo,9560
|
|
8
|
+
SpiralMap/datafiles/flim_all.pkl,sha256=G4mad8eZQ_cuow_N6ZkyuK2yWAd4i-jhOwvRXzX8Tkc,2129
|
|
9
|
+
SpiralMap/datafiles/spiral.bib,sha256=F9e7jMTLehTPB9DRmsdH_VtR66-jJ7dAunStEq9WDUY,6361
|
|
10
|
+
SpiralMap/datafiles/Drimmel2024_cepheids/ArmAttributes_dyoungW1_bw025.pkl,sha256=F4pUfUSEg7_BBC9jpMjFeuWFHj4dYKszrpMt8wKW0ds,6571
|
|
11
|
+
SpiralMap/datafiles/Drimmel_NIR/Drimmel2armspiral.fits,sha256=jJ2k0yddyIUbMxGRGszD6cwlleUrGMtkrMByc_hU5bA,14400
|
|
12
|
+
SpiralMap/datafiles/Drimmel_NIR/Readme_spiral_m2_147.txt,sha256=h2aA4V9T8RQRBlG_GYDJRfLswnqrK6AmdCleFR-NLSE,395
|
|
13
|
+
SpiralMap/datafiles/Drimmel_NIR/spiral_m2_147.dat,sha256=UEDgTEln0EEqkjSiHrAQEOgpjvjQsEOwl0OK5d5oiKE,9898
|
|
14
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm1_X_hel.npy,sha256=e1y4iEdzAApRz9kWqT58unYUgwmu1GMm67s3640dnSs,936
|
|
15
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm1_Y_hel.npy,sha256=UKL-53SHBeRrG00kT2wUrsnqQKCTgq2vAnGF-B1gb1I,936
|
|
16
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm2_X_hel.npy,sha256=waNcmSVl6wPqN_ncvgMmdh3B82pwUiaeW3foZj_QmRc,936
|
|
17
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm2_Y_hel.npy,sha256=cmW4QzqzNNVvJg1AKEMA-bOvYiTh2FAyjBvKqDedjqU,936
|
|
18
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm3_X_hel.npy,sha256=YX5KY09_2LHOCC91DgkAXVkV0wnCouMbEW2IhfZ_Hv4,936
|
|
19
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm3_Y_hel.npy,sha256=7W7vEvSmWGsuPDUKguGjbuJBrDhyVUJWDrIdERhpqHc,936
|
|
20
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm4_X_hel.npy,sha256=FspiPEmrw7fjqA9KxVNTLjgYR04vHvudFF5qqIUM7Bw,936
|
|
21
|
+
SpiralMap/datafiles/Drimmel_NIR/phase_shifted/Arm4_Y_hel.npy,sha256=uWJlsGv5G-rxzWAu29toJa04mooI_Gjxme5bq_wwJD8,936
|
|
22
|
+
SpiralMap/datafiles/GaiaPVP_cont_2022/GaiaPVP_cont_2022_pproj_contours.pkl,sha256=Eq_Ak5w_uybvAH2Tjpv2idvw7aPJM_pfwwoN74uMFZs,81044
|
|
23
|
+
SpiralMap/datafiles/GaiaPVP_cont_2022/over_dens_grid_threshold_0_003_dens.npy,sha256=ZamwXVTZXdOUItqoKcXqqdY3qPWZMNbSPRiW7gCUJtc,117256
|
|
24
|
+
SpiralMap/datafiles/GaiaPVP_cont_2022/xvalues_dens.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
25
|
+
SpiralMap/datafiles/GaiaPVP_cont_2022/yvalues_dens.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
26
|
+
SpiralMap/datafiles/Poggio_cont_2021/Poggio_cont_2021_pproj_contours.pkl,sha256=x8Sdb5bXSiAN7tOlgZIouCFsJzbuts45tDyBCoJcbLQ,66827
|
|
27
|
+
SpiralMap/datafiles/Poggio_cont_2021/overdens_grid_locscale03.npy,sha256=peM4jyLQsE8X4bMTCCe-7UD3Hayi2qmRcOQzCudBfHM,117256
|
|
28
|
+
SpiralMap/datafiles/Poggio_cont_2021/xvalues.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
29
|
+
SpiralMap/datafiles/Poggio_cont_2021/yvalues.npy,sha256=uhY3STTfBhTer8pWNAkLezyu4o94VmNZgft0RZPFcTk,1096
|
|
30
|
+
SpiralMap/figdir_primer/polar_proj_multiple_models2.png,sha256=Wpyp8A1rjzMZHCdBbMJW56ZOwitRMAmDRaWZkk5Y_Lg,129119
|
|
31
|
+
spiralmap-0.0.0.0.2.dist-info/METADATA,sha256=6D9bJw6cJ2mwXDEy0xBvzWA8twsN8KTXwoV8UKRDIwM,1978
|
|
32
|
+
spiralmap-0.0.0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
33
|
+
spiralmap-0.0.0.0.2.dist-info/licenses/LICENSE.md,sha256=5w1L9A7eVMqU0wNIsBTTZA8K2JBIK0KKbqMSaQ1z9m0,1076
|
|
34
|
+
spiralmap-0.0.0.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [Prusty & Khanna]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|