private void getintbright() { weights = new float[ncurves][xpts][ypts]; for (int i = 0; i < ncurves; i++) { nmeas[i] = 0; for (int j = 0; j < xpts; j++) { for (int k = 0; k < ypts; k++) { nmeas[i] += (int) pch[i][j][k]; } } double tempavg = 0.0; double tempavg2 = 0.0; double temp2avg = 0.0; double temp2avg2 = 0.0; double tempccavg = 0.0; for (int j = 0; j < xpts; j++) { for (int k = 0; k < ypts; k++) { double normed = (double) pch[i][j][k] / (double) nmeas[i]; if (pch[i][j][k] > 0.0f) { weights[i][j][k] = (float) ((double) nmeas[i] / (normed * (1.0f - normed))); } else { weights[i][j][k] = 1.0f; } tempavg += normed * (double) j; tempavg2 += normed * (double) j * (double) j; temp2avg += normed * (double) k; temp2avg2 += normed * (double) k * (double) k; tempccavg += normed * (double) k * (double) j; } } tempccavg -= tempavg * temp2avg; brightcc[i] = tempccavg / Math.sqrt(tempavg * temp2avg); tempavg2 -= tempavg * tempavg; tempavg2 /= tempavg; bright1[i] = (tempavg2 - 1.0); temp2avg2 -= temp2avg * temp2avg; temp2avg2 /= temp2avg; bright2[i] = (temp2avg2 - 1.0); intensity1[i] = tempavg; intensity2[i] = temp2avg; if (psfflag == 0) { bright1[i] /= 0.3536; bright2[i] /= 0.3536; brightcc[i] /= 0.3536; } else { if (psfflag == 1) { bright1[i] /= 0.078; bright2[i] /= 0.078; brightcc[i] /= 0.078; } else { bright1[i] /= 0.5; bright2[i] /= 0.5; brightcc[i] /= 0.5; } } number1[i] = intensity1[i] / bright1[i]; number2[i] = intensity2[i] / bright2[i]; brightmincc[i] = (bright1[i] * beta) * Math.sqrt(intensity1[i] / intensity2[i]); } }
public void updatebeta() { for (int i = 0; i <= ncurves; i++) { brightmincc[i] = (bright1[i] * beta) / Math.sqrt(intensity1[i] / intensity2[i]); eminccarray[i].setText("" + (float) brightmincc[i]); } }
private void updateavg() { nmeas[ncurves] = 0; avg = new float[xpts][ypts]; avgweights = new float[xpts][ypts]; for (int i = 0; i < ncurves; i++) { if (include[i]) { for (int j = 0; j < xpts; j++) { for (int k = 0; k < ypts; k++) { avg[j][k] += pch[i][j][k]; nmeas[ncurves] += (int) pch[i][j][k]; } } } } double tempavg = 0.0; double tempavg2 = 0.0; double temp2avg = 0.0; double temp2avg2 = 0.0; double tempccavg = 0.0; for (int i = 0; i < xpts; i++) { for (int j = 0; j < ypts; j++) { double normed = (double) avg[i][j] / (double) nmeas[ncurves]; avgweights[i][j] = (float) ((double) nmeas[ncurves] / (normed * (1.0f - normed))); if (avg[i][j] > 0.0f) { avgweights[i][j] = (float) ((double) nmeas[ncurves] / (normed * (1.0f - normed))); } else { avgweights[i][j] = 1.0f; } tempavg += (double) i * normed; tempavg2 += (double) i * (double) i * normed; temp2avg += (double) j * normed; temp2avg2 += (double) j * (double) j * normed; tempccavg += (double) i * (double) j * normed; } } tempccavg -= tempavg * temp2avg; brightcc[ncurves] = tempccavg / Math.sqrt(tempavg * temp2avg); tempavg2 -= tempavg * tempavg; tempavg2 /= tempavg; bright1[ncurves] = (tempavg2 - 1.0); temp2avg2 -= temp2avg * temp2avg; temp2avg2 /= temp2avg; bright2[ncurves] = (temp2avg2 - 1.0); intensity1[ncurves] = tempavg; intensity2[ncurves] = temp2avg; if (psfflag == 0) { bright1[ncurves] /= 0.3536; bright2[ncurves] /= 0.3536; brightcc[ncurves] /= 0.3536; } else { if (psfflag == 1) { bright1[ncurves] /= 0.078; bright2[ncurves] /= 0.078; brightcc[ncurves] /= 0.078; } else { bright1[ncurves] /= 0.5; bright2[ncurves] /= 0.5; brightcc[ncurves] /= 0.5; } } number1[ncurves] = intensity1[ncurves] / bright1[ncurves]; number2[ncurves] = intensity2[ncurves] / bright2[ncurves]; brightmincc[ncurves] = (bright1[ncurves] * beta) * Math.sqrt(intensity1[ncurves] / intensity2[ncurves]); }