-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.py
executable file
·197 lines (173 loc) · 6.7 KB
/
example.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python
"""Example of dipole_error usage"""
import uncertainties
import dipole_error
# HE2217-2818
QSO_RA = "22 20 06.757" # RA
QSO_DEC = "-28 03 23.34" # DEC
REDSHIFT = 1.6919 # Just pick a redshift to start
RADIAL_DISTANCE = 9.757 # GLyr
#DIP_RA = 17.3
#DIP_RA_ERR = 1.0
#DIP_DEC = -61.0
#DIP_DEC_ERR = 10.0
#DIP_AMPLITUDE = 0.97e-5
#DIP_AMPLITUDE_ERR = 0.21e-5 # average of asymmetric errors
#DIP_MONOPOLE = -0.178e-5
#DIP_MONOPOLE_ERR = 0.084e-5
# Values and errors combined for uncertainties package.
#DIPOLE_AMPLITUDE = uncertainties.ufloat((DIP_AMPLITUDE, DIP_AMPLITUDE_ERR))
#MONOPOLE = uncertainties.ufloat((DIP_MONOPOLE, DIP_MONOPOLE_ERR))
#DIPOLE_RA = uncertainties.ufloat((DIP_RA, DIP_RA_ERR))
#DIPOLE_DEC = uncertainties.ufloat((DIP_DEC, DIP_DEC_ERR))
#print "Using default inputs: "
#print dipole_error.dipole_monopole()
#print
#print "Different RA values: "
#for ra_value in ["12h20m06.757", 17.2, "17h12m"]:
# print "RA:", ra_value, "\n da/a:", dipole_error.dipole_monopole(right_ascension=ra_value, \
# declination=QSO_DEC, \
# dipole_ra=DIPOLE_RA, \
# dipole_dec=DIPOLE_DEC, \
# amplitude=DIPOLE_AMPLITUDE, \
# monopole=MONOPOLE)
#print
#print "Different DEC values: "
#for dec_value in ["-28d03m23.34", "-61d03m", 15.0]:
# print "DEC:", dec_value, "\n da/a:", \
# dipole_error.dipole_monopole(right_ascension=QSO_RA, \
# declination=dec_value, \
# dipole_ra=DIPOLE_RA, \
# dipole_dec=DIPOLE_DEC, \
# amplitude=DIPOLE_AMPLITUDE, \
# monopole=MONOPOLE)
#print
#print "Different Amplitude/error values: "
#for amplitude_error in [0.1e-5, 2.0e-5]:
# print "Amplitude error:", amplitude_error, "\n da/a:", \
# dipole_error.dipole_monopole(right_ascension=QSO_RA, \
# declination=QSO_DEC, \
# dipole_ra=DIPOLE_RA, \
# dipole_dec=DIPOLE_DEC, \
# amplitude=uncertainties.ufloat((DIP_AMPLITUDE, amplitude_error)), \
# monopole=MONOPOLE)
#print
#print "If you want to do it by hand: "
#print dipole_error.dipole_monopole(\
# right_ascension="22h20m06.757", \
# declination="-28d03m23.34", \
# dipole_ra=uncertainties.ufloat((17.3, 1.0)), \
# dipole_dec=uncertainties.ufloat((-61.0, 10.0)), \
# amplitude=uncertainties.ufloat((0.97e-5, 0.21e-5)), \
# monopole=uncertainties.ufloat((-0.178e-5, 0.084e-5)),\
# )
#print
#print "If you don't want error, just pass a float (note monopole term):"
#print dipole_error.dipole_monopole(\
# right_ascension="22h20m06.757", \
# declination="-28d03m23.34", \
# dipole_ra=uncertainties.ufloat((17.3, 1.0)), \
# dipole_dec=uncertainties.ufloat((-61.0, 10.0)), \
# amplitude=uncertainties.ufloat((0.97e-5, 0.21e-5)), \
# monopole=0.,\
# )
#print
#print "Same functionality with the two other models: z_dipole_monopole and r_dipole_monopole:"
# =====================
# = dipole_only =
# =====================
DIP_RA = 17.4
DIP_RA_ERR = 0.9
DIP_DEC = -58.0
DIP_DEC_ERR = 9.0
DIP_AMPLITUDE = 1.02e-5
DIP_AMPLITUDE_ERR = 0.21e-5 # average of asymmetric errors
# Uncertainties
DIPOLE_AMPLITUDE = uncertainties.ufloat(DIP_AMPLITUDE, DIP_AMPLITUDE_ERR)
MONOPOLE = 0.
DIPOLE_RA = uncertainties.ufloat(DIP_RA, DIP_RA_ERR)
DIPOLE_DEC = uncertainties.ufloat(DIP_DEC, DIP_DEC_ERR)
print "dipole_only"
print dipole_error.dipole_monopole(right_ascension=QSO_RA, \
declination=QSO_DEC, \
dipole_ra=DIPOLE_RA, \
dipole_dec=DIPOLE_DEC, \
amplitude=DIPOLE_AMPLITUDE, \
monopole=MONOPOLE)
# =====================
# = dipole_monopole =
# =====================
DIP_RA = 17.3
DIP_RA_ERR = 1.0
DIP_DEC = -61.0
DIP_DEC_ERR = 10.0
DIP_AMPLITUDE = 0.97e-5
DIP_AMPLITUDE_ERR = 0.21e-5 # average of asymmetric errors
DIP_MONOPOLE = -0.178e-5
DIP_MONOPOLE_ERR = 0.084e-5
# Uncertainties
DIPOLE_AMPLITUDE = uncertainties.ufloat(DIP_AMPLITUDE, DIP_AMPLITUDE_ERR)
MONOPOLE = uncertainties.ufloat(DIP_MONOPOLE, DIP_MONOPOLE_ERR)
DIPOLE_RA = uncertainties.ufloat(DIP_RA, DIP_RA_ERR)
DIPOLE_DEC = uncertainties.ufloat(DIP_DEC, DIP_DEC_ERR)
print
print "dipole_monopole"
print dipole_error.dipole_monopole(right_ascension=QSO_RA, \
declination=QSO_DEC, \
dipole_ra=DIPOLE_RA, \
dipole_dec=DIPOLE_DEC, \
amplitude=DIPOLE_AMPLITUDE, \
monopole=MONOPOLE)
# =====================
# = z_dipole_monopole =
# =====================
Z_DIP_RA = 17.5
Z_DIP_RA_ERR = 1.0
Z_DIP_DEC = -62.0
Z_DIP_DEC_ERR = 10.0
Z_DIP_PREFACTOR = 0.81e-5
Z_DIP_PREFACTOR_ERR = 0.27e-5 # average of .26 and .28
Z_DIP_MONOPOLE = -0.184e-5
Z_DIP_MONOPOLE_ERR = 0.085e-5
Z_DIP_BETA = 0.46
Z_DIP_BETA_ERR = 0.49
Z_DIPOLE_RA = uncertainties.ufloat(Z_DIP_RA, Z_DIP_RA_ERR)
Z_DIPOLE_DEC = uncertainties.ufloat(Z_DIP_DEC, Z_DIP_DEC_ERR)
Z_DIPOLE_PREFACTOR = uncertainties.ufloat(Z_DIP_PREFACTOR, Z_DIP_PREFACTOR_ERR)
Z_DIPOLE_MONOPOLE = uncertainties.ufloat(Z_DIP_MONOPOLE, Z_DIP_MONOPOLE_ERR)
Z_DIPOLE_BETA = uncertainties.ufloat(Z_DIP_BETA, Z_DIP_BETA_ERR)
print
print "z_dipole_monopole: "
print dipole_error.z_dipole_monopole(right_ascension=QSO_RA, \
declination=QSO_DEC, \
dipole_ra=Z_DIPOLE_RA, \
dipole_dec=Z_DIPOLE_DEC, \
prefactor=Z_DIP_PREFACTOR, \
z_redshift=REDSHIFT, \
beta=Z_DIP_BETA, \
monopole=Z_DIP_MONOPOLE)
# =====================
# = r_dipole_monopole =
# =====================
R_DIP_RA = 17.5
R_DIP_RA_ERR = 1.0
R_DIP_DEC = -62.0
R_DIP_DEC_ERR = 10.0
R_DIP_AMPLITUDE = 1.1e-6 # in GLyr
R_DIP_AMPLITUDE_ERR = 0.2e-6 # average of asymmetric errors
R_DIP_MONOPOLE = -0.187e-5
R_DIP_MONOPOLE_ERR = 0.084e-5
# Uncertainties
R_DIPOLE_AMPLITUDE = uncertainties.ufloat(R_DIP_AMPLITUDE, R_DIP_AMPLITUDE_ERR)
R_DIPOLE_MONOPOLE = uncertainties.ufloat(R_DIP_MONOPOLE, R_DIP_MONOPOLE_ERR)
R_DIPOLE_RA = uncertainties.ufloat(R_DIP_RA, R_DIP_RA_ERR)
R_DIPOLE_DEC = uncertainties.ufloat(R_DIP_DEC, R_DIP_DEC_ERR)
print
print "r_dipole_monopole"
print dipole_error.r_dipole_monopole(right_ascension=QSO_RA, \
declination=QSO_DEC, \
dipole_ra=R_DIPOLE_RA, \
dipole_dec=R_DIPOLE_DEC, \
amplitude=R_DIPOLE_AMPLITUDE, \
radial_distance=RADIAL_DISTANCE, \
monopole=R_DIPOLE_MONOPOLE)