Skip to content

Commit 1da5141

Browse files
committed
Merge branch 'rc' into dev
2 parents a657766 + 22c76c4 commit 1da5141

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/firefly/java/edu/caltech/ipac/firefly/server/query/HistogramProcessor.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
* It works for two algorithm, fixed bin size algorithm and variable bin size algorithm. If the bin size is available
3131
* from the input parameter, it will calculate the fixed bin size histogram. If the bin size is not available, it will
3232
* calculate variable bin size histogram.
33+
*
34+
* By default it keeps empty bins if any. This could be controlled by a parameter, reserveEmptyBins in the UI if needed.
35+
*
36+
* CHANGE HISTORY:
37+
*
38+
* 5/23/17
39+
* IRSA-371 Changed the showEmptyBin to true. It was false previously.
40+
*
3341
*/
3442
public class HistogramProcessor extends IpacTablePartProcessor {
3543
private static final String SEARCH_REQUEST = "searchRequest";
@@ -52,6 +60,7 @@ public class HistogramProcessor extends IpacTablePartProcessor {
5260
// private final String ALGORITHM = "algorithm";
5361
private final String FALSEPOSTIVERATE = "falsePositiveRate";
5462
private final String PRESERVE_EMPTY_BIN="preserveEmptyBins";
63+
private boolean showEmptyBin= true;
5564
private String algorithm = null;// FIXED_SIZE_ALGORITHM;
5665
private int numBins=0;
5766
private double binWidth=0.0;
@@ -61,7 +70,7 @@ public class HistogramProcessor extends IpacTablePartProcessor {
6170
private double max = Double.NaN;
6271
private String columnExpression;
6372
private double falsePostiveRate = 0.05;
64-
private boolean showEmptyBin=false;
73+
6574

6675
private static String[] getInputFilePath(String inputFileName) {
6776
String[] dirs = inputFileName.split("/");
@@ -170,12 +179,16 @@ private void getParameters(TableServerRequest tableServerRequest) {
170179
else if (name.equalsIgnoreCase(FALSEPOSTIVERATE)) {
171180
falsePostiveRate = Double.parseDouble(value);
172181
}
182+
/*05/23/17
183+
The UI does not have this parameter specified and passed.
184+
The default now changed to show all the bins. The code
185+
leave as is in case UI may need this field in the future.
186+
*/
173187
else if (name.equalsIgnoreCase(PRESERVE_EMPTY_BIN) ){
174188
showEmptyBin= Boolean.parseBoolean(value);
175189
}
176190
}
177191

178-
179192
if (binSelection!=null ){
180193
if (binSelection.equalsIgnoreCase("numBins")) {
181194

@@ -260,7 +273,6 @@ private Object[] calculateFixedBinSizeDataArray(double[] columnData) {
260273

261274
int nBins = numBins>0? numBins : (int) Math.ceil((max-min)/binSize);
262275

263-
// double delta =( max -min)/100*numBins;
264276
long[] numPointsInBin = new long[nBins];
265277
double[] binMin = new double[nBins];
266278

@@ -421,15 +433,10 @@ private Object[] calculateVariableBinSizeDataArray(double[] columnData) throws D
421433
binMin[0] = min;
422434
//assign the left edge to the binMin
423435
System.arraycopy(bins, 0, binMin, 1, nBin-1);
424-
// for (int i = 1; i < nBin; i++) {
425-
// binMin[i] = bins[i - 1];
426-
// }
427436

428437
//assign the right edge to the binMax
429438
System.arraycopy(bins, 0, binMax, 0, nBin);
430-
// for (int i = 0; i < nBin; i++) {
431-
// binMax[i] = bins[i];
432-
// }
439+
433440
}
434441

435442
if (showEmptyBin){
@@ -500,7 +507,7 @@ public double[] getBins(double[] columnData) throws DataAccessException {
500507
}
501508

502509
//-----------------------------------------------------------------
503-
// Recover changepoints by iteratively peeling off the last block
510+
// Recover change points by iteratively peeling off the last block
504511
//-----------------------------------------------------------------
505512
ArrayList<Integer> changePointList = new ArrayList<>();
506513
int ind = n;

0 commit comments

Comments
 (0)