erykoff / redmapper

The redMaPPer Cluster Finder
Apache License 2.0
22 stars 8 forks source link

GalaxyCatalogMaker Issues #94

Open DevinW3 opened 6 months ago

DevinW3 commented 6 months ago

Hi there,

I'm having trouble getting my input galaxy catalog to work with redmapper.GalaxyCatalogMaker. I have made sure my input fits table has the required data types outlined in the first step of redMaPPer's HOW-TO. I tried appending the whole galaxy catalog in one line (first error below), and also tried appending one galaxy at a time in a for loop (2nd error below) like is done in the HOW-TO example. Any help you can provide is much appreciated.

Traceback (most recent call last): File "PATH/catalog_maker.py", line 46, in maker.append_galaxies(galaxy_catalog) File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/galaxy.py", line 768, in append_galaxies raise RuntimeError("We think there are 0 galaxies in pixel %d, but the file exists." % (pix)) RuntimeError: We think there are 0 galaxies in pixel 5749, but the file exists.

Traceback (most recent call last): File "PATH/catalog_maker.py", line 46, in maker.append_galaxies(galaxies[i]) File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/galaxy.py", line 731, in append_galaxies self._check_galaxies(gals) File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/galaxy.py", line 998, in _check_galaxies if len(np.unique(gals['id'])) < len(gals['id']): ^^^^^^^^^^^^^^^ TypeError: object of type 'numpy.int64' has no len()

erykoff commented 6 months ago

Hmm. First of all, you do not send galaxies in one at a time ... that would take forever and isn't supported anyway.

But the first problem is somewhat cryptic. I'm wondering if you tried to run this and it left some stub files in the way? Can you make sure the output directory is empty before running? Otherwise I don't know what to suggest. If you could post a sample of the input galaxy file or what is in catalog_maker.py.

DevinW3 commented 6 months ago

Thanks for the tip, it was a combination of two things, one being the output folder not being empty. The other was that I was passing the input FITS file as an astropy table, when I fed GalaxyCatalogMaker the raw fits.data it worked.

However I've now run into an issue with the red-sequence calibration step (error below), which is making me think the galaxy catalog step didn't work as well as I thought. In the cal.yml file I've made sure the galfile path is to where the master_table.fit got created.

redmapper_calibrate.py -c cal_example.yml INFO:redmapper-16:Selecting red galaxies from spectra... Traceback (most recent call last): File "PATH/bin/redmapper_calibrate.py", line 4, in import('pkg_resources').run_script('redmapper==0.8.5', 'redmapper_calibrate.py') File "PATH/lib/python3.11/site-packages/pkg_resources/init.py", line 722, in run_script self.require(requires)[0].run_script(script_name, ns) File "PATH/lib/python3.11/site-packages/pkg_resources/init.py", line 1561, in run_script exec(code, namespace, namespace) File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/EGG-INFO/scripts/redmapper_calibrate.py", line 19, in calib.run() File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/calibration/calibrate.py", line 64, in run selred.run() File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/calibration/selectspecred.py", line 60, in run gals = GalaxyCatalog.from_galfile(self.config.galfile, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "PATH/lib/python3.11/site-packages/redmapper-0.8.5-py3.11-linux-x86_64.egg/redmapper/galaxy.py", line 235, in from_galfile first_fname = os.path.join(path, tab.filenames[indices[0]].decode())


IndexError: index 0 is out of bounds for axis 0 with size 0