-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc85aa2
commit 03f8651
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import itertools | ||
|
||
import pandas as pd | ||
from hipscat.catalog import Catalog | ||
from hipscat.pixel_tree.pixel_alignment import PixelAlignment | ||
from hipscat.pixel_tree.pixel_alignment_types import PixelAlignmentType | ||
|
||
column_names = [ | ||
PixelAlignment.PRIMARY_ORDER_COLUMN_NAME, | ||
PixelAlignment.PRIMARY_PIXEL_COLUMN_NAME, | ||
PixelAlignment.JOIN_ORDER_COLUMN_NAME, | ||
PixelAlignment.JOIN_PIXEL_COLUMN_NAME, | ||
PixelAlignment.ALIGNED_ORDER_COLUMN_NAME, | ||
PixelAlignment.ALIGNED_PIXEL_COLUMN_NAME, | ||
] | ||
|
||
|
||
def autocorrelation_alignment(catalog: Catalog) -> PixelAlignment: | ||
"""TODO""" | ||
upper_triangle = [ | ||
[left.order, left.pixel, right.order, right.pixel, left.order, left.pixel] | ||
for (left, right) in itertools.combinations(catalog.get_healpix_pixels(), 2) | ||
] | ||
upper_triangle = pd.DataFrame(upper_triangle, columns=column_names) | ||
diagonal = pd.DataFrame( | ||
[ | ||
[pix.order, pix.pixel, pix.order, pix.pixel, pix.order, pix.pixel] | ||
for pix in catalog.get_healpix_pixels() | ||
] | ||
) | ||
result_mapping = pd.concat([upper_triangle, diagonal]) | ||
return PixelAlignment(catalog.pixel_tree, result_mapping, PixelAlignmentType.OUTER) | ||
|
||
|
||
def crosscorrelation_alignment(catalog_left: Catalog, catalog_right: Catalog) -> PixelAlignment: | ||
"""TODO""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def test_data_dir(): | ||
return Path(__file__).parent.parent / "data" | ||
|
||
|
||
@pytest.fixture | ||
def data_catalog_dir(test_data_dir): | ||
return test_data_dir / "DATA" | ||
|
||
|
||
@pytest.fixture | ||
def raw_catalog_dir(test_data_dir): | ||
return test_data_dir / "RAW" | ||
|
||
|
||
@pytest.fixture | ||
def dr7_lrg_catalog_dir(test_data_dir): | ||
return test_data_dir / "DR7-lrg" | ||
|
||
|
||
@pytest.fixture | ||
def dr7_lrg_rand_catalog_dir(test_data_dir): | ||
return test_data_dir / "DR7-lrg-rand" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import hipscat | ||
from corrgi.alignment import autocorrelation_alignment | ||
|
||
|
||
def test_autocorrelation_alignment(data_catalog_dir): | ||
data_catalog = hipscat.read_from_hipscat(data_catalog_dir) | ||
alignment = autocorrelation_alignment(data_catalog) | ||
assert len(alignment.pixel_mapping) == 28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
lint.ignore = [ | ||
"D103", # Allow Missing docstring in public function | ||
] |