5
5
import matplotlib .pyplot as plt
6
6
from mpl_toolkits .axes_grid1 .inset_locator import zoomed_inset_axes , mark_inset , inset_axes
7
7
8
+ global offset
9
+ offset = 0
10
+
8
11
power = 0.2
9
12
def bincl (ell , cl , clerr , nbins = 10 ):
10
13
clerr = np .mean (clerr , axis = 0 )
@@ -148,7 +151,6 @@ def plot_measurement(self, experiment, cltype, color='b', bins=None,
148
151
data = self .data [cltype ]
149
152
150
153
ell_center , ell_minus , ell_plus , binval , sigma_plus , sigma_minus , upper_bound = data .get_data (experiment )
151
-
152
154
sigmas = np .array ([sigma_plus , sigma_minus ])
153
155
154
156
if label is None :
@@ -191,12 +193,15 @@ def plot_measurement(self, experiment, cltype, color='b', bins=None,
191
193
xerr , ellb , clb , errb = bincl (ell_center [i_bin ], binval [i_bin ],
192
194
sigmas [:,i_bin ], nbins = nbins )
193
195
inds = np .where (ellb > 45 )
196
+
194
197
self .ax .errorbar (ellb [inds ]** power , clb [inds ]** 0.5 , xerr = xerr [inds ],
195
- yerr = 0.5 * errb [inds ]/ clb [inds ]** 0.5 , fmt = symbol ,
198
+ yerr = 0.5 * errb [inds ]/ abs (clb [inds ])** 0.5 , fmt = symbol ,
199
+ #yerr=errb[inds], fmt=symbol,
196
200
ms = ms ,
197
201
color = color , alpha = alpha )
198
202
self .ax .errorbar (ellb [inds ]** power , (- clb [inds ])** 0.5 , xerr = xerr [inds ],
199
- yerr = 0.5 * errb [inds ]/ (- clb [inds ])** 0.5 , fmt = symbol , markerfacecolor = 'none' ,
203
+ yerr = 0.5 * errb [inds ]/ abs (clb [inds ])** 0.5 , fmt = symbol , markerfacecolor = 'none' ,
204
+ #yerr=errb[inds], fmt=symbol, markerfacecolor='none',
200
205
ms = ms , markeredgecolor = color , markeredgewidth = 1 ,
201
206
ecolor = color , alpha = alpha )
202
207
inds = np .where (ellb <= 45 )
@@ -211,11 +216,18 @@ def plot_measurement(self, experiment, cltype, color='b', bins=None,
211
216
xerr , ellb , clb , errb = bincl (ell_center [i_bin ][inds ],
212
217
binval [i_bin ][inds ], sigmas [:,i_bin ][:,inds [0 ]],
213
218
nbins = nbins )
214
- self .ax .errorbar (ellb ** power , clb ** 0.5 , xerr = xerr ,
215
- yerr = 0.5 * errb / clb ** 0.5 , fmt = symbol ,
219
+ if np .any (np .array ([clb ])) == 0 :
220
+ norm = 0.5 * errb
221
+ clb = 0.5 * errb
222
+ else :
223
+ norm = 0.5 * errb / abs (clb )** 0.5
224
+ clb = clb
225
+ jitter = 1 + np .random .random (len (ellb ))* 0.05
226
+ self .ax .errorbar (jitter * ellb ** power , clb ** 0.5 ,
227
+ yerr = norm , fmt = symbol ,
216
228
ms = ms , color = color , alpha = alpha )
217
- self .ax .errorbar (ellb ** power , (- clb )** 0.5 , xerr = xerr ,
218
- yerr = 0.5 * errb / ( - clb ) ** 0.5 , fmt = symbol , markerfacecolor = 'none' ,
229
+ self .ax .errorbar (jitter * ellb ** power , (- clb )** 0.5 ,
230
+ yerr = norm , fmt = symbol , markerfacecolor = 'none' ,
219
231
ms = ms , markeredgecolor = color , markeredgewidth = 1 ,
220
232
ecolor = color , alpha = alpha )
221
233
label = None
@@ -256,14 +268,14 @@ def plot_measurement(self, experiment, cltype, color='b', bins=None,
256
268
label=label, ms=ms, alpha=alpha)
257
269
'''
258
270
259
-
260
271
if np .any (i_ub ):
261
- self .ax .errorbar (ell_center [i_ub ], upper_bound [i_ub ], xerr = xerr [:, i_ub ], yerr = sigmas [:, i_ub ], color = color , fmt = 'o' , label = label ,
272
+ self .ax .errorbar (ell_center [i_ub ], upper_bound [i_ub ]** 0.5 , xerr = xerr [:, i_ub ], yerr = sigmas [:, i_ub ]/ abs ( upper_bound [ i_ub ]) ** 0.5 , color = color , fmt = 'o' , label = label ,
262
273
uplims = True , ms = ms )
263
- self .ax .errorbar (ell_center [i_ub ], - upper_bound [i_ub ], xerr = xerr [:,
264
- i_ub ], yerr = sigmas [:, i_ub ], fmt = 'o' , label = label ,
274
+ self .ax .errorbar (ell_center [i_ub ], ( - upper_bound [i_ub ]) ** 0.5 , xerr = xerr [:,
275
+ i_ub ], yerr = sigmas [:, i_ub ]/ abs ( upper_bound [ i_ub ]) ** 0.5 , fmt = 'o' , label = label ,
265
276
markerfacecolor = 'none' , markeredgecolor = color , uplims = True ,
266
277
ms = ms )
278
+ print (ell_center [i_ub ], upper_bound [i_ub ], sigmas [:,i_ub ])
267
279
268
280
269
281
0 commit comments