Java examples for java.lang:Math Algorithm
Allows histogram scoring from discrete input REU values
import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Random; public class Main{ /**// www.ja v a 2s . co m * * Allows histogram scoring from discrete input REU values * * Uses a representative cytometry distribution, and centers the distribution at the desired mean. * */ public static ArrayList<Double> getDefaultHistgramAtSpecifiedMean( double log_mean, String file_name_default) { ArrayList<Double> histogram = new ArrayList<Double>(); ArrayList<String> reus = Util.fileLines(file_name_default); double total_logreu = 0.0; for (int r = 0; r < reus.size(); ++r) { double reu = Double.valueOf(reus.get(r)); double logreu = Math.log10(reu); total_logreu += logreu; } double avg_logreu = total_logreu / reus.size(); for (int r = 0; r < reus.size(); ++r) { double reu = Double.valueOf(reus.get(r)); double logreu = Math.log10(reu) - avg_logreu + log_mean; //histogram centered at input value histogram.add(logreu); //Print.message(2, "bin center " + log_mean + ", histogram value " + logreu); } return histogram; } }