private boolean showfitdialog() { int nparams = avgparams.length; Object[][] tabledata = new Object[nparams + 1][3]; String[] columnlabels = {"Parameters", "Values", "Fix?"}; tabledata[0][0] = "Check chi^2?"; tabledata[0][1] = new Boolean(checkc2); tabledata[1][0] = "backgroundg"; tabledata[2][0] = "backgroundr"; tabledata[3][0] = "e1g"; tabledata[4][0] = "e1r"; tabledata[5][0] = "N1"; tabledata[6][0] = "e2g"; tabledata[7][0] = "e2r"; tabledata[8][0] = "N2"; tabledata[9][0] = "e3g"; tabledata[10][0] = "e3r"; tabledata[11][0] = "N3"; for (int i = 0; i < nparams; i++) { tabledata[i + 1][1] = new Double(avgparams[i]); tabledata[i + 1][2] = new Boolean(avgfixes[i] == 1); } Object[][] retvals = jguis.TableDialog2.showDialog(null, null, "Fit Parameters", columnlabels, tabledata, null); if (retvals == null) { return false; } checkc2 = ((Boolean) retvals[0][1]).booleanValue(); for (int i = 0; i < nparams; i++) { avgparams[i] = ((Double) retvals[i + 1][1]).doubleValue(); avgfixes[i] = ((Boolean) retvals[i + 1][2]).booleanValue() ? 1 : 0; } return true; }
private boolean showglobalfitdialog(double[][] params, String[][] formulas, int[][] vflmatrix) { int nsets = params.length; int nparams = params[0].length; Object[][] tabledata = new Object[nparams + 1][2 + 2 * nsets]; int[][] options = new int[nparams + 1][2 + 2 * nsets]; String[] columnlabels = new String[2 + 2 * nsets]; columnlabels[0] = "Parameters"; columnlabels[1] = "Linking"; for (int i = 0; i < nsets; i++) { columnlabels[2 * i + 2] = "values " + i; columnlabels[2 * i + 3] = "link " + i; } String[] vfl = {"Vary", "Fix", "Link", "FLink"}; String[] linking = {"Custom", "LinkAll", "VaryAll"}; tabledata[0][0] = "Check chi^2?"; tabledata[0][1] = new Boolean(checkc2); tabledata[1][0] = "backgroundg"; tabledata[2][0] = "backgroundr"; tabledata[3][0] = "e1g"; tabledata[4][0] = "e1r"; tabledata[5][0] = "N1"; tabledata[6][0] = "e2g"; tabledata[7][0] = "e2r"; tabledata[8][0] = "N2"; tabledata[9][0] = "e3g"; tabledata[10][0] = "e3r"; tabledata[11][0] = "N3"; for (int i = 0; i < nparams; i++) { tabledata[i + 1][1] = linking; for (int j = 0; j < nsets; j++) { tabledata[i + 1][2 * j + 2] = new String("" + (float) params[j][i]); tabledata[i + 1][2 * j + 3] = vfl; options[i + 1][2 * j + 3] = vflmatrix[j][i]; if (vflmatrix[j][i] > 2) { tabledata[i + 1][2 * j + 2] = formulas[j][i]; } else { tabledata[i + 1][2 * j + 2] = new String("" + (float) params[j][i]); } } } Object[][] retvals = jguis.TableDialog2.showDialog( null, null, "Fit Parameters", columnlabels, tabledata, options); if (retvals == null) { // IJ.showMessage("returned false"); return false; } // IJ.showMessage("returned true"); checkc2 = ((Boolean) retvals[0][1]).booleanValue(); for (int i = 0; i < nparams; i++) { int linkindex = 0; String retlink = (String) retvals[i + 1][1]; if (retlink.equals("LinkAll")) { linkindex = 1; } if (retlink.equals("VaryAll")) { linkindex = 2; } for (int j = 0; j < nsets; j++) { if (linkindex == 0) { String retvfl = (String) retvals[i + 1][2 * j + 3]; if (retvfl.equals("Vary")) { vflmatrix[j][i] = 0; } else { if (retvfl.equals("Fix")) { vflmatrix[j][i] = 1; } else { if (retvfl.equals("Link")) { vflmatrix[j][i] = 2; } else { vflmatrix[j][i] = 3; // IJ.showMessage(""+j+" , "+i); } } } } else { String retvfl = (String) retvals[i + 1][2 * j + 3]; if (linkindex == 1) { if (retvfl.equals("Fix") && j == 0) { vflmatrix[j][i] = 1; } else { if (retvfl.equals("FLink")) { vflmatrix[j][i] = 3; } else { vflmatrix[j][i] = 2; } } } else { if (retvfl.equals("FLink")) { vflmatrix[j][i] = 3; } else { vflmatrix[j][i] = 0; } } } if (vflmatrix[j][i] < 3) { params[j][i] = Double.parseDouble((String) retvals[i + 1][2 * j + 2]); } else { params[j][i] = 0.0; formulas[j][i] = (String) retvals[i + 1][2 * j + 2]; // IJ.showMessage(formulas[j][i]); } } } return true; }