Examples of DblParamSet


Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

//       }
     
      //this.avgcoefficients.setParam(params[n],pKaSum.divideBy(((Integer)divisors.get(params[n])).intValue()));
     
     
      DblParamSet pparms = this.getPriorParams();
      pparms.setParam(params[n],pKaSum.divideBy(((Integer)divisors.get(params[n])).intValue()));
     
      pKaSum = ((DblMatrix)SUMSQ.get(params[n])).minus((pKaSum.pow(2.0)).divideBy(((Integer)divisors.get(params[n])).intValue()));
      //this.stdcoefficients.setParam(params[n],pKaSum);
      pparms.setParam(params[n]+"_sigma",DblMatrix.sqrt(pKaSum));//Set the standard deviation in the priorParameters.
     
    }   
  }
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

    //////  PRIORS //////
   
    //We'll construct standard priors (mean and std) for the parameters.  We can get fancy later on...
    Set params = this.getDeclaredParameters();
    Iterator iter = params.iterator();
    DblParamSet priors = new DblParamSet();
    String meanname = null;
    String varname = null;
   
    DblMatrix var_val;
    DblMatrix mean_val;
   
    while (iter.hasNext())
    {
      String mainparam = (String)iter.next();
     
      if (mainparam.endsWith("sigma")) //Then it is a variance component.
      {
        meanname = "mean_log_"+mainparam;
        varname = "var_log_"+mainparam; 
       
        priors.put(meanname,this.getParam(mainparam));
        priors.put(varname,new DblMatrix(0.1));
      }
      else
      {
        String[] parts = mainparam.split("_");
        if (parts.length >= 3)
        { 
          String r = parts[parts.length-3];
         
          if ((r.equals("pKa")) || (r.equals("pKb")))
          {
            Integer ion = new Integer(parts[parts.length-1]);
           
            if (ion.intValue() > 0) // Order-restriction priors.
            {
              meanname = "mean_log_delta_"+mainparam;
              varname = "var_log_delta_"+mainparam;
             
              DblMatrix delta = this.getParam(mainparam).minus(this.getpKaLeftOf(mainparam));
             
              priors.put(meanname,DblMatrix.log(delta));
              //Set variance to 1/10 the mean.
              priors.put(varname,new DblMatrix(0.01));
            }
            else
            {
              meanname = "mean_"+mainparam;
              varname = "var_"+mainparam;
             
              priors.put(meanname,this.getParam(mainparam));
              priors.put(varname,new DblMatrix(0.01));
            }
           
           
          }
          else
          {
            meanname = "mean_"+mainparam;
            varname = "var_"+mainparam;
           
            priors.put(meanname,this.getParam(mainparam));
            priors.put(varname,new DblMatrix(1.0));
          }
        }
        else
        {
          meanname = "mean_"+mainparam;
          varname = "var_"+mainparam;
         
          priors.put(meanname,this.getParam(mainparam));
          priors.put(varname,new DblMatrix(1.0));
        }
         
      }
     
    }
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

    JLabel adjLabel = new JLabel("Adjust Cb for variability in:");
    adjLabel.setAlignmentX((float)0.5);
   
    this.configurationMap = new HashMap();
   
    this.smoothingParams = new DblParamSet();
   
    this.smoothingAdj = new JRadioButton("Smoothing");
    this.smoothingAdj.setAlignmentX((float)0.0);
    this.smoothingAdj.setToolTipText("A locally-weighted smoothing regression is added to the model for Cb(pH).");
    this.configurationMap.put("smoothingAdj",this.tempAdj);
   
    this.smoothingAdjExp = new JRadioButton("Experiment-wise smoothing");
    this.smoothingAdjExp.setAlignmentX((float)0.0);
    this.smoothingAdjExp.setToolTipText("A distinct locally-weighted smoothing regression is added to the model for Cb(pH) for each experiment.");
    this.configurationMap.put("smoothingAdjExp",this.tempAdj);
   
    this.smoothingAdjExpSS = new JRadioButton("Subsample-wise smoothing");
    this.smoothingAdjExpSS.setAlignmentX((float)0.0);
    this.smoothingAdjExpSS.setToolTipText("A distinct locally-weighted smoothing regression is added to the model for Cb(pH) for each subsample.");
    this.configurationMap.put("smoothingAdjSS",this.tempAdj);
   
   
    this.tempAdj = new JRadioButton("Temp. (C)");
    this.tempAdj.setAlignmentX((float)0.0);
    this.tempAdj.setToolTipText("The temperature during each titration is included in an activity correction of the pKa/pKb.");
    this.configurationMap.put("tempAdj",this.tempAdj);
   
    this.dielectricAdj = new JRadioButton("Dielectric");
    this.dielectricAdj.setAlignmentX((float)0.0);
    this.dielectricAdj.setToolTipText("The measure dielectric for each titration is included in an activity correction of the pKa/pKb.");
    this.configurationMap.put("dielectricAdj",this.dielectricAdj);
   
    this.ionicAdj = new JRadioButton("Ionic Str.");
    this.ionicAdj.setAlignmentX((float)0.0);
    this.ionicAdj.setToolTipText("The calculated ionic strength during each titration is included in an activity correction of the pKa/pKb.");
    this.configurationMap.put("ionicAdj",this.ionicAdj);
   
    this.latentpHLinkInterceptAdj = new JRadioButton("Intercept of latent pH link function");
    this.latentpHLinkInterceptAdj.setAlignmentX((float)0.0);
    this.latentpHLinkInterceptAdj.setToolTipText("The actual pH are assumed to be ``latent'' having a link function with an intercept.");
    this.configurationMap.put("latentpHLinkInterceptAdj",this.latentpHLinkInterceptAdj);
   
    this.latentpHLinkInterceptExpAdj = new JRadioButton("Experiment-wise intercept of latent pH link function");
    this.latentpHLinkInterceptExpAdj.setAlignmentX((float)0.0);
    this.latentpHLinkInterceptExpAdj.setToolTipText("A separate latent link intercept is estimated for each experiment.");
    this.configurationMap.put("latentpHLinkInterceptExpAdj",this.latentpHLinkInterceptExpAdj);
   
    this.latentpHLinkInterceptExpSSAdj = new JRadioButton("Subsample-wise intercept of latent pH link function");
    this.latentpHLinkInterceptExpSSAdj.setAlignmentX((float)0.0);
    this.latentpHLinkInterceptExpSSAdj.setToolTipText("A separate latent link intercept is estimated for each subsample.");
    this.configurationMap.put("latentpHLinkInterceptExpSSAdj",this.latentpHLinkInterceptExpSSAdj);
   
    this.latentpHLinkLinearAdj = new JRadioButton("Linear component of latent pH link function");
    this.latentpHLinkLinearAdj.setAlignmentX((float)0.0);
    this.latentpHLinkLinearAdj.setToolTipText("The actual pH are assumed to be ``latent'' having a link function with a linear effect.");
    this.configurationMap.put("latentpHLinkLinearAdj",this.latentpHLinkLinearAdj);
   
    this.latentpHLinkLinearExpAdj = new JRadioButton("Experiment-wise linear component of latent pH link function");
    this.latentpHLinkLinearExpAdj.setAlignmentX((float)0.0);
    this.latentpHLinkLinearExpAdj.setToolTipText("A separate latent link linear effect is estimated for each experiment.");
    this.configurationMap.put("latentpHLinkLinearExpAdj",this.latentpHLinkLinearExpAdj);
   
    this.latentpHLinkLinearExpSSAdj = new JRadioButton("Subsample-wise linear component of latent pH link function");
    this.latentpHLinkLinearExpSSAdj.setAlignmentX((float)0.0);
    this.latentpHLinkLinearExpSSAdj.setToolTipText("A separate latent link linear effect is estimated for each subsample.");
    this.configurationMap.put("latentpHLinkLinearExpSSAdj",this.latentpHLinkLinearExpSSAdj);
   
    this.latentpHLinkQuadraticAdj = new JRadioButton("Quadratic component of latent pH link function");
    this.latentpHLinkQuadraticAdj.setAlignmentX((float)0.0);
    this.latentpHLinkQuadraticAdj.setToolTipText("The actual pH are assumed to be ``latent'' having a link function with a quadratic effect.");
    this.configurationMap.put("latentpHLinkQuadraticAdj",this.latentpHLinkQuadraticAdj);
   
    this.latentpHLinkQuadraticExpAdj = new JRadioButton("Experiment-wise quadratic component of latent pH link function");
    this.latentpHLinkQuadraticExpAdj.setAlignmentX((float)0.0);
    this.latentpHLinkQuadraticExpAdj.setToolTipText("A separate latent link quadratic effect is estimated for each experiment.");
    this.configurationMap.put("latentpHLinkQuadraticExpAdj",this.latentpHLinkQuadraticExpAdj);
   
    this.latentpHLinkQuadraticExpSSAdj = new JRadioButton("Subsample-wise quadratic component of latent pH link function");
    this.latentpHLinkQuadraticExpSSAdj.setAlignmentX((float)0.0);
    this.latentpHLinkQuadraticExpSSAdj.setToolTipText("A separate latent link quadratic effect is estimated for each subsample.");
    this.configurationMap.put("latentpHLinkQuadraticExpSSAdj",this.latentpHLinkQuadraticExpSSAdj);
   
    this.latentpHLinkCubicAdj = new JRadioButton("Cubic component of latent pH link function");
    this.latentpHLinkCubicAdj.setAlignmentX((float)0.0);
    this.latentpHLinkCubicAdj.setToolTipText("The actual pH are assumed to be ``latent'' having a link function with a cubic effect.");
    this.configurationMap.put("latentpHLinkCubicAdj",this.latentpHLinkCubicAdj);
   
    this.latentpHLinkCubicExpAdj = new JRadioButton("Experiment-wise cubic component of latent pH link function");
    this.latentpHLinkCubicExpAdj.setAlignmentX((float)0.0);
    this.latentpHLinkCubicExpAdj.setToolTipText("A separate latent link cubic effect is estimated for each experiment.");
    this.configurationMap.put("latentpHLinkCubicExpAdj",this.latentpHLinkCubicExpAdj);
   
    this.latentpHLinkCubicExpSSAdj = new JRadioButton("Subsample-wise cubic component of latent pH link function");
    this.latentpHLinkCubicExpSSAdj.setAlignmentX((float)0.0);
    this.latentpHLinkCubicExpSSAdj.setToolTipText("A separate latent link cubic effect is estimated for each subsample.");
    this.configurationMap.put("latentpHLinkCubicExpSSAdj",this.latentpHLinkCubicExpSSAdj);
   
    this.pipetteAliquotAdj = new JRadioButton("Pipetting increment errors");
    this.pipetteAliquotAdj.setAlignmentX((float)0.0);
    this.pipetteAliquotAdj.setToolTipText("The actual titrant aliquots are assumed to be ``latent'' and are estimated using, in part, the stated volumes.");
    this.configurationMap.put("pipetteAliquotAdj",this.pipetteAliquotAdj);
   
    this.bufferConcentrationAdj = new JRadioButton("This buffer's concentration");//Otherwise assumed to be 1.0.
    this.bufferConcentrationAdj.setAlignmentX((float)0.0);
    this.bufferConcentrationAdj.setToolTipText("The mean relative concentration for this buffer is assumed to be exactly 1.0 if unselected. Typically, this should only be selected for simple buffers.");
    this.configurationMap.put("bufferConcentrationAdj",this.bufferConcentrationAdj);
   
    this.bufferExpConcentrationAdj = new JRadioButton("Experiment-wise buffer concentration");
    this.bufferExpConcentrationAdj.setAlignmentX((float)0.0);
    this.bufferExpConcentrationAdj.setToolTipText("There is a departure from the mean relative buffer concentration for each experiment.");
    this.configurationMap.put("bufferExpConcentrationAdj",this.bufferExpConcentrationAdj);
   
    this.bufferExpSSConcentrationAdj = new JRadioButton("Subsample-wise buffer concentration");
    this.bufferExpSSConcentrationAdj.setAlignmentX((float)0.0);
    this.bufferExpSSConcentrationAdj.setToolTipText("There is a departure from the mean relative buffer concentration for each subsample within each experiment.");
    this.configurationMap.put("bufferExpSSConcentrationAdj",this.bufferExpSSConcentrationAdj);
   
    this.titrantConcentrationAdj = new JRadioButton("Mean titrant concentration");
    this.titrantConcentrationAdj.setAlignmentX((float)0.0);
    this.titrantConcentrationAdj.setToolTipText("The concentration for titrants is assumed to depart from their stated values.");
    this.configurationMap.put("titrantConcentrationAdj",this.titrantConcentrationAdj);
   
    this.titrantExpConcentrationAdj = new JRadioButton("Experiment-wise titrant concentration");
    this.titrantExpConcentrationAdj.setAlignmentX((float)0.0);
    this.titrantExpConcentrationAdj.setToolTipText("For each experiment, there is an average departure of titrant concentrations from their stated values.");
    this.configurationMap.put("titrantExpConcentrationAdj",this.titrantExpConcentrationAdj);
   
    this.titrantExpSSConcentrationAdj = new JRadioButton("Subsample-wise titrant concentration");
    this.titrantExpSSConcentrationAdj.setAlignmentX((float)0.0);
    this.titrantExpSSConcentrationAdj.setToolTipText("For each subsample within an experiment, there is an average departure of titrant concentrations from their stated values.");
    this.configurationMap.put("titrantExpSSConcentrationAdj",this.titrantExpSSConcentrationAdj);
 
    this.pKaAdj = new JRadioButton("pKa/pKb uncertainty ");
    this.pKaAdj.setAlignmentX((float)0.0);
    this.pKaAdj.setToolTipText("pKa/pKb depart from their stated values");
    this.configurationMap.put("pKaAdj",this.pKaAdj);
   
    this.pKaExpAdj = new JRadioButton("Experiment-wise pKa/pKb");
    this.pKaExpAdj.setAlignmentX((float)0.0);
    this.pKaAdj.setToolTipText("For each experiment, their is an average pKa/pKb departure from their stated values.");
    this.configurationMap.put("pKaExpAdj",this.pKaExpAdj);
   
    this.pKaExpSSAdj = new JRadioButton("Subsample-wise pKa/pKb");
    this.pKaExpSSAdj.setAlignmentX((float)0.0);
    this.pKaExpSSAdj.setToolTipText("For each subsample within an experiment, their is an average pKa/pKb departure from their stated values.");
    this.configurationMap.put("pKaExpSSAdj",this.pKaExpSSAdj);
   
   
    this.smoothingAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
             
                boolean userWants = smoothingAdj.isSelected();
                //Turn the other two off if they are on.
                if (userWants)
                {
                  smoothingAdjExp.setSelected(false);
                  smoothingAdjExpSS.setSelected(false);
                }
               
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForSmoothing",userWants);
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
               
                configureMixingParameters();
              }
            }
          });
         
    this.smoothingAdjExp.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
             
                boolean userWants = smoothingAdjExp.isSelected();
                //Turn the other two off.
                if (userWants)
                {
                  smoothingAdj.setSelected(false);
                  smoothingAdjExpSS.setSelected(false);
                }
               
               
               
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForSmoothingExp",userWants);
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.smoothingAdjExpSS.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
             
                boolean userWants = smoothingAdjExpSS.isSelected();
                //Turn the other two off.
                if (userWants)
                {
                  smoothingAdj.setSelected(false);
                  smoothingAdjExp.setSelected(false);
                }
               
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForSmoothingExpSS",userWants);
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
     
    this.tempAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForTemperature",tempAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.dielectricAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForDielectric",dielectricAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          })
             
    this.ionicAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForIonicStrength",ionicAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
   
    //Otherwise the intercept is zero -- that would be wierd...     
    this.latentpHLinkInterceptAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkIntercept",latentpHLinkInterceptAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkInterceptExpAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkInterceptExp",latentpHLinkInterceptExpAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkInterceptExpSSAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkInterceptExpSS",latentpHLinkInterceptExpSSAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkLinearAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkLinear",latentpHLinkLinearAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkLinearExpAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkLinearExp",latentpHLinkLinearExpAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkLinearExpSSAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkLinearExpSS",latentpHLinkLinearExpSSAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });   
         
         
    this.latentpHLinkQuadraticAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkQuadratic",latentpHLinkQuadraticAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkQuadraticExpAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkQuadraticExp",latentpHLinkQuadraticExpAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkQuadraticExpSSAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkQuadraticExpSS",latentpHLinkQuadraticExpSSAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkCubicAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkCubic",latentpHLinkCubicAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkCubicExpAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkCubicExp",latentpHLinkCubicExpAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.latentpHLinkCubicExpSSAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForLatentpHLinkCubicExpSS",latentpHLinkCubicExpSSAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });     
    this.pipetteAliquotAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForPipettingErrors",pipetteAliquotAdj.isSelected());
               
                like.getParams().show("After setAdjustForPipettingErrors ="+pipetteAliquotAdj.isSelected());
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
               
              }
            }
          });
         
         
    this.bufferConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForBufferConc",bufferConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });     
         
    this.bufferExpConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForBufferExpConc",bufferExpConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.bufferExpSSConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForBufferExpSSConc",bufferExpSSConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.titrantConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForTitrantConc",titrantConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          })
             
    this.titrantExpConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForTitrantExpConc",titrantExpConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
    this.titrantExpSSConcentrationAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForTitrantExpSSConc",titrantExpSSConcentrationAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.pKaAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForpKa",pKaAdj.isSelected());
                System.out.println("pKaAdj ActionListener"+" pKaAdj.isSelected()="+pKaAdj.isSelected());
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.pKaExpAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForpKaExp",pKaExpAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
         
    this.pKaExpSSAdj.addActionListener(new ActionListener()
          { 
            public void actionPerformed(ActionEvent ev)
            {
              if (like instanceof BufferPredictorParameterizations)
              {
                ((BufferPredictorParameterizations)like).setAdjustFor("adjustForpKaExpSS",pKaExpSSAdj.isSelected());
               
                parameterEditor.setParamSet(like.getParams());
                currentEditor.setParamSet(like.getParams());
                priorEditor.setParamSet(like.getPriorParams());
                smoothingParams.replaceParams(like.getSmoothingParams());
                configureMixingParameters();
              }
            }
          });
   
   
    // this.initialpHAdj.addActionListener(new ActionListener()
//           { 
//             public void actionPerformed(ActionEvent ev)
//             {
//               if (like instanceof BufferPredictorParameterizations)
//               {
//                 ((BufferPredictorParameterizations)like).setAdjustForInitialpH(initialpHAdj.isSelected());
//                 parameterEditor.setParamSet(like.getParams());
//                 currentEditor.setParamSet(like.getParams());
//                 priorEditor.setParamSet(like.getPriorParams());
//                 configureMixingParameters();
//               }
//             }
//           });
//    
//     this.initialpHExpAdj.addActionListener(new ActionListener()
//           { 
//             public void actionPerformed(ActionEvent ev)
//             {
//               if (like instanceof BufferPredictorParameterizations)
//               {
//                 ((BufferPredictorParameterizations)like).setAdjustForInitialpHExp(initialpHExpAdj.isSelected());
//                 parameterEditor.setParamSet(like.getParams());
//                 currentEditor.setParamSet(like.getParams());
//                 priorEditor.setParamSet(like.getPriorParams());
//                 configureMixingParameters();
//               }
//             }
//           });
//          
//     this.initialpHExpSSAdj.addActionListener(new ActionListener()
//           { 
//             public void actionPerformed(ActionEvent ev)
//             {
//               if (like instanceof BufferPredictorParameterizations)
//               {
//                 ((BufferPredictorParameterizations)like).setAdjustForInitialpHExpSS(initialpHExpSSAdj.isSelected());
//                 parameterEditor.setParamSet(like.getParams());
//                 currentEditor.setParamSet(like.getParams());
//                 priorEditor.setParamSet(like.getPriorParams());
//                 configureMixingParameters();
//               }
//             }
//           });
//    
//    
   
   
   
    this.updateDataButton = new JButton("Update Data");
    this.updateDataButton.setPreferredSize(new Dimension(150,20));
    this.updateDataButton.setMinimumSize(new Dimension(150,20));
    this.updateDataButton.setMaximumSize(new Dimension(150,20));
    this.updateDataButton.setAlignmentX((float)0.5);
    this.updateDataButton.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
          try 
          {
            updateGraphics();
          }
          catch (Exception err)
          {
            throw new RuntimeException("Problem updating data.",err);
          }
        }
      }
    );
   
    //System.out.println("KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK");
   
   
    String[] predictors = new String[]{"LOWESS"};
    this.cplxPredictorSelector = new JComboBox(predictors);
    this.cplxPredictorSelector.setPreferredSize(new Dimension(150,20));
    this.cplxPredictorSelector.setMinimumSize(new Dimension(150,20));
    this.cplxPredictorSelector.setMaximumSize(new Dimension(150,20));
   
   
    JLabel smoothLabel = new JLabel("Smooth Method");
    smoothLabel.setAlignmentX((float)0.5);
    this.smoothParamMethods = new String[]{"fixed","gcv",};
     this.smoothParamMethodSelector = new JComboBox(this.smoothParamMethods);
     smoothLabel.setLabelFor(this.smoothParamMethodSelector);

    this.smoothParamMethodSelector.setPreferredSize(new Dimension(150,20));
    this.smoothParamMethodSelector.setMinimumSize(new Dimension(150,20));
    this.smoothParamMethodSelector.setMaximumSize(new Dimension(150,20));

    this.smoothParamMethodSelector.setEditable(false);
     this.currentSmoothParamMethod = "gcv";


     this.smoothParamText = new JTextField("");

    this.polyOrders = new String[]{"linear","quadratic","cubic"};

    this.polynomialOrder = new JComboBox(this.polyOrders);
    this.polynomialOrder.setPreferredSize(new Dimension(150,20));
    this.polynomialOrder.setMinimumSize(new Dimension(150,20));
    this.polynomialOrder.setMaximumSize(new Dimension(150,20));

    this.smoothParamText = new JTextField("0.9");
    this.smoothParamText.setPreferredSize(new Dimension(150,20));
    this.smoothParamText.setMinimumSize(new Dimension(150,20));
    this.smoothParamText.setMaximumSize(new Dimension(150,20));
   
    this.refitButton = new JButton("New Fit");
    this.refitButton.setPreferredSize(new Dimension(150,20));
    this.refitButton.setMinimumSize(new Dimension(150,20));
    this.refitButton.setMaximumSize(new Dimension(150,20));
    this.refitButton.setAlignmentX((float)0.5);
   
    this.stopfitButton = new JButton("Stop Fit");
    this.stopfitButton.setPreferredSize(new Dimension(150,20));
    this.stopfitButton.setMinimumSize(new Dimension(150,20));
    this.stopfitButton.setMaximumSize(new Dimension(150,20));
    this.stopfitButton.setAlignmentX((float)0.5);
   
    this.setFitToNullButton = new JButton("Remove Fit");
    this.setFitToNullButton.setPreferredSize(new Dimension(150,20));
    this.setFitToNullButton.setMinimumSize(new Dimension(150,20));
    this.setFitToNullButton.setMaximumSize(new Dimension(150,20));
    this.setFitToNullButton.setAlignmentX((float)0.5);
   
    this.stopfitButton.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
          est.haltSolution(true);
        }
      });
         

    this.refitButton.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
         
          String predType = (String)cplxPredictorSelector.getSelectedItem();
         
         
          //like = (StatisticalModel)parameterEditor.getHierarchicalParameters();
         
          //System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
          //parameterEditor.getParamSet();
          //System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
         
         
          like.setParams(parameterEditor.getParamSet());
          like.setPriorParams(priorEditor.getParamSet());
          prop.replaceMixingParams(proposalEditor.getParamSet());
         
          //System.out.println("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC");
          //((BayesianBufferPredictorNew)like).setPlotPanel(plotPanel);
         
          // if (predType.equals("Local Poly. Reg."))
//           {
//             predictor = new LpregBufferPredictor();
//           }
//           else
//           {
//             throw new IllegalArgumentException("Unrecognized complex predictor selection.");
//          
//           }
         
          //like = new BayesianLinear();
         
          //This constructor should automatically configure the parameters to initial values.
         
          //like = new BayesianBufferPredictor(storage);
         
          //parameterEditor.setHierarchicalParameters(like);
         
         
          //like.setDataSet(outSet);
         
          //like.setParam("B0",new DblMatrix(-1.0));
          //like.setParam("B1",new DblMatrix(0.1));
          //like.setParam("sigma",new DblMatrix(0.02));
         
          //like.mapName("X","pH");
          //like.mapName("Y","Cbplot");
         
          //((BayesianBufferPredictorNew)like).setPlotSet(outSet);
                     
          // prop = new GaussianProposal(like);
//                                        
//           //Set all variance components to be log normal in the proposal distribution.
//           Set params = like.getDeclaredParameters();
//           Iterator iter = params.iterator();
//           while (iter.hasNext())
//           {
//             String pname = (String)iter.next();
//            
//             if (pname.contains("sigma"))
//             {
//            
//               if (pname.startsWith("sigmaCb")) //Concentrations can not be negative!!
//               {
//                 prop.setLogNormal(pname);
//                 prop.setMixingParam(pname,new DblMatrix(0.0001));
//               }
//               else
//               {
//                 prop.setLogNormal(pname);
//                 prop.setMixingParam(pname,new DblMatrix(0.001));
//               }
//             }
//             else if (pname.startsWith("T#")) //Concentrations can not be negative!!
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.startsWith("TExpSSdev")) //Volume deviations can not be negative!!
//             {
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.startsWith("C#")) //
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.startsWith("CExpdev")) //
//             {
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.startsWith("CExpSSdev")) //
//             {
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.startsWith("Vo#")) //Volumes added can not be negative!!
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.00001));
//             }
//             else if (pname.startsWith("v#")) //Volumes added can not be negative!!
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.00001));
//             }
//             else if (pname.contains("pKa#")) //From order-restricted inference on the pKa's
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else if (pname.contains("pKadiff")) //From order-restricted inference on the pKa's
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.01));
//             }
//             else if (pname.contains("pKbdiff")) //From order-restricted inference on the pKb's
//             {
//               prop.setLogNormal(pname);
//               prop.setMixingParam(pname,new DblMatrix(0.01));
//             }
//             else if (pname.contains("smoothing"))
//             {
//               prop.setMixingParam(pname,new DblMatrix(0.001));
//             }
//             else
//             {
//               DblMatrix VALUE = DblMatrix.abs(like.getParam(pname));
//               if (DblMatrix.test(VALUE.eq(0.0)))
//               {
//                 VALUE = new DblMatrix(0.000001);
//               }
//               else
//               {  VALUE = VALUE.times(0.000001);
//               }
//              
//               prop.setMixingParam(pname,VALUE);
//              
//             }
//            
//           }
         
          // prop.setMixingParam("B0",new DblMatrix(0.01));
//           prop.setMixingParam("B1",new DblMatrix(0.01));
//           prop.setMixingParam("sigma",new DblMatrix(0.1));
//          
         
                                        est = new MCMC(new MetropolisHastings(like,like,prop));
                                        est.setChainLength(10); //Number of samples to keep in memory...
                                        est.setMaxIterations(300);
         
          String[] parameters = like.parameterSet();
          MCMCBlock varcompBlock = new MCMCBlock();
          MCMCBlock otherBlock = new MCMCBlock();
          varcompBlock.setName("Latent pH/Variance components");
          otherBlock.setName("Model components");
         
          varcompBlock.setCycles(25);
          otherBlock.setCycles(25);
         
          for (int p=0;p<parameters.length;p++)
          {
            if (parameters[p].contains("sigma"))
            {
              varcompBlock.addParameter(parameters[p]);
            }
            else if (parameters[p].startsWith("pH"))
            {
              varcompBlock.addParameter(parameters[p]);
            }
            else if (parameters[p].startsWith("linearpH"))
            {
              varcompBlock.addParameter(parameters[p]);
            }
            else if (parameters[p].startsWith("quadraticpH"))
            {
              varcompBlock.addParameter(parameters[p]);
            }
            else if (parameters[p].startsWith("cubicpH"))
            {
              varcompBlock.addParameter(parameters[p]);
            }
            else
            {
              otherBlock.addParameter(parameters[p]);
            }
          }
          est.addBlock(varcompBlock);
          est.addBlock(otherBlock);
         
          //est.addBlock(otherBlock);
          //est.addBlock(varcompBlock);
                                               
                                        /////////////                 
                                       
         
          if (mcmc_infopanel == null)
          {
            mcmc_panel.setLayout(new GridLayout(1,1));
            mcmc_infopanel = new SLFigure(mcmc_panel);
                        mcmc_panel.add(mcmc_infopanel);
                        mcmc_ax = new SLAxes(mcmc_infopanel);
          }
          else
          {
            mcmc_panel.removeAll();
            mcmc_infopanel = new SLFigure(mcmc_panel);
            mcmc_panel.add(mcmc_infopanel);
            mcmc_ax.removeAllChild();
          }
         
         
         
                      ////////////
         
                      DefaultReporter rep = (DefaultReporter)est.getDefaultReporter("MCMC");
                      //ParameterReportPlot ptrace = new ParameterReportPlot(mcmc_ax,rep);
          //ptrace.setSemiLogY(true);
          ValueReportPlot ptrace = new ValueReportPlot(mcmc_ax,rep);
                      ptrace.setDelay(100);
         
          //FigureReporter prep = (FigureReporter)like.getFigureReporter("Residuals");
          //FigureReport figplot = new FigureReport(prep);
         
         
         
          repaint();
         
         
                      /////////////////////
                      Animation happy = new Animation();
                      parentthread = new Thread(happy);
                      parentthread.start();
         
          // while (!mcmc_complete)
//           {
//             try
//             {
//               Thread.sleep(3000);
//             }
//             catch (Exception err)
//             {
//               throw new RuntimeException("Problem sleeping thread.",err);
//             }
//           }
          //
//           DblParamSet paramEst = est.getEstimate(10);
//           System.out.println("Here is the estimate");
//           paramEst.show("Parameter estimates:");
//          
         
         
         
                      // Lpreg FUNC = new Lpreg(outSet,"pH","Cbplot");
//
//
//           String polyorder = (String)polynomialOrder.getSelectedItem();
//
//           DblMatrix model = new DblMatrix("[0;1]");
//
//           if (polyorder.equalsIgnoreCase("quadratic"))
//           {
//             model = new DblMatrix("[0;1;2]"); 
//           }
//
//           if (polyorder.equalsIgnoreCase("cubic"))
//           {
//             model = new DblMatrix("[0;1;2;3]"); 
//           }
//
//           FUNC.setModel(model);
//
//                       //
//                       //Fiddle with the settings...
//                       //
//
//
//                       NNBandwidth BW = new NNBandwidth(FUNC);
//
//                       FixedSmoothMethod SM = new FixedSmoothMethod(FUNC);
//                       String sp_text = smoothParamText.getText();
//
//           NumberFormat nf = NumberFormat.getInstance();
//           Number n = null;
//           try
//           {
//                           contentPane.setLayout(new BoxLayout(contentPane,BoxLayout.X_AXIS));    n = nf.parse(sp_text);
//             System.err.println("parsing of " + sp_text + " = " + n);
//                       }
//           catch (ParseException ex)
//           {
//                               System.err.println("parsing of " + sp_text + " failed");
//                       }
//
//           SM.setSmoothParameter(new Double(n.doubleValue())); //The proportion of N that gives K in the NN method.
//
//                       //GCVSmoothMethod SM = new GCVSmoothMethod(Func);
//
//
//                       BW.setSmoothMethod(SM);
//                       FUNC.setBandwidthMethod(BW);
//                       //Func.setSmoothingKernel(new UniformWeightAlgorithm());
//                       //
//
//
//           //Get a vector of pH to predict over that is more dense that
//           //the original data.
//          
//           Min m = new Min(outSet);
//           m.addResponseVariable("pH");
//           m.run();
//           DataSet minpH = m.getResult();
//           DblMatrix min = new DblMatrix((Double)minpH.getValueAt(0,1));
//          
//           Max mx = new Max(outSet);
//           mx.addResponseVariable("pH");
//           mx.run();
//           DataSet maxpH = mx.getResult();
//           DblMatrix max = new DblMatrix((Double)maxpH.getValueAt(0,1));
//          
//           DblMatrix xx[] = new DblMatrix[1];
//           xx[0] = DblMatrix.span(min,max,2*outSet.getRowCount());
//          
//           System.out.println("Beginning LPREG...");
//           long start = System.currentTimeMillis();
//          
//                       DblMatrix yy = FUNC.predict(xx);
//           long stop = System.currentTimeMillis();
//          
//           System.out.println("Total prediction time"+(stop-start));
//          
//           SLAxes ax = plotPanel.getAxes();
//           fitline = new SLLine(plotPanel.getAxes());
//           fitline.setMarkerType(8);
//           fitline.setLineColor(Color.black);
//          
//           fitline.setXData(xx[0]);
//           fitline.setYData(yy);
//
//
//           //Finally, set the ComplexBufferPredictor to the
//           //regression object.
//           ((LpregBufferPredictor)predictor).setLpreg(FUNC);
        }
      }
    );


    //This button actually requests the ComplexBufferPredictor
    this.setFitToNullButton.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent ev)
        {
          plotPanel.removeAll();
          plotPanel.repaint();
          predictor = null;
          //fitline.setXData(null);
          //fitline.setYData(null);
        }
      }
    );

    controlBox.add(adjLabel);
   
   
    Box adjChoices = Box.createVerticalBox();
   
    adjChoices.add(this.bufferConcentrationAdj);
    adjChoices.add(this.bufferExpConcentrationAdj);
    adjChoices.add(this.bufferExpSSConcentrationAdj);
   
    adjChoices.add(this.pKaAdj);
    adjChoices.add(this.pKaExpAdj);
    adjChoices.add(this.pKaExpSSAdj);
   
    adjChoices.add(this.latentpHLinkInterceptAdj);
    adjChoices.add(this.latentpHLinkInterceptExpAdj);
    adjChoices.add(this.latentpHLinkInterceptExpSSAdj);
   
    adjChoices.add(this.latentpHLinkLinearAdj);
    adjChoices.add(this.latentpHLinkLinearExpAdj);
    adjChoices.add(this.latentpHLinkLinearExpSSAdj);
   
    adjChoices.add(this.latentpHLinkQuadraticAdj);
    adjChoices.add(this.latentpHLinkQuadraticExpAdj);
    adjChoices.add(this.latentpHLinkQuadraticExpSSAdj);
   
    adjChoices.add(this.latentpHLinkCubicAdj);
    adjChoices.add(this.latentpHLinkCubicExpAdj);
    adjChoices.add(this.latentpHLinkCubicExpSSAdj);
   
    adjChoices.add(this.titrantExpConcentrationAdj);
    adjChoices.add(this.titrantExpSSConcentrationAdj);
   
    adjChoices.add(this.pipetteAliquotAdj);
    adjChoices.add(this.tempAdj);
    adjChoices.add(this.dielectricAdj);
    adjChoices.add(this.ionicAdj);
   
    adjChoices.add(this.smoothingAdj);
    adjChoices.add(this.smoothingAdjExp);
    adjChoices.add(this.smoothingAdjExpSS);
   
    JScrollPane jscp = new JScrollPane(adjChoices);
    controlBox.add(jscp);
   
    controlBox.add(this.updateDataButton);
    controlBox.add(this.refitButton);
    controlBox.add(this.stopfitButton);
    controlBox.add(this.setFitToNullButton);
   
    controlBox.add(this.cplxPredictorSelector);
    controlBox.add(smoothLabel);
    controlBox.add(this.smoothParamMethodSelector);
    controlBox.add(this.smoothParamText);
    controlBox.add(this.polynomialOrder);
    controlBox.add(Box.createVerticalGlue());
   
   
    this.parameterEditor = new DblParamSetFrame("Edit initial guesses");
    this.parameterEditor.setAlphaSorted(true);
   
    this.parameterEditor.addCancelListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            parameterEditor.setVisible(false)
          }
        });
       
    this.parameterEditor.addOkListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            parameterEditor.setVisible(false)
          }
        });
       
       
    this.currentEditor = new DblParamSetFrame("Current estimates")
    this.currentEditor.setAlphaSorted(true)
   
    this.currentEditor.addCancelListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            currentEditor.setVisible(false)
          }
        });
       
    this.currentEditor.addOkListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            currentEditor.setVisible(false);
             
          }
        });
   
    this.priorEditor = new DblParamSetFrame("Edit prior parameters")
    this.priorEditor.setAlphaSorted(true)
   
    this.priorEditor.addCancelListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            priorEditor.setVisible(false)
          }
        });
       
    this.priorEditor.addOkListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            priorEditor.setVisible(false);
             
          }
        });
       
       
    this.proposalEditor = new DblParamSetFrame("Edit proposal mixing parameters")
    this.proposalEditor.setAlphaSorted(true)
   
    this.proposalEditor.addCancelListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            proposalEditor.setVisible(false)
          }
        });
       
    this.proposalEditor.addOkListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            proposalEditor.setVisible(false);
             
          }
        });
   
    DblParamSet temp = new DblParamSet();
    temp.setParam("Hey",new DblMatrix(1.0));
    temp.setParam("There",new DblMatrix(2.0));
   
    this.priorEditor.setParamSet(temp);
       
    //this.parameterEditor 
   
     
    //System.out.println("2KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK");
   
   
    //this.parameterEditor.setHierarchicalParameters(this.like);
    this.like.getParams();
    //System.out.println("22KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK");
    this.currentEditor.setParamSet(this.like.getParams());
    //System.out.println("222KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"); 
    this.priorEditor.setParamSet(this.like.getPriorParams());
    //System.out.println("222KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"); 
    this.editParameters = new JButton("Edit initial guess...");
    this.editParameters.setAlignmentX((float)0.5);
    this.editParameters.addActionListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            //Open a parameter editor
            parameterEditor.setVisible(true);
          }
        });
       
     
    //Allow viewing of the current estimates....
    //We may need to require the user to stop the optimization to
    // interrupt the thread!
    this.viewParameters = new JButton("View estimates...");
    this.viewParameters.setAlignmentX((float)0.5);
    this.viewParameters.addActionListener(new ActionListener()
        {
          public void actionPerformed(ActionEvent ev)
          {
            //Open a parameter editor
            if (est != null)
            {
              DblParamSet current = est.getEstimate();
              currentEditor.setParamSet(current);
            }
           
            currentEditor.setVisible(true);
           
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

//       conn.createBuffer(repos,buffName);
//     }
//    
//     BufferStorage backingBuffer =  conn.getBuffer(repos,buffName);
//    
    DblParamSet pars = null;
    DblParamSet pars2 = null;
   
    String descriptor = "parameter";
    pars = parameterEditor.getParamSet();
    pars2 = currentEditor.getParamSet();
    Vector persistentParams = backingBuffer.getPersistentParametersForDescriptor(descriptor);
    for (int j=0;j<persistentParams.size();j++)
    {
      PersistentParameter pp = (PersistentParameter)persistentParams.get(j);
      pars.setParam(pp.getName(),new DblMatrix(new Double(pp.getValue())));
      pars2.setParam(pp.getName(),new DblMatrix(new Double(pp.getValue())))
    }
   
   
    descriptor = "prior";
    pars = priorEditor.getParamSet();
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

   
    //BufferStorage backingBuffer =  conn.getBuffer(repos,buffName);
   
   
    String[] pnames;
    DblParamSet pars = null;
    String descriptor = "parameter";
    pars = parameterEditor.getParamSet();
    pnames = pars.parameterSet();
    for (int j=0;j<pnames.length;j++)
    {
      backingBuffer.addPersistentParameter(pnames[j],descriptor);
      //backingBuffer.setPersistentParameterDescriptor(pnames[j],descriptor);
      backingBuffer.setPersistentParameterValue(pnames[j],descriptor,pars.getParam(pnames[j]).getDoubleAt(0).toString());
     
    }
   
    descriptor = "prior";
    pars = priorEditor.getParamSet();
    pnames = pars.parameterSet();
    for (int j=0;j<pnames.length;j++)
    {
      backingBuffer.addPersistentParameter(pnames[j],descriptor);
      //backingBuffer.setPersistentParameterDescriptor(pnames[j],descriptor);
      backingBuffer.setPersistentParameterValue(pnames[j],descriptor,pars.getParam(pnames[j]).getDoubleAt(0).toString());
     
     
    }
   
    descriptor = "mixing";
    pars = proposalEditor.getParamSet();
    pnames = pars.parameterSet();
    for (int j=0;j<pnames.length;j++)
    {
      backingBuffer.addPersistentParameter(pnames[j],descriptor);
      //backingBuffer.setPersistentParameterDescriptor(pnames[j],descriptor);
      backingBuffer.setPersistentParameterValue(pnames[j],descriptor,pars.getParam(pnames[j]).getDoubleAt(0).toString());
     
    }
   
    descriptor = "configuration";
    Set pset = this.configurationMap.keySet();
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

   
  }
 
  public void removePersistentParameter(String parametername,String descriptor)
  {
    DblParamSet pars = null;
   
    if (descriptor.equals("parameter"))
    {
      pars = parameterEditor.getParamSet();
      pars.remove(parametername);
      pars = null;
     
      pars = currentEditor.getParamSet();
      pars.remove(parametername);
      pars = null;
    }
   
    if (descriptor.equals("prior"))
    {
      pars = priorEditor.getParamSet();
      pars.remove(parametername);
      pars = null;
    }
   
    if (descriptor.equals("mixing"))
    {
      pars = proposalEditor.getParamSet();
      pars.remove(parametername);
      pars = null;
    }
   
   
    if (descriptor.equals("configuration"))
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

  }
 
  public void addPersistentParameter(String parametername,String descriptor)
  {
   
    DblParamSet pars = null;
   
    if (descriptor.equals("parameter"))
    {
      System.out.println("Adding parameter");
      pars = parameterEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(0.0));
      parameterEditor.setParamSet(pars);
     
      pars = currentEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(0.0));
      currentEditor.setParamSet(pars);
    }
    else if (descriptor.equals("prior"))
    {
      System.out.println("Adding prior");
      pars = priorEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(0.0));
      priorEditor.setParamSet(pars);
    }
    else if (descriptor.equals("mixing"))
    {
      System.out.println("Adding mixing");
      pars = proposalEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(0.0));
      proposalEditor.setParamSet(pars);
    }
    else if (descriptor.equals("configuration"))
    {
      System.out.println("Adding configuration");
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

  }
 
  public void setPersistentParameterValue(String parametername,String descriptor,String val)
  {
   
    DblParamSet pars = null;
   
    if (descriptor.equals("parameter"))
    {
      pars = parameterEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(new Double(val)));
      parameterEditor.setParamSet(pars);
     
      pars = currentEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(new Double(val)));
      currentEditor.setParamSet(pars);
     
    }
   
    if (descriptor.equals("prior"))
    {
      pars = priorEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(new Double(val)));
      priorEditor.setParamSet(pars);
    }
   
    if (descriptor.equals("mixing"))
    {
      pars = proposalEditor.getParamSet();
      pars.setParam(parametername,new DblMatrix(new Double(val)));
      proposalEditor.setParamSet(pars);
     
    }
   
    if (descriptor.equals("configuration"))
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

  }
 
  public String getPersistentParameterValue(String parametername,String descriptor)
  {
   
    DblParamSet pars = null;
    String out = null;
   
    if (descriptor.equals("parameter"))
    {
      pars = parameterEditor.getParamSet();
      out = pars.getParam(parametername).getDoubleAt(0).toString();     
    }
   
    if (descriptor.equals("prior"))
    {
      pars = priorEditor.getParamSet();
      out = pars.getParam(parametername).getDoubleAt(0).toString();
    }
   
    if (descriptor.equals("mixing"))
    {
      pars = proposalEditor.getParamSet();
      out = pars.getParam(parametername).getDoubleAt(0).toString();
     
    }
   
    if (descriptor.equals("configuration"))
    {
View Full Code Here

Examples of com.mockturtlesolutions.snifflib.datatypes.DblParamSet

 
  public Vector getPersistentParametersForDescriptor(String descript)
  {
    Vector outSet = new Vector();
   
    DblParamSet pars = null;
   
    String descriptor = "";
    String[] params;
   
    if (descript.equals("parameter"))
    {
   
      descriptor = "parameter";
   
      pars = parameterEditor.getParamSet();
      params = pars.parameterSet();
   
      for (int j=0;j<params.length;j++)
      {
        DblMatrix val = pars.getParam(params[j]);
        outSet.add(new PersistentParameter(params[j],descriptor,val.getDoubleAt(0).toString()));
      }
    }
   
   
    if (descript.equals("prior"))
    {
   
      descriptor = "prior";
     
      pars = priorEditor.getParamSet();
      params = pars.parameterSet();
     
      for (int j=0;j<params.length;j++)
      {
        DblMatrix val = pars.getParam(params[j]);
        outSet.add(new PersistentParameter(params[j],descriptor,val.getDoubleAt(0).toString()));
      }
    }
   
    if (descript.equals("mixing"))
    {
   
      descriptor = "mixing";
      pars = proposalEditor.getParamSet();
      params = pars.parameterSet();

      for (int j=0;j<params.length;j++)
      {
        DblMatrix val = pars.getParam(params[j]);
        outSet.add(new PersistentParameter(params[j],descriptor,val.getDoubleAt(0).toString()));
      }
    }
   
    if (descript.equals("configuration"))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.