Skip to content

Commit

Permalink
isort/pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
smcguire-cmu committed Jan 9, 2024
1 parent 0b06a1c commit 6945e96
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/hipscat_import/margin_cache/margin_cache_map_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from hipscat.catalog.partition_info import PartitionInfo
from hipscat.io import file_io, paths


# pylint: disable=too-many-locals,too-many-arguments


Expand All @@ -21,7 +22,7 @@ def map_pixel_shards(
data = file_io.load_parquet_to_pandas(partition_file)

data["margin_pixel"] = hp.ang2pix(
2 ** margin_order,
2**margin_order,
data[ra_column].values,
data[dec_column].values,
lonlat=True,
Expand Down Expand Up @@ -68,16 +69,18 @@ def _to_pixel_shard(data, margin_threshold, output_path, ra_column, dec_column):
"margin_check",
"margin_pixel",
]
).rename(
columns={
PartitionInfo.METADATA_ORDER_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_ORDER_COLUMN_NAME}",
PartitionInfo.METADATA_DIR_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_DIR_COLUMN_NAME}",
PartitionInfo.METADATA_PIXEL_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_PIXEL_COLUMN_NAME}",
"partition_order": PartitionInfo.METADATA_ORDER_COLUMN_NAME,
"partition_pixel": PartitionInfo.METADATA_PIXEL_COLUMN_NAME
}
)

rename_columns = {
PartitionInfo.METADATA_ORDER_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_ORDER_COLUMN_NAME}",
PartitionInfo.METADATA_DIR_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_DIR_COLUMN_NAME}",
PartitionInfo.METADATA_PIXEL_COLUMN_NAME: f"margin_{PartitionInfo.METADATA_PIXEL_COLUMN_NAME}",
"partition_order": PartitionInfo.METADATA_ORDER_COLUMN_NAME,
"partition_pixel": PartitionInfo.METADATA_PIXEL_COLUMN_NAME,
}

final_df.rename(columns=rename_columns, inplace=True)

dir_column = np.floor_divide(final_df[PartitionInfo.METADATA_PIXEL_COLUMN_NAME].values, 10000) * 10000

final_df[PartitionInfo.METADATA_DIR_COLUMN_NAME] = dir_column
Expand Down

0 comments on commit 6945e96

Please sign in to comment.