def bayesian_blocks(t, x=None, sigma=None, fitness=u'events', **kwargs):
 FITNESS_DICT = {u'events': Events, u'regular_events': RegularEvents, u'measures': PointMeasures}
 fitness = FITNESS_DICT.get(fitness, fitness)
 if ((type(fitness) is type) and issubclass(fitness, FitnessFunc)):
  fitfunc = fitness(**kwargs)
 elif isinstance(fitness, FitnessFunc):
  fitfunc = fitness
 else:
  raise ValueError(u'fitness parameter not understood')
 return fitfunc.fit(t, x, sigma)

def bayesian_blocks ( t , x = None , sigma = None , fitness = u'events' , ** kwargs ) : FITNESS_DICT = { u'events' : Events , u'regular_events' : RegularEvents , u'measures' : PointMeasures } fitness = FITNESS_DICT . get ( fitness , fitness ) if ( ( type ( fitness ) is type ) and issubclass ( fitness , FitnessFunc ) ) : fitfunc = fitness ( ** kwargs ) elif isinstance ( fitness , FitnessFunc ) : fitfunc = fitness else : raise ValueError ( u'fitness parameter not understood' ) return fitfunc . fit ( t , x , sigma )
compute optimal segmentation of data with scargles bayesian blocks this is a flexible implementation of the bayesian blocks algorithm described in scargle 2012 [1]_ .