From 5691c9b3b0a8b739b1085ffdc8534099e861b75b Mon Sep 17 00:00:00 2001
From: Guylaine Prat <guylaine.prat@c-s.fr>
Date: Wed, 15 Nov 2017 12:52:04 +0100
Subject: [PATCH] Update tutorials and add Junit tests (WIP)

---
 .gitignore                                    |    9 -
 ...nterSensorsOptimizationProblemBuilder.java |    2 +-
 .../java/org/orekit/rugged/api/Rugged.java    |    2 +-
 .../org/orekit/rugged/api/RuggedTest.java     |   41 +-
 .../org/orekit/rugged/utils/RefiningTest.java | 1245 ++++++++---------
 .../refiningPleiades/GroundRefining.java      |  177 ++-
 .../refiningPleiades/InterRefining.java       |  196 +--
 .../generators/InterMeasurementGenerator.java |   46 +-
 .../refiningPleiades/models/OrbitModel.java   |    3 +-
 9 files changed, 736 insertions(+), 985 deletions(-)

diff --git a/.gitignore b/.gitignore
index db7ba5eb..83eaec7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,12 +4,3 @@ bin
 .settings
 target
 
-/erreur.txt
-/erreurApresGraphivz.txt
-/erreurMvnSiteVO
-/listeWarningDeprecatedTest.txt
-/titi
-/toto
-/traceMvnFindbugs.txt
-/tutu
-/.gitignore
diff --git a/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java b/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java
index eccb7031..580b2fd0 100644
--- a/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java
+++ b/src/main/java/org/orekit/rugged/adjustment/InterSensorsOptimizationProblemBuilder.java
@@ -225,7 +225,7 @@ public class InterSensorsOptimizationProblemBuilder extends OptimizationProblemB
                         final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
 
                         final DerivativeStructure[] ilResult =
-                                ruggedB.distanceBetweenLOSDerivatives(lineSensorA, dateA, pixelA, scToBodyA,
+                                ruggedB.distanceBetweenLOSderivatives(lineSensorA, dateA, pixelA, scToBodyA,
                                                                       lineSensorB, dateB, pixelB, this.getGenerator());
 
                         if (ilResult == null) {
diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java
index fe1cf500..95f733ed 100644
--- a/src/main/java/org/orekit/rugged/api/Rugged.java
+++ b/src/main/java/org/orekit/rugged/api/Rugged.java
@@ -698,7 +698,7 @@ public class Rugged {
      * @exception RuggedException if frames cannot be computed at date
      * @see #distanceBetweenLOS(LineSensor, AbsoluteDate, double, SpacecraftToObservedBody, LineSensor, AbsoluteDate, double)
      */
-    public DerivativeStructure[] distanceBetweenLOSDerivatives(
+    public DerivativeStructure[] distanceBetweenLOSderivatives(
                                  final LineSensor sensorA, final AbsoluteDate dateA, final double pixelA,
                                  final SpacecraftToObservedBody scToBodyA,
                                  final LineSensor sensorB, final AbsoluteDate dateB, final double pixelB,
diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java
index 8fb83aa0..976e54b1 100644
--- a/src/test/java/org/orekit/rugged/api/RuggedTest.java
+++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java
@@ -74,7 +74,6 @@ import org.orekit.rugged.raster.TileUpdater;
 import org.orekit.rugged.raster.VolcanicConeElevationUpdater;
 import org.orekit.rugged.adjustment.measurements.Observables;
 import org.orekit.rugged.utils.DSGenerator;
-import org.orekit.rugged.utils.RefiningLiaisonMetrics;
 import org.orekit.rugged.utils.RefiningTest;
 import org.orekit.time.AbsoluteDate;
 import org.orekit.time.TimeScale;
@@ -1381,18 +1380,42 @@ public class RuggedTest {
         RefiningTest refiningTest = new RefiningTest();
         refiningTest.InitRefiningTest();
         
-        // Compute ground truth residuals
-        // ------------------------------
-        System.out.format("\n**** Ground truth residuals **** %n");
+        final SensorPixel realPixelA = new SensorPixel(2005.015883575199, 18004.968656395424);
+        final SensorPixel realPixelB = new SensorPixel(4798.487736488162, 13952.2195710654);
+
+        double[] distancesBetweenLOS = refiningTest.computeDistancesBetweenLOS(realPixelA, realPixelB);
         
-        RefiningLiaisonMetrics liaisonMetrics = refiningTest.computeLiaisonMetrics(refiningTest.getInterMapping(), refiningTest.getRuggedA(), refiningTest.getRuggedB());
+        double expectedDistanceBetweenLOS = 3.887643821673281; // 3.8880172668944164
+        double expectedDistanceToTheGround = 6368020.620436288; // 6368020.560101736
+        Assert.assertEquals(expectedDistanceBetweenLOS, distancesBetweenLOS[0], 1.e-2);
+        Assert.assertEquals(expectedDistanceToTheGround, distancesBetweenLOS[1], 5.e-1);
         
-        System.out.format("Max: %1.4e Mean: %1.4e %n",liaisonMetrics.getMaxResidual(),liaisonMetrics.getMeanResidual());
-        System.out.format("LOS distance Max: %1.4e Mean: %1.4e %n",liaisonMetrics.getLosMaxDistance(),liaisonMetrics.getLosMeanDistance());
-        System.out.format("Earth distance Max: %1.4e Mean: %1.4e %n",liaisonMetrics.getEarthMaxDistance(),liaisonMetrics.getEarthMeanDistance());
-
+        
+    }
+    
+    @Test
+    public void testDistanceBetweenLOSDerivatives() throws RuggedException {
+        
+//        try {
+            RefiningTest refiningTest = new RefiningTest();
+            refiningTest.InitRefiningTest();
+
+            final SensorPixel realPixelA = new SensorPixel(2005.015883575199, 18004.968656395424);
+            final SensorPixel realPixelB = new SensorPixel(4798.487736488162, 13952.2195710654);
+            double losDistance = 3.887643821673281;
+            double earthDistance = 6368020.620436288;
+
+            // TODO GP a debugger
+//            DerivativeStructure[] distancesBetweenLOSwithDS = refiningTest.computeDistancesBetweenLOSDerivatives(realPixelA, realPixelB, losDistance, earthDistance);
+
+//
+//        } catch (InvocationTargetException | NoSuchMethodException |
+//                SecurityException | IllegalAccessException | IllegalArgumentException e) {
+//            Assert.fail(e.getLocalizedMessage());
+//        }
     }
     
+    
     @Before
     public void setUp() throws OrekitException, URISyntaxException {
         TestUtils.clearFactories();
diff --git a/src/test/java/org/orekit/rugged/utils/RefiningTest.java b/src/test/java/org/orekit/rugged/utils/RefiningTest.java
index 94bc0a5e..f90feba7 100644
--- a/src/test/java/org/orekit/rugged/utils/RefiningTest.java
+++ b/src/test/java/org/orekit/rugged/utils/RefiningTest.java
@@ -1,22 +1,17 @@
 package org.orekit.rugged.utils;
 
 import java.io.File;
+import java.lang.reflect.InvocationTargetException;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
 
+import org.hipparchus.analysis.differentiation.DerivativeStructure;
 import org.hipparchus.geometry.euclidean.threed.Rotation;
 import org.hipparchus.geometry.euclidean.threed.RotationConvention;
 import org.hipparchus.geometry.euclidean.threed.RotationOrder;
 import org.hipparchus.geometry.euclidean.threed.Vector3D;
 import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
-import org.hipparchus.random.GaussianRandomGenerator;
-import org.hipparchus.random.UncorrelatedRandomVectorGenerator;
-import org.hipparchus.random.Well19937a;
 import org.hipparchus.util.FastMath;
 import org.junit.After;
 import org.junit.Assert;
@@ -27,7 +22,6 @@ import org.orekit.attitudes.TabulatedLofOffset;
 import org.orekit.attitudes.YawCompensation;
 import org.orekit.bodies.BodyShape;
 import org.orekit.bodies.CelestialBodyFactory;
-import org.orekit.bodies.GeodeticPoint;
 import org.orekit.data.DataProvidersManager;
 import org.orekit.data.DirectoryCrawler;
 import org.orekit.errors.OrekitException;
@@ -46,6 +40,7 @@ import org.orekit.propagation.SpacecraftState;
 import org.orekit.propagation.analytical.KeplerianPropagator;
 import org.orekit.propagation.numerical.NumericalPropagator;
 import org.orekit.rugged.TestUtils;
+import org.orekit.rugged.adjustment.InterSensorsOptimizationProblemBuilder;
 import org.orekit.rugged.adjustment.measurements.Observables;
 import org.orekit.rugged.adjustment.measurements.SensorToSensorMapping;
 import org.orekit.rugged.api.AlgorithmId;
@@ -55,8 +50,6 @@ import org.orekit.rugged.api.InertialFrameId;
 import org.orekit.rugged.api.Rugged;
 import org.orekit.rugged.api.RuggedBuilder;
 import org.orekit.rugged.errors.RuggedException;
-import org.orekit.rugged.errors.RuggedExceptionWrapper;
-import org.orekit.rugged.errors.RuggedMessages;
 import org.orekit.rugged.linesensor.LineDatation;
 import org.orekit.rugged.linesensor.LineSensor;
 import org.orekit.rugged.linesensor.LinearLineDatation;
@@ -83,17 +76,11 @@ public class RefiningTest {
     /** Pleiades viewing model B */
     PleiadesViewingModel pleiadesViewingModelB;
     
-    /** Orbit model corresponding to viewing model A */
-    OrbitModel orbitmodelA;
-
-    /** Orbit model corresponding to viewing model B */
-    OrbitModel orbitmodelB;
-
-    /** Sensor name A corresponding to viewing model A */
-    String sensorNameA;
-
-    /** Sensor name A corresponding to viewing model B */
-    String sensorNameB;
+    /** Line sensor A */
+    LineSensor lineSensorA;
+    
+    /** Line sensor B */
+    LineSensor lineSensorB;
 
     /** RuggedA's instance */
     Rugged ruggedA;
@@ -101,12 +88,6 @@ public class RefiningTest {
     /** RuggedB's instance */
     Rugged ruggedB;
 
-    /** Inter-measurements (between both viewing models) */
-    InterMeasurementGenerator measurements;
-    
-    /** Mapping from sensor A to sensor B. */
-    private SensorToSensorMapping interMapping;
-
 
     /** Initialize refining tests
      * @throws RuggedException
@@ -119,40 +100,37 @@ public class RefiningTest {
             
             // Initialize refining context
             // ---------------------------
-            this.sensorNameA = "SensorA";
+            String sensorNameA = "SensorA";
             final double incidenceAngleA = -5.0;
             final String dateA = "2016-01-01T11:59:50.0";
             this.pleiadesViewingModelA = new PleiadesViewingModel(sensorNameA, incidenceAngleA, dateA);
 
-            this.sensorNameB = "SensorB";
+            String sensorNameB = "SensorB";
             final double incidenceAngleB = 0.0;
             final String dateB = "2016-01-01T12:02:50.0";
             this.pleiadesViewingModelB = new PleiadesViewingModel(sensorNameB, incidenceAngleB, dateB);
 
-            this.orbitmodelA =  new OrbitModel();
-            this.orbitmodelB =  new OrbitModel();
+            OrbitModel orbitmodelA =  new OrbitModel();
+            OrbitModel orbitmodelB =  new OrbitModel();
 
             // Sensors's definition: creation of 2 Pleiades viewing models
             // -----------------------------------------------------------
             
             // 1/- Create First Pleiades Viewing Model A
-//            PleiadesViewingModel pleiadesViewingModelA = refining.getPleiadesViewingModelA();
             final AbsoluteDate minDateA =  pleiadesViewingModelA.getMinDate();
             final AbsoluteDate maxDateA =  pleiadesViewingModelA.getMaxDate();
             final AbsoluteDate refDateA = pleiadesViewingModelA.getDatationReference();
-            LineSensor lineSensorA =  pleiadesViewingModelA.getLineSensor();
-//            System.out.format(Locale.US, "Viewing model A - date min: %s max: %s ref: %s %n", minDateA, maxDateA, refDateA);
+            this.lineSensorA =  pleiadesViewingModelA.getLineSensor();
 
             // ----Satellite position, velocity and attitude: create orbit model A
-//            OrbitModel orbitmodelA = refining.getOrbitmodelA();
             BodyShape earthA = TestUtils.createEarth();
             NormalizedSphericalHarmonicsProvider gravityFieldA = TestUtils.createGravityField();
             Orbit orbitA  = orbitmodelA.createOrbit(gravityFieldA.getMu(), refDateA);
 
             // ----If no LOF Transform Attitude Provider is Nadir Pointing Yaw Compensation
             final double [] rollPoly = {0.0,0.0,0.0};
-            double[] pitchPoly = {0.025,0.0};
-            double[] yawPoly = {0.0,0.0,0.0};
+            final double[] pitchPoly = {0.025,0.0};
+            final double[] yawPoly = {0.0,0.0,0.0};
             orbitmodelA.setLOFTransform(rollPoly, pitchPoly, yawPoly, minDateA);
 
             // ----Satellite attitude
@@ -160,18 +138,9 @@ public class RefiningTest {
             int nbQPoints = 2;
 
             // ----Position and velocities
-//            PVCoordinates PVA = orbitA.getPVCoordinates(earthA.getBodyFrame());
             List<TimeStampedPVCoordinates> satellitePVListA = orbitmodelA.orbitToPV(orbitA, earthA, minDateA.shiftedBy(-0.0), maxDateA.shiftedBy(+0.0), 0.25);
             int nbPVPoints = 8;
 
-            // ----Convert frame and coordinates type in one call
-//            GeodeticPoint gpA = earthA.transform(PVA.getPosition(), earthA.getBodyFrame(), orbitA.getDate());
-
-//            System.out.format(Locale.US, "(A) Geodetic Point at date %s : φ = %8.10f °, λ = %8.10f %n",
-//                              orbitA.getDate().toString(),
-//                              FastMath.toDegrees(gpA.getLatitude()),
-//                              FastMath.toDegrees(gpA.getLongitude()));
-
             // Rugged A initialization
             // ---------------------
             RuggedBuilder ruggedBuilderA = new RuggedBuilder();
@@ -191,14 +160,11 @@ public class RefiningTest {
             this.ruggedA = ruggedBuilderA.build();
 
 
-
             // 2/- Create Second Pleiades Viewing Model
-//            PleiadesViewingModel pleiadesViewingModelB = refining.getPleiadesViewingModelB();
             final AbsoluteDate minDateB =  pleiadesViewingModelB.getMinDate();
             final AbsoluteDate maxDateB =  pleiadesViewingModelB.getMaxDate();
             final AbsoluteDate refDateB = pleiadesViewingModelB.getDatationReference();
-            LineSensor lineSensorB =  pleiadesViewingModelB.getLineSensor();
-//            System.out.format(Locale.US, "Viewing model B - date min: %s max: %s ref: %s  %n", minDateB, maxDateB, refDateB);
+            this.lineSensorB =  pleiadesViewingModelB.getLineSensor();
 
             // ----Satellite position, velocity and attitude: create orbit model B
             BodyShape earthB = TestUtils.createEarth();
@@ -209,14 +175,7 @@ public class RefiningTest {
             List<TimeStampedAngularCoordinates> satelliteQListB = orbitmodelB.orbitToQ(orbitB, earthB, minDateB.shiftedBy(-0.0), maxDateB.shiftedBy(+0.0), 0.25);
 
             // ----Position and velocities
-//            PVCoordinates PVB = orbitB.getPVCoordinates(earthB.getBodyFrame());
             List<TimeStampedPVCoordinates> satellitePVListB = orbitmodelB.orbitToPV(orbitB, earthB, minDateB.shiftedBy(-0.0), maxDateB.shiftedBy(+0.0), 0.25);
-//            GeodeticPoint gpB = earthB.transform(PVB.getPosition(), earthB.getBodyFrame(), orbitB.getDate());
-
-//            System.out.format(Locale.US, "(B) Geodetic Point at date %s : φ = %8.10f °, λ = %8.10f %n",orbitA.getDate().toString(),
-//                              FastMath.toDegrees(gpB.getLatitude()),
-//                              FastMath.toDegrees(gpB.getLongitude()));
-//
 
             // Rugged B initialization
             // ---------------------
@@ -236,17 +195,9 @@ public class RefiningTest {
 
             this.ruggedB = ruggedBuilderB.build();
 
-            // Compute distance between LOS
-            // -----------------------------
-            double distance = computeDistanceBetweenLOS(lineSensorA, lineSensorB);
-            System.out.format("distance %f meters %n",distance);
-
-
             // Initialize disruptions:
             // -----------------------
-
             // Introduce rotations around instrument axes (roll and pitch translations, scale factor)
-            System.out.format("\n**** Add disruptions on both acquisitions (A,B): roll and pitch rotations, scale factor **** %n");
             double rollValueA =  FastMath.toRadians(0.004);
             double pitchValueA = FastMath.toRadians(0.0008);
             double rollValueB =  FastMath.toRadians(-0.004);
@@ -254,44 +205,10 @@ public class RefiningTest {
             double factorValue = 1.0;
 
             // Apply disruptions on physical model (acquisition A)
-            applyDisruptions(this.ruggedA,this.sensorNameA, rollValueA, pitchValueA, factorValue);
+            applyDisruptions(this.ruggedA, sensorNameA, rollValueA, pitchValueA, factorValue);
             
             // Apply disruptions on physical model (acquisition B)
-            applyDisruptions(this.ruggedB,this.sensorNameB, rollValueB, pitchValueB, factorValue);
-
-
-            // Generate measurements (observations) from physical model disrupted
-            // ------------------------------------------------------------------
-            int lineSampling = 1000;
-            int pixelSampling = 1000;
-
-            // Noise definition
-            // distribution: gaussian(0), vector dimension: 2
-            final Noise noise = new Noise(0,2);
-            // {pixelA mean, pixelB mean}
-            final double[] mean = {5.0,0.0};
-            // {pixelB std, pixelB std}
-            final double[] standardDeviation = {0.1,0.1};
-
-            noise.setMean(mean);
-            noise.setStandardDeviation(standardDeviation);
-
-//            System.out.format("\tSensor A mean: %f std %f %n",mean[0],standardDeviation[0]);
-//            System.out.format("\tSensor B mean: %f std %f %n",mean[1],standardDeviation[1]);
-
-            InterMeasurementGenerator measurements = generateNoisyPoints(lineSampling, pixelSampling,
-                                                                          ruggedA, sensorNameA,
-                                                                          pleiadesViewingModelA.getDimension(),
-                                                                          ruggedB, sensorNameB,
-                                                                          pleiadesViewingModelB.getDimension(),
-                                                                          noise);
-            this.interMapping = measurements.getInterMapping();
-
-//            // Compute ground truth residuals
-//            // ------------------------------
-//            System.out.format("\n**** Ground truth residuals **** %n");
-//            computeLiaisonMetrics(this.interMapping, ruggedA, ruggedB);
-            
+            applyDisruptions(this.ruggedB, sensorNameB, rollValueB, pitchValueB, factorValue);
 
         } catch (OrekitException oe) {
             Assert.fail(oe.getLocalizedMessage());
@@ -301,188 +218,188 @@ public class RefiningTest {
     }
     
     
-    /** Estimate distance between LOS
-     * @param lineSensorA line sensor A
-     * @param lineSensorB line sensor B
-     * @return GSD
-     */
-    private double computeDistanceBetweenLOS(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(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()),
-                          FastMath.toDegrees(centerPointA.getLongitude()),centerPointA.getAltitude());
-
-
-        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(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()),
-                          FastMath.toDegrees(centerPointB.getLongitude()),centerPointB.getAltitude());
-
-
-        lineDateB = lineSensorB.getDate(0);
-        losB = lineSensorB.getLOS(lineDateB,0);
-        GeodeticPoint firstPointB = ruggedB.directLocation(lineDateB, positionB, losB);
-        System.out.format(Locale.US, "first geodetic position B : φ = %8.10f °, λ = %8.10f °, h = %8.3f m%n",
-                          FastMath.toDegrees(firstPointB.getLatitude()),
-                          FastMath.toDegrees(firstPointB.getLongitude()),firstPointB.getAltitude());
-
-        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()),
-                          FastMath.toDegrees(lastPointB.getLongitude()),lastPointB.getAltitude());
-
-//        final Vector3D p1 = new Vector3D(centerPointA.getLatitude(), centerPointA.getLongitude()); //
-//        final Vector3D p2 = new Vector3D(centerPointB.getLatitude(), centerPointB.getLongitude());
-//        double distance =  Constants.WGS84_EARTH_EQUATORIAL_RADIUS * Vector3D.angle(p1, p2);
-
-        return computeDistanceInMeter(centerPointA.getLongitude(), centerPointA.getLatitude(), centerPointB.getLongitude(), centerPointB.getLatitude());
-    }
+//    /** Estimate distance between LOS
+//     * @param lineSensorA line sensor A
+//     * @param lineSensorB line sensor B
+//     * @return GSD
+//     */
+//    private double computeDistanceBetweenLOS(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(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()),
+//                          FastMath.toDegrees(centerPointA.getLongitude()),centerPointA.getAltitude());
+//
+//
+//        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(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()),
+//                          FastMath.toDegrees(centerPointB.getLongitude()),centerPointB.getAltitude());
+//
+//
+//        lineDateB = lineSensorB.getDate(0);
+//        losB = lineSensorB.getLOS(lineDateB,0);
+//        GeodeticPoint firstPointB = ruggedB.directLocation(lineDateB, positionB, losB);
+//        System.out.format(Locale.US, "first geodetic position B : φ = %8.10f °, λ = %8.10f °, h = %8.3f m%n",
+//                          FastMath.toDegrees(firstPointB.getLatitude()),
+//                          FastMath.toDegrees(firstPointB.getLongitude()),firstPointB.getAltitude());
+//
+//        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()),
+//                          FastMath.toDegrees(lastPointB.getLongitude()),lastPointB.getAltitude());
+//
+////        final Vector3D p1 = new Vector3D(centerPointA.getLatitude(), centerPointA.getLongitude()); //
+////        final Vector3D p2 = new Vector3D(centerPointB.getLatitude(), centerPointB.getLongitude());
+////        double distance =  Constants.WGS84_EARTH_EQUATORIAL_RADIUS * Vector3D.angle(p1, p2);
+//
+//        return computeDistanceInMeter(centerPointA.getLongitude(), centerPointA.getLatitude(), centerPointB.getLongitude(), centerPointB.getLatitude());
+//    }
     
-    /** Compute a geodetic distance in meters between 2 geodetic points (long1, lat1) and point (long2, lat2).
-     * @param long1 Longitude of first geodetic point (rad)
-     * @param lat1 Latitude of first geodetic point (rad)
-     * @param long2 Longitude of second geodetic point (rad)
-     * @param lat2 Latitude of second geodetic point (rad)
-     * @return distance in meters
-     */
-    public static double computeDistanceInMeter(final double long1, final double lat1,
-                                                final double long2, final double lat2) {
-
-        // get vectors on unit sphere from angular coordinates
-        final Vector3D p1 = new Vector3D(lat1, long1); //
-        final Vector3D p2 = new Vector3D(lat2, long2);
-        final double distance =  Constants.WGS84_EARTH_EQUATORIAL_RADIUS * Vector3D.angle(p1, p2);
-        return distance;
-    }
-
-    /**
-     * Compute metrics: case of liaison points.
-     * @param measMapping Mapping of observations/measurements = the ground truth
-     * @param ruggedA Rugged instance corresponding to viewing model A
-     * @param ruggedB Rugged instance corresponding to viewing model B
-     * @param computeAngular Flag to know if distance is computed in meters (false) or with angular (true)
-     * @exception RuggedException if direct location fails
-     */
-    public RefiningLiaisonMetrics computeLiaisonMetrics(final SensorToSensorMapping measMapping, final Rugged ruggedA, final Rugged ruggedB)
-        throws RuggedException {
-        
-        RefiningLiaisonMetrics liaisonMetrics = new RefiningLiaisonMetrics();
-        double resMax = liaisonMetrics.getMaxResidual();
-        double resMean = liaisonMetrics.getMeanResidual();
-        double losDistanceMax = liaisonMetrics.getLosMaxDistance();
-        double losDistanceMean = liaisonMetrics.getLosMeanDistance();
-        double earthDistanceMax = liaisonMetrics.getEarthMaxDistance();
-        double earthDistanceMean = liaisonMetrics.getEarthMeanDistance();
-        
-
-        // Mapping of observations/measurements = the ground truth
-        final Set<Map.Entry<SensorPixel, SensorPixel>> measurementsMapping;
-
-        final LineSensor lineSensorA;   // line sensor corresponding to rugged A
-        final LineSensor lineSensorB;   // line sensor corresponding to rugged B
-        double count = 0;               // counter for computing remaining mean distance
-        double losDistanceCount = 0;    // counter for computing LOS distance mean
-        double earthDistanceCount = 0;  // counter for computing Earth distance mean
-        int i = 0;                      // increment of measurements
-
-        // Initialization
-        measurementsMapping = measMapping.getMapping();
-        lineSensorA = ruggedA.getLineSensor(measMapping.getSensorNameA());
-        lineSensorB = ruggedB.getLineSensor(measMapping.getSensorNameB());
-        int nbMeas = measurementsMapping.size(); // number of measurements
-
-        // Browse map of measurements
-        for (Iterator<Map.Entry<SensorPixel, SensorPixel>> gtIt = measurementsMapping.iterator();
-                        gtIt.hasNext();
-                        i++) {
-
-            if (i == measurementsMapping.size()) {
-                break;
-            }
-
-            final Map.Entry<SensorPixel, SensorPixel> gtMapping = gtIt.next();
-
-            final SensorPixel spA = gtMapping.getKey();
-            final SensorPixel spB = gtMapping.getValue();
-
-            final AbsoluteDate dateA = lineSensorA.getDate(spA.getLineNumber());
-            final AbsoluteDate dateB = lineSensorB.getDate(spB.getLineNumber());
-
-            final double pixelA = spA.getPixelNumber();
-            final double pixelB = spB.getPixelNumber();
-
-            final Vector3D losA = lineSensorA.getLOS(dateA, pixelA);
-            final Vector3D losB = lineSensorB.getLOS(dateB, pixelB);
-
-            final GeodeticPoint gpA = ruggedA.directLocation(dateA, lineSensorA.getPosition(), losA);
-            final GeodeticPoint gpB = ruggedB.directLocation(dateB, lineSensorB.getPosition(), losB);
-
-            final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
-
-            // Estimated distances (LOS / Earth)
-            final double[] distances = ruggedB.distanceBetweenLOS(lineSensorA, dateA, pixelA, scToBodyA, lineSensorB, dateB, pixelB);
-
-            // LOS distance control
-            final double estLosDistance =  distances[0]; // LOS distance estimation
-            if (estLosDistance > losDistanceMax) {
-                losDistanceMax = estLosDistance;
-            }
-            losDistanceCount += estLosDistance;
-
-            // Earth distance control
-            final double estEarthDistance = distances[1]; // Earth distance estimation
-            final double measEarthDistance = measMapping.getBodyDistance(i).doubleValue(); // Earth measurement distance
-            final double earthDistance =  FastMath.abs(estEarthDistance - measEarthDistance);
-
-            if (earthDistance > earthDistanceMax) {
-                earthDistanceMax = earthDistance;
-
-            }
-            earthDistanceCount += earthDistance;
-
-            // Compute remaining distance
-            double distance = RefiningTest.computeDistanceInMeter(gpB.getLongitude(), gpB.getLatitude(),
-                                                                  gpA.getLongitude(), gpA.getLatitude());
-            count += distance;
-            if (distance > resMax) {
-                resMax = distance;
-            }
-        }
-
-        resMean = count / nbMeas;
-        losDistanceMean = losDistanceCount / nbMeas;
-        earthDistanceMean = earthDistanceCount / nbMeas;
-        
-        // Set the results
-        liaisonMetrics.setMaxResidual(resMax);
-        liaisonMetrics.setMeanResidual(resMean);
-        liaisonMetrics.setLosMaxDistance(losDistanceMax);
-        liaisonMetrics.setLosMeanDistance(losDistanceMean);
-        liaisonMetrics.setEarthMaxDistance(earthDistanceMax);
-        liaisonMetrics.setEarthMeanDistance(earthDistanceMean);
-        
-        return liaisonMetrics;
-    }
+//    /** Compute a geodetic distance in meters between 2 geodetic points (long1, lat1) and point (long2, lat2).
+//     * @param long1 Longitude of first geodetic point (rad)
+//     * @param lat1 Latitude of first geodetic point (rad)
+//     * @param long2 Longitude of second geodetic point (rad)
+//     * @param lat2 Latitude of second geodetic point (rad)
+//     * @return distance in meters
+//     */
+//    public static double computeDistanceInMeter(final double long1, final double lat1,
+//                                                final double long2, final double lat2) {
+//
+//        // get vectors on unit sphere from angular coordinates
+//        final Vector3D p1 = new Vector3D(lat1, long1); //
+//        final Vector3D p2 = new Vector3D(lat2, long2);
+//        final double distance =  Constants.WGS84_EARTH_EQUATORIAL_RADIUS * Vector3D.angle(p1, p2);
+//        return distance;
+//    }
+
+//    /**
+//     * Compute metrics: case of liaison points.
+//     * @param measMapping Mapping of observations/measurements = the ground truth
+//     * @param ruggedA Rugged instance corresponding to viewing model A
+//     * @param ruggedB Rugged instance corresponding to viewing model B
+//     * @param computeAngular Flag to know if distance is computed in meters (false) or with angular (true)
+//     * @exception RuggedException if direct location fails
+//     */
+//    public RefiningLiaisonMetrics computeLiaisonMetrics(final SensorToSensorMapping measMapping, final Rugged ruggedA, final Rugged ruggedB)
+//        throws RuggedException {
+//        
+//        RefiningLiaisonMetrics liaisonMetrics = new RefiningLiaisonMetrics();
+//        double resMax = liaisonMetrics.getMaxResidual();
+//        double resMean = liaisonMetrics.getMeanResidual();
+//        double losDistanceMax = liaisonMetrics.getLosMaxDistance();
+//        double losDistanceMean = liaisonMetrics.getLosMeanDistance();
+//        double earthDistanceMax = liaisonMetrics.getEarthMaxDistance();
+//        double earthDistanceMean = liaisonMetrics.getEarthMeanDistance();
+//        
+//
+//        // Mapping of observations/measurements = the ground truth
+//        final Set<Map.Entry<SensorPixel, SensorPixel>> measurementsMapping;
+//
+//        final LineSensor lineSensorA;   // line sensor corresponding to rugged A
+//        final LineSensor lineSensorB;   // line sensor corresponding to rugged B
+//        double count = 0;               // counter for computing remaining mean distance
+//        double losDistanceCount = 0;    // counter for computing LOS distance mean
+//        double earthDistanceCount = 0;  // counter for computing Earth distance mean
+//        int i = 0;                      // increment of measurements
+//
+//        // Initialization
+//        measurementsMapping = measMapping.getMapping();
+//        lineSensorA = ruggedA.getLineSensor(measMapping.getSensorNameA());
+//        lineSensorB = ruggedB.getLineSensor(measMapping.getSensorNameB());
+//        int nbMeas = measurementsMapping.size(); // number of measurements
+//
+//        // Browse map of measurements
+//        for (Iterator<Map.Entry<SensorPixel, SensorPixel>> gtIt = measurementsMapping.iterator();
+//                        gtIt.hasNext();
+//                        i++) {
+//
+//            if (i == measurementsMapping.size()) {
+//                break;
+//            }
+//
+//            final Map.Entry<SensorPixel, SensorPixel> gtMapping = gtIt.next();
+//
+//            final SensorPixel spA = gtMapping.getKey();
+//            final SensorPixel spB = gtMapping.getValue();
+//
+//            final AbsoluteDate dateA = lineSensorA.getDate(spA.getLineNumber());
+//            final AbsoluteDate dateB = lineSensorB.getDate(spB.getLineNumber());
+//
+//            final double pixelA = spA.getPixelNumber();
+//            final double pixelB = spB.getPixelNumber();
+//
+//            final Vector3D losA = lineSensorA.getLOS(dateA, pixelA);
+//            final Vector3D losB = lineSensorB.getLOS(dateB, pixelB);
+//
+//            final GeodeticPoint gpA = ruggedA.directLocation(dateA, lineSensorA.getPosition(), losA);
+//            final GeodeticPoint gpB = ruggedB.directLocation(dateB, lineSensorB.getPosition(), losB);
+//
+//            final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
+//
+//            // Estimated distances (LOS / Earth)
+//            final double[] distances = ruggedB.distanceBetweenLOS(lineSensorA, dateA, pixelA, scToBodyA, lineSensorB, dateB, pixelB);
+//
+//            // LOS distance control
+//            final double estLosDistance =  distances[0]; // LOS distance estimation
+//            if (estLosDistance > losDistanceMax) {
+//                losDistanceMax = estLosDistance;
+//            }
+//            losDistanceCount += estLosDistance;
+//
+//            // Earth distance control
+//            final double estEarthDistance = distances[1]; // Earth distance estimation
+//            final double measEarthDistance = measMapping.getBodyDistance(i).doubleValue(); // Earth measurement distance
+//            final double earthDistance =  FastMath.abs(estEarthDistance - measEarthDistance);
+//
+//            if (earthDistance > earthDistanceMax) {
+//                earthDistanceMax = earthDistance;
+//
+//            }
+//            earthDistanceCount += earthDistance;
+//
+//            // Compute remaining distance
+//            double distance = RefiningTest.computeDistanceInMeter(gpB.getLongitude(), gpB.getLatitude(),
+//                                                                  gpA.getLongitude(), gpA.getLatitude());
+//            count += distance;
+//            if (distance > resMax) {
+//                resMax = distance;
+//            }
+//        }
+//
+//        resMean = count / nbMeas;
+//        losDistanceMean = losDistanceCount / nbMeas;
+//        earthDistanceMean = earthDistanceCount / nbMeas;
+//        
+//        // Set the results
+//        liaisonMetrics.setMaxResidual(resMax);
+//        liaisonMetrics.setMeanResidual(resMean);
+//        liaisonMetrics.setLosMaxDistance(losDistanceMax);
+//        liaisonMetrics.setLosMeanDistance(losDistanceMean);
+//        liaisonMetrics.setEarthMaxDistance(earthDistanceMax);
+//        liaisonMetrics.setEarthMeanDistance(earthDistanceMean);
+//        
+//        return liaisonMetrics;
+//    }
     
     /** Apply disruptions on acquisition for roll, pitch and scale factor
      * @param rugged Rugged instance
@@ -517,65 +434,110 @@ public class RefiningTest {
         findFirst().get().setValue(factorValue);
     }
     
-    /** Generate noisy measurements (sensor to sensor mapping)
-     * @param lineSampling line sampling
-     * @param pixelSampling pixel sampling
-     * @param ruggedA Rugged instance of acquisition A
-     * @param sensorNameA line sensor name A
-     * @param dimensionA dimension for acquisition A
-     * @param ruggedB Rugged instance of acquisition B
-     * @param sensorNameB line sensor name B
-     * @param dimensionB dimension for acquisition B
-     * @param noise noise structure to generate noisy measurements
-     * @return inter-measurements generator (sensor to sensor mapping)
+
+    /** Compute the distances between LOS of two real pixels (one from sensor A and one from sensor B)
+     * @param realPixelA real pixel from sensor A
+     * @param realPixelB real pixel from sensor B
+     * @return the distances of two real pixels computed between LOS and to the ground
      * @throws RuggedException
      */
-    public InterMeasurementGenerator 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;
+    public double[] computeDistancesBetweenLOS(final SensorPixel realPixelA, final SensorPixel realPixelB) throws RuggedException {
         
-        // Earth constraint weight
-        final double earthConstraintWeight = 0.1;
+        final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
 
-        // Generate measurements with constraints on Earth distance and outliers control
-        InterMeasurementGenerator measurements = new InterMeasurementGenerator(ruggedA, sensorNameA, dimensionA,
-                                                                   ruggedB, sensorNameB, dimensionB,
-                                                                   outlierValue,
-                                                                   earthConstraintWeight);
-        System.out.format("\n**** Generate noisy measurements (sensor to sensor mapping) **** %n");
-
-        // Generation noisy measurements
-        measurements.createNoisyMeasurement(lineSampling, pixelSampling, noise);
-
-        System.out.format("Number of tie points generated: %d %n", measurements.getMeasurementCount());
-
-        return measurements;
+        final AbsoluteDate realDateA = this.lineSensorA.getDate(realPixelA.getLineNumber());
+        final AbsoluteDate realDateB = this.lineSensorB.getDate(realPixelB.getLineNumber());
+        
+        final double[] distanceLOSB = this.ruggedB.distanceBetweenLOS(
+                                           this.lineSensorA, realDateA, realPixelA.getPixelNumber(), 
+                                           scToBodyA,
+                                           this.lineSensorB, realDateB, realPixelB.getPixelNumber());
+        
+        return distanceLOSB;
     }
-
     
-    public Rugged getRuggedA() {
-        return ruggedA;
-    }
+    /** Compute the distances with derivatives between LOS of two real pixels (one from sensor A and one from sensor B)
+     * @param realPixelA real pixel from sensor A
+     * @param realPixelB real pixel from sensor B
+     * @return the distances of two real pixels computed between LOS and to the ground
+     * @throws RuggedException
+     * @throws SecurityException 
+     * @throws NoSuchMethodException 
+     * @throws InvocationTargetException 
+     * @throws IllegalArgumentException 
+     * @throws IllegalAccessException 
+     */
+    public DerivativeStructure[] computeDistancesBetweenLOSDerivatives(final SensorPixel realPixelA, final SensorPixel realPixelB,
+                                                                       double losDistance, double earthDistance) 
+        throws RuggedException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        
+        final SpacecraftToObservedBody scToBodyA = this.ruggedA.getScToBody();
 
+        final AbsoluteDate realDateA = this.lineSensorA.getDate(realPixelA.getLineNumber());
+        final AbsoluteDate realDateB = this.lineSensorB.getDate(realPixelB.getLineNumber());
+        
+        final List<LineSensor> sensors = new ArrayList<LineSensor>();
+        sensors.addAll(this.ruggedA.getLineSensors());
+        sensors.addAll(this.ruggedB.getLineSensors());
+        
+        final List<Rugged> ruggedList = new ArrayList<Rugged>();
+        ruggedList.add(this.ruggedA);
+        ruggedList.add(this.ruggedB);
+        
+//        // we want to adjust sensor roll and pitch angles
+//        ParameterDriver rollDriverA =
+//                        this.lineSensorA.getParametersDrivers().
+//                        filter(driver -> driver.getName().equals("roll")).findFirst().get();
+//        rollDriverA.setSelected(true);
+//        ParameterDriver pitchDriverA =
+//                        this.lineSensorA.getParametersDrivers().
+//                        filter(driver -> driver.getName().equals("pitch")).findFirst().get();
+//        pitchDriverA.setSelected(true);
 
-    public Rugged getRuggedB() {
-        return ruggedB;
-    }
-    
-    public SensorToSensorMapping getInterMapping() {
-        return interMapping;
-    }
 
+        
+//        rugged.
+//        getLineSensor(sensorName).
+//        getParametersDrivers().
+//        filter(driver -> driver.getName().equals(sensorName+"_roll") || driver.getName().equals(sensorName+"_pitch")).
+//        forEach(driver -> {
+//            try {
+//                driver.setSelected(true);
+//                driver.setValue(0.0);
+//            } catch (OrekitException e) {
+//                throw new OrekitExceptionWrapper(e);
+//            }
+//        });
+
+        
+        // prepare generator
+        final Observables measurements = new Observables(2);
+        SensorToSensorMapping interMapping = new SensorToSensorMapping(this.lineSensorA.getName(), ruggedA.getName(), this.lineSensorB.getName(), ruggedB.getName());
+        interMapping.addMapping(realPixelA, realPixelB, losDistance, earthDistance);
+        measurements.addInterMapping(interMapping);
+        
+        
+        InterSensorsOptimizationProblemBuilder optimizationPbBuilder = new InterSensorsOptimizationProblemBuilder(sensors, measurements, ruggedList);
+        
+        java.lang.reflect.Method createGenerator = InterSensorsOptimizationProblemBuilder.class.getSuperclass().getDeclaredMethod("createGenerator");
+        createGenerator.setAccessible(true);
+        DSGenerator generator = (DSGenerator) createGenerator.invoke(optimizationPbBuilder);
+
+        final DerivativeStructure[] distanceLOSwithDS = this.ruggedB.distanceBetweenLOSderivatives(
+                                           this.lineSensorA, realDateA, realPixelA.getPixelNumber(), 
+                                           scToBodyA,
+                                           this.lineSensorB, realDateB, realPixelB.getPixelNumber(),
+                                           generator);
+        
+        return distanceLOSwithDS;
+    }
 
     @After
     public void tearDown() {
     }
 }
 
+
 class OrbitModel {
 
     /** Flag to change Attitude Law (by default Nadir Pointing Yaw Compensation). */
@@ -781,290 +743,207 @@ class OrbitModel {
     }
 }  
 
-/**
- * Inter-measurements generator (sensor to sensor mapping).
- */
-class InterMeasurementGenerator {
-
-    /** Mapping from sensor A to sensor B. */
-    private SensorToSensorMapping interMappingGenerated;
-
-    /** Observables which contains sensor to sensor mapping.*/
-    private Observables observables;
-
-    /** Rugged instance corresponding to the viewing model A */
-    private Rugged ruggedA;
-
-    /** Rugged instance corresponding to the viewing model B */
-    private Rugged ruggedB;
-
-    /** Sensor A */
-    private LineSensor sensorA;
-
-    /** Sensor B */
-    private LineSensor sensorB;
-
-    /** Number of measurements */
-    private int measurementCount;
-
-
-    /** Sensor name B */
-    private String sensorNameB;
-
-    /** Number of line for acquisition A */
-    private int dimensionA;
-
-    /** Number of line for acquisition B */
-    private int dimensionB;
-
-    /** Limit value for outlier points */
-    private double outlier;
-
-
-    /** Default constructor: measurements generation without outlier points control
-     * and without Earth distance constraint.
-     */
-    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
-                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB)
-        throws RuggedException {
-
-        // Initialize parameters
-        initParams(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
-
-        // Generate reference mapping, without Earth distance constraint
-        interMappingGenerated = new SensorToSensorMapping(sensorNameA, sensorNameB);
-
-        // Create observables for two models
-        observables = new Observables(2);
-    }
-
-
-    /** Constructor for measurements generation taking into account outlier points control,
-     * without Earth distance constraint.
-     */
-    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
-                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB,
-                                 final double outlier)
-        throws RuggedException {
-
-        this(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
-        this.outlier = outlier;
-    }
-
-    /** Constructor for measurements generation taking into account outlier points control,
-     * and Earth distance constraint.
-     */
-    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
-                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB,
-                                 final double outlier, final double earthConstraintWeight)
-        throws RuggedException {
-
-        // Initialize parameters
-        initParams(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
-
-        // Generate reference mapping, with Earth distance constraints.
-        // Weighting will be applied as follow :
-        //     (1-earthConstraintWeight) for losDistance weighting
-        //     earthConstraintWeight for earthDistance weighting
-        interMappingGenerated = new SensorToSensorMapping(sensorNameA, ruggedA.getName(), sensorNameB, ruggedB.getName(), earthConstraintWeight);
-
-        // Outlier points control
-        this.outlier = outlier;
-
-        // Observables which contains sensor to sensor mapping
-        this.observables = new Observables(2);
-    }
-
-    /** Get the mapping from sensor A to sensor B
-     * @return the mapping from sensor A to sensor B
-     */
-    public SensorToSensorMapping getInterMapping() {
-        return interMappingGenerated;
-    }
-
-    /**  Get the observables which contains sensor to sensor mapping
-     * @return the observables which contains sensor to sensor mapping
-     */
-    public Observables getObservables() {
-        return observables;
-    }
-
-    public int getMeasurementCount() {
-        return measurementCount;
-    }
-
-    public void createMeasurement(final int lineSampling, final int pixelSampling) throws RuggedException {
-
-        // Search the sensor pixel seeing point
-        final int minLine = 0;
-        final int maxLine = dimensionB - 1;
-
-        for (double line = 0; line < dimensionA; line += lineSampling) {
-
-            final AbsoluteDate dateA = sensorA.getDate(line);
-
-            for (double pixelA = 0; pixelA < sensorA.getNbPixels(); pixelA += pixelSampling) {
-
-                final GeodeticPoint gpA = ruggedA.directLocation(dateA, sensorA.getPosition(),
-                                                                 sensorA.getLOS(dateA, pixelA));
-
-                final SensorPixel sensorPixelB = ruggedB.inverseLocation(sensorNameB, gpA, minLine, maxLine);
-
-                // We need to test if the sensor pixel is found in the prescribed lines
-                // otherwise the sensor pixel is null
-                if (sensorPixelB != null) {
-                    
-                    final AbsoluteDate dateB = sensorB.getDate(sensorPixelB.getLineNumber());
-                    final double pixelB = sensorPixelB.getPixelNumber();
-                    final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
-
-                    final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(),
-                                                                     sensorB.getLOS(dateB, pixelB));
-
-                    final double GEOdistance = RefiningTest.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
-                                                                      gpB.getLongitude(), gpB.getLatitude());
-
-                    if (GEOdistance < this.outlier) {
-                        
-                        final SensorPixel RealPixelA = new SensorPixel(line, pixelA);
-                        final SensorPixel RealPixelB = new SensorPixel(sensorPixelB.getLineNumber(), sensorPixelB.getPixelNumber());
-
-                        final AbsoluteDate RealDateA = sensorA.getDate(RealPixelA.getLineNumber());
-                        final AbsoluteDate RealDateB = sensorB.getDate(RealPixelB.getLineNumber());
-                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, RealDateA, RealPixelA.getPixelNumber(), scToBodyA,
-                                                                                 sensorB, RealDateB, RealPixelB.getPixelNumber());
-
-                        final double losDistance = 0.0;
-                        final double earthDistance = distanceLOSB[1];
-
-                        interMappingGenerated.addMapping(RealPixelA, RealPixelB, losDistance, earthDistance);
-
-                        // increment the number of measurements
-                        this.measurementCount++;
-                    }
-                }
-            }
-        }
-
-        this.observables.addInterMapping(interMappingGenerated);
-    }
-
-
-    /** Tie point creation from direct 1ocation with Rugged A and inverse location with Rugged B
-     * @param lineSampling sampling along lines
-     * @param pixelSampling sampling along columns
-     * @param noise errors to apply to measure for pixel A and pixel B
-     * @throws RuggedException
-     */
-    public void createNoisyMeasurement(final int lineSampling, final int pixelSampling, final Noise noise)
-        throws RuggedException {
-
-        // Get noise features (errors)
-        // [pixelA, pixelB] mean
-        final double[] mean = noise.getMean();
-        // [pixelA, pixelB] standard deviation
-        final double[] std = noise.getStandardDeviation();
-
-        // Search the sensor pixel seeing point
-        final int minLine = 0;
-        final int maxLine = dimensionB - 1;
-
-        final double meanA[] = { mean[0], mean[0] };
-        final double stdA[]  = { std[0], std[0] };
-        final double meanB[] = { mean[1], mean[1] };
-        final double stdB[]  = { std[1], std[1] };
-
-        // TODO GP explanation about seed ???
-        final GaussianRandomGenerator rngA = new GaussianRandomGenerator(new Well19937a(0xefac03d9be4d24b9l));
-        final UncorrelatedRandomVectorGenerator rvgA = new UncorrelatedRandomVectorGenerator(meanA, stdA, rngA);
-
-        // TODO GP explanation about seed ???
-        final GaussianRandomGenerator rngB = new GaussianRandomGenerator(new Well19937a(0xdf1c03d9be0b34b9l));
-        final UncorrelatedRandomVectorGenerator rvgB = new UncorrelatedRandomVectorGenerator(meanB, stdB, rngB);
-
-        for (double line = 0; line < dimensionA; line += lineSampling) {
-
-            final AbsoluteDate dateA = sensorA.getDate(line);
-            for (double pixelA = 0; pixelA < sensorA.getNbPixels(); pixelA += pixelSampling) {
-
-                final GeodeticPoint gpA = ruggedA.directLocation(dateA, sensorA.getPosition(),
-                                                                 sensorA.getLOS(dateA, pixelA));
-                final SensorPixel sensorPixelB = ruggedB.inverseLocation(sensorNameB, gpA, minLine, maxLine);
-
-                // We need to test if the sensor pixel is found in the prescribed lines
-                // otherwise the sensor pixel is null
-                if (sensorPixelB != null) {
-                    
-                    final AbsoluteDate dateB = sensorB.getDate(sensorPixelB.getLineNumber());
-                    final double pixelB = sensorPixelB.getPixelNumber();
-
-                    // Get spacecraft to body transform of Rugged instance A
-                    final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
-
-                    final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(),
-                                                                     sensorB.getLOS(dateB, pixelB));
-                    final double GEOdistance = RefiningTest.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
-                                                                                   gpB.getLongitude(), gpB.getLatitude());
-                    // TODO GP explanation about computation here
-                    if (GEOdistance < outlier) {
-
-                        final double[] vecRandomA = rvgA.nextVector();
-                        final double[] vecRandomB = rvgB.nextVector();
-
-                        final SensorPixel RealPixelA = new SensorPixel(line + vecRandomA[0], pixelA + vecRandomA[1]);
-                        final SensorPixel RealPixelB = new SensorPixel(sensorPixelB.getLineNumber() + vecRandomB[0],
-                                                                       sensorPixelB.getPixelNumber() + vecRandomB[1]);
-                        final AbsoluteDate RealDateA = sensorA.getDate(RealPixelA.getLineNumber());
-                        final AbsoluteDate RealDateB = sensorB.getDate(RealPixelB.getLineNumber());
-                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, RealDateA, RealPixelA.getPixelNumber(), scToBodyA,
-                                                                                 sensorB, RealDateB, RealPixelB.getPixelNumber());
-                        final Double losDistance = 0.0;
-                        final Double earthDistance = distanceLOSB[1];
-
-                        interMappingGenerated.addMapping(RealPixelA, RealPixelB, losDistance, earthDistance);
-
-                        // increment the number of measurements
-                        this.measurementCount++;
-                    }
-                }
-            }
-        }
-
-        this.observables.addInterMapping(interMappingGenerated);
-    }
-
-    /** Default constructor: measurements generation without outlier points control
-     * and Earth distances constraint.
-     * @param rA Rugged instance A
-     * @param sNameA sensor name A
-     * @param dimA dimension for acquisition A
-     * @param rB Rugged instance B
-     * @param sNameB sensor name B
-     * @param dimB dimension for acquisition B
-     * @throws RuggedException
-     */
-    private void initParams(final Rugged rA, final String sNameA, final int dimA,
-                            final Rugged rB, final String sNameB, final int dimB)
-        throws RuggedException {
-
-        this.sensorNameB = sNameB;
-        // Check that sensors's name is different
-        if (sNameA.contains(sNameB)) {
-           throw new RuggedExceptionWrapper(new RuggedException(RuggedMessages.DUPLICATED_PARAMETER_NAME, sNameA));
-        }
-
-        this.ruggedA = rA;
-        this.ruggedB = rB;
-
-        this.sensorA = rA.getLineSensor(sNameA);
-        this.sensorB = rB.getLineSensor(sNameB);
-
-        this.dimensionA = dimA;
-        this.dimensionB = dimB;
-
-        this.measurementCount = 0;
-    }
-}
+///**
+// * Inter-measurements generator (sensor to sensor mapping).
+// */
+//class InterMeasurementGenerator {
+//
+//    /** Mapping from sensor A to sensor B. */
+//    private SensorToSensorMapping interMappingGenerated;
+//
+//    /** Observables which contains sensor to sensor mapping.*/
+//    private Observables observables;
+//
+//    /** Rugged instance corresponding to the viewing model A */
+//    private Rugged ruggedA;
+//
+//    /** Rugged instance corresponding to the viewing model B */
+//    private Rugged ruggedB;
+//
+//    /** Sensor A */
+//    private LineSensor sensorA;
+//
+//    /** Sensor B */
+//    private LineSensor sensorB;
+//
+//    /** Number of measurements */
+//    private int measurementCount;
+//
+//
+//    /** Sensor name B */
+//    private String sensorNameB;
+//
+//    /** Number of line for acquisition A */
+//    private int dimensionA;
+//
+//    /** Number of line for acquisition B */
+//    private int dimensionB;
+//
+//    /** Limit value for outlier points */
+//    private double outlier;
+//
+//
+//    /** Default constructor: measurements generation without outlier points control
+//     * and without Earth distance constraint.
+//     */
+//    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
+//                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB)
+//        throws RuggedException {
+//
+//        // Initialize parameters
+//        initParams(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
+//
+//        // Generate reference mapping, without Earth distance constraint
+//        interMappingGenerated = new SensorToSensorMapping(sensorNameA, sensorNameB);
+//
+//        // Create observables for two models
+//        observables = new Observables(2);
+//    }
+//
+//
+//    /** Constructor for measurements generation taking into account outlier points control,
+//     * without Earth distance constraint.
+//     */
+//    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
+//                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB,
+//                                 final double outlier)
+//        throws RuggedException {
+//
+//        this(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
+//        this.outlier = outlier;
+//    }
+//
+//    /** Constructor for measurements generation taking into account outlier points control,
+//     * and Earth distance constraint.
+//     */
+//    public InterMeasurementGenerator(final Rugged ruggedA, final String sensorNameA, final int dimensionA,
+//                                 final Rugged ruggedB, final String sensorNameB, final int dimensionB,
+//                                 final double outlier, final double earthConstraintWeight)
+//        throws RuggedException {
+//
+//        // Initialize parameters
+//        initParams(ruggedA, sensorNameA, dimensionA, ruggedB, sensorNameB, dimensionB);
+//
+//        // Generate reference mapping, with Earth distance constraints.
+//        // Weighting will be applied as follow :
+//        //     (1-earthConstraintWeight) for losDistance weighting
+//        //     earthConstraintWeight for earthDistance weighting
+//        interMappingGenerated = new SensorToSensorMapping(sensorNameA, ruggedA.getName(), sensorNameB, ruggedB.getName(), earthConstraintWeight);
+//
+//        // Outlier points control
+//        this.outlier = outlier;
+//
+//        // Observables which contains sensor to sensor mapping
+//        this.observables = new Observables(2);
+//    }
+//
+//    /** Get the mapping from sensor A to sensor B
+//     * @return the mapping from sensor A to sensor B
+//     */
+//    public SensorToSensorMapping getInterMapping() {
+//        return interMappingGenerated;
+//    }
+//
+//    /**  Get the observables which contains sensor to sensor mapping
+//     * @return the observables which contains sensor to sensor mapping
+//     */
+//    public Observables getObservables() {
+//        return observables;
+//    }
+//
+//    public int getMeasurementCount() {
+//        return measurementCount;
+//    }
+//
+//    public void createMeasurement(final int lineSampling, final int pixelSampling) throws RuggedException {
+//
+//        // Search the sensor pixel seeing point
+//        final int minLine = 0;
+//        final int maxLine = dimensionB - 1;
+//
+//        for (double line = 0; line < dimensionA; line += lineSampling) {
+//
+//            final AbsoluteDate dateA = sensorA.getDate(line);
+//
+//            for (double pixelA = 0; pixelA < sensorA.getNbPixels(); pixelA += pixelSampling) {
+//
+//                final GeodeticPoint gpA = ruggedA.directLocation(dateA, sensorA.getPosition(),
+//                                                                 sensorA.getLOS(dateA, pixelA));
+//
+//                final SensorPixel sensorPixelB = ruggedB.inverseLocation(sensorNameB, gpA, minLine, maxLine);
+//
+//                // We need to test if the sensor pixel is found in the prescribed lines
+//                // otherwise the sensor pixel is null
+//                if (sensorPixelB != null) {
+//                    
+//                    final AbsoluteDate dateB = sensorB.getDate(sensorPixelB.getLineNumber());
+//                    final double pixelB = sensorPixelB.getPixelNumber();
+//                    final SpacecraftToObservedBody scToBodyA = ruggedA.getScToBody();
+//
+//                    final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(),
+//                                                                     sensorB.getLOS(dateB, pixelB));
+//
+//                    final double GEOdistance = RefiningTest.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
+//                                                                      gpB.getLongitude(), gpB.getLatitude());
+//
+//                    if (GEOdistance < this.outlier) {
+//                        
+//                        final SensorPixel RealPixelA = new SensorPixel(line, pixelA);
+//                        final SensorPixel RealPixelB = new SensorPixel(sensorPixelB.getLineNumber(), sensorPixelB.getPixelNumber());
+//
+//                        final AbsoluteDate RealDateA = sensorA.getDate(RealPixelA.getLineNumber());
+//                        final AbsoluteDate RealDateB = sensorB.getDate(RealPixelB.getLineNumber());
+//                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, RealDateA, RealPixelA.getPixelNumber(), scToBodyA,
+//                                                                                 sensorB, RealDateB, RealPixelB.getPixelNumber());
+//
+//                        final double losDistance = 0.0;
+//                        final double earthDistance = distanceLOSB[1];
+//
+//                        interMappingGenerated.addMapping(RealPixelA, RealPixelB, losDistance, earthDistance);
+//
+//                        // increment the number of measurements
+//                        this.measurementCount++;
+//                    }
+//                }
+//            }
+//        }
+//
+//        this.observables.addInterMapping(interMappingGenerated);
+//    }
+//
+//
+//    /** Default constructor: measurements generation without outlier points control
+//     * and Earth distances constraint.
+//     * @param rA Rugged instance A
+//     * @param sNameA sensor name A
+//     * @param dimA dimension for acquisition A
+//     * @param rB Rugged instance B
+//     * @param sNameB sensor name B
+//     * @param dimB dimension for acquisition B
+//     * @throws RuggedException
+//     */
+//    private void initParams(final Rugged rA, final String sNameA, final int dimA,
+//                            final Rugged rB, final String sNameB, final int dimB)
+//        throws RuggedException {
+//
+//        this.sensorNameB = sNameB;
+//        // Check that sensors's name is different
+//        if (sNameA.contains(sNameB)) {
+//           throw new RuggedExceptionWrapper(new RuggedException(RuggedMessages.DUPLICATED_PARAMETER_NAME, sNameA));
+//        }
+//
+//        this.ruggedA = rA;
+//        this.ruggedB = rB;
+//
+//        this.sensorA = rA.getLineSensor(sNameA);
+//        this.sensorB = rB.getLineSensor(sNameB);
+//
+//        this.dimensionA = dimA;
+//        this.dimensionB = dimB;
+//
+//        this.measurementCount = 0;
+//    }
+//}
 
 
 /**
@@ -1208,76 +1087,76 @@ public int getDimension() {
     }
 }
 
-/** Class for adding a noise to measurements.
- */
-class Noise {
-
-    /** Type of distribution. */
-    private static final int GAUSSIAN = 0;
-
-    /** Dimension. */
-    private int dimension;
-
-    /** Mean. */
-    private double[] mean;
-
-    /** Standard deviation. */
-    private double[] standardDeviation;
-
-    /** Distribution. */
-    private int distribution = GAUSSIAN;
-
-    /** Build a new instance.
-     * @param distribution noise type
-     * @param dimension noise dimension
-     */
-    public Noise(final int distribution, final int dimension) {
-
-        this.mean = new double[dimension];
-        this.standardDeviation = new double[dimension];
-        this.dimension = dimension;
-        this.distribution = distribution;
-    }
-
-    /** Get the mean.
-     * @return the mean
-     */
-    public double[] getMean() {
-        return mean.clone();
-    }
-
-    /** Set the mean.
-     * @param meanValue the mean to set
-     */
-    public void setMean(final double[] meanValue) {
-        this.mean = meanValue.clone();
-    }
-
-    /** Get the standard deviation.
-     * @return the standard deviation
-     */
-    public double[] getStandardDeviation() {
-        return standardDeviation.clone();
-    }
-
-    /** Set the standard deviation.
-     * @param standardDeviationValue the standard deviation to set
-     */
-    public void setStandardDeviation(final double[] standardDeviationValue) {
-        this.standardDeviation = standardDeviationValue.clone();
-    }
-
-    /** Get the distribution.
-     * @return the distribution
-     */
-    public int getDistribution() {
-        return distribution;
-    }
-
-    /** Get the dimension.
-     * @return the dimension
-     */
-    public int getDimension() {
-        return dimension;
-    }
-}
+///** Class for adding a noise to measurements.
+// */
+//class Noise {
+//
+//    /** Type of distribution. */
+//    private static final int GAUSSIAN = 0;
+//
+//    /** Dimension. */
+//    private int dimension;
+//
+//    /** Mean. */
+//    private double[] mean;
+//
+//    /** Standard deviation. */
+//    private double[] standardDeviation;
+//
+//    /** Distribution. */
+//    private int distribution = GAUSSIAN;
+//
+//    /** Build a new instance.
+//     * @param distribution noise type
+//     * @param dimension noise dimension
+//     */
+//    public Noise(final int distribution, final int dimension) {
+//
+//        this.mean = new double[dimension];
+//        this.standardDeviation = new double[dimension];
+//        this.dimension = dimension;
+//        this.distribution = distribution;
+//    }
+//
+//    /** Get the mean.
+//     * @return the mean
+//     */
+//    public double[] getMean() {
+//        return mean.clone();
+//    }
+//
+//    /** Set the mean.
+//     * @param meanValue the mean to set
+//     */
+//    public void setMean(final double[] meanValue) {
+//        this.mean = meanValue.clone();
+//    }
+//
+//    /** Get the standard deviation.
+//     * @return the standard deviation
+//     */
+//    public double[] getStandardDeviation() {
+//        return standardDeviation.clone();
+//    }
+//
+//    /** Set the standard deviation.
+//     * @param standardDeviationValue the standard deviation to set
+//     */
+//    public void setStandardDeviation(final double[] standardDeviationValue) {
+//        this.standardDeviation = standardDeviationValue.clone();
+//    }
+//
+//    /** Get the distribution.
+//     * @return the distribution
+//     */
+//    public int getDistribution() {
+//        return distribution;
+//    }
+//
+//    /** Get the dimension.
+//     * @return the dimension
+//     */
+//    public int getDimension() {
+//        return dimension;
+//    }
+//}
diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java
index 433ad512..278cd311 100644
--- a/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java
+++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java
@@ -64,26 +64,20 @@ import fr.cs.examples.refiningPleiades.models.PleiadesViewingModel;
 public class GroundRefining extends Refining {
 
     /** Pleiades viewing model */
-    PleiadesViewingModel pleiadesViewingModel;
-
-    /** Orbit model */
-    OrbitModel orbitmodel;
+    private static PleiadesViewingModel pleiadesViewingModel;
 
     /** Sensor name */
-    String sensorName;
+    private static String sensorName;
 
     /** Rugged instance */
-    Rugged rugged;
-
-    /** Ground measurements */
-    GroundMeasurementGenerator measurements;
+    private static Rugged rugged;
+    
 
     /** Main function
      */
     public static void main(String[] args) {
     	
     	try {
-    		
             // Initialize Orekit, assuming an orekit-data folder is in user home directory
             // ---------------------------------------------------------------------------
             File home       = new File(System.getProperty("user.home"));
@@ -97,7 +91,6 @@ public class GroundRefining extends Refining {
             // Sensor's definition: create Pleiades viewing model
             // --------------------------------------------------
             System.out.format("**** Build Pleiades viewing model and orbit definition **** %n");
-            PleiadesViewingModel pleiadesViewingModel = refining.getPleiadesViewingModel();
             AbsoluteDate minDate =  pleiadesViewingModel.getMinDate();
             AbsoluteDate maxDate =  pleiadesViewingModel.getMaxDate();
             AbsoluteDate refDate = pleiadesViewingModel.getDatationReference();
@@ -105,7 +98,7 @@ public class GroundRefining extends Refining {
 
             // Satellite position, velocity and attitude: create an orbit model
             // ----------------------------------------------------------------
-            OrbitModel orbitmodel = refining.getOrbitmodel();
+            OrbitModel orbitmodel = new OrbitModel();
             BodyShape earth = orbitmodel.createEarth();
             NormalizedSphericalHarmonicsProvider gravityField = orbitmodel.createGravityField();
             Orbit orbit = orbitmodel.createOrbit(gravityField.getMu(), refDate);
@@ -150,8 +143,9 @@ public class GroundRefining extends Refining {
 
             ruggedBuilder.setName("Rugged_refining");
 
-            refining.setRugged(ruggedBuilder.build());
+            rugged = ruggedBuilder.build();
 
+            
             // Compute ground sample distance (GSD)
             // ------------------------------------
             double [] gsd = refining.computeGSD(lineSensor);
@@ -167,8 +161,7 @@ public class GroundRefining extends Refining {
             System.out.format("roll: %3.5f \tpitch: %3.5f \tfactor: %3.5f \n",rollValue, pitchValue, factorValue);
 
             // Apply disruptions on physical model
-            refining.applyDisruptions(refining.getRugged(), refining.getSensorName(),
-                                      rollValue, pitchValue, factorValue);
+            refining.applyDisruptions(rugged, sensorName, rollValue, pitchValue, factorValue);
 
             // Generate measurements (observations) from physical model disrupted
             // ------------------------------------------------------------------
@@ -176,32 +169,37 @@ public class GroundRefining extends Refining {
             int pixelSampling = 1000;
 
             // Noise definition
-            final Noise noise = new Noise(0,3); /* distribution: gaussian(0), vector dimension:3 */
-            final double[] mean = {0.0,0.0,0.0};                /* {lat mean, long mean, alt mean} */
-            final double[] standardDeviation = {0.0,0.0,0.0};   /* {lat std, long std, alt std} */
+            // distribution: gaussian(0), vector dimension:3
+            final Noise noise = new Noise(0,3);
+            
+            // lat mean, long mean, alt mean
+            final double[] mean = {0.0,0.0,0.0};
+            // lat std, long std, alt std}
+            final double[] standardDeviation = {0.0,0.0,0.0};
+            
             noise.setMean(mean);
             noise.setStandardDeviation(standardDeviation);
 
+            // Ground measurements
             GroundMeasurementGenerator measurements = refining.generateNoisyPoints(lineSampling, pixelSampling,
-                                                                           refining.getRugged(), refining.getSensorName(),
-                                                                           refining.getPleiadesViewingModel().getDimension(),
-                                                                           noise);
-            refining.setMeasurements(measurements);
+                                                                                   rugged, sensorName,
+                                                                                   pleiadesViewingModel.getDimension(),
+                                                                                   noise);
 
             // Compute ground truth residuals
             // ------------------------------
             System.out.format("\n**** Ground truth residuals **** %n");
-            refining.computeMetrics(measurements.getGroundMapping(), refining.getRugged(), false);
+            refining.computeMetrics(measurements.getGroundMapping(), rugged, false);
 
             // Initialize physical model without disruptions
             // ---------------------------------------------
             System.out.format("\n**** Initialize physical model without disruptions: reset Roll/Pitch/Factor **** %n");
-            refining.resetModel(refining.getRugged(), refining.getSensorName(), true);
+            refining.resetModel(rugged, sensorName, true);
 
             // Compute initial residuals
             // -------------------------
             System.out.format("\n**** Initial Residuals  **** %n");
-            refining.computeMetrics(measurements.getGroundMapping(), refining.getRugged(), false);
+            refining.computeMetrics(measurements.getGroundMapping(), rugged, false);
 
             // Start optimization
             // ------------------
@@ -210,23 +208,22 @@ public class GroundRefining extends Refining {
             int maxIterations = 100;
             double convergenceThreshold =  1.e-11;
 
-            refining.optimization(maxIterations, convergenceThreshold, measurements.getObservables(), refining.getRugged());
+            refining.optimization(maxIterations, convergenceThreshold, measurements.getObservables(), rugged);
 
             // Check estimated values
             // ----------------------
             System.out.format("\n**** Check parameters ajustement **** %n");
-            refining.paramsEstimation(refining.getRugged(), refining.getSensorName(),
-                                      rollValue, pitchValue, factorValue);
+            refining.paramsEstimation(rugged, sensorName, rollValue, pitchValue, factorValue);
 
             // Compute statistics
             // ------------------
             System.out.format("\n**** Compute Statistics **** %n");
 
             // Residuals computed in meters
-            refining.computeMetrics(measurements.getGroundMapping(), refining.getRugged(), false);
+            refining.computeMetrics(measurements.getGroundMapping(), rugged, false);
 
             // Residuals computed in degrees
-            refining.computeMetrics(measurements.getGroundMapping(), refining.getRugged(), true);
+            refining.computeMetrics(measurements.getGroundMapping(), rugged, true);
 
         } catch (OrekitException oe) {
             System.err.println(oe.getLocalizedMessage());
@@ -242,7 +239,7 @@ public class GroundRefining extends Refining {
 
         sensorName = "line";
         pleiadesViewingModel = new PleiadesViewingModel(sensorName);
-        orbitmodel =  new OrbitModel();
+
     }
 
      /** Estimate ground sample distance (GSD)
@@ -286,68 +283,60 @@ public class GroundRefining extends Refining {
         return gsd;
     }
 
-    /**
-     * Get the Pleiades viewing model
-     * @return the Pleiades viewing model
-     */
-    public PleiadesViewingModel getPleiadesViewingModel() {
-        return pleiadesViewingModel;
-    }
-
-    /**
-     * Set the Pleiades viewing model
-     * @param pleiadesViewingModel Pleiades viewing model to set
-     */
-    public void setPleiadesViewingModel(final PleiadesViewingModel pleiadesViewingModel) {
-        this.pleiadesViewingModel = pleiadesViewingModel;
-    }
-
-    /**
-     * Get the orbit model
-     * @return the orbit model
-     */
-    public OrbitModel getOrbitmodel() {
-        return orbitmodel;
-    }
-
-    /**
-     * Set the orbit model
-     * @param orbitmodel the orbit model to set
-     */
-    public void setOrbitmodel(final OrbitModel orbitmodel) {
-        this.orbitmodel = orbitmodel;
-    }
-
-    /**
-     * Get the sensor name
-     * @return the sensor name
-     */
-    public String getSensorName() {
-        return sensorName;
-    }
-
-    /**
-     * Get the Rugged instance
-     * @return the rugged instance
-     */
-    public Rugged getRugged() {
-        return rugged;
-    }
-
-    /**
-     * Set the Rugged instance
-     * @param rugged the Rugged instance to set
-     */
-    public void setRugged(final Rugged rugged) {
-        this.rugged = rugged;
-    }
-
-    /**
-     * Set the measurements
-     * @param measurements the measurements to set
-     */
-    public void setMeasurements(final GroundMeasurementGenerator measurements) {
-        this.measurements = measurements;
-    }
+//    /**
+//     * Get the Pleiades viewing model
+//     * @return the Pleiades viewing model
+//     */
+//    public PleiadesViewingModel getPleiadesViewingModel() {
+//        return pleiadesViewingModel;
+//    }
+//
+//    /**
+//     * Set the Pleiades viewing model
+//     * @param pleiadesViewingModel Pleiades viewing model to set
+//     */
+//    public void setPleiadesViewingModel(final PleiadesViewingModel pleiadesViewingModel) {
+//        this.pleiadesViewingModel = pleiadesViewingModel;
+//    }
+//
+//    /**
+//     * Get the orbit model
+//     * @return the orbit model
+//     */
+//    public OrbitModel getOrbitmodel() {
+//        return orbitmodel;
+//    }
+//
+//    /**
+//     * Set the orbit model
+//     * @param orbitmodel the orbit model to set
+//     */
+//    public void setOrbitmodel(final OrbitModel orbitmodel) {
+//        this.orbitmodel = orbitmodel;
+//    }
+//
+//    /**
+//     * Get the sensor name
+//     * @return the sensor name
+//     */
+//    public String getSensorName() {
+//        return sensorName;
+//    }
+//
+//    /**
+//     * Get the Rugged instance
+//     * @return the rugged instance
+//     */
+//    public Rugged getRugged() {
+//        return rugged;
+//    }
+//
+//    /**
+//     * Set the Rugged instance
+//     * @param rugged the Rugged instance to set
+//     */
+//    public void setRugged(final Rugged rugged) {
+//        this.rugged = rugged;
+//    }
 }
 
diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java
index 3fd6d61c..d970859e 100644
--- a/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java
+++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java
@@ -67,31 +67,22 @@ import fr.cs.examples.refiningPleiades.models.PleiadesViewingModel;
 public class InterRefining extends Refining {
 
 	/** Pleiades viewing model A */
-	PleiadesViewingModel pleiadesViewingModelA;
+	private static PleiadesViewingModel pleiadesViewingModelA;
 
 	/** Pleiades viewing model B */
-	PleiadesViewingModel pleiadesViewingModelB;
-
-	/** Orbit model corresponding to viewing model A */
-	OrbitModel orbitmodelA;
-
-	/** Orbit model corresponding to viewing model B */
-	OrbitModel orbitmodelB;
+	private static PleiadesViewingModel pleiadesViewingModelB;
 
 	/** Sensor name A corresponding to viewing model A */
-	String sensorNameA;
+	private static String sensorNameA;
 
 	/** Sensor name A corresponding to viewing model B */
-	String sensorNameB;
+	private static String sensorNameB;
 
 	/** RuggedA's instance */
-	Rugged ruggedA;
+	private static Rugged ruggedA;
 
 	/** RuggedB's instance */
-	Rugged ruggedB;
-
-	/** Inter-measurements (between both viewing models) */
-	InterMeasurementGenerator measurements;
+	private static Rugged ruggedB;
 
 
 	/** Main function
@@ -99,7 +90,6 @@ public class InterRefining extends Refining {
 	public static void main(String[] args) {
 		
 		try {
-			
 			// Initialize Orekit, assuming an orekit-data folder is in user home directory
 			// ---------------------------------------------------------------------------
 			File home       = new File(System.getProperty("user.home"));
@@ -116,7 +106,6 @@ public class InterRefining extends Refining {
             System.out.format("**** Build Pleiades viewing model A and its orbit definition **** %n");
 
             // 1/- Create First Pleiades Viewing Model
-            PleiadesViewingModel pleiadesViewingModelA = refining.getPleiadesViewingModelA();
             final AbsoluteDate minDateA =  pleiadesViewingModelA.getMinDate();
             final AbsoluteDate maxDateA =  pleiadesViewingModelA.getMaxDate();
             final AbsoluteDate refDateA = pleiadesViewingModelA.getDatationReference();
@@ -124,7 +113,7 @@ public class InterRefining extends Refining {
             System.out.format(Locale.US, "Viewing model A - date min: %s max: %s ref: %s %n", minDateA, maxDateA, refDateA);
 
             // ----Satellite position, velocity and attitude: create orbit model A
-            OrbitModel orbitmodelA = refining.getOrbitmodelA();
+            OrbitModel orbitmodelA = new OrbitModel();
             BodyShape earthA = orbitmodelA.createEarth();
             NormalizedSphericalHarmonicsProvider gravityFieldA = orbitmodelA.createGravityField();
             Orbit orbitA = orbitmodelA.createOrbit(gravityFieldA.getMu(), refDateA);
@@ -169,13 +158,12 @@ public class InterRefining extends Refining {
 
             ruggedBuilderA.setName("RuggedA");
 
-            refining.setRuggedA(ruggedBuilderA.build());
+            ruggedA = ruggedBuilderA.build();
 
 
             System.out.format("\n**** Build Pleiades viewing model B and its orbit definition **** %n");
 
             // 2/- Create Second Pleiades Viewing Model
-            PleiadesViewingModel pleiadesViewingModelB = refining.getPleiadesViewingModelB();
             final AbsoluteDate minDateB =  pleiadesViewingModelB.getMinDate();
             final AbsoluteDate maxDateB =  pleiadesViewingModelB.getMaxDate();
             final AbsoluteDate refDateB = pleiadesViewingModelB.getDatationReference();
@@ -183,7 +171,7 @@ public class InterRefining extends Refining {
             System.out.format(Locale.US, "Viewing model B - date min: %s max: %s ref: %s  %n", minDateB, maxDateB, refDateB);
 
             // ----Satellite position, velocity and attitude: create orbit model B
-            OrbitModel orbitmodelB =  refining.getOrbitmodelB();
+            OrbitModel orbitmodelB =  new OrbitModel();
             BodyShape earthB = orbitmodelB.createEarth();
             NormalizedSphericalHarmonicsProvider gravityFieldB = orbitmodelB.createGravityField();
             Orbit orbitB = orbitmodelB.createOrbit(gravityFieldB.getMu(), refDateB);
@@ -218,7 +206,7 @@ public class InterRefining extends Refining {
 
             ruggedBuilderB.setName("RuggedB");
 
-            refining.setRuggedB(ruggedBuilderB.build());
+            ruggedB = ruggedBuilderB.build();
 
             // Compute distance between LOS
             // -----------------------------
@@ -240,12 +228,10 @@ public class InterRefining extends Refining {
             System.out.format("Acquisition B roll: %3.5f \tpitch: %3.5f \tfactor: %3.5f \n",rollValueB,pitchValueB,factorValue);
 
             // Apply disruptions on physical model (acquisition A)
-            refining.applyDisruptions(refining.getRuggedA(),refining.getSensorNameA(),
-                                      rollValueA, pitchValueA, factorValue);
+            refining.applyDisruptions(ruggedA, sensorNameA, rollValueA, pitchValueA, factorValue);
 
             // Apply disruptions on physical model (acquisition B)
-            refining.applyDisruptions(refining.getRuggedB(),refining.getSensorNameB(),
-                                      rollValueB, pitchValueB, factorValue);
+            refining.applyDisruptions(ruggedB, sensorNameB, rollValueB, pitchValueB, factorValue);
 
 
             // Generate measurements (observations) from physical model disrupted
@@ -267,57 +253,51 @@ public class InterRefining extends Refining {
             System.out.format("\tSensor A mean: %f std %f %n",mean[0],standardDeviation[0]);
             System.out.format("\tSensor B mean: %f std %f %n",mean[1],standardDeviation[1]);
 
+            // Inter-measurements (between both viewing models)
             InterMeasurementGenerator measurements = refining.generateNoisyPoints(lineSampling, pixelSampling,
-                                                                          refining.getRuggedA(), refining.getSensorNameA(),
-                                                                          refining.getPleiadesViewingModelA().getDimension(),
-                                                                          refining.getRuggedB(), refining.getSensorNameB(),
-                                                                          refining.getPleiadesViewingModelB().getDimension(),
+                                                                          ruggedA, sensorNameA,
+                                                                          pleiadesViewingModelA.getDimension(),
+                                                                          ruggedB, sensorNameB,
+                                                                          pleiadesViewingModelB.getDimension(),
                                                                           noise);
-            refining.setMeasurements(measurements);
 
             // Compute ground truth residuals
             // ------------------------------
             System.out.format("\n**** Ground truth residuals **** %n");
-            refining.computeMetrics(measurements.getInterMapping(), refining.getRuggedA(), refining.getRuggedB(), false);
+            refining.computeMetrics(measurements.getInterMapping(), ruggedA, ruggedB, false);
 
             // Initialize physical models without disruptions
             // -----------------------------------------------
             System.out.format("\n**** Initialize physical models (A,B) without disruptions: reset Roll/Pitch/Factor **** %n");
-            refining.resetModel(refining.getRuggedA(), refining.getSensorNameA(), false);
-            refining.resetModel(refining.getRuggedB(), refining.getSensorNameB(), false);
+            refining.resetModel(ruggedA, sensorNameA, false);
+            refining.resetModel(ruggedB, sensorNameB, false);
 
             // Compute initial residuals
             // -------------------------
             System.out.format("\n**** Initial Residuals  **** %n");
-            refining.computeMetrics(measurements.getInterMapping(), refining.getRuggedA(), refining.getRuggedB(), false);
+            refining.computeMetrics(measurements.getInterMapping(), ruggedA, ruggedB, false);
 
             // Start optimization
             // ------------------
             System.out.format("\n**** Start optimization  **** %n");
-
-            int maxIterations = 100;
-            double convergenceThreshold = 1.e-7;
+            final int maxIterations = 100;
+            final double convergenceThreshold = 1.e-7;
 
             refining.optimization(maxIterations, convergenceThreshold,
-                                  measurements.getObservables(),
-                                  refining.getRuggeds());
+                                  measurements.getObservables(), refining.getRuggeds());
 
             // Check estimated values
             // ----------------------
             System.out.format("\n**** Check parameters ajustement **** %n");
             System.out.format("Acquisition A:%n");
-            refining.paramsEstimation(refining.getRuggedA(), refining.getSensorNameA(),
-                                      rollValueA, pitchValueA, factorValue);
+            refining.paramsEstimation(ruggedA, sensorNameA, rollValueA, pitchValueA, factorValue);
             System.out.format("Acquisition B:%n");
-            refining.paramsEstimation(refining.getRuggedB(), refining.getSensorNameB(),
-                                      rollValueB, pitchValueB, factorValue);
-            //refining.paramsEstimation(rollValueA, pitchValueA, factorValue, rollValueB, pitchValueB);
-
+            refining.paramsEstimation(ruggedB, sensorNameB, rollValueB, pitchValueB, factorValue);
 
             // Compute statistics
             // ------------------
             System.out.format("\n**** Compute Statistics **** %n");
-            refining.computeMetrics(measurements.getInterMapping(), refining.getRuggedA(), refining.getRuggedB(), false);
+            refining.computeMetrics(measurements.getInterMapping(), ruggedA, ruggedB, false);
 
         } catch (OrekitException oe) {
             System.err.println(oe.getLocalizedMessage());
@@ -331,20 +311,18 @@ public class InterRefining extends Refining {
 	/** Constructor */
 	public InterRefining() throws RuggedException, OrekitException {
 
-		this.sensorNameA = "SensorA";
+		sensorNameA = "SensorA";
 		final double incidenceAngleA = -5.0;
 		final String dateA = "2016-01-01T11:59:50.0";
 
-		this.pleiadesViewingModelA = new PleiadesViewingModel(sensorNameA, incidenceAngleA, dateA);
+		pleiadesViewingModelA = new PleiadesViewingModel(sensorNameA, incidenceAngleA, dateA);
 
-		this.sensorNameB = "SensorB";
+		sensorNameB = "SensorB";
 		final double incidenceAngleB = 0.0;
 		final String dateB = "2016-01-01T12:02:50.0";
 
-		this.pleiadesViewingModelB = new PleiadesViewingModel(sensorNameB, incidenceAngleB, dateB);
+		pleiadesViewingModelB = new PleiadesViewingModel(sensorNameB, incidenceAngleB, dateB);
 
-		this.orbitmodelA =  new OrbitModel();
-		this.orbitmodelB =  new OrbitModel();
 	}
 
     /** Estimate distance between LOS
@@ -354,16 +332,13 @@ public class InterRefining extends Refining {
      */
     private double computeDistanceBetweenLOS(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(dimensionA/2);
         Vector3D losA = lineSensorA.getLOS(lineDateA,dimensionA/2);
         GeodeticPoint centerPointA = ruggedA.directLocation(lineDateA, positionA, losA);
@@ -371,7 +346,6 @@ public class InterRefining extends Refining {
                           FastMath.toDegrees(centerPointA.getLatitude()),
                           FastMath.toDegrees(centerPointA.getLongitude()),centerPointA.getAltitude());
 
-
         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.
 
@@ -382,7 +356,6 @@ public class InterRefining extends Refining {
                           FastMath.toDegrees(centerPointB.getLatitude()),
                           FastMath.toDegrees(centerPointB.getLongitude()),centerPointB.getAltitude());
 
-
         lineDateB = lineSensorB.getDate(0);
         losB = lineSensorB.getLOS(lineDateB,0);
         GeodeticPoint firstPointB = ruggedB.directLocation(lineDateB, positionB, losB);
@@ -403,116 +376,11 @@ public class InterRefining extends Refining {
         return distance;
     }
 
-    /**
-     * @return the pleiadesViewingModelA
-     */
-    public PleiadesViewingModel getPleiadesViewingModelA() {
-        return pleiadesViewingModelA;
-    }
-
-    /**
-     * @param pleiadesViewingModelA the pleiadesViewingModelA to set
-     */
-    public void setPleiadesViewingModelA(final PleiadesViewingModel pleiadesViewingModelA) {
-        this.pleiadesViewingModelA = pleiadesViewingModelA;
-    }
-
-    /**
-     * @return the pleiadesViewingModelB
-     */
-    public PleiadesViewingModel getPleiadesViewingModelB() {
-        return pleiadesViewingModelB;
-    }
-
-    /**
-     * @param pleiadesViewingModelB the pleiadesViewingModelB to set
-     */
-    public void setPleiadesViewingModelB(final PleiadesViewingModel pleiadesViewingModelB) {
-        this.pleiadesViewingModelB = pleiadesViewingModelB;
-    }
-
-    /**
-     * @return the orbitmodelA
-     */
-    public OrbitModel getOrbitmodelA() {
-        return orbitmodelA;
-    }
-
-    /**
-     * @param orbitmodelA the orbitmodelA to set
-     */
-    public void setOrbitmodelA(final OrbitModel orbitmodelA) {
-        this.orbitmodelA = orbitmodelA;
-    }
-
-    /**
-     * @return the orbitmodelB
-     */
-    public OrbitModel getOrbitmodelB() {
-        return orbitmodelB;
-    }
-
-    /**
-     * @param orbitmodelB the orbitmodelB to set
-     */
-    public void setOrbitmodelB(final OrbitModel orbitmodelB) {
-        this.orbitmodelB = orbitmodelB;
-    }
-
-    /**
-     * @return the sensorNameA
-     */
-    public String getSensorNameA() {
-        return sensorNameA;
-    }
-
-    /**
-     * @return the sensorNameB
-     */
-    public String getSensorNameB() {
-        return sensorNameB;
-    }
-
-    /**
-     * @return the ruggedA
-     */
-    public Rugged getRuggedA() {
-        return ruggedA;
-    }
-
-    /**
-     * @param ruggedA the ruggedA to set
-     */
-    public void setRuggedA(final Rugged ruggedA) {
-        this.ruggedA = ruggedA;
-    }
-
-    /**
-     * @return the ruggedB
-     */
-    public Rugged getRuggedB() {
-        return ruggedB;
-    }
-
     /**
      * @return the ruggedList
      */
     public  Collection<Rugged> getRuggeds() {
-        List<Rugged> ruggedList = Arrays.asList(this.ruggedA, this.ruggedB);
+        List<Rugged> ruggedList = Arrays.asList(ruggedA, ruggedB);
         return ruggedList;
     }
-
-    /**
-     * @param ruggedB the ruggedB to set
-     */
-    public void setRuggedB(final Rugged ruggedB) {
-        this.ruggedB = ruggedB;
-    }
-
-    /**
-     * @param measurements the measurements to set
-     */
-    public void setMeasurements(final InterMeasurementGenerator measurements) {
-        this.measurements = measurements;
-    }
 }
diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java
index fbe74b50..3c67f6db 100644
--- a/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java
+++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java
@@ -203,25 +203,25 @@ public class InterMeasurementGenerator implements Measurable {
                     final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(),
                                                                      sensorB.getLOS(dateB, pixelB));
 
-                    final double GEOdistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
+                    final double geoDistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
                                                                                     gpB.getLongitude(), gpB.getLatitude());
 
-                    if (GEOdistance < this.outlier) {
+                    if (geoDistance < this.outlier) {
                     	
-                        final SensorPixel RealPixelA = new SensorPixel(line, pixelA);
-                        final SensorPixel RealPixelB = new SensorPixel(sensorPixelB.getLineNumber(), sensorPixelB.getPixelNumber());
+                        final SensorPixel realPixelA = new SensorPixel(line, pixelA);
+                        final SensorPixel realPixelB = new SensorPixel(sensorPixelB.getLineNumber(), sensorPixelB.getPixelNumber());
 
-                        final AbsoluteDate RealDateA = sensorA.getDate(RealPixelA.getLineNumber());
-                        final AbsoluteDate RealDateB = sensorB.getDate(RealPixelB.getLineNumber());
-                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, RealDateA, RealPixelA.getPixelNumber(), scToBodyA,
-                                                                                 sensorB, RealDateB, RealPixelB.getPixelNumber());
+                        final AbsoluteDate realDateA = sensorA.getDate(realPixelA.getLineNumber());
+                        final AbsoluteDate realDateB = sensorB.getDate(realPixelB.getLineNumber());
+                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, realDateA, realPixelA.getPixelNumber(), scToBodyA,
+                                                                                 sensorB, realDateB, realPixelB.getPixelNumber());
 
                         final double losDistance = 0.0;
                         final double earthDistance = distanceLOSB[1];
 
-                        interMapping.addMapping(RealPixelA, RealPixelB, losDistance, earthDistance);
+                        interMapping.addMapping(realPixelA, realPixelB, losDistance, earthDistance);
 
-                        // increment the number of measurements
+                        // Increment the number of measurements
                         this.measurementCount++;
                     }
                 }
@@ -256,11 +256,11 @@ public class InterMeasurementGenerator implements Measurable {
         final double meanB[] = { mean[1], mean[1] };
         final double stdB[]  = { std[1], std[1] };
 
-        // seed has been fixed for tests purpose
+        // Seed has been fixed for tests purpose
         final GaussianRandomGenerator rngA = new GaussianRandomGenerator(new Well19937a(0xefac03d9be4d24b9l));
         final UncorrelatedRandomVectorGenerator rvgA = new UncorrelatedRandomVectorGenerator(meanA, stdA, rngA);
 
-        // seed has been fixed for tests purpose
+        // Seed has been fixed for tests purpose
         final GaussianRandomGenerator rngB = new GaussianRandomGenerator(new Well19937a(0xdf1c03d9be0b34b9l));
         final UncorrelatedRandomVectorGenerator rvgB = new UncorrelatedRandomVectorGenerator(meanB, stdB, rngB);
 
@@ -285,27 +285,27 @@ public class InterMeasurementGenerator implements Measurable {
 
                     final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(),
                                                                      sensorB.getLOS(dateB, pixelB));
-                    final double GEOdistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
+                    final double geoDistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(),
                                                                                     gpB.getLongitude(), gpB.getLatitude());
-                    // create the inter mapping if distance is below outlier value
-                    if (GEOdistance < outlier) {
+                    // Create the inter mapping if distance is below outlier value
+                    if (geoDistance < outlier) {
 
                         final double[] vecRandomA = rvgA.nextVector();
                         final double[] vecRandomB = rvgB.nextVector();
 
-                        final SensorPixel RealPixelA = new SensorPixel(line + vecRandomA[0], pixelA + vecRandomA[1]);
-                        final SensorPixel RealPixelB = new SensorPixel(sensorPixelB.getLineNumber() + vecRandomB[0],
+                        final SensorPixel realPixelA = new SensorPixel(line + vecRandomA[0], pixelA + vecRandomA[1]);
+                        final SensorPixel realPixelB = new SensorPixel(sensorPixelB.getLineNumber() + vecRandomB[0],
                                                                        sensorPixelB.getPixelNumber() + vecRandomB[1]);
-                        final AbsoluteDate RealDateA = sensorA.getDate(RealPixelA.getLineNumber());
-                        final AbsoluteDate RealDateB = sensorB.getDate(RealPixelB.getLineNumber());
-                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, RealDateA, RealPixelA.getPixelNumber(), scToBodyA,
-                                                                                 sensorB, RealDateB, RealPixelB.getPixelNumber());
+                        final AbsoluteDate realDateA = sensorA.getDate(realPixelA.getLineNumber());
+                        final AbsoluteDate realDateB = sensorB.getDate(realPixelB.getLineNumber());
+                        final double[] distanceLOSB = ruggedB.distanceBetweenLOS(sensorA, realDateA, realPixelA.getPixelNumber(), scToBodyA,
+                                                                                 sensorB, realDateB, realPixelB.getPixelNumber());
                         final Double losDistance = 0.0;
                         final Double earthDistance = distanceLOSB[1];
 
-                        interMapping.addMapping(RealPixelA, RealPixelB, losDistance, earthDistance);
+                        interMapping.addMapping(realPixelA, realPixelB, losDistance, earthDistance);
 
-                        // increment the number of measurements
+                        // Increment the number of measurements
                         this.measurementCount++;
                     }
                 }
diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/models/OrbitModel.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/models/OrbitModel.java
index c75ff025..fc9a3d23 100644
--- a/src/tutorials/java/fr/cs/examples/refiningPleiades/models/OrbitModel.java
+++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/models/OrbitModel.java
@@ -66,7 +66,8 @@ import org.orekit.utils.AngularDerivativesFilter;
  * </p>
  * @author Jonathan Guinet
  * @author Guylaine Prat
- * @since 2.0 */
+ * @since 2.0 
+ */
 
 public class OrbitModel {
 
-- 
GitLab