private void calculateMean() {
        
        double sum = 0;
        Integer count = 0;
        
        for(int i=0; i<data.length; i++) {
            if (calibrationFlag[i]) {
                sum += data[i];
                count++;
            }
        }
        mean = sum / count.doubleValue();
        
    }