title: Average data over time?
body: <p>I’d like to calculate an average VAL1, VAL2 and SIGNAL value for the SIGNAL data in my sample data at 5 second intervals. In other words, using the sample data included, I’d like to calculate the average values between the 1st data point (in this case being) 01:45:18 through 01:45:22, 01:45:23 through 01:45:27, 01:45:28 through 01:45:32, and 01:45:33 through the remainder of the data.</p>
  
  <p>Ideally, I’d like to store the averaged information in variables such as: dec_average, ra_average, and n_average</p>
  
  <p>Any suggestions or ideas on how I could achieve this? Here’s the code I have so far. </p>
  
  <pre><code>import sys
  import os
  import matplotlib.pyplot as plt
  from matplotlib.dates import strpdate2num
  import numpy as np
  import matplotlib.colors
  import matplotlib.cm
  
  sat_id,dec,ra,n = np.loadtxt("mydata.asc", usecols=(3,5,7,9), unpack=True)
  </code></pre>
  
  <p>Sample data:<br>
  Timestamp: 01:45:18 SATID 02 VAL1 36 VAL2 188 SIGNAL 34<br>
  Timestamp: 01:45:19 SATID 02 VAL1 36 VAL2 188 SIGNAL 34<br>
  Timestamp: 01:45:20 SATID 02 VAL1 36 VAL2 188 SIGNAL 35<br>
  Timestamp: 01:45:21 SATID 02 VAL1 36 VAL2 188 SIGNAL 34<br>
  Timestamp: 01:45:22 SATID 02 VAL1 36 VAL2 188 SIGNAL 35<br>
  Timestamp: 01:45:23 SATID 02 VAL1 36 VAL2 188 SIGNAL 35<br>
  Timestamp: 01:45:24 SATID 02 VAL1 36 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:25 SATID 02 VAL1 36 VAL2 188 SIGNAL 35<br>
  Timestamp: 01:45:26 SATID 02 VAL1 36 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:27 SATID 02 VAL1 37 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:28 SATID 02 VAL1 37 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:29 SATID 02 VAL1 37 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:30 SATID 02 VAL1 38 VAL2 188 SIGNAL 37<br>
  Timestamp: 01:45:31 SATID 02 VAL1 38 VAL2 188 SIGNAL 36<br>
  Timestamp: 01:45:32 SATID 02 VAL1 39 VAL2 188 SIGNAL 37<br>
  Timestamp: 01:45:33 SATID 02 VAL1 39 VAL2 188 SIGNAL 37<br>
  Timestamp: 01:45:34 SATID 02 VAL1 39 VAL2 188 SIGNAL 37<br>
  Timestamp: 01:45:35 SATID 02 VAL1 39 VAL2 188 SIGNAL 38<br></p>