Skip to content

Commit

Permalink
tests for bundle adjust plots
Browse files Browse the repository at this point in the history
  • Loading branch information
bpurinton committed May 10, 2024
1 parent c0ff8b7 commit 7c47d89
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 5 deletions.
26 changes: 26 additions & 0 deletions tests/test_bundle_adjust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pytest
from asp_plot.bundle_adjust import ReadResiduals, PlotResiduals
import matplotlib
import geopandas as gpd

matplotlib.use("Agg")


class TestBundleAdjust:
@pytest.fixture
def residual_files(self):
directory = "tests/test_data/"
ba_prefix = "ba/ba"
return ReadResiduals(directory, ba_prefix)

def test_get_residual_gdfs(self, residual_files):
resid_init, resid_final = residual_files.get_residual_gdfs()
assert isinstance(resid_init, gpd.GeoDataFrame)
assert isinstance(resid_final, gpd.GeoDataFrame)

def test_plot_n_residuals(self, residual_files):
resid_init, resid_final = residual_files.get_residual_gdfs()
try:
PlotResiduals([resid_init, resid_final]).plot_n_residuals(column_name="mean_residual")
except Exception as e:
pytest.fail(f"figure method raised an exception: {str(e)}")
7 changes: 7 additions & 0 deletions tests/test_data/ba/ba-final_residuals_pointmap.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# lon, lat, height_above_datum, mean_residual, num_observations
# Geodetic Datum --> Name: WGS_1984 Spheroid: WGS 84 Semi-major axis: 6378137 Semi-minor axis: 6356752.3142451793 Meridian: Greenwich at 0 Proj4 Str: +proj=longlat +datum=WGS84 +no_defs
-156.8787621266714, 71.271874841087325, -0.36491041881727709, 0.27929182170458566, 2
-156.8780547480608, 71.275398550769182, 0.26183095769151948, 0.091659615252865478, 2
-156.87727580996784, 71.286145888801144, -0.91625511622648326, 0.052193733525443042, 2
-156.87470631386205, 71.290327538976598, -1.5761793022808819, 0.23095878065626796, 2
-156.87364518396637, 71.27818895086348, -0.7222090013486745, 0.12443687149487473, 2
9 changes: 9 additions & 0 deletions tests/test_data/ba/ba-initial_residuals_pointmap.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# lon, lat, height_above_datum, mean_residual, num_observations
# Geodetic Datum --> Name: WGS_1984 Spheroid: WGS 84 Semi-major axis: 6378137 Semi-minor axis: 6356752.3142451793 Meridian: Greenwich at 0 Proj4 Str: +proj=longlat +datum=WGS84 +no_defs
-156.87876206140302, 71.271875132031866, -0.42092562742504364, 0.19631815744360209, 2
-156.87805391399652, 71.275398639905859, 0.22662260452218885, 0.38524321762160979, 2
-156.87727461766127, 71.286145872610589, -0.93934368885776565, 0.52892293474772789, 2
-156.87470605883939, 71.290327757295771, -1.6203314659331238, 0.24375310456064955, 2
-156.87527466499779, 71.276976449943888, -63.30750525606679, 19.410683117621161, 2
-156.87364231464838, 71.27818852567637, -0.71749579571765587, 0.25425952709437116, 2
-156.87361011617145, 71.273405048961152, 0.040032582617270253, 0.53133591364021404, 2
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/test_processing_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
class TestProcessingParameters:
@pytest.fixture
def processing_parameters(self):
bundle_adjust_log = "tests/test_data/ba-log.txt"
stereo_log = "tests/test_data/stereo-log.txt"
point2dem_log = "tests/test_data/point2dem-log.txt"
bundle_adjust_log = "tests/test_data/ba/ba-log.txt"
stereo_log = "tests/test_data/stereo/stereo-log.txt"
point2dem_log = "tests/test_data/stereo/point2dem-log.txt"
return ProcessingParameters(bundle_adjust_log, stereo_log, point2dem_log)

def test_init(self, processing_parameters):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_scene_plots.py → tests/test_scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class TestScenePlotter:
@pytest.fixture
def scene_plotter(self):
left_image_fn = "tests/test_data/mini-L_sub.tif"
right_image_fn = "tests/test_data/mini-R_sub.tif"
left_image_fn = "tests/test_data/stereo/mini-L_sub.tif"
right_image_fn = "tests/test_data/stereo/mini-R_sub.tif"
return ScenePlotter(left_image_fn, right_image_fn)

def test_plot_orthos(self, scene_plotter):
Expand Down

0 comments on commit 7c47d89

Please sign in to comment.