Skip to content

Commit

Permalink
Fix calls to read_hats
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu committed Oct 29, 2024
1 parent 01040cd commit 788deb0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def small_sky_xmatch_catalog_cloud(small_sky_xmatch_dir_cloud):

@pytest.fixture
def small_sky_order1_hats_catalog_cloud(small_sky_order1_dir_cloud):
return hc.catalog.Catalog.read_hats(small_sky_order1_dir_cloud)
return hc.read_hats(small_sky_order1_dir_cloud)


@pytest.fixture
Expand Down
10 changes: 0 additions & 10 deletions tests/hats/catalog/test_catalog_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@
from hats.loaders import read_hats


def test_load_catalog_small_sky(small_sky_dir_cloud):
"""Instantiate a catalog with 1 pixel"""
cat = Catalog.read_hats(small_sky_dir_cloud)

assert cat.catalog_name == "small_sky"
assert len(cat.get_healpix_pixels()) == 1

assert is_valid_catalog(small_sky_dir_cloud)


def test_load_catalog_small_sky_with_loader(small_sky_dir_cloud):
"""Instantiate a catalog with 1 pixel"""
cat = read_hats(small_sky_dir_cloud)
Expand Down
6 changes: 3 additions & 3 deletions tests/hats_import/test_create_margin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hats_import.margin_cache.margin_cache as mc
from hats.catalog.healpix_dataset.healpix_dataset import HealpixDataset
from hats import read_hats
from hats_import.margin_cache.margin_cache_arguments import MarginCacheArguments


Expand Down Expand Up @@ -30,7 +30,7 @@ def test_margin_cache_gen(

mc.generate_margin_cache(args, dask_client)

catalog = HealpixDataset.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path

Expand Down Expand Up @@ -61,6 +61,6 @@ def test_margin_cache_gen_read_from_cloud(

mc.generate_margin_cache(args, dask_client)

catalog = HealpixDataset.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path
6 changes: 3 additions & 3 deletions tests/hats_import/test_run_catalog_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import hats_import.catalog.run_import as runner
import pytest
from hats.catalog.catalog import Catalog
from hats import read_hats
from hats_import.catalog.arguments import ImportArguments
from hats_import.catalog.file_readers import CsvReader

Expand Down Expand Up @@ -30,7 +30,7 @@ def test_catalog_import_write_to_cloud(
runner.run(args, dask_client)

# Check that the catalog metadata file exists
catalog = Catalog.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path
assert catalog.catalog_info.ra_column == "ra"
Expand Down Expand Up @@ -61,7 +61,7 @@ def test_catalog_import_read_from_cloud(dask_client, small_sky_parts_dir_cloud,
runner.run(args, dask_client)

# Check that the catalog metadata file exists
catalog = Catalog.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path
assert catalog.catalog_info.ra_column == "ra"
Expand Down
6 changes: 3 additions & 3 deletions tests/hats_import/test_run_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hats_import.index.run_index as runner
import pyarrow as pa
from hats.catalog.dataset.dataset import Dataset
from hats import read_hats
from hats.io.file_io import read_parquet_metadata
from hats_import.index.arguments import IndexArguments

Expand All @@ -25,7 +25,7 @@ def test_run_index(
runner.run(args, dask_client)

# Check that the catalog metadata file exists
catalog = Dataset.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path

Expand Down Expand Up @@ -67,7 +67,7 @@ def test_run_index_read_from_cloud(small_sky_order1_dir_cloud, tmp_path, dask_cl
runner.run(args, dask_client)

# Check that the catalog metadata file exists
catalog = Dataset.read_hats(args.catalog_path)
catalog = read_hats(args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == args.catalog_path

Expand Down
8 changes: 4 additions & 4 deletions tests/hats_import/test_run_soap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hats_import.soap.run_soap as runner
import pytest
from hats.catalog.association_catalog.association_catalog import AssociationCatalog
from hats import read_hats
from hats.io.file_io import read_parquet_metadata
from hats_import.soap.arguments import SoapArguments

Expand Down Expand Up @@ -36,7 +36,7 @@ def test_object_to_self_write_to_cloud(
runner.run(small_sky_soap_args, dask_client)

## Check that the association data can be parsed as a valid association catalog.
catalog = AssociationCatalog.read_hats(small_sky_soap_args.catalog_path)
catalog = read_hats(small_sky_soap_args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == small_sky_soap_args.catalog_path
assert len(catalog.get_join_pixels()) == 4
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_object_to_self_write_to_cloud(
runner.run(small_sky_soap_args, dask_client)

## Check that the association data can be parsed as a valid association catalog.
catalog = AssociationCatalog.read_hats(small_sky_soap_args.catalog_path)
catalog = read_hats(small_sky_soap_args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == small_sky_soap_args.catalog_path
assert len(catalog.get_join_pixels()) == 4
Expand Down Expand Up @@ -101,7 +101,7 @@ def test_object_to_self_read_from_cloud(
runner.run(small_sky_soap_args, dask_client)

## Check that the association data can be parsed as a valid association catalog.
catalog = AssociationCatalog.read_hats(small_sky_soap_args.catalog_path)
catalog = read_hats(small_sky_soap_args.catalog_path)
assert catalog.on_disk
assert catalog.catalog_path == small_sky_soap_args.catalog_path
assert len(catalog.get_join_pixels()) == 4
Expand Down
4 changes: 2 additions & 2 deletions tests/lsdb/catalog/test_index_search.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from hats.catalog.index.index_catalog import IndexCatalog
from hats import read_hats


def test_index_search(small_sky_order1_catalog_cloud, small_sky_index_dir_cloud):
catalog_index = IndexCatalog.read_hats(small_sky_index_dir_cloud)
catalog_index = read_hats(small_sky_index_dir_cloud)

index_search_catalog = small_sky_order1_catalog_cloud.index_search([900], catalog_index)
index_search_df = index_search_catalog.compute()
Expand Down

0 comments on commit 788deb0

Please sign in to comment.