@@ -521,7 +521,7 @@ def find_overfluctuations(self, ts_val, savepath=None):
521521 either case, a plot of the overfluctuations as a function of the
522522 injected signal is produced.
523523 """
524- x_acc , y , yerr = [], [], []
524+ x_acc , y , yerr , yerr_ts_jitter = [], [], [], []
525525 x = self .scale_labels
526526
527527 for scale in x :
@@ -542,6 +542,12 @@ def find_overfluctuations(self, ts_val, savepath=None):
542542 x_acc .append (float (scale ))
543543 yerr .append (1.0 / np .sqrt (float (len (ts_array ))))
544544
545+ # another way to estimate the error on the overfluctuation fractions
546+ ts_mean_fluc = np .mean (ts_array ) / np .sqrt (len (ts_array ))
547+ frac_ul = float (len (ts_array [ts_array + ts_mean_fluc > ts_val ])) / (float (len (ts_array )))
548+ frac_ll = float (len (ts_array [ts_array - ts_mean_fluc > ts_val ])) / (float (len (ts_array )))
549+ yerr_ts_jitter .append (np .max ([(frac_ul - frac_ll )/ 2. , 1e-5 ]))
550+
545551 if frac != 0.0 :
546552 logger .info (f"Making plot for { scale = } , { frac = } " )
547553 self .make_plots (scale )
@@ -555,13 +561,13 @@ def find_overfluctuations(self, ts_val, savepath=None):
555561 )
556562
557563 x = np .array (x_acc )
558- self .overfluctuations [ts_val ] = x , y , yerr
564+ self .overfluctuations [ts_val ] = x , y , yerr , yerr_ts_jitter
559565
560566 fit , err , extrapolated = self .sensitivity_fit (savepath , ts_val )
561567 return fit , err , extrapolated
562568
563569 def sensitivity_fit (self , savepath , ts_val ):
564- x , y , yerr = self .overfluctuations [ts_val ]
570+ x , y , yerr , yerr_ts_jitter = self .overfluctuations [ts_val ]
565571 x_flux = k_to_flux (x )
566572
567573 threshold = 0.9
@@ -612,7 +618,7 @@ def best_f(x, sd=0.0):
612618
613619 fig = plt .figure ()
614620 ax1 = fig .add_subplot (111 )
615- ax1 .errorbar (x_flux , y , yerr = yerr , color = "black" , fmt = " " , marker = "o" )
621+ ax1 .errorbar (x_flux , y , yerr = yerr_ts_jitter , color = "black" , fmt = " " , marker = "o" )
616622 ax1 .plot (k_to_flux (xrange ), best_f (xrange ), color = "blue" )
617623 ax1 .fill_between (
618624 k_to_flux (xrange ),
0 commit comments