Skip to content
Snippets Groups Projects
Commit d24021a7 authored by Guylaine Prat's avatar Guylaine Prat
Browse files

Add final for methods arg; private when possible

parent c1f0659a
No related branches found
No related tags found
No related merge requests found
Showing
with 81 additions and 63 deletions
......@@ -127,6 +127,7 @@ public class AdjustmentContext {
public Optimum estimateFreeParameters(final Collection<String> ruggedNameList, final int maxEvaluations,
final double parametersConvergenceThreshold)
throws RuggedException {
try {
final List<Rugged> ruggedList = new ArrayList<Rugged>();
......
......@@ -209,11 +209,9 @@ public class GroundOptimizationProblemBuilder extends OptimizationProblemBuilder
}
l += 2;
}
}
// inverse loc result with Jacobian for all reference points
return new Pair<RealVector, RealMatrix>(value, jacobian);
......
......@@ -41,6 +41,7 @@ public class LeastSquareAdjuster {
*/
// TODO GP public protected ???
LeastSquareAdjuster(final OptimizerId optimizerID) {
this.optimizerID = optimizerID;
this.adjuster = this.selectOptimizer();
}
......@@ -48,6 +49,7 @@ public class LeastSquareAdjuster {
/** Default constructor with Gauss Newton with QR decomposition algorithm.*/
// TODO GP public protected ???
LeastSquareAdjuster() {
this.optimizerID = OptimizerId.GAUSS_NEWTON_QR;
this.adjuster = this.selectOptimizer();
}
......
......@@ -44,6 +44,7 @@ public class Noise {
* @param dimension noise dimension
*/
public Noise(final int distribution, final int dimension) {
this.mean = new double[dimension];
this.standardDeviation = new double[dimension];
Noise.dimension = dimension;
......
......@@ -49,6 +49,7 @@ public class Observables {
* @param nbModels number of viewing models to map
*/
public Observables(final int nbModels) {
this.groundMappings = new LinkedHashMap<String, SensorToGroundMapping>();
this.interMappings = new LinkedHashMap<String, SensorToSensorMapping>();
this.nbModels = nbModels;
......@@ -58,6 +59,7 @@ public class Observables {
* @param interMapping sensor to sensor mapping
*/
public void addInterMapping(final SensorToSensorMapping interMapping) {
interMappings.put(this.createKey(interMapping), interMapping);
}
......@@ -66,6 +68,7 @@ public class Observables {
* @param groundMapping sensor to ground mapping
*/
public void addGroundMapping(final SensorToGroundMapping groundMapping) {
groundMappings.put(this.createKey(groundMapping), groundMapping);
}
......@@ -83,6 +86,7 @@ public class Observables {
* @return selected ground mapping or null if sensor is not found
*/
public SensorToGroundMapping getGroundMapping(final String ruggedName, final String sensorName) {
final SensorToGroundMapping mapping = this.groundMappings.get(ruggedName + RUGGED_SENSOR_SEPARATOR + sensorName);
return mapping;
}
......
......@@ -55,6 +55,7 @@ public class SensorMapping<T> {
* @param ruggedName name of the Rugged to which mapping applies
*/
public SensorMapping(final String sensorName, final String ruggedName) {
this.sensorName = sensorName;
this.ruggedName = ruggedName;
this.mapping = new LinkedHashMap<SensorPixel, T>();
......
......@@ -54,6 +54,7 @@ public class SensorToGroundMapping {
* @param sensorName name of the sensor to which mapping applies
*/
public SensorToGroundMapping(final String ruggedName, final String sensorName) {
this.sensorName = sensorName;
this.groundMapping = new SensorMapping<GeodeticPoint>(sensorName, ruggedName);
}
......
......@@ -251,6 +251,9 @@ public class GroundRefining extends Refining {
*/
private double[] computeGSD(final LineSensor lineSensor) throws RuggedException {
// Get number of line
int dimension = pleiadesViewingModel.getDimension();
// Get position
Vector3D position = lineSensor.getPosition(); // This returns a zero vector since we set the relative position of the sensor w.r.T the satellite to 0.
......@@ -258,26 +261,26 @@ public class GroundRefining extends Refining {
AbsoluteDate firstLineDate = lineSensor.getDate(0);
Vector3D los = lineSensor.getLOS(firstLineDate,0);
GeodeticPoint upLeftPoint = rugged.directLocation(firstLineDate, position, los);
los = lineSensor.getLOS(firstLineDate,pleiadesViewingModel.dimension-1);
los = lineSensor.getLOS(firstLineDate,dimension-1);
// Get center geodetic point
AbsoluteDate lineDate = lineSensor.getDate(pleiadesViewingModel.dimension/2);
los = lineSensor.getLOS(lineDate,pleiadesViewingModel.dimension/2);
AbsoluteDate lineDate = lineSensor.getDate(dimension/2);
los = lineSensor.getLOS(lineDate,dimension/2);
// Get upper right geodetic point
int pixelPosition = pleiadesViewingModel.dimension-1;
int pixelPosition = dimension-1;
los = lineSensor.getLOS(firstLineDate,pixelPosition);
GeodeticPoint upperRight = rugged.directLocation(firstLineDate, position, los);
// Get lower left geodetic point
AbsoluteDate lineDate_y = lineSensor.getDate(pleiadesViewingModel.dimension-1);
AbsoluteDate lineDate_y = lineSensor.getDate(dimension-1);
los = lineSensor.getLOS(lineDate_y,0);
GeodeticPoint lowerLeft = rugged.directLocation(lineDate_y, position, los);
double gsdX = DistanceTools.computeDistanceInMeter(upLeftPoint.getLongitude(), upLeftPoint.getLatitude(),
upperRight.getLongitude() , upperRight.getLatitude())/pleiadesViewingModel.dimension;
upperRight.getLongitude() , upperRight.getLatitude())/dimension;
double gsdY = DistanceTools.computeDistanceInMeter(upLeftPoint.getLongitude(), upLeftPoint.getLatitude(),
lowerLeft.getLongitude() , lowerLeft.getLatitude())/pleiadesViewingModel.dimension;
lowerLeft.getLongitude() , lowerLeft.getLatitude())/dimension;
double [] gsd = {gsdX, gsdY};
return gsd;
......@@ -295,7 +298,7 @@ public class GroundRefining extends Refining {
* Set the Pleiades viewing model
* @param pleiadesViewingModel Pleiades viewing model to set
*/
public void setPleiadesViewingModel(PleiadesViewingModel pleiadesViewingModel) {
public void setPleiadesViewingModel(final PleiadesViewingModel pleiadesViewingModel) {
this.pleiadesViewingModel = pleiadesViewingModel;
}
......@@ -311,7 +314,7 @@ public class GroundRefining extends Refining {
* Set the orbit model
* @param orbitmodel the orbit model to set
*/
public void setOrbitmodel(OrbitModel orbitmodel) {
public void setOrbitmodel(final OrbitModel orbitmodel) {
this.orbitmodel = orbitmodel;
}
......@@ -335,7 +338,7 @@ public class GroundRefining extends Refining {
* Set the Rugged instance
* @param rugged the Rugged instance to set
*/
public void setRugged(Rugged rugged) {
public void setRugged(final Rugged rugged) {
this.rugged = rugged;
}
......@@ -343,7 +346,7 @@ public class GroundRefining extends Refining {
* Set the measures
* @param measures the measures to set
*/
public void setMeasures(GroundMeasureGenerator measures) {
public void setMeasures(final GroundMeasureGenerator measures) {
this.measures = measures;
}
}
......
......@@ -354,12 +354,18 @@ public class InterRefining extends Refining {
*/
private double computeDistance(final LineSensor lineSensorA, final LineSensor lineSensorB) throws RuggedException {
// Get number of line of sensors
int dimensionA = pleiadesViewingModelA.getDimension();
int dimensionB = pleiadesViewingModelB.getDimension();
Vector3D positionA = lineSensorA.getPosition();
// This returns a zero vector since we set the relative position of the sensor w.r.T the satellite to 0.
AbsoluteDate lineDateA = lineSensorA.getDate(pleiadesViewingModelA.dimension/2);
Vector3D losA = lineSensorA.getLOS(lineDateA,pleiadesViewingModelA.dimension/2);
AbsoluteDate lineDateA = lineSensorA.getDate(dimensionA/2);
Vector3D losA = lineSensorA.getLOS(lineDateA,dimensionA/2);
GeodeticPoint centerPointA = ruggedA.directLocation(lineDateA, positionA, losA);
System.out.format(Locale.US, "\ncenter geodetic position A : φ = %8.10f °, λ = %8.10f °, h = %8.3f m%n",
FastMath.toDegrees(centerPointA.getLatitude()),
......@@ -369,8 +375,8 @@ public class InterRefining extends Refining {
Vector3D positionB = lineSensorB.getPosition();
// This returns a zero vector since we set the relative position of the sensor w.r.T the satellite to 0.
AbsoluteDate lineDateB = lineSensorB.getDate(pleiadesViewingModelB.dimension/2);
Vector3D losB = lineSensorB.getLOS(lineDateB,pleiadesViewingModelB.dimension/2);
AbsoluteDate lineDateB = lineSensorB.getDate(dimensionB/2);
Vector3D losB = lineSensorB.getLOS(lineDateB,dimensionB/2);
GeodeticPoint centerPointB = ruggedB.directLocation(lineDateB, positionB, losB);
System.out.format(Locale.US, "center geodetic position B : φ = %8.10f °, λ = %8.10f °, h = %8.3f m%n",
FastMath.toDegrees(centerPointB.getLatitude()),
......@@ -384,8 +390,8 @@ public class InterRefining extends Refining {
FastMath.toDegrees(firstPointB.getLatitude()),
FastMath.toDegrees(firstPointB.getLongitude()),firstPointB.getAltitude());
lineDateB = lineSensorB.getDate(pleiadesViewingModelB.dimension-1);
losB = lineSensorB.getLOS(lineDateB,pleiadesViewingModelB.dimension-1);
lineDateB = lineSensorB.getDate(dimensionB-1);
losB = lineSensorB.getLOS(lineDateB,dimensionB-1);
GeodeticPoint lastPointB = ruggedB.directLocation(lineDateB, positionB, losB);
System.out.format(Locale.US, "last geodetic position B : φ = %8.10f °, λ = %8.10f °, h = %8.3f m%n",
FastMath.toDegrees(lastPointB.getLatitude()),
......@@ -407,8 +413,7 @@ public class InterRefining extends Refining {
/**
* @param pleiadesViewingModelA the pleiadesViewingModelA to set
*/
public void
setPleiadesViewingModelA(PleiadesViewingModel pleiadesViewingModelA) {
public void setPleiadesViewingModelA(final PleiadesViewingModel pleiadesViewingModelA) {
this.pleiadesViewingModelA = pleiadesViewingModelA;
}
......@@ -422,8 +427,7 @@ public class InterRefining extends Refining {
/**
* @param pleiadesViewingModelB the pleiadesViewingModelB to set
*/
public void
setPleiadesViewingModelB(PleiadesViewingModel pleiadesViewingModelB) {
public void setPleiadesViewingModelB(final PleiadesViewingModel pleiadesViewingModelB) {
this.pleiadesViewingModelB = pleiadesViewingModelB;
}
......@@ -437,7 +441,7 @@ public class InterRefining extends Refining {
/**
* @param orbitmodelA the orbitmodelA to set
*/
public void setOrbitmodelA(OrbitModel orbitmodelA) {
public void setOrbitmodelA(final OrbitModel orbitmodelA) {
this.orbitmodelA = orbitmodelA;
}
......@@ -451,7 +455,7 @@ public class InterRefining extends Refining {
/**
* @param orbitmodelB the orbitmodelB to set
*/
public void setOrbitmodelB(OrbitModel orbitmodelB) {
public void setOrbitmodelB(final OrbitModel orbitmodelB) {
this.orbitmodelB = orbitmodelB;
}
......@@ -479,7 +483,7 @@ public class InterRefining extends Refining {
/**
* @param ruggedA the ruggedA to set
*/
public void setRuggedA(Rugged ruggedA) {
public void setRuggedA(final Rugged ruggedA) {
this.ruggedA = ruggedA;
}
......@@ -501,14 +505,14 @@ public class InterRefining extends Refining {
/**
* @param ruggedB the ruggedB to set
*/
public void setRuggedB(Rugged ruggedB) {
public void setRuggedB(final Rugged ruggedB) {
this.ruggedB = ruggedB;
}
/**
* @param measures the measures to set
*/
public void setMeasures(InterMeasureGenerator measures) {
public void setMeasures(final InterMeasureGenerator measures) {
this.measures = measures;
}
}
......@@ -64,8 +64,8 @@ public class Refining {
* @param factorValue scale factor
* @throws RuggedException
*/
public void applyDisruptions(Rugged rugged, String sensorName,
double rollValue, double pitchValue, double factorValue)
public void applyDisruptions(final Rugged rugged, final String sensorName,
final double rollValue, final double pitchValue, final double factorValue)
throws OrekitException, RuggedException {
final String commonFactorName = "factor";
......@@ -98,9 +98,9 @@ public class Refining {
* @return ground measures generator (sensor to ground mapping)
* @throws RuggedException
*/
public GroundMeasureGenerator generatePoints(int lineSampling, int pixelSampling,
Rugged rugged, String sensorName,
int dimension) throws RuggedException {
public GroundMeasureGenerator generatePoints(final int lineSampling, final int pixelSampling,
final Rugged rugged, final String sensorName,
final int dimension) throws RuggedException {
GroundMeasureGenerator measures = new GroundMeasureGenerator(rugged, sensorName, dimension);
......@@ -126,9 +126,10 @@ public class Refining {
* @return inter measures generator (sensor to sensor mapping)
* @throws RuggedException
*/
public InterMeasureGenerator generatePoints(int lineSampling, int pixelSampling,
Rugged ruggedA, String sensorNameA, int dimensionA,
Rugged ruggedB, String sensorNameB, int dimensionB) throws RuggedException {
public InterMeasureGenerator generatePoints(final int lineSampling, final int pixelSampling,
final Rugged ruggedA, final String sensorNameA, final int dimensionA,
final Rugged ruggedB, final String sensorNameB, final int dimensionB)
throws RuggedException {
// Outliers control
final double outlierValue = 1e+2;
......@@ -161,9 +162,9 @@ public class Refining {
* @return ground measures generator (sensor to ground mapping)
* @throws RuggedException
*/
public GroundMeasureGenerator generateNoisyPoints(int lineSampling, int pixelSampling,
Rugged rugged, String sensorName, int dimension,
Noise noise) throws RuggedException {
public GroundMeasureGenerator generateNoisyPoints(final int lineSampling, final int pixelSampling,
final Rugged rugged, final String sensorName, final int dimension,
final Noise noise) throws RuggedException {
// Generate ground measures
GroundMeasureGenerator measures = new GroundMeasureGenerator(rugged, sensorName, dimension);
......@@ -191,10 +192,10 @@ public class Refining {
* @return inter-measures generator (sensor to sensor mapping)
* @throws RuggedException
*/
public InterMeasureGenerator generateNoisyPoints(int lineSampling, int pixelSampling,
Rugged ruggedA, String sensorNameA, int dimensionA,
Rugged ruggedB, String sensorNameB, int dimensionB,
Noise noise) throws RuggedException {
public InterMeasureGenerator generateNoisyPoints(final int lineSampling, final int pixelSampling,
final Rugged ruggedA, final String sensorNameA, final int dimensionA,
final Rugged ruggedB, final String sensorNameB, final int dimensionB,
final Noise noise) throws RuggedException {
// Outliers control
final double outlierValue = 1.e+2;
......@@ -224,8 +225,8 @@ public class Refining {
* @param unit flag to know if distance is computed in meters (false) or with angular (true)
* @throws RuggedException
*/
public void computeMetrics(SensorToGroundMapping groundMapping,
Rugged rugged, boolean unit) throws RuggedException {
public void computeMetrics(final SensorToGroundMapping groundMapping,
final Rugged rugged, final boolean unit) throws RuggedException {
String stUnit = null;
if(unit) {
......@@ -246,9 +247,9 @@ public class Refining {
* @param unit flag to know if distance is computed in meters (false) or with angular (true)
* @throws RuggedException
*/
public void computeMetrics(SensorToSensorMapping interMapping,
Rugged ruggedA, Rugged ruggedB,
boolean unit) throws RuggedException {
public void computeMetrics(final SensorToSensorMapping interMapping,
final Rugged ruggedA, final Rugged ruggedB,
final boolean unit) throws RuggedException {
String stUnit = null;
if(unit) stUnit="degrees";
......@@ -266,7 +267,7 @@ public class Refining {
* @param isSelected flag to known if factor parameter is selected or not
* @throws RuggedException
*/
public void resetModel(Rugged rugged, String sensorName, boolean isSelected) throws RuggedException {
public void resetModel(final Rugged rugged, final String sensorName, final boolean isSelected) throws RuggedException {
final String commonFactorName = "factor";
......@@ -307,8 +308,8 @@ public class Refining {
* @param rugged Rugged instance
* @throws RuggedException
*/
public void optimization(int maxIterations, double convergenceThreshold,
Observables measures, Rugged rugged) throws RuggedException {
public void optimization(final int maxIterations, final double convergenceThreshold,
final Observables measures, final Rugged rugged) throws RuggedException {
System.out.format("Iterations max: %d\tconvergence threshold: %3.6e \n", maxIterations, convergenceThreshold);
......@@ -328,9 +329,9 @@ public class Refining {
* @param ruggeds Rugged instances A and B
* @throws RuggedException
*/
public void optimization(int maxIterations, double convergenceThreshold,
Observables measures,
Collection<Rugged> ruggeds) throws RuggedException {
public void optimization(final int maxIterations, final double convergenceThreshold,
final Observables measures,
final Collection<Rugged> ruggeds) throws RuggedException {
System.out.format("Iterations max: %d\tconvergence threshold: %3.6e \n", maxIterations, convergenceThreshold);
......@@ -361,8 +362,8 @@ public class Refining {
* @param factorValue scale factor
* @throws RuggedException
*/
public void paramsEstimation(Rugged rugged, String sensorName,
double rollValue, double pitchValue, double factorValue)
public void paramsEstimation(final Rugged rugged, final String sensorName,
final double rollValue, final double pitchValue, final double factorValue)
throws RuggedException {
final String commonFactorName = "factor";
......
......@@ -50,13 +50,14 @@ import org.orekit.errors.OrekitException;
public class PleiadesViewingModel {
/** intrinsic Pleiades parameters. */
public double fov = 1.65; // 20km - alt 694km
private double fov = 1.65; // 20km - alt 694km
// Number of line of the sensor
public int dimension = 40000;
private int dimension = 40000;
public double angle;
public LineSensor lineSensor;
public String date;
private double angle;
private LineSensor lineSensor;
private String date;
private String sensorName;
......@@ -156,9 +157,10 @@ public class PleiadesViewingModel {
return sensorName;
}
/** TODO GP add comments
/** Get the number of lines of the sensor
* @return the number of lines of the sensor
*/
public int getDimension() {
public int getDimension() {
return dimension;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment