Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests + test data for CSM jigsaw #4530

Merged
merged 10 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions isis/src/control/objs/BundleAdjust/BundleAdjust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,8 +1857,6 @@ namespace Isis {
BundleMeasure &measure,
BundleControlPoint &point) {

std::cout << "Computing partials for [" << measure.cubeSerialNumber() << "] in [" << point.id() << "]." << std::endl;

Camera *measureCamera = measure.camera();
BundleObservationQsp observation = measure.parentBundleObservation();

Expand Down Expand Up @@ -1935,7 +1933,6 @@ namespace Isis {
coeffTarget *= observationWeight;
}
}
std::cout << std::endl;

return true;
}
Expand Down
43 changes: 43 additions & 0 deletions isis/tests/Fixtures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "FileName.h"

#include "Blob.h"
#include "csminit.h"
#include "Fixtures.h"
#include "Portal.h"
#include "LineManager.h"
Expand Down Expand Up @@ -1373,4 +1374,46 @@ namespace Isis {
}
}

void CSMNetwork::SetUp(){
QString APP_XML = FileName("$ISISROOT/bin/xml/csminit.xml").expanded();
QVector<QString> fNames = {"/Test_A", "/Test_B",
"/Test_C", "/Test_D",
"/Test_E", "/Test_F",
"/Test_G", "/Test_H",
"/Test_I", "/Test_J"
};

cubes.fill(nullptr, 10);

cubeList = new FileList();
cubeListFile = tempDir.path() + "/cubes.lis";
// Create CSMInit-ed cubes
for (int i = 0; i < cubes.size() ; i++){
cubes[i] = new Cube();
cubes[i]->setDimensions(1024,1024,1);
FileName cubName = FileName(tempDir.path()+fNames[i]+".cub");
cubes[i]->create(cubName.expanded());
cubeList->append(cubes[i]->fileName());
QVector<QString> args = {"from="+cubName.expanded(),
"state=data/CSMNetwork/"+fNames[i]+".json",
"modelname=TestCsmModel",
"pluginname=TestCsmPlugin"
};
UserInterface ui(APP_XML, args);
csminit(ui);
}
cubeList->write(cubeListFile);
}

void CSMNetwork::TearDown() {
for(int i = 0; i < cubes.size(); i++) {
if(cubes[i] && cubes[i]->isOpen()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's open, shouldn't the procedure be (1) close the cube, (2) delete the cube?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of thought the same, but it segfaults when I try to close here, and other fixtures (e.g. ApolloNetwork) don't close before deleting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thanks!

delete cubes[i];
}
}

if (cubeList) {
delete cubeList;
}
}
}
18 changes: 17 additions & 1 deletion isis/tests/Fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ namespace Isis {
void TearDown() override;
};


class DefaultCube : public TempTestingFiles {
protected:
Cube *testCube;
Expand Down Expand Up @@ -338,6 +337,23 @@ class VikThmNetwork : public TempTestingFiles {
void SetUp() override;
void TearDown() override;
};

class CSMNetwork : public TempTestingFiles {
protected:

QVector<FileName> stateStringFiles;
QVector<FileName> labelFiles;
QVector<Cube*> cubes;

ControlNet *network;
QString controlNetPath;
AustinSanders marked this conversation as resolved.
Show resolved Hide resolved

FileList *cubeList;
QString cubeListFile;

void SetUp() override;
void TearDown() override;
};
}

#endif
75 changes: 75 additions & 0 deletions isis/tests/FunctionalTestsJigsaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Latitude.h"
#include "Longitude.h"
#include "ControlPoint.h"
#include "CSMCamera.h"

#include "jigsaw.h"

Expand Down Expand Up @@ -1591,3 +1592,77 @@ TEST_F(MiniRFNetwork, FunctionalTestJigsawRadar) {
"0.0,-1.5077677229935,N/A,N/A,22.723572340278,0.0,22.723572340278,N/A,N/A,-169.13683247633,"
"0.0,-169.13683247633,N/A,N/A", 1);
}


TEST_F(CSMNetwork, FunctionalTestCSMNetwork) {
QTemporaryDir prefix;
QString outCnetFileName = prefix.path() + "/outTemp.net";

// solving for position only, with error propagation
QVector<QString> args1 = {"fromlist="+cubeListFile,
"cnet=data/CSMNetwork/test.net",
"onet="+outCnetFileName,
"maxits=10",
"errorprop=yes",
"bundleout_txt=yes",
"csmsolveset=adjustable",
"POINT_LATITUDE_SIGMA=1125",
"POINT_LONGITUDE_SIGMA=1125",
"file_prefix="+tempDir.path()+"/"
};

UserInterface options1(APP_XML, args1);
try {
jigsaw(options1);

}
catch (IException &e) {
FAIL() << "Failed to bundle: " << e.what() << std::endl;
}

CSVReader line = CSVReader(tempDir.path() + "/bundleout_points.csv", false, 0,
',', false, true);

compareCsvLine(line.getRow(25),
"csm_test_019, FREE, 5, 0, 0, 1.5, 358.5, 1000, 0, 0, 0,"
" 950.4447199, -1195.518876, 0, 999.3147674, -26.16797812, 26.17694831", 1);
compareCsvLine(line.getRow(28),
"csm_test_022, FREE, 5, 0, 0, 1.5, 1.5, 1000, 0, 0, 0,"
" 288.1013812, -1391.568893, 0, 999.3147674,"
" 26.16797812, 26.17694831", 1);
compareCsvLine(line.getRow(49),
"csm_test_043, FREE, 5, 0, 0, -1.5, 358.5, 1000, 0, 0, 0,"
" 1392.108941, -833.2591342, 0, 999.3147674, -26.16797812,"
" -26.17694831", 1);
compareCsvLine(line.getRow(52),
"csm_test_046, FREE, 5, 0, 0, -1.5, 1.5, 1000, 0, 0, 0, 51.85037177,"
" -597.070682, 0, 999.3147674, 26.16797812, -26.17694831", 1);
compareCsvLine(line.getRow(11),
"csm_test_005, FREE, 2, 0, 0, 3.5, 0.5, 1000, 0, 0, 0, 684.8038438,"
" 233.517266, 0, 998.0967925, 8.71025875, 61.04853953", 1);


line = CSVReader(tempDir.path() + "/bundleout_images.csv", false, 0, ',', false, true);
compareCsvLine(line.getRow(3),
"/var/folders/nb/f0fd1pkn2l7gqjdf_5wyzh18002c5k/T/qt_temp-BGU8tK/Test_B.cub,"
AustinSanders marked this conversation as resolved.
Show resolved Hide resolved
" 6.65E-12, 1.41E-13, 4.70E-12, 2.875, 0.125, 3, 0.004162598, 0,"
" -0.0078125, 0.0078125, 6.29E-15, 0.004162598, 0, 258, -2, 256, 68.2, 0",
1);

compareCsvLine(line.getRow(5),
"/var/folders/nb/f0fd1pkn2l7gqjdf_5wyzh18002c5k/T/qt_temp-NXcUte/Test_D.cub,"
"3.96E-12, 1.31E-13, 2.80E-12, -0.125, 0.125, 2.23E-17,"
" 0.004162598, 0, -2.875, -0.125, -3, 0.004162598, 0, 254, 2, 256, 68.2, 0", 1);
compareCsvLine(line.getRow(7),
"/var/folders/nb/f0fd1pkn2l7gqjdf_5wyzh18002c5k/T/qt_temp-BGU8tK/Test_F.cub,"
" 1.55E-13, 8.46E-14, 1.25E-13, 0, 1.39E-17, 1.39E-17, 0.004162598, 0, 3.03125,"
" -0.03125, 3, 0.004162598, 0, 272, -16, 256, 68.2, 0", 1);
compareCsvLine(line.getRow(9),
"/var/folders/nb/f0fd1pkn2l7gqjdf_5wyzh18002c5k/T/qt_temp-NXcUte/Test_H.cub,"
"6.65E-12, 1.10E-13, 4.70E-12, -3.03125, 0.03125, -3, 0.004162598, 0, 0, 6.17E-15,"
" 6.17E-15, 0.004162598",1);
compareCsvLine(line.getRow(11),
"/var/folders/nb/f0fd1pkn2l7gqjdf_5wyzh18002c5k/T/qt_temp-NXcUte/Test_J.cub,"
"2.76E-12, 9.95E-14, 1.96E-12, -0.0625, 0.0625, -2.63E-17, 0.016650391,"
" 0, -0.03125, 0.03125, 6.23E-15, 0.016650391", 1);
}
Loading