How do I use the MaNGA Catalog drpAll File?

Back to MaNGA tutorials

The drpall file

The drpall file is a summary file from the MaNGA Data Reduction Pipeline (DRP). This table contains target and observational information (e.g., number of exposures, IFU size, identifiers), as well as galaxies properties taken from the NSA catalog, such as redshift and photometry for all the galaxies in the current data release. The datamodel for the drpall file can be found here.

Accessing the drpall file with Python

Astropy primer for working with table data

import numpy as np
from import fits

drpall ='drpall-v2_4_3.fits')
tbdata = drpall[1].data

# Print column names

Find the redshift of a galaxy:

ind = np.where(tbdata['mangaid'] == '12-193481')
print('redshift =', tbdata['nsa_z'][ind][0])

Find galaxies that match a specific ancillary catalog:

# select the column for the MaNGA Target 3 bitmask
targets = tbdata['mngtarg3']

# select rows from the Dwarf Galaxies with MaNGA ancillary catalog (which is bit 14)
dwarf_indices = np.where(targets & 1 << 14)[0]
array([  750,   943,  1709,  7457,  7488,  7489,  7518,  7591,  7671,
        8003,  8179,  8448,  8464,  8866,  9198,  9423,  9674,  9687,
        9996, 10757, 11442])

Identifying unique galaxies:

# Find all datacubes 
cube_bools = (data['mngtarg1'] != 0) | (data['mngtarg3'] != 0))
cubes = data[cube_bools]

# Find galaxies excluding those from the Coma, IC342, M31 ancillary programs (bits 19,20,21)
targ3 = data['mngtarg3']
galaxies = data[cube_bools & ((targ3 & 1<<19) == 0) & ((targ3 & 1<<20) == 0) & ((targ3 & 1<<21) == 0)]
print('Number of galaxies', len(galaxies))

# Get unique galaxies
uniq_vals, uniq_idx=np.unique(galaxies['mangaid'], return_index=True)
uniq_galaxies = galaxies[uniq_idx]
print('Unique galaxies', len(uniq_galaxies))

Accessing the drpall file with IDL

The drpall file can be read in using for example MRDFITS. This will put the data into an IDL structure.


; Print column names

Find the redshift of a galaxy:

ind = where(t.mangaid eq '12-193481')
print,'redshift =', t[ind].nsa_z

Identifying unique galaxies:

; Find the indices of datacubes 
cube_bools = (t.mngtarg1 ne 0) or (t.mngtarg3 ne 0)

; Select only datacubes
cubes = t[where(cube_bools)]
print,'Number of data cubes: ', n_elements(cubes) 

; Find galaxies excluding those from the Coma, IC342, M31 ancillary programs (bits 19,20,21)
galaxies = t[where(cube_bools and ((t.mngtarg3 and 2L^19L+2L^20L+2L^21) eq 0))]

; Select unique galaxies
mangaid = galaxies.mangaid
uqmangaid = mangaid[uniq(mangaid[sort(mangaid)])]
print,'Number of unique galaxies: ', n_elements(uqmangaid) 

Accessing the drpall file with Marvin

Select Main Sample Galaxies

To select the Main Sample galaxies (Primary + Secondary + Color Enhanced samples), we need to download the DR15 drpall file file and put it in the expected $SAS_BASE_DIR directory. For more information on the location of your SAS_BASE_DIR environment variable, see the Marvin documentation.

Let’s open the DRPall file:

from marvin import config
from marvin.utils.general.general import get_drpall_table

data = get_drpall_table()

The Main Sample consists of the Primary, Secondary, and Color-Enhanced Samples, which correspond to MNGTARG1 bits 10, 11, and 12, respectively.

import numpy as np
primary        = data['mngtarg1'] & 2**10                                 
secondary      = data['mngtarg1'] & 2**11                                 
color_enhanced = data['mngtarg1'] & 2**12                                 

main_sample = np.logical_or.reduce((primary, secondary, color_enhanced)) 

plateifus = data['plateifu'][main_sample]

Accessing the drpall file with CAS

The drpAll file exists as a table in CAS. You can query the drpall table under the Query tab in CASjobs. For example, to find all galaxies with redshift > 0.05 and stellar mass <1e10:

mangaid, objra, objdec, nsa_z, nsa_sersic_mass 	
FROM dbo.mangaDrpAll	
where nsa_z > 0.05 and nsa_sersic_mass < 1e10