Accepts a data set from a whole test, averages reps and re-creates the 
        progress plot as the same as it was during live plotting. Number of thresholds
        must match the size of the channel dimension

def loadCurve(data, groups, thresholds, absvals, fs, xlabels):
        """Accepts a data set from a whole test, averages reps and re-creates the 
        progress plot as the same as it was during live plotting. Number of thresholds
        must match the size of the channel dimension"""
        xlims = (xlabels[0], xlabels[-1])
        pw = ProgressWidget(groups, xlims)
        spike_counts = []
        # skip control
        for itrace in range(data.shape[0]):
            count = 0
            for ichan in range(data.shape[2]):
                flat_reps = data[itrace,:,ichan,:].flatten()
                count += len(spikestats.spike_times(flat_reps, thresholds[ichan], fs, absvals[ichan]))
            spike_counts.append(count/(data.shape[1]*data.shape[2])) #mean spikes per rep

        i = 0
        for g in groups:
            for x in xlabels:
                pw.setPoint(x, g, spike_counts[i])
                i +=1

        return pw