Skip to content

Commit

Permalink
feat: fix typo and package name (#834)
Browse files Browse the repository at this point in the history
* feat: fix typo and package name
* test: added main function as test
  • Loading branch information
asmfstatoil authored Nov 3, 2023
1 parent d04112a commit e5aa801
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* DataSmoothor.java
* DataSmoother.java
*
* Created on 31. januar 2001, 21:27
*/

package neqsim.statistics.dataAnalysis.dataSmoothing;
package neqsim.statistics.dataanalysis.datasmoothing;

import Jama.Matrix;

Expand All @@ -16,20 +16,22 @@
* @author Even Solbraa
* @version $Id: $Id
*/
public class DataSmoothor {
double[] nonSmoothedNumbers, smoothedNumbers, cCoef;
int nl = 0, nr = 0, ld = 0, m = 0, mm = 0, imj = 0, kk = 0;
public class DataSmoother {
double[] nonSmoothedNumbers;
double[] smoothedNumbers;
double[] cCoef;
int nl = 0;
int nr = 0;
int ld = 0;
int m = 0;
int mm = 0;
int imj = 0;
int kk = 0;
int[] index;
double[][] a;
double[] b;
double sum = 0, fac = 0;

/**
* <p>
* Constructor for DataSmoothor.
* </p>
*/
public DataSmoothor() {}
double sum = 0;
double fac = 0;

/**
* <p>
Expand All @@ -42,7 +44,7 @@ public DataSmoothor() {}
* @param ld a int
* @param m a int
*/
public DataSmoothor(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
public DataSmoother(double[] nonSmoothedNumbers, int nl, int nr, int ld, int m) {
this.nonSmoothedNumbers = new double[nonSmoothedNumbers.length];
this.smoothedNumbers = new double[nonSmoothedNumbers.length];
this.cCoef = new double[nonSmoothedNumbers.length];
Expand Down Expand Up @@ -157,21 +159,4 @@ public void setSmoothedNumbers() {
public double[] getSmoothedNumbers() {
return smoothedNumbers;
}

/**
* <p>
* main.
* </p>
*
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
double[] numbers = {10, 11, 12, 13, 14, 15, 15.5, 15, 19, 14, 14, 13, 12, 12, 11, 10, 9, 8};
DataSmoothor test = new DataSmoothor(numbers, 3, 3, 0, 4);
Matrix data = new Matrix(test.getSmoothedNumbers(), 1);
data.print(10, 2);
test.runSmoothing();
data = new Matrix(test.getSmoothedNumbers(), 1);
data.print(10, 2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package neqsim.statistics.experimentalSampleCreation.sampleCreator.wettedWallColumnSampleCreator;

import Jama.Matrix;
import neqsim.statistics.dataAnalysis.dataSmoothing.DataSmoothor;
import neqsim.statistics.dataanalysis.datasmoothing.DataSmoother;
import neqsim.statistics.experimentalEquipmentData.ExperimentalEquipmentData;
import neqsim.statistics.experimentalEquipmentData.wettedWallColumnData.WettedWallColumnData;
import neqsim.statistics.experimentalSampleCreation.readDataFromFile.wettedWallColumnReader.WettedWallColumnDataObject;
Expand All @@ -26,7 +26,6 @@
*/
public class WettedWallColumnSampleCreator extends SampleCreator {
WettedWallDataReader reader;
DataSmoothor smoothor;
double[] time;
double[] pressure;
double[] inletLiquidTemperature;
Expand Down Expand Up @@ -115,33 +114,33 @@ public void smoothData() {
Matrix data = new Matrix(pressure, 1);
data.print(10, 2);

smoothor = new DataSmoothor(pressure, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedPressure = smoothor.getSmoothedNumbers();
DataSmoother smoother = new DataSmoother(pressure, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedPressure = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(inletLiquidTemperature, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedInletLiquidTemperature = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(inletLiquidTemperature, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedInletLiquidTemperature = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(outletLiquidTemperature, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedOutletLiquidTemperature = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(outletLiquidTemperature, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedOutletLiquidTemperature = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(columnWallTemperature, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedColumnWallTemperature = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(columnWallTemperature, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedColumnWallTemperature = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(inletTotalGasFlowRate, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedInletTotalGasFlowRate = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(inletTotalGasFlowRate, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedInletTotalGasFlowRate = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(co2SupplyRate, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedCo2SupplyRate = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(co2SupplyRate, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedCo2SupplyRate = smoother.getSmoothedNumbers();

smoothor = new DataSmoothor(inletLiquidFlowRate, 10, 10, 0, 2);
smoothor.runSmoothing();
smoothedInletLiquidFlowRate = smoothor.getSmoothedNumbers();
smoother = new DataSmoother(inletLiquidFlowRate, 10, 10, 0, 2);
smoother.runSmoothing();
smoothedInletLiquidFlowRate = smoother.getSmoothedNumbers();

data = new Matrix(smoothedPressure, 1);
data.print(10, 2);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package neqsim.statistics.dataanalysis.datasmoothing;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class DataSmootherTest {

@Test
void testgetSmoothedNumbers() {
double[] numbers = {10, 11, 12, 13, 14, 15, 15.5, 15, 19, 14, 14, 13, 12, 12, 11, 10, 9, 8};
DataSmoother test = new DataSmoother(numbers, 3, 3, 0, 4);
Assertions.assertArrayEquals(numbers, test.getSmoothedNumbers());

double[] expected = {10.000000, 11.000000, 12.000000, 12.567099567099579, 13.567099567099582,
14.556277056277072, 15.305194805194823, 15.389610389610409, 16.66233766233768,
17.149350649350666, 13.350649350649375, 13.627705627705646, 12.432900432900452,
11.89177489177491, 11.541125541125552, 10.000000, 9.000000, 8.000000};
test.runSmoothing();
Assertions.assertArrayEquals(expected, test.getSmoothedNumbers());
}
}

0 comments on commit e5aa801

Please sign in to comment.