Skip to content

Commit

Permalink
Fix data and column names for kdtree unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu committed Mar 8, 2024
1 parent a35d827 commit 21fa658
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 8 deletions.
104 changes: 104 additions & 0 deletions tests/data/xmatch/xmatch_correct.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
small_sky_id,xmatch_id,dist_arcsec
700,700,14.017453846797961
701,701,15.901521432561362
703,703,26.874535043777758
704,704,29.09425652200152
705,705,8.662223451354839
706,706,5.071285713726
707,707,24.16209436088856
708,708,31.65043906020204
709,709,18.3059124294474
710,710,12.3644877751998
712,712,27.93451787898084
713,713,35.5945293987804
714,714,29.734361046373678
715,715,33.55803088353612
717,717,25.66070269217856
718,718,5.99883948881892
719,719,21.969279803593082
720,720,33.8895018659502
722,722,19.07167872465396
723,723,15.231398879361599
724,724,28.138679249150517
725,725,14.68155100223412
726,726,30.84163314967116
727,727,24.80597990550108
728,728,15.15445187095872
729,729,30.44494178388396
730,730,30.97470923621964
731,731,16.33872774624156
732,732,16.42789467220176
733,733,15.678747299871361
734,734,24.600146450507278
735,735,35.792978697256316
736,736,24.06300345180972
738,738,23.08220729875332
739,739,11.68963379185464
740,740,28.92745927850112
741,741,25.64932704542856
742,742,23.141335666947842
744,744,29.89250102694096
746,746,29.4347447419932
747,747,30.454789351577404
748,748,11.024647160886
749,749,15.38505007535232
750,750,19.143969540118558
751,751,34.65270515053872
753,753,25.64906890785192
755,741,25.64932704542856
757,757,14.840652116010238
758,758,20.35614635209152
759,759,33.36464320737696
760,760,30.1391802853686
761,761,30.682225898676723
762,762,25.0711254440982
763,763,11.45075968659348
765,765,25.930930399768798
766,766,25.2137234908494
768,768,17.42799369904848
769,769,34.04875483289016
770,770,31.16039983138944
771,771,12.09458887429068
772,772,10.90064138179284
773,773,27.38605498039404
774,774,8.516378506305239
775,775,22.30363655513532
776,776,35.61863385352644
777,777,3.22769769285924
779,779,9.641881617603119
780,780,15.58970223203016
781,781,22.734396762309363
782,782,17.75019564952236
783,783,22.34043481634712
784,784,35.66339448548544
785,785,15.15398409958104
787,787,11.29739519062332
788,788,21.55190207403924
789,789,25.46244787457772
790,790,26.66197745385156
793,793,35.07781842309852
794,794,16.3090070025516
797,797,6.78800036705148
800,800,29.765719763649358
801,801,27.8019798197328
802,802,22.140036779301
803,803,28.59099197583852
804,804,28.211126059140838
805,805,19.869505827957358
808,808,20.60328681919296
809,809,21.0205637818722
810,810,24.08447699159436
811,723,15.231398879361599
812,812,18.5771156912892
813,813,6.66670499635356
815,815,27.6893711399808
816,816,34.27955589703572
817,817,23.42456553624156
820,820,32.0256636230934
821,821,17.54336256468156
822,822,32.7681974647458
823,823,13.532963298758999
826,826,11.91254231039976
827,827,3.5888459240199597
828,828,16.68279245758272
830,830,35.40881557157724
6 changes: 3 additions & 3 deletions tests/lsdb/catalog/test_crossmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_kdtree_crossmatch(small_sky_catalog_cloud, small_sky_xmatch_catalog_clo
).compute()
assert len(xmatched) == len(xmatch_correct_cloud)
for _, correct_row in xmatch_correct_cloud.iterrows():
assert correct_row["ss_id"] in xmatched["id_small_sky"].values
xmatch_row = xmatched[xmatched["id_small_sky"] == correct_row["ss_id"]]
assert correct_row["small_sky_id"] in xmatched["id_small_sky"].values
xmatch_row = xmatched[xmatched["id_small_sky"] == correct_row["small_sky_id"]]
assert xmatch_row["id_small_sky_xmatch"].values == correct_row["xmatch_id"]
assert xmatch_row["_DIST"].values == pytest.approx(correct_row["dist"])
assert xmatch_row["_dist_arcsec"].values == pytest.approx(correct_row["dist_arcsec"])
8 changes: 3 additions & 5 deletions tests/lsdb/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
SMALL_SKY_XMATCH_NAME = "small_sky_xmatch"
SMALL_SKY_ORDER1_DIR_NAME = "small_sky_order1"
XMATCH_CORRECT_FILE = "xmatch_correct.csv"
XMATCH_CORRECT_005_FILE = "xmatch_correct_0_005.csv"
XMATCH_MOCK_FILE = "xmatch_mock.csv"


@pytest.fixture
Expand Down Expand Up @@ -56,6 +54,6 @@ def small_sky_order1_catalog_cloud(small_sky_order1_dir_cloud, example_cloud_sto


@pytest.fixture
def xmatch_correct_cloud(small_sky_xmatch_dir_cloud, example_cloud_storage_options):
pathway = os.path.join(small_sky_xmatch_dir_cloud, XMATCH_CORRECT_FILE)
return file_io.load_csv_to_pandas(pathway, storage_options=example_cloud_storage_options)
def xmatch_correct_cloud(local_data_dir):
pathway = os.path.join(local_data_dir, "xmatch", XMATCH_CORRECT_FILE)
return file_io.load_csv_to_pandas(pathway)

0 comments on commit 21fa658

Please sign in to comment.