private boolean testIfRegressionWasSuccessful() { // **** TODO Design a more effective scheme to test for NR // success // Test if the regression analysis was successful based on the LRE line R2 Double r2 = profile.getR2(); Double emaxNR = profile.getNrEmax(); // Very, very crude approach if (r2 < 0.8 || r2.isNaN() || emaxNR < 0.3) { // Error dialog DISABLED as it is extremely irrating // Toolkit.getDefaultToolkit().beep(); // SimpleDateFormat sdf = new SimpleDateFormat("dMMMyy"); // JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), // "The nonlinear regression analysis has failed for well '" // + sdf.format(profile.getRunDate()) + ": " // + profile.getWellLabel() + "'.\n" // + "LRE analysis will be conducted without baseline-slope correction", // "Failed to Apply Nonlinear Regression.", // JOptionPane.ERROR_MESSAGE); // Reset the LRE window using Fb profile.setWasNonlinearRegressionSuccessful(false); profile.setNrFb(0); profile.setNrFbSlope(0); // Return to average Fb background subtraction LreWindowSelector.substractBackgroundUsingAvFc(profile); // Recalculate the LRE parameters prfSum.update(); // Reinitialize the profile List<LreWindowSelectionParameters> l = prfSum.getDatabase().getAllObjects(LreWindowSelectionParameters.class); LreWindowSelectionParameters parameters = l.get(0); LreAnalysisService lreAnalService = Lookup.getDefault().lookup(LreAnalysisService.class); lreAnalService.lreWindowInitialization(prfSum, parameters); return false; } profile.setWasNonlinearRegressionSuccessful(true); return true; }