From 20cf3c08c201185c07d318fddb47ba13334bca21 Mon Sep 17 00:00:00 2001 From: Neil Shephard Date: Mon, 18 Nov 2024 14:21:16 +0000 Subject: [PATCH] tests(tracing): Split and update tests of disordered traces Splits `test_trace_image_disordered` into two tests, the original compares dictionaries, the newer (suffixed with `_dataframes`) compares the dataframes/csv files that are produced, of which there are two and one needed updating to include the `grain_width_mean` column that #999 introduces. --- ...atenanes_disordered_tracing_grainstats.csv | 3 - .../catenanes_disordered_tracing_stats.csv | 25 ---- .../rep_int_disordered_tracing_grainstats.csv | 2 - .../rep_int_disordered_tracing_stats.csv | 13 -- ..._image_disordered_dataframes[catenane].out | 28 ++++ ...d_dataframes[replication_intermediate].out | 15 ++ tests/tracing/test_disordered_tracing.py | 141 ++++++++++++++---- 7 files changed, 152 insertions(+), 75 deletions(-) delete mode 100644 tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_grainstats.csv delete mode 100644 tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_stats.csv delete mode 100644 tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_grainstats.csv delete mode 100644 tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_stats.csv create mode 100644 tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[catenane].out create mode 100644 tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[replication_intermediate].out diff --git a/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_grainstats.csv b/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_grainstats.csv deleted file mode 100644 index dbeceb405dd..00000000000 --- a/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_grainstats.csv +++ /dev/null @@ -1,3 +0,0 @@ -,image,grain_number,grain_endpoints,grain_junctions,total_branch_lengths -0,test_image,0,0,14,5.755249825836855e-07 -1,test_image,1,0,12,5.747857998943139e-07 diff --git a/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_stats.csv b/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_stats.csv deleted file mode 100644 index 4e0198f6f88..00000000000 --- a/tests/resources/tracing/disordered_tracing/catenanes_disordered_tracing_stats.csv +++ /dev/null @@ -1,25 +0,0 @@ -,image,grain_number,branch_distance,branch_type,connected_segments,mean_pixel_value,stdev_pixel_value,min_value,median_value,middle_value -0,test_image,0,29.857677897827887,2,"[1, 2, 6]",2.6683043052890536,0.3576668425125195,1.993486285613394,2.6464969869174926,2.6743964509318303 -1,test_image,0,28.644860587199464,2,"[0, 2, 6]",2.728953130422273,0.21545195325432523,2.5506513793095915,2.6838064728094184,2.6579579145357006 -2,test_image,0,1.8682724368761408,2,"[0, 1, 3, 4]",4.067541277649083,0.16905835685823303,3.7890382980796193,4.138536286707056,4.13958834095104 -3,test_image,0,146.60562184380709,2,"[2, 4, 9]",2.6693913722865377,0.2947637179915079,1.2200007753773205,2.7080175948240655,2.9115862857598005 -4,test_image,0,26.170179495009112,2,"[2, 3, 9]",2.834959559756504,0.3436409841063358,2.535374801513602,2.7607877845412387,2.7651337225310604 -5,test_image,0,224.58506419260596,2,"[6, 7, 10, 11]",2.700995491724554,0.2653435468736685,1.787397162651758,2.7330374920770115,2.2573671026451536 -6,test_image,0,6.9504086553142095,2,"[0, 1, 5, 7]",3.626373814193468,0.6406710041895474,2.588846104614013,3.84195778773634,3.84195778773634 -7,test_image,0,31.203269242513674,2,"[5, 6, 8, 11]",2.843560036090906,0.5572924823368127,2.1307434183593315,2.705164120987648,2.75295411300335 -8,test_image,0,31.286996805637532,2,"[7, 9, 10, 11]",2.7443198761048193,0.3822328907364185,2.4149214282007074,2.653495727717319,2.4706619619066386 -9,test_image,0,5.570136218438069,2,"[3, 4, 8, 10]",2.7308714736136963,0.049010037214155706,2.6525934702850984,2.7378802570467666,2.749457125278597 -10,test_image,0,38.18835899001824,2,"[5, 8, 9, 11]",2.7864423529784395,0.15142352544214144,2.445066671627662,2.7710339081422832,2.6967078592376783 -11,test_image,0,4.59413621843807,2,"[5, 7, 8, 10]",4.126603901043527,0.37133617585304246,3.351114087306773,4.238726491399509,4.238726491399509 -0,test_image,1,37.70035899001824,2,"[1, 2, 3, 6]",2.7732793700561382,0.13491385165238218,2.445066671627662,2.7690167332032654,2.7141994425994813 -1,test_image,1,223.89492797416787,2,"[0, 2, 4, 9]",2.69655183205219,0.26110756906553556,1.8203021919659572,2.7314109425842963,2.2743843560760055 -2,test_image,1,5.08213621843807,2,"[0, 1, 3, 4]",4.029037066510506,0.4638075153095662,3.0770475331177405,4.18502108746829,4.18502108746829 -3,test_image,1,31.001133024075603,2,"[0, 2, 4, 6]",2.746190739871742,0.4020468170580353,2.443926567140926,2.6515637708741715,2.443926567140926 -4,test_image,1,31.405405460951744,2,"[1, 2, 3, 9]",2.8422583900088516,0.5622599874985189,2.1307434183593315,2.694237316611716,2.75295411300335 -5,test_image,1,147.49789428068328,2,"[6, 7, 11]",2.6728103603722104,0.2940846131940484,1.2200007753773205,2.712208521357603,2.9467266502403127 -6,test_image,1,5.77227243687614,2,"[0, 3, 5, 7]",2.7225654392347494,0.051361792194696554,2.6525934702850984,2.7127873939436142,2.7180535973290754 -7,test_image,1,25.682179495009112,2,"[5, 6, 11]",2.85129816853438,0.36309882085275597,2.535374801513602,2.7617733887534093,2.770465264733052 -8,test_image,1,27.870996805637535,2,"[9, 10, 11]",2.7169147220384864,0.1798385572282301,2.5506513793095915,2.6863743944825202,2.6579579145357006 -9,test_image,1,6.9504086553142095,2,"[1, 4, 8, 10]",3.679401125994582,0.5950886464826225,2.6485713386465375,3.84195778773634,3.84195778773634 -10,test_image,1,29.369677897827888,2,"[8, 9, 11]",2.640305654101202,0.3106025836163093,1.993486285613394,2.648283332587627,2.682776277975024 -11,test_image,1,2.558408655314211,2,"[5, 7, 8, 10]",3.974846970762266,0.23923528279875325,3.6040697432150033,4.075122442799481,4.075122442799481 diff --git a/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_grainstats.csv b/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_grainstats.csv deleted file mode 100644 index f8c476af20b..00000000000 --- a/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_grainstats.csv +++ /dev/null @@ -1,2 +0,0 @@ -,image,grain_number,grain_endpoints,grain_junctions,total_branch_lengths -0,test_image,0,0,13,9.685225788725929e-07 diff --git a/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_stats.csv b/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_stats.csv deleted file mode 100644 index e503c214bb8..00000000000 --- a/tests/resources/tracing/disordered_tracing/rep_int_disordered_tracing_stats.csv +++ /dev/null @@ -1,13 +0,0 @@ -,image,grain_number,branch_distance,branch_type,connected_segments,mean_pixel_value,stdev_pixel_value,min_value,median_value,middle_value -0,test_image,0,172.69207377569276,2,"[1, 2, 3, 8]",2.147391874570661,0.18580255309380492,1.4117732114082249,2.147881683634531,2.193944711921703 -1,test_image,0,338.03541679389866,2,"[0, 2, 7, 11]",2.1261598928571943,0.1841696602430932,1.127883594233125,2.1329128300921694,2.236342991231205 -2,test_image,0,0.6901362184380704,2,"[0, 1, 3, 4]",3.5129004230159246,0.2441665496774352,3.2687338733384856,3.5129004230159246,3.5129004230159246 -3,test_image,0,75.41508335877963,2,"[0, 2, 4, 8]",2.1781050277619003,0.22952699769811186,1.4117732114082249,2.178401374885392,2.2734312397952836 -4,test_image,0,31.893405460951744,2,"[2, 3, 5, 6]",2.1378544765518392,0.338975206263122,1.7555674668849865,2.094437231758162,2.2880045741720902 -5,test_image,0,51.51744873752279,2,"[4, 6, 7]",2.233921716584725,0.23610837345626215,1.7265179765777217,2.206985179983061,2.0220519901178635 -6,test_image,0,1.1781362184380704,2,"[4, 5, 7]",3.4335547526985297,0.29158462263860985,3.0268131230204918,3.578160584306969,3.6956905507681284 -7,test_image,0,153.8275289019402,2,"[1, 5, 6, 11]",2.1708118960130536,0.23399433389250326,1.32021443851052,2.1773699140297205,2.1908233129216366 -8,test_image,0,58.753721174398926,2,"[0, 3, 10, 11]",2.0020290183250613,0.3370066648426065,0.8859157914742134,2.08256912431822,2.247454035474802 -9,test_image,0,38.962222771580166,3,[10],2.2735993718579453,0.17804635219989257,2.0015543670262534,2.2595377460435833,2.2032782158757636 -10,test_image,0,0.488,2,"[8, 9, 11]",2.875087133879444,0.009881348191510873,2.865205785688025,2.875087133879444,2.875087133879444 -11,test_image,0,45.069405460951735,2,"[1, 7, 8, 10]",2.1854926308595277,0.22637773949873832,1.289281969607514,2.227074000531621,2.227074000531621 diff --git a/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[catenane].out b/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[catenane].out new file mode 100644 index 00000000000..cadfb618a38 --- /dev/null +++ b/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[catenane].out @@ -0,0 +1,28 @@ + image grain_number grain_endpoints grain_junctions total_branch_lengths grain_width_mean +0 test_image 0 0 14 5.7552e-07 4.3883e-09 +1 test_image 1 0 12 5.7479e-07 4.4161e-09 + image grain_number branch_distance branch_type connected_segments mean_pixel_value stdev_pixel_value min_value median_value middle_value +0 test_image 0 2.9858e+01 2 [1, 2, 6] 2.6683e+00 3.5767e-01 1.9935e+00 2.6465e+00 2.6744e+00 +1 test_image 0 2.8645e+01 2 [0, 2, 6] 2.7290e+00 2.1545e-01 2.5507e+00 2.6838e+00 2.6580e+00 +2 test_image 0 1.8683e+00 2 [0, 1, 3, 4] 4.0675e+00 1.6906e-01 3.7890e+00 4.1385e+00 4.1396e+00 +3 test_image 0 1.4661e+02 2 [2, 4, 9] 2.6694e+00 2.9476e-01 1.2200e+00 2.7080e+00 2.9116e+00 +4 test_image 0 2.6170e+01 2 [2, 3, 9] 2.8350e+00 3.4364e-01 2.5354e+00 2.7608e+00 2.7651e+00 +5 test_image 0 2.2459e+02 2 [6, 7, 10, 11] 2.7010e+00 2.6534e-01 1.7874e+00 2.7330e+00 2.2574e+00 +6 test_image 0 6.9504e+00 2 [0, 1, 5, 7] 3.6264e+00 6.4067e-01 2.5888e+00 3.8420e+00 3.8420e+00 +7 test_image 0 3.1203e+01 2 [5, 6, 8, 11] 2.8436e+00 5.5729e-01 2.1307e+00 2.7052e+00 2.7530e+00 +8 test_image 0 3.1287e+01 2 [7, 9, 10, 11] 2.7443e+00 3.8223e-01 2.4149e+00 2.6535e+00 2.4707e+00 +9 test_image 0 5.5701e+00 2 [3, 4, 8, 10] 2.7309e+00 4.9010e-02 2.6526e+00 2.7379e+00 2.7495e+00 +10 test_image 0 3.8188e+01 2 [5, 8, 9, 11] 2.7864e+00 1.5142e-01 2.4451e+00 2.7710e+00 2.6967e+00 +11 test_image 0 4.5941e+00 2 [5, 7, 8, 10] 4.1266e+00 3.7134e-01 3.3511e+00 4.2387e+00 4.2387e+00 +0 test_image 1 3.7700e+01 2 [1, 2, 3, 6] 2.7733e+00 1.3491e-01 2.4451e+00 2.7690e+00 2.7142e+00 +1 test_image 1 2.2389e+02 2 [0, 2, 4, 9] 2.6966e+00 2.6111e-01 1.8203e+00 2.7314e+00 2.2744e+00 +2 test_image 1 5.0821e+00 2 [0, 1, 3, 4] 4.0290e+00 4.6381e-01 3.0770e+00 4.1850e+00 4.1850e+00 +3 test_image 1 3.1001e+01 2 [0, 2, 4, 6] 2.7462e+00 4.0205e-01 2.4439e+00 2.6516e+00 2.4439e+00 +4 test_image 1 3.1405e+01 2 [1, 2, 3, 9] 2.8423e+00 5.6226e-01 2.1307e+00 2.6942e+00 2.7530e+00 +5 test_image 1 1.4750e+02 2 [6, 7, 11] 2.6728e+00 2.9408e-01 1.2200e+00 2.7122e+00 2.9467e+00 +6 test_image 1 5.7723e+00 2 [0, 3, 5, 7] 2.7226e+00 5.1362e-02 2.6526e+00 2.7128e+00 2.7181e+00 +7 test_image 1 2.5682e+01 2 [5, 6, 11] 2.8513e+00 3.6310e-01 2.5354e+00 2.7618e+00 2.7705e+00 +8 test_image 1 2.7871e+01 2 [9, 10, 11] 2.7169e+00 1.7984e-01 2.5507e+00 2.6864e+00 2.6580e+00 +9 test_image 1 6.9504e+00 2 [1, 4, 8, 10] 3.6794e+00 5.9509e-01 2.6486e+00 3.8420e+00 3.8420e+00 +10 test_image 1 2.9370e+01 2 [8, 9, 11] 2.6403e+00 3.1060e-01 1.9935e+00 2.6483e+00 2.6828e+00 +11 test_image 1 2.5584e+00 2 [5, 7, 8, 10] 3.9748e+00 2.3924e-01 3.6041e+00 4.0751e+00 4.0751e+00 diff --git a/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[replication_intermediate].out b/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[replication_intermediate].out new file mode 100644 index 00000000000..bd9a460f380 --- /dev/null +++ b/tests/tracing/_regtest_outputs/test_disordered_tracing.test_trace_image_disordered_dataframes[replication_intermediate].out @@ -0,0 +1,15 @@ + image grain_number grain_endpoints grain_junctions total_branch_lengths grain_width_mean +0 test_image 0 0 13 9.6852e-07 3.0318e-09 + image grain_number branch_distance branch_type connected_segments mean_pixel_value stdev_pixel_value min_value median_value middle_value +0 test_image 0 1.7269e+02 2 [1, 2, 3, 8] 2.1474e+00 1.8580e-01 1.4118e+00 2.1479e+00 2.1939e+00 +1 test_image 0 3.3804e+02 2 [0, 2, 7, 11] 2.1262e+00 1.8417e-01 1.1279e+00 2.1329e+00 2.2363e+00 +2 test_image 0 6.9014e-01 2 [0, 1, 3, 4] 3.5129e+00 2.4417e-01 3.2687e+00 3.5129e+00 3.5129e+00 +3 test_image 0 7.5415e+01 2 [0, 2, 4, 8] 2.1781e+00 2.2953e-01 1.4118e+00 2.1784e+00 2.2734e+00 +4 test_image 0 3.1893e+01 2 [2, 3, 5, 6] 2.1379e+00 3.3898e-01 1.7556e+00 2.0944e+00 2.2880e+00 +5 test_image 0 5.1517e+01 2 [4, 6, 7] 2.2339e+00 2.3611e-01 1.7265e+00 2.2070e+00 2.0221e+00 +6 test_image 0 1.1781e+00 2 [4, 5, 7] 3.4336e+00 2.9158e-01 3.0268e+00 3.5782e+00 3.6957e+00 +7 test_image 0 1.5383e+02 2 [1, 5, 6, 11] 2.1708e+00 2.3399e-01 1.3202e+00 2.1774e+00 2.1908e+00 +8 test_image 0 5.8754e+01 2 [0, 3, 10, 11] 2.0020e+00 3.3701e-01 8.8592e-01 2.0826e+00 2.2475e+00 +9 test_image 0 3.8962e+01 3 [10] 2.2736e+00 1.7805e-01 2.0016e+00 2.2595e+00 2.2033e+00 +10 test_image 0 4.8800e-01 2 [8, 9, 11] 2.8751e+00 9.8813e-03 2.8652e+00 2.8751e+00 2.8751e+00 +11 test_image 0 4.5069e+01 2 [1, 7, 8, 10] 2.1855e+00 2.2638e-01 1.2893e+00 2.2271e+00 2.2271e+00 diff --git a/tests/tracing/test_disordered_tracing.py b/tests/tracing/test_disordered_tracing.py index 50b868a0e23..d17ce22c850 100644 --- a/tests/tracing/test_disordered_tracing.py +++ b/tests/tracing/test_disordered_tracing.py @@ -7,7 +7,6 @@ import numpy as np import numpy.typing as npt -import pandas as pd import pytest from topostats.io import dict_almost_equal # pylint: disable=no-name-in-module import-error @@ -16,6 +15,7 @@ # pylint: disable=too-many-arguments # pylint: disable=too-many-locals # pylint: disable=too-many-lines +# pylint: disable=too-many-positional-arguments # pylint: disable=unspecified-encoding BASE_DIR = Path.cwd() @@ -1294,9 +1294,7 @@ def test_disordered_trace_grain( "skeletonisation_params", "pruning_params", "expected_disordered_crop_data_filename", - "expected_disordered_tracing_grainstats_filename", "expected_all_images_filename", - "expected_disordered_tracing_stats_filename", ), [ pytest.param( @@ -1326,9 +1324,7 @@ def test_disordered_trace_grain( "method_outlier": "mean_abs", }, "catenanes_disordered_tracing_crop_data.pkl", - "catenanes_disordered_tracing_grainstats.csv", "catenanes_disordered_tracing_all_images.pkl", - "catenanes_disordered_tracing_stats.csv", id="catenane", ), pytest.param( @@ -1358,9 +1354,7 @@ def test_disordered_trace_grain( "method_outlier": "mean_abs", }, "rep_int_disordered_tracing_crop_data.pkl", - "rep_int_disordered_tracing_grainstats.csv", "rep_int_disordered_tracing_all_images.pkl", - "rep_int_disordered_tracing_stats.csv", id="replication intermediate", ), ], @@ -1374,9 +1368,7 @@ def test_trace_image_disordered( skeletonisation_params: dict, pruning_params: dict, expected_disordered_crop_data_filename: str, - expected_disordered_tracing_grainstats_filename: str, expected_all_images_filename: str, - expected_disordered_tracing_stats_filename: str, ) -> None: """Test the trace image disordered method.""" # Load the image @@ -1385,9 +1377,9 @@ def test_trace_image_disordered( ( result_disordered_crop_data, - result_disordered_tracing_grainstats, + _, result_all_images, - result_disordered_tracing_stats, + _, ) = disordered_tracing.trace_image_disordered( image=image, grains_mask=mask, @@ -1407,42 +1399,127 @@ def test_trace_image_disordered( # variable_pruned_skeleton = result_all_images["pruned_skeleton"] # variable_branch_types = result_all_images["branch_types"] - # Update expected values - CHECK RESULTS WITH EXPERT BEFORE UPDATING - # Pickle result_disordered_crop_data + # # Update expected values - CHECK RESULTS WITH EXPERT BEFORE UPDATING + # # Pickle result_disordered_crop_data # with open(DISORDERED_TRACING_RESOURCES / expected_disordered_crop_data_filename, "wb") as f: # pkl.dump(result_disordered_crop_data, f) - # # Save result_disordered_tracing_grainstats as a csv - # result_disordered_tracing_grainstats.to_csv( - # DISORDERED_TRACING_RESOURCES / expected_disordered_tracing_grainstats_filename - # ) - # # Save result_all_images as a pickle # with open(DISORDERED_TRACING_RESOURCES / expected_all_images_filename, "wb") as f: # pkl.dump(result_all_images, f) - # # Save result_disordered_tracing_stats dataframe as a csv - # result_disordered_tracing_stats.to_csv(DISORDERED_TRACING_RESOURCES / expected_disordered_tracing_stats_filename) - # Load expected values with Path.open(DISORDERED_TRACING_RESOURCES / expected_disordered_crop_data_filename, "rb") as f: expected_disordered_crop_data = pkl.load(f) - expected_disordered_tracing_grainstats = pd.read_csv( - DISORDERED_TRACING_RESOURCES / expected_disordered_tracing_grainstats_filename, index_col=0 - ) - with Path.open(DISORDERED_TRACING_RESOURCES / expected_all_images_filename, "rb") as f: expected_all_images = pkl.load(f) - - expected_disordered_tracing_stats = pd.read_csv( - DISORDERED_TRACING_RESOURCES / expected_disordered_tracing_stats_filename, index_col=0 - ) - assert dict_almost_equal(result_disordered_crop_data, expected_disordered_crop_data, abs_tol=1e-11) - pd.testing.assert_frame_equal(result_disordered_tracing_grainstats, expected_disordered_tracing_grainstats) assert dict_almost_equal(result_all_images, expected_all_images, abs_tol=1e-11) - pd.testing.assert_frame_equal(result_disordered_tracing_stats, expected_disordered_tracing_stats) + + +@pytest.mark.parametrize( + ( + "image_filename", + "mask_filename", + "pixel_to_nm_scaling", + "min_skeleton_size", + "mask_smoothing_params", + "skeletonisation_params", + "pruning_params", + ), + [ + pytest.param( + "example_catenanes.npy", + "example_catenanes_labelled_grain_mask_thresholded.npy", + # Pixel to nm scaling + 0.488, + # Min skeleton size + 10, + # Mask smoothing parameters + { + "gaussian_sigma": 2, + "dilation_iterations": 2, + "holearea_min_max": [10, None], + }, + # Skeletonisation parameters + { + "method": "topostats", + "height_bias": 0.6, + }, + # Pruning parameters + { + "method": "topostats", + "max_length": 7.0, + "height_threshold": None, + "method_values": "mid", + "method_outlier": "mean_abs", + }, + id="catenane", + ), + pytest.param( + "example_rep_int.npy", + "example_rep_int_labelled_grain_mask_thresholded.npy", + # Pixel to nm scaling + 0.488, + # Min skeleton size + 10, + # Mask smoothing parameters + { + "gaussian_sigma": 2, + "dilation_iterations": 2, + "holearea_min_max": [10, None], + }, + # Skeletonisation parameters + { + "method": "topostats", + "height_bias": 0.6, + }, + # Pruning parameters + { + "method": "topostats", + "max_length": 20.0, + "height_threshold": None, + "method_values": "mid", + "method_outlier": "mean_abs", + }, + id="replication intermediate", + ), + ], +) +def test_trace_image_disordered_dataframes( + image_filename: str, + mask_filename: str, + pixel_to_nm_scaling: float, + min_skeleton_size: int, + mask_smoothing_params: dict, + skeletonisation_params: dict, + pruning_params: dict, + regtest: callable, +) -> None: + """Test the trace image disordered method produces correct dataframes (/csv files).""" + # Load the image + image = np.load(GENERAL_RESOURCES / image_filename) + mask = np.load(GENERAL_RESOURCES / mask_filename) + + ( + _, + result_disordered_tracing_grainstats, + _, + result_disordered_tracing_stats, + ) = disordered_tracing.trace_image_disordered( + image=image, + grains_mask=mask, + filename="test_image", + pixel_to_nm_scaling=pixel_to_nm_scaling, + min_skeleton_size=min_skeleton_size, + mask_smoothing_params=mask_smoothing_params, + skeletonisation_params=skeletonisation_params, + pruning_params=pruning_params, + pad_width=1, + ) + print(result_disordered_tracing_grainstats.to_string(float_format="{:.4e}".format), file=regtest) + print(result_disordered_tracing_stats.to_string(float_format="{:.4e}".format), file=regtest) @pytest.mark.skip(reason="Awaiting test to be written 2024-10-15.")