[AstroPy] Intelligent averaging of time series data

Nicholas Ross npross at roe.ac.uk
Sat Sep 29 05:27:46 EDT 2018

Hi Astropy, 

I have what seems a very easy problem, but I haven’t found an elegant solution yet. 

I have the following (time-series) data:
	t = [5.13,   5.27,   5.40,   5.46,  190.99, 191.13, 191.267, 368.70, 368.83,  368.90, 368.93]
	y = [17.17, 17.18, 17.014, 17.104,  16.981,  16.96,   16.85,  17.27, 17.66,   17.76, 18.01]
so, groups of data in short (time) intervals then separated cleanly by a long time gap.
I'm looking for a simple method that will intelligently average these together; sort of a 'Bayesian blocks’ 
but for non-histogram data.

The return of 
	t_prime=[5.315, 191.129, 368.84], 
	y_prime=[17.117, 16.930, 17.660] 
is the first-order result I'd be after, but with the option to include weights/weighted data in more sophisticated analyses.
The suggested approaches to this problem are doing a simple moving average, or maybe a numpy convolution, 
but I'm looking for something a bit more elegant and that can generalize to larger, similar, but not identical datasets.


More information about the AstroPy mailing list