Skip to content

Commit a104092

Browse files
committed
Merge branch 'hotfix_fillcf' into 'main'
Bug fixes (in launch_fillcf.py and dale.cc) See merge request ardg/libra!155
2 parents 69058e4 + 7db7edb commit a104092

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
lines changed

apps/src/Dale/dale.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ namespace Dale
244244
//
245245
//---------------------------------------------------
246246
//
247-
string type, subType, targetName, weightName, sumwtName, pbName;
247+
string type="", subType="", targetName=imageName, weightName=wtImageName, sumwtName=sowImageName, pbName="";
248248

249249
LogIO logio(LogOrigin("Dale","dale"));
250250

@@ -300,7 +300,7 @@ namespace Dale
300300
// << endl;
301301
if (computePB)
302302
{
303-
pbName = imageName + ".pb";
303+
pbName = librautils::removeExtension(targetName) + ".pb";
304304
compute_pb(pbName, *wImage, *swImage, pblimit, logio);
305305
}
306306
}

apps/src/tests/test_dale.cc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,64 @@ TEST(DaleTest, AppLevelPSF) {
6767
}
6868

6969

70+
TEST(DaleTest, AppLevelPSFWithAllNames) {
71+
// Get the test name
72+
string testName = ::testing::UnitTest::GetInstance()->current_test_info()->name();
73+
74+
// Create a unique directory for this test case
75+
path testDir = current_path() / testName;
76+
string testdir = testDir.string();
77+
78+
// create test dir
79+
std::filesystem::create_directory(testDir);
80+
81+
//copy over from gold_standard to test dir
82+
std::filesystem::copy(goldDir/"refim_point_wterm_vlad.psf", testDir/"refim_point_wterm_vlad.psf", copy_options::recursive);
83+
std::filesystem::copy(goldDir/"refim_point_wterm_vlad.weight", testDir/"refim_point_wterm_vlad.weight", copy_options::recursive);
84+
std::filesystem::copy(goldDir/"refim_point_wterm_vlad.sumwt", testDir/"refim_point_wterm_vlad.sumwt", copy_options::recursive);
85+
86+
//Step into test dir
87+
std::filesystem::current_path(testDir);
88+
89+
// note, workdir, psfcutoff and facets are actually not used un acme
90+
string imageName="refim_point_wterm_vlad.psf", normtype="flatnoise", imType="psf";
91+
string wtImageName="refim_point_wterm_vlad.weight", sowImageName="refim_point_wterm_vlad.sumwt";
92+
float pblimit=0.005, psfcutoff=0.35;
93+
bool computePB = true;
94+
bool normalize_weight = true;
95+
96+
Dale::dale(imageName,
97+
wtImageName, sowImageName,
98+
normtype, imType, pblimit,
99+
//psfcutoff,
100+
computePB);// normalize_weight);
101+
102+
103+
// Check that the .psf is generated
104+
path p1("refim_point_wterm_vlad.psf");
105+
path p2("refim_point_wterm_vlad.pb");
106+
bool ans = exists(p1) && exists(p2) ;
107+
108+
EXPECT_TRUE( ans );
109+
110+
float tol = 0.05;
111+
float goldValLoc0 = 1;
112+
float goldValLoc1 = -0.0070736;
113+
114+
PagedImage<Float> psfimage("refim_point_wterm_vlad.psf");
115+
EXPECT_NEAR(psfimage(IPosition(4,1024,1024,0,0)), goldValLoc0, tol);
116+
EXPECT_NEAR(psfimage(IPosition(4,1050,1050,0,0)), goldValLoc1, tol);
117+
118+
PagedImage<Float> pbimage("refim_point_wterm_vlad.pb");
119+
EXPECT_NEAR(pbimage(IPosition(4,1024,1024,0,0)), goldValLoc0, tol);
120+
121+
//move to parent directory
122+
std::filesystem::current_path(testDir.parent_path());
123+
124+
remove_all(testDir);
125+
}
126+
127+
70128
TEST(DaleTest, AppLevelResidual) {
71129
// Get the test name
72130
string testName = ::testing::UnitTest::GetInstance()->current_test_info()->name();

scripts/experimental/launch_fillcf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ def check_coyote_app(self):
216216
self.logger.info(f"coyote_app path is now set to absolute path: {self.coyote_app}")
217217

218218
checkfile = self.check_path(self.coyote_app)
219-
if checkfile == "directory":
219+
if "directory" in checkfile:
220220
self.logger.warning(f"{self.coyote_app} is a directory. Checking for binary in {self.coyote_app}/bin/coyote")
221221
checkfile = self.check_path(os.path.join(self.coyote_app, "bin/coyote"))
222-
if checkfile == "file":
222+
if "file" in checkfile:
223223
self.coyote_app = os.path.join(self.coyote_app, "bin/coyote")
224224
self.logger.info(f"coyote_app binary found at {self.coyote_app}")
225225
elif "file (executable)" in checkfile:
226-
self.logger.warning(f"coyote_app binary not found in {self.coyote_app}. Please provide the correct path.")
227-
elif checkfile == "file":
226+
self.logger.info(f"coyote_app binary found in {self.coyote_app}.");
227+
elif "file" in checkfile:
228228
self.logger.info(f"coyote_app binary found at {self.coyote_app}")
229229
return
230230
else:

0 commit comments

Comments
 (0)