Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin pandas and numpy versions. #284

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.