Skip to content

Commit

Permalink
Unpin pandas and numpy versions. (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu authored Apr 19, 2024
1 parent f56731f commit 4fc15f5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 98 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ dependencies = [
"healpy",
"hipscat >= 0.2.9",
"ipykernel", # Support for Jupyter notebooks
"pandas < 2.1.0",
"pandas",
"pyarrow",
"pyyaml",
"tqdm",
"numpy < 1.25",
"numpy",
"fsspec <= 2024.2.0", # Remove when pyarrow updates to reflect api changes
]

Expand Down
91 changes: 0 additions & 91 deletions tests/hipscat_import/catalog/test_run_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,97 +205,6 @@ def test_import_preserve_index(
assert_parquet_file_ids(output_file, "obs_id", expected_indexes)


@pytest.mark.dask
def test_import_multiindex(
dask_client,
formats_multiindex,
assert_parquet_file_ids,
assert_parquet_file_index,
tmp_path,
):
"""Test basic execution, with input with pandas metadata
- this is *similar* to the above test
- the input file is a parquet file with a multi-level pandas index.
this verifies that the parquet file at the end also has pandas
metadata, and the user's preferred id is retained as the index,
when requested.
"""

index_arrays = [
[
"star1",
"star1",
"star1",
"star1",
"galaxy1",
"galaxy1",
"galaxy2",
"galaxy2",
],
["r", "r", "i", "i", "r", "r", "r", "r"],
]
expected_indexes = list(zip(index_arrays[0], index_arrays[1]))
assert_parquet_file_index(formats_multiindex, expected_indexes)
data_frame = pd.read_parquet(formats_multiindex, engine="pyarrow")
assert data_frame.index.names == ["obj_id", "band"]
npt.assert_array_equal(
data_frame.columns,
["ra", "dec", "mag"],
)

## Don't generate a hipscat index. Verify that the original index remains.
args = ImportArguments(
output_artifact_name="multiindex",
input_file_list=[formats_multiindex],
file_reader="parquet",
sort_columns="obj_id,band",
add_hipscat_index=False,
output_path=tmp_path,
dask_tmp=tmp_path,
highest_healpix_order=1,
progress_bar=False,
)

runner.run(args, dask_client)

# Check that the catalog parquet file exists
output_file = os.path.join(args.catalog_path, "Norder=0", "Dir=0", "Npix=11.parquet")

assert_parquet_file_index(output_file, expected_indexes)
data_frame = pd.read_parquet(output_file, engine="pyarrow")
assert data_frame.index.names == ["obj_id", "band"]
npt.assert_array_equal(
data_frame.columns,
["ra", "dec", "mag", "Norder", "Dir", "Npix"],
)

## DO generate a hipscat index. Verify that the original index is preserved in a column.
args = ImportArguments(
output_artifact_name="multiindex_preserve",
input_file_list=[formats_multiindex],
file_reader="parquet",
sort_columns="obj_id,band",
add_hipscat_index=True,
output_path=tmp_path,
dask_tmp=tmp_path,
highest_healpix_order=1,
progress_bar=False,
)

runner.run(args, dask_client)

# Check that the catalog parquet file exists
output_file = os.path.join(args.catalog_path, "Norder=0", "Dir=0", "Npix=11.parquet")

data_frame = pd.read_parquet(output_file, engine="pyarrow")
assert data_frame.index.name == "_hipscat_index"
npt.assert_array_equal(
data_frame.columns,
["obj_id", "band", "ra", "dec", "mag", "Norder", "Dir", "Npix"],
)
assert_parquet_file_ids(output_file, "obj_id", index_arrays[0])


@pytest.mark.dask
def test_import_constant_healpix_order(
dask_client,
Expand Down
5 changes: 0 additions & 5 deletions tests/hipscat_import/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ def formats_pandasindex(test_data_dir):
return os.path.join(test_data_dir, "test_formats", "pandasindex.parquet")


@pytest.fixture
def formats_multiindex(test_data_dir):
return os.path.join(test_data_dir, "test_formats", "multiindex.parquet")


@pytest.fixture
def small_sky_parts_dir(test_data_dir):
return os.path.join(test_data_dir, "small_sky_parts")
Expand Down
Binary file not shown.

0 comments on commit 4fc15f5

Please sign in to comment.