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

Use list of names, instead of pandas index. #343

Merged
merged 1 commit into from
Jul 16, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hipscat_import/catalog/file_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __init__(
if self.column_names:
self.kwargs["names"] = self.column_names
elif not self.header and schema_parquet is not None:
self.kwargs["names"] = schema_parquet.columns
self.kwargs["names"] = list(schema_parquet.columns)

if self.type_map:
self.kwargs["dtype"] = self.type_map
Expand Down
34 changes: 34 additions & 0 deletions tests/hipscat_import/catalog/test_argument_validation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""Tests of argument validation"""

import pytest
from hipscat.io import write_metadata

from hipscat_import.catalog.arguments import ImportArguments, check_healpix_order_range
from hipscat_import.catalog.file_readers import CsvReader

# pylint: disable=protected-access

Expand Down Expand Up @@ -206,6 +208,38 @@ def test_provenance_info(blank_data_dir, tmp_path):
assert "epoch" in runtime_args


def test_write_provenance_info(formats_dir, tmp_path):
"""Verify that provenance info can be written to JSON file."""
input_file = formats_dir / "gaia_minimum.csv"
schema_file = formats_dir / "gaia_minimum_schema.parquet"

args = ImportArguments(
output_artifact_name="gaia_minimum",
input_file_list=[input_file],
file_reader=CsvReader(
comment="#",
header=None,
schema_file=schema_file,
),
ra_column="ra",
dec_column="dec",
sort_columns="solution_id",
use_schema_file=schema_file,
output_path=tmp_path,
dask_tmp=tmp_path,
highest_healpix_order=2,
pixel_threshold=3_000,
progress_bar=False,
)

write_metadata.write_provenance_info(
catalog_base_dir=args.catalog_path,
dataset_info=args.to_catalog_info(0),
tool_args=args.provenance_info(),
storage_options=args.output_storage_options,
)


def test_check_healpix_order_range():
"""Test method check_healpix_order_range"""
check_healpix_order_range(5, "order_field")
Expand Down