Skip to content

Commit

Permalink
Use list of names, instead of pandas index. (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucchi-cmu committed Jul 16, 2024
1 parent 205818a commit 72a7626
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
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

0 comments on commit 72a7626

Please sign in to comment.