int samplingtime = parser.getInt("samplingtime",0);
//double windowfraction = parser.getDouble("windowfraction",0);
boolean subtractMean = parser.hasCommand("subtractmean");
IDoubleList lagtimes = doublesNew.listFrom(0, 1);
while (lagtimes.get(lagtimes.size() - 1) < maxtime)
{
lagtimes.append((int) ((lagtimes.get(lagtimes.size() - 1) + 1) * lagtmult));
}
//IDoubleArray lagtimes = doublesNew.arrayFrom(1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000);
IDoubleArray averageWidths = doublesNew.array(lagtimes.size());
for (int i = 0; i < averageWidths.size(); i++)
{
averageWidths.set(i, 1.0);
//averageWidths.set(i, Math.max(1.0, windowfraction * lagtimes.get(i)));
//System.out.println(lagtimes.get(i)+"\t"+averageWidths.get(i));
}
//System.out.println();
//System.exit(0);
EventBinningCorrelator correlator = new EventBinningCorrelator(lagtimes, averageWidths, samplingtime);
for (int i = 0; i < inputFiles.size(); i++)
{
IDoubleArray time = data.readColumn(inputFiles.get(i), timecol);
IDoubleArray don = data.readColumn(inputFiles.get(i), col1);
IDoubleArray acc = data.readColumn(inputFiles.get(i), col2);
IDoubleArray E = doublesNew.array(don.size());
for (int j = 0; j < E.size(); j++)
{
E.set(j, acc.get(j) / (don.get(j) + acc.get(j)));
}
correlator.add(time, E);
}
IDoubleArray corr = null;
if (subtractMean)
{
corr = correlator.getCorrelationMeanFree();
}
else
{
corr = correlator.getCorrelation();
}
//IDoubleArray corr = correlator.correlate(time, E);
for (int i = 0; i < lagtimes.size(); i++)
{
System.out.println(lagtimes.get(i) + "\t" + corr.get(i));
}
}