Skip to content
Snippets Groups Projects
Commit 2679bc6b authored by LabatAllee Lucie's avatar LabatAllee Lucie
Browse files

prepare to merge mutual methods from Refining and InterRefining

parent ae04470b
No related branches found
No related tags found
No related merge requests found
...@@ -70,8 +70,8 @@ public class PleiadesViewingModel { ...@@ -70,8 +70,8 @@ public class PleiadesViewingModel {
* sensorName="line", incidenceAngle = 0.0, date = "2016-01-01T12:00:00.0" * sensorName="line", incidenceAngle = 0.0, date = "2016-01-01T12:00:00.0"
* </p> * </p>
*/ */
public PleiadesViewingModel() throws RuggedException, OrekitException { public PleiadesViewingModel(final String sensorName) throws RuggedException, OrekitException {
this("line",0.0,"2016-01-01T12:00:00.0"); this(sensorName,0.0,"2016-01-01T12:00:00.0");
} }
/** PleiadesViewingModel constructor /** PleiadesViewingModel constructor
......
...@@ -84,10 +84,10 @@ public class InterRefining { ...@@ -84,10 +84,10 @@ public class InterRefining {
OrbitModel orbitmodelB; OrbitModel orbitmodelB;
/** Sensor name A corresponding to viewing model A */ /** Sensor name A corresponding to viewing model A */
String SensorNameA; String sensorNameA;
/** Sensor name A corresponding to viewing model B */ /** Sensor name A corresponding to viewing model B */
String SensorNameB; String sensorNameB;
/** RuggedA 's instance */ /** RuggedA 's instance */
...@@ -96,7 +96,7 @@ public class InterRefining { ...@@ -96,7 +96,7 @@ public class InterRefining {
/** RuggedB 's instance */ /** RuggedB 's instance */
Rugged ruggedB; Rugged ruggedB;
/** Measurements */ /** Inter-measurements (between both viewing models) */
InterMeasureGenerator measures; InterMeasureGenerator measures;
/** /**
...@@ -104,17 +104,17 @@ public class InterRefining { ...@@ -104,17 +104,17 @@ public class InterRefining {
*/ */
public InterRefining() throws RuggedException, OrekitException { public InterRefining() throws RuggedException, OrekitException {
SensorNameA = "SensorA"; sensorNameA = "SensorA";
final double incidenceAngleA = -5.0; final double incidenceAngleA = -5.0;
final String dateA = "2016-01-01T11:59:50.0"; final String dateA = "2016-01-01T11:59:50.0";
pleiadesViewingModelA = new PleiadesViewingModel(SensorNameA, incidenceAngleA, dateA); pleiadesViewingModelA = new PleiadesViewingModel(sensorNameA, incidenceAngleA, dateA);
SensorNameB = "SensorB"; sensorNameB = "SensorB";
final double incidenceAngleB = 0.0; final double incidenceAngleB = 0.0;
final String dateB = "2016-01-01T12:02:50.0"; final String dateB = "2016-01-01T12:02:50.0";
pleiadesViewingModelB = new PleiadesViewingModel(SensorNameB, incidenceAngleB, dateB); pleiadesViewingModelB = new PleiadesViewingModel(sensorNameB, incidenceAngleB, dateB);
orbitmodelA = new OrbitModel(); orbitmodelA = new OrbitModel();
orbitmodelB = new OrbitModel(); orbitmodelB = new OrbitModel();
...@@ -308,7 +308,14 @@ public class InterRefining { ...@@ -308,7 +308,14 @@ public class InterRefining {
// Check estimated values // Check estimated values
// ---------------------- // ----------------------
refining.paramsEstimation(rollValueA, pitchValueA, factorValue, rollValueB, pitchValueB); System.out.format("\n**** Check parameters ajustement **** %n");
System.out.format("Acquisition A:%n");
refining.paramsEstimation(refining.getRuggedA(), refining.getSensorNameA(),
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);
// Compute statistics // Compute statistics
...@@ -409,7 +416,7 @@ public class InterRefining { ...@@ -409,7 +416,7 @@ public class InterRefining {
* @return the sensorNameA * @return the sensorNameA
*/ */
public String getSensorNameA() { public String getSensorNameA() {
return SensorNameA; return sensorNameA;
} }
...@@ -418,7 +425,7 @@ public class InterRefining { ...@@ -418,7 +425,7 @@ public class InterRefining {
* @return the sensorNameB * @return the sensorNameB
*/ */
public String getSensorNameB() { public String getSensorNameB() {
return SensorNameB; return sensorNameB;
} }
...@@ -513,9 +520,11 @@ public class InterRefining { ...@@ -513,9 +520,11 @@ public class InterRefining {
/** Apply disruptions on acquisition A or B /** Apply disruptions on acquisition A or B
* @param rollValue rotation on roll value * @param rugged Rugged instance
* @param pitchValue rotation on pitch value * @param sensorName line sensor name
* @param factorValue scale factor * @param rollValue rotation on roll value
* @param pitchValue rotation on pitch value
* @param factorValue scale factor
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
...@@ -557,6 +566,7 @@ public class InterRefining { ...@@ -557,6 +566,7 @@ public class InterRefining {
final double earthConstraintWeight = 0.1; // earth constraint weight final double earthConstraintWeight = 0.1; // earth constraint weight
// TODO: faire le cas sans contraintes // TODO: faire le cas sans contraintes
/* Generate measures with constraints on Earth distance */
InterMeasureGenerator measures = new InterMeasureGenerator(pleiadesViewingModelA,ruggedA, InterMeasureGenerator measures = new InterMeasureGenerator(pleiadesViewingModelA,ruggedA,
pleiadesViewingModelB,ruggedB, pleiadesViewingModelB,ruggedB,
outlierValue, outlierValue,
...@@ -613,7 +623,9 @@ public class InterRefining { ...@@ -613,7 +623,9 @@ public class InterRefining {
} }
/** Reset models /** Reset a model
* @param rugged Rugged instance
* @param sensorName line sensor name
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
...@@ -674,70 +686,45 @@ public class InterRefining { ...@@ -674,70 +686,45 @@ public class InterRefining {
/** Check parameters estimation /** Check parameters estimation
* @param rugged Rugged instance
* @param sensorName line sensor name
* @param rollValue rotation on roll value
* @param pitchValue rotation on pitch value
* @param factorValue scale factor
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
public void paramsEstimation(double rollValueA, double pitchValueA, double factorValue, public void paramsEstimation(Rugged rugged, String sensorName,
double rollValueB, double pitchValueB) throws OrekitException, RuggedException { double rollValue, double pitchValue, double factorValue) throws OrekitException, RuggedException {
final String commonFactorName = "factor"; final String commonFactorName = "factor";
System.out.format("\n**** Check parameters ajustement **** %n"); // Estimate Roll
double estimatedRoll = rugged.getLineSensor(sensorName).
// Acquisition A
// -------------
// Estimate roll
double estRollA = ruggedA.getLineSensor(pleiadesViewingModelA.getSensorName()).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals(SensorNameA+"_roll")). filter(driver -> driver.getName().equals(sensorName+"_roll")).
findFirst().get().getValue(); findFirst().get().getValue();
double rollErrorA = (estRollA - rollValueA);
System.out.format("Estimated roll A: %3.5f\troll error: %3.6e%n", estRollA, rollErrorA);
// Estimate pitch
double estPitchA = ruggedA.getLineSensor(pleiadesViewingModelA.getSensorName()).
getParametersDrivers().
filter(driver -> driver.getName().equals(SensorNameA+"_pitch")).
findFirst().get().getValue();
double pitchErrorA = (estPitchA - pitchValueA);
System.out.format("Estimated pitch A: %3.5f\tpitch error: %3.6e%n", estPitchA, pitchErrorA);
// Estimate scale factor double rollError = (estimatedRoll - rollValue);
double estFactorA = ruggedA.getLineSensor(pleiadesViewingModelA.getSensorName()). System.out.format("Estimated roll: %3.5f\troll error: %3.6e %n", estimatedRoll, rollError);
getParametersDrivers().
filter(driver -> driver.getName().equals(commonFactorName)).
findFirst().get().getValue();
double factorErrorA = (estFactorA - factorValue);
System.out.format("Estimated factor A: %3.5f\tfactor error: %3.6e%n", estFactorA, factorErrorA);
// Acquisition B
// -------------
// Estimate roll
double estRollB = ruggedB.getLineSensor(pleiadesViewingModelB.getSensorName()).
getParametersDrivers().
filter(driver -> driver.getName().equals(SensorNameB+"_roll")).
findFirst().get().getValue();
double rollErrorB = (estRollB - rollValueB);
System.out.format("Estimated roll B: %3.5f\troll error: %3.6e%n", estRollB, rollErrorB);
// Estimate pitch // Estimate pitch
double estPitchB = ruggedB.getLineSensor(pleiadesViewingModelB.getSensorName()). double estimatedPitch = rugged.getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals(SensorNameB+"_pitch")). filter(driver -> driver.getName().equals(sensorName+"_pitch")).
findFirst().get().getValue(); findFirst().get().getValue();
double pitchErrorB = (estPitchB - pitchValueB);
System.out.format("Estimated pitch B: %3.5f\tpitch error: %3.6e%n", estPitchB, pitchErrorB);
// Estimate scale factor double pitchError = (estimatedPitch - pitchValue);
double estFactorB = ruggedB.getLineSensor(pleiadesViewingModelB.getSensorName()). System.out.format("Estimated pitch: %3.5f\tpitch error: %3.6e %n", estimatedPitch, pitchError);
getParametersDrivers().
filter(driver -> driver.getName().equals(commonFactorName)). // Estimate factor
findFirst().get().getValue(); double estimatedFactor = rugged.getLineSensor(sensorName).
double factorErrorB = (estFactorB - factorValue); getParametersDrivers().
System.out.format("Estimated factor B: %3.5f\tfactor error: %3.6e%n", estFactorB, factorErrorB); filter(driver -> driver.getName().equals(commonFactorName)).
findFirst().get().getValue();
double factorError = (estimatedFactor - factorValue);
System.out.format("Estimated factor: %3.5f\tfactor error: %3.6e %n", estimatedFactor, factorError);
} }
} }
...@@ -73,10 +73,13 @@ public class Refining { ...@@ -73,10 +73,13 @@ public class Refining {
/** Orbit model */ /** Orbit model */
OrbitModel orbitmodel; OrbitModel orbitmodel;
/** Sensor name */
String sensorName;
/** Rugged instance */ /** Rugged instance */
Rugged rugged; Rugged rugged;
/** Measurements */ /** Ground measurements */
GroundMeasureGenerator measures; GroundMeasureGenerator measures;
...@@ -85,7 +88,8 @@ public class Refining { ...@@ -85,7 +88,8 @@ public class Refining {
*/ */
public Refining() throws RuggedException, OrekitException { public Refining() throws RuggedException, OrekitException {
pleiadesViewingModel = new PleiadesViewingModel(); sensorName = "line";
pleiadesViewingModel = new PleiadesViewingModel(sensorName);
orbitmodel = new OrbitModel(); orbitmodel = new OrbitModel();
} }
...@@ -182,7 +186,8 @@ public class Refining { ...@@ -182,7 +186,8 @@ public class Refining {
System.out.format("roll: %3.5f \tpitch: %3.5f \tfactor: %3.5f \n",rollValue, pitchValue, factorValue); System.out.format("roll: %3.5f \tpitch: %3.5f \tfactor: %3.5f \n",rollValue, pitchValue, factorValue);
// Apply disruptions on physical model // Apply disruptions on physical model
refining.applyDisruptions(rollValue, pitchValue, factorValue); refining.applyDisruptions(refining.getRugged(), refining.getSensorName(),
rollValue, pitchValue, factorValue);
// Generate measures (observations) from physical model disrupted // Generate measures (observations) from physical model disrupted
...@@ -200,7 +205,7 @@ public class Refining { ...@@ -200,7 +205,7 @@ public class Refining {
// Initialize physical model without disruptions // Initialize physical model without disruptions
// --------------------------------------------- // ---------------------------------------------
System.out.format("\n**** Initialize physical model without disruptions: reset Roll/Pitch/Factor **** %n"); System.out.format("\n**** Initialize physical model without disruptions: reset Roll/Pitch/Factor **** %n");
refining.resetModel(); refining.resetModel(refining.getRugged(), refining.getSensorName());
// Compute initial residues // Compute initial residues
...@@ -217,7 +222,9 @@ public class Refining { ...@@ -217,7 +222,9 @@ public class Refining {
// Check estimated values // Check estimated values
// ---------------------- // ----------------------
refining.paramsEstimation(rollValue, pitchValue, factorValue); System.out.format("\n**** Check parameters ajustement **** %n");
refining.paramsEstimation(refining.getRugged(), refining.getSensorName(),
rollValue, pitchValue, factorValue);
// Compute statistics // Compute statistics
...@@ -272,6 +279,15 @@ public class Refining { ...@@ -272,6 +279,15 @@ public class Refining {
this.orbitmodel = orbitmodel; this.orbitmodel = orbitmodel;
} }
/**
* @return the sensorName
*/
public String getSensorName() {
return sensorName;
}
/** /**
* @return the rugged * @return the rugged
*/ */
...@@ -338,31 +354,36 @@ public class Refining { ...@@ -338,31 +354,36 @@ public class Refining {
/** Apply disruptions /** Apply disruptions
* @param rugged Rugged instance
* @param sensorName line sensor name
* @param rollValue rotation on roll value * @param rollValue rotation on roll value
* @param pitchValue rotation on pitch value * @param pitchValue rotation on pitch value
* @param factorValue scale factor * @param factorValue scale factor
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
public void applyDisruptions(double rollValue, double pitchValue, double factorValue) throws OrekitException, RuggedException { public void applyDisruptions(Rugged rugged, String sensorName, double rollValue, double pitchValue, double factorValue) throws OrekitException, RuggedException {
final String commonFactorName = "factor";
rugged. rugged.
getLineSensor("line"). getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("line_roll")). filter(driver -> driver.getName().equals(sensorName+"_roll")).
findFirst().get().setValue(rollValue); findFirst().get().setValue(rollValue);
rugged. rugged.
getLineSensor("line"). getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("line_pitch")). filter(driver -> driver.getName().equals(sensorName+"_pitch")).
findFirst().get().setValue(pitchValue); findFirst().get().setValue(pitchValue);
rugged. rugged.
getLineSensor("line"). getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("factor")). filter(driver -> driver.getName().equals(commonFactorName)).
findFirst().get().setValue(factorValue); findFirst().get().setValue(factorValue);
} }
...@@ -426,16 +447,21 @@ public class Refining { ...@@ -426,16 +447,21 @@ public class Refining {
} }
/** Reset models /** Reset a model
* @param rugged Rugged instance
* @param sensorName line sensor name
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
public void resetModel() throws OrekitException, RuggedException { public void resetModel(Rugged rugged, String sensorName) throws OrekitException, RuggedException {
final String commonFactorName = "factor";
rugged. rugged.
getLineSensor(pleiadesViewingModel.getSensorName()). getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("line_roll") || driver.getName().equals("line_pitch")). filter(driver -> driver.getName().equals(sensorName+"_roll")
|| driver.getName().equals(sensorName+"_pitch")).
forEach(driver -> { forEach(driver -> {
try { try {
driver.setSelected(true); driver.setSelected(true);
...@@ -445,9 +471,9 @@ public class Refining { ...@@ -445,9 +471,9 @@ public class Refining {
} }
}); });
rugged. rugged.
getLineSensor(pleiadesViewingModel.getSensorName()). getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("factor")). filter(driver -> driver.getName().equals(commonFactorName)).
forEach(driver -> { forEach(driver -> {
try { try {
driver.setSelected(true); driver.setSelected(true);
...@@ -484,34 +510,41 @@ public class Refining { ...@@ -484,34 +510,41 @@ public class Refining {
/** Check parameters estimation /** Check parameters estimation
* @param rugged Rugged instance
* @param sensorName line sensor name
* @param rollValue rotation on roll value
* @param pitchValue rotation on pitch value
* @param factorValue scale factor
* @throws OrekitException * @throws OrekitException
* @throws RuggedException * @throws RuggedException
*/ */
public void paramsEstimation(double rollValue, double pitchValue, double factorValue) throws OrekitException, RuggedException { public void paramsEstimation(Rugged rugged, String sensorName,
double rollValue, double pitchValue, double factorValue) throws OrekitException, RuggedException {
final String commonFactorName = "factor";
System.out.format("\n**** Check parameters ajustement **** %n");
// Estimate Roll // Estimate Roll
double estimatedRoll = rugged.getLineSensor(pleiadesViewingModel.getSensorName()). double estimatedRoll = rugged.getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("line_roll")). filter(driver -> driver.getName().equals(sensorName+"_roll")).
findFirst().get().getValue(); findFirst().get().getValue();
double rollError = (estimatedRoll - rollValue); double rollError = (estimatedRoll - rollValue);
System.out.format("Estimated roll: %3.5f\troll error: %3.6e %n", estimatedRoll, rollError); System.out.format("Estimated roll: %3.5f\troll error: %3.6e %n", estimatedRoll, rollError);
// Estimate pitch // Estimate pitch
double estimatedPitch = rugged.getLineSensor(pleiadesViewingModel.getSensorName()). double estimatedPitch = rugged.getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("line_pitch")). filter(driver -> driver.getName().equals(sensorName+"_pitch")).
findFirst().get().getValue(); findFirst().get().getValue();
double pitchError = (estimatedPitch - pitchValue); double pitchError = (estimatedPitch - pitchValue);
System.out.format("Estimated pitch: %3.5f\tpitch error: %3.6e %n", estimatedPitch, pitchError); System.out.format("Estimated pitch: %3.5f\tpitch error: %3.6e %n", estimatedPitch, pitchError);
// Estimate factor // Estimate factor
double estimatedFactor = rugged.getLineSensor(pleiadesViewingModel.getSensorName()). double estimatedFactor = rugged.getLineSensor(sensorName).
getParametersDrivers(). getParametersDrivers().
filter(driver -> driver.getName().equals("factor")). filter(driver -> driver.getName().equals(commonFactorName)).
findFirst().get().getValue(); findFirst().get().getValue();
double factorError = (estimatedFactor - factorValue); double factorError = (estimatedFactor - factorValue);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment