Skip to content

ValueError in finalize_catalog() when only one hpix #99

@rancesol

Description

@rancesol

When I run finalize_catalog() but there is only one hpix (i.e. one foo_hpix.fit) I get the issue

Traceback (most recent call last):
  File "/pbs/throng/lsst/users/rsolomon/redmapper/data_prep/lib/createPixFilesParr_GCR.py", line 148, in <module>
    maker.finalize_catalog()
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/redmapper/galaxy.py", line 889, in finalize_catalog
    tab.to_fits_file(self.filename, header=hdr, clobber=True)
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/redmapper/catalog.py", line 146, in to_fits_file
    fitsio.write(filename, temp_array, clobber=clobber, header=header, extname=extname)
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/fitsio/fitslib.py", line 409, in write
    fits.write(
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/fitsio/fitslib.py", line 761, in write
    self.write_table(data, units=units,
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/fitsio/fitslib.py", line 1182, in write_table
    self[-1].write(data, names=names)
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/fitsio/hdu/table.py", line 291, in write
    self._verify_column_data(tcolnum, tdata)
  File "/sps/lsst/users/rsolomon/conda_envs/redmapper/lib/python3.11/site-packages/fitsio/hdu/table.py", line 417, in _verify_column_data
    raise ValueError(
ValueError: bad input shape for column 'filenames': expected '(1,)', got '()'

Seems like a list of foo_hpix.fit file names is expected but if there is only one hpix then it does not receive a list and breaks.
This is easy enough to ignore in cosmoDC2 since the footprint is in hpix format but DP0.2 is trickier and would require really high resolution to avoid this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions