-
Notifications
You must be signed in to change notification settings - Fork 1
/
visibilityplot.py
81 lines (70 loc) · 2.53 KB
/
visibilityplot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os
import numpy as np
import scipy.special
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
from collections import namedtuple
import poweroften
def matplotlib_setup():
# \showthe\columnwidth
# fig_width_pt = 240 #onecolumn mnras:504
# inches_per_pt = 1.0 / 72.27
golden_mean = (np.sqrt(5) - 1.0) / 2.0
# fig_width = fig_width_pt * inches_per_pt
fig_width = 9.96
posterfont = 30
fig_height = fig_width * golden_mean
fig_size = [fig_width, fig_height]
matplotlib.rc('text', usetex=True)
matplotlib.rc('figure', figsize=fig_size)
matplotlib.rc('font', size=posterfont, family='serif')
matplotlib.rc('axes', labelsize=posterfont)
matplotlib.rc('legend', fontsize=posterfont)
matplotlib.rc('xtick', labelsize=posterfont)
matplotlib.rc('ytick', labelsize=posterfont)
matplotlib.rc('text.latex',
preamble=r'\usepackage[T1]{fontenc}\usepackage{lmodern}')
# matplotlib_setup()
# import matplotlib.pyplot as plt
# import plots
# Activate Seaborn color aliases
sns.set_palette('colorblind')
sns.set_color_codes(palette='colorblind')
sns.set_context('poster',font_scale=0.85)
sns.set_style("ticks")
def mas2rad(angdia):
return angdia * 10 ** (-3) * (1/(3600)) * np.pi/180
def limb_darkened_fit(spatialfreq, angdia, ldcoeff):
a = ((1-ldcoeff)/(2) + (ldcoeff)/(3)) ** (-1)
x = np.pi * spatialfreq * mas2rad(angdia)
b = ((1 - ldcoeff) * ((scipy.special.jv(1,x)) / x) +
ldcoeff * ((np.pi/2) ** (1/2)) *
((scipy.special.jv((3/2), x)) / (x ** (3/2))))
return (a * b) ** 2
spatialfreq, v2, sigma_v2, u, v = np.loadtxt(
'nu_vis.txt', skiprows=1, usecols=(0, 1, 2, 3, 4)).T
ldcoeff = 0.52
angdia = 0.458
plt.figure()
plt.xlabel(r'Spatial frequency [rad$^{-1}$]')
plt.ylabel(r'Visibility$^2$')
scale = 3
plt.errorbar(spatialfreq, v2, yerr=sigma_v2,
ecolor='b',
alpha=0.5,
elinewidth=1 * scale,
capsize=2 * scale,
linestyle='None')
plt.plot(spatialfreq, v2, '.', color='k', alpha=0.7, markersize=4 * scale,
#mew=0.5 * scale, mfc='None'
)
spatialfreq = np.asarray(sorted(spatialfreq))
xs = np.linspace(0, 6 * 10 ** 8, 150)
plt.xlim([np.min(xs), np.max(xs)])
ld = limb_darkened_fit(xs, angdia, ldcoeff)
plt.plot(xs, ld, 'k', linewidth=2)
plt.gca().get_xaxis().set_major_formatter(poweroften.MyScalarFormatter())
plt.gca().get_xaxis().get_major_formatter().set_powerlimits([-4, 4])
plt.savefig('visibilityplot.pdf', dpi=300, bbox_inches='tight')
#plt.show()