- Timestamp:
- 11/18/11 19:55:02 (8 years ago)
- Location:
- trunk/projects/curve-fitter/src/main/java/loci/curvefitter
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/AbstractCurveFitter.java
r7673 r7810 41 41 */ 42 42 public abstract class AbstractCurveFitter implements ICurveFitter { 43 FitAlgorithm m_fitAlgorithm; 43 44 FitFunction m_fitFunction; 44 45 double m_xInc = ICurveFitter.DEFAULT_X_INC; 45 46 boolean[] m_free; 46 47 double[] m_instrumentResponse; 48 49 @Override 50 public FitAlgorithm getFitAlgorithm() { 51 return m_fitAlgorithm; 52 } 53 54 @Override 55 public void setFitAlgorithm(FitAlgorithm algorithm) { 56 m_fitAlgorithm = algorithm; 57 } 47 58 48 59 @Override -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/CurveFitData.java
r7673 r7810 53 53 double[] m_sig; 54 54 double[] m_yFitted; 55 double m_chiSquareTarget; 55 56 double m_chiSquare; 56 57 Object m_userData; … … 136 137 } 137 138 139 @Override 140 public double getChiSquareTarget() { 141 return m_chiSquareTarget; 142 } 143 144 @Override 145 public void setChiSquareTarget(double chiSquareTarget) { 146 m_chiSquareTarget = chiSquareTarget; 147 } 148 149 @Override 138 150 public double getChiSquare() { 139 151 return m_chiSquare; 140 152 } 141 153 154 @Override 142 155 public void setChiSquare(double chiSquare) { 143 156 m_chiSquare = chiSquare; -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/GrayCurveFitter.java
r7668 r7810 81 81 } 82 82 83 public GrayCurveFitter(int algType) {84 m_algType = algType;85 }86 87 public GrayCurveFitter() {88 m_algType = 0;89 }90 91 83 @Override 92 84 public int fitData(ICurveFitData[] dataArray, int start, int stop) { … … 98 90 //TODO ARG August use initial X of 0. 99 91 100 if ( 0 == m_algType) {92 if (FitAlgorithm.RLD.equals(m_fitAlgorithm)) { 101 93 float xincr = (float) m_xInc; 102 94 int fitStart = start; -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/GrayNRCurveFitter.java
r7668 r7810 120 120 } 121 121 122 public GrayNRCurveFitter(int algType) {123 m_algType = algType;124 }125 126 public GrayNRCurveFitter() {127 m_algType = 0;128 }129 130 122 131 123 @Override … … 160 152 } 161 153 162 if ( 0 == m_algType) { //TODO crude; use enums154 if (FitAlgorithm.RLD.equals(m_fitAlgorithm)) { 163 155 // RLD or triple integral fit 164 156 DoubleByReference z = new DoubleByReference(); -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/ICurveFitData.java
r7673 r7810 158 158 */ 159 159 public void setYFitted(double yFit[]); 160 161 /** 162 * Gets chi square target. 163 * 164 * @return targetted chisquare 165 */ 166 public double getChiSquareTarget(); 167 168 /** 169 * Sets chi square target 170 * 171 * @param chiSquare targetted chi square 172 */ 173 public void setChiSquareTarget(double chiSquareTarget); 174 175 176 /** 177 * Gets fitted chi square. 178 * 179 * @return fitted chisquare 180 */ 181 public double getChiSquare(); 182 183 /** 184 * Sets fitted chi square 185 * 186 * @param chiSquare fitted chi square 187 */ 188 public void setChiSquare(double chiSquare); 160 189 } -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/ICurveFitter.java
r7673 r7810 41 41 */ 42 42 public interface ICurveFitter { 43 43 44 /** 45 * Specifies fitting algorithm. 46 */ 47 public enum FitAlgorithm { 48 RLD, LMA, RLD_LMA 49 } 50 44 51 /** 45 52 * Specifies curves that this fits. … … 53 60 */ 54 61 public double DEFAULT_X_INC = 1.0f; 62 63 /** 64 * Get fitting algorithm. 65 * 66 * @return fitting algorithm 67 */ 68 public FitAlgorithm getFitAlgorithm(); 69 70 /** 71 * Set fitting algorithm. 72 * 73 * @param fitting algorithm 74 */ 75 public void setFitAlgorithm(FitAlgorithm algorithm); 55 76 56 77 /** … … 132 153 * @return status code 133 154 */ 134 public int fitData(ICurveFitData[] data, int start, int stop); 155 public int fitData(ICurveFitData[] data, int start, int stop); 135 156 } -
trunk/projects/curve-fitter/src/main/java/loci/curvefitter/SLIMCurveFitter.java
r7700 r7810 55 55 */ 56 56 public class SLIMCurveFitter extends AbstractCurveFitter { 57 public enum AlgorithmType { RLD, LMA, RLD_LMA };58 59 57 private static boolean s_libraryLoaded = false; 60 58 private static boolean s_libraryOnPath = false; 61 59 private static CLibrary s_library; 62 63 private AlgorithmType m_algorithmType;64 60 65 61 /** … … 182 178 ); 183 179 184 /**185 * Create a curve fitter for a given algorithm type.186 *187 * @param algorithmType188 */189 public SLIMCurveFitter(AlgorithmType algorithmType) {190 m_algorithmType = algorithmType;191 }192 193 /**194 * Create the default curve fitter, which uses RLD.195 *196 */197 public SLIMCurveFitter() {198 m_algorithmType = AlgorithmType.RLD;199 }200 201 202 180 @Override 203 181 public int fitData(ICurveFitData[] dataArray, int start, int stop) { … … 239 217 240 218 boolean[] free = m_free.clone(); 241 if ( AlgorithmType.RLD.equals(m_algorithmType)) {219 if (FitAlgorithm.RLD.equals(m_fitAlgorithm)) { 242 220 // pure RLD (versus RLD followed by LMA) has no way to fix 243 221 // parameters … … 251 229 DoubleByReference chiSquare = new DoubleByReference(); 252 230 double chiSquareTarget = 1.0; //TODO s/b specified incoming 253 254 if ( AlgorithmType.RLD.equals(m_algorithmType) || AlgorithmType.RLD_LMA.equals(m_algorithmType)) {231 232 if (FitAlgorithm.RLD.equals(m_fitAlgorithm) || FitAlgorithm.RLD_LMA.equals(m_fitAlgorithm)) { 255 233 // RLD or triple integral fit 256 234 DoubleByReference z = new DoubleByReference(); … … 299 277 } 300 278 } 301 302 if ( AlgorithmType.LMA.equals(m_algorithmType) || AlgorithmType.RLD_LMA.equals(m_algorithmType)) {279 280 if (FitAlgorithm.LMA.equals(m_fitAlgorithm) || FitAlgorithm.RLD_LMA.equals(m_fitAlgorithm)) { 303 281 // LMA fit 304 282 for (ICurveFitData data: dataArray) { … … 331 309 double[] chiSquare = new double[1]; 332 310 double chiSquareTarget = 1.0; //TODO s/b specified incoming 333 334 if ( AlgorithmType.RLD.equals(m_algorithmType) || AlgorithmType.RLD_LMA.equals(m_algorithmType)) {311 312 if (FitAlgorithm.RLD.equals(m_fitAlgorithm) || FitAlgorithm.RLD_LMA.equals(m_fitAlgorithm)) { 335 313 // RLD or triple integral fit 336 314 … … 382 360 } 383 361 384 if ( AlgorithmType.LMA.equals(m_algorithmType) || AlgorithmType.RLD_LMA.equals(m_algorithmType)) {362 if (FitAlgorithm.LMA.equals(m_fitAlgorithm) || FitAlgorithm.RLD_LMA.equals(m_fitAlgorithm)) { 385 363 // LMA fit 386 364 for (ICurveFitData data: dataArray) {
Note: See TracChangeset
for help on using the changeset viewer.