SDSS¶
The kszx.sdss module contains functions for downloading/parsing SDSS data products.
References
- kszx.sdss.read_galaxies(survey, dr=12, download=False)¶
Reads SDSS galaxy catalog, and returns a Catalog object.
After calling this function, you’ll probably want to call
Catalog.apply_redshift_cut()to retrict to an appropriate redshift range.Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’, ‘CMASSLOWZTOT_North’, ‘CMASSLOWZTOT_South’, ‘CLASSLOWZE2_North’, or ‘CMASSLOWZE3_North’.dr(integer): either 11 or 12.download(boolean): if True, then all needed data files will be auto-downloaded.
Returns a
kszx.Catalogobject, with the following columns:ra_deg, dec_deg, z, # sky location, redshift wfkp, # FKP weight wcp, wzf, wsys, # systematic weights cboss, # completeness (denoted C_BOSS in papers and COMP in the FITS file) id # unique identifier
Reminder: SDSS galaxies are usually weighted by
(wzf + wcp − 1) * wsys * wkp.Example usage:
# kszx.sdss.read_galaxies() returns a kszx.Catalog. gcat = kszx.sdss.read_galaxies('CMASS_North') gcat.apply_redshift_cut(0.43, 0.7)
- kszx.sdss.read_randoms(survey, dr=12, download=False)¶
Reads SDSS random catalog, and returns a Catalog object.
After calling this function, you’ll probably want to call
Catalog.apply_redshift_cut()to retrict to an appropriate redshift range.Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’, ‘CMASSLOWZTOT_North’, ‘CMASSLOWZTOT_South’, ‘CLASSLOWZE2_North’, or ‘CMASSLOWZE3_North’.dr(integer): either 11 or 12.download(boolean): if True, then all needed data files will be auto-downloaded.
Returns a
kszx.Catalogobject, with the following columns:ra_deg, dec_deg, z # sky location, redshift wfkp # FKP weight
Example usage:
# kszx.sdss.read_randoms() returns a kszx.Catalog. rcat = kszx.sdss.read_randoms('CMASS_North') rcat.apply_redshift_cut(0.43, 0.7)
- kszx.sdss.read_mock(survey, mock_type, ix, dr=12, download=False)¶
Reads SDSS mock galaxy catalog, and returns a Catalog object.
Note that the qpm mocks are already restricted to an appropriate redshift range, i.e. there should be no need to call
Catalog.apply_redshift_cut()(unlike the “core” SDSS galaxy/random catalogs).Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’.mock_type(str): currently ‘qpm’ (DR12 only) and ‘pthalos’ (DR11 only) are implemented.ix(integer): index of mock, in the range0 <= ix < 1000, except for CMASS PTHALOS where the range is0 <= ix < 600.dr(integer): either 11 or 12.download(boolean): if True, then all needed data files will be auto-downloaded.
Returns a
kszx.Catalogobject, with the following columns:ra_deg, dec_deg, z, # sky location, redshift wveto # systematic weights wfkp # FKP weight (available for QPM but not PTHALOS) cboss, wcp, wzf # PTHALOS only: completeness/systematics weights ztrue # PTHALOS only: true redshift, removing peculiar velocities
Example usage:
# kszx.sdss.read_mock() returns a kszx.Catalog. mcat = kszx.sdss.read_mock('CMASS_North', 'qpm', 0) # index can be 0 <= ix < 1000 # mcat.apply_redshift_cut(0.43, 0.7) not needed!
- kszx.sdss.read_mock_randoms(survey, mock_type, dr=12, download=False)¶
Reads SDSS mock random catalog, and returns a Catalog object.
Note that the qpm mocks are already restricted to an appropriate redshift range, i.e. there should be no need to call
Catalog.apply_redshift_cut()(unlike the “core” SDSS galaxy/random catalogs).Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’.mock_type(str): currently ‘qpm’ (DR12 only) and ‘pthalos’ (DR11 only) are implemented.dr(integer): either 11 or 12.download(boolean): if True, then all needed data files will be auto-downloaded.
Returns a
kszx.Catalogobject, with the following columns:ra_deg, dec_deg, z # sky location, redshift wfkp # FKP weight
Example usage:
# kszx.sdss.read_mock_randoms() returns a kszx.Catalog. mrcat = kszx.sdss.read_mock_randoms('CMASS_North', 'qpm') # mrcat.apply_redshift_cut(0.43, 0.7) not needed!
- kszx.sdss.read_mask(survey, dr=12, download=False)¶
Reads SDSS mangle mask, and returns a pymangle object. Rarely needed!
Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’, ‘CMASSLOWZTOT_North’, ‘CMASSLOWZTOT_South’, ‘CLASSLOWZE2_North’, or ‘CMASSLOWZE3_North’.dr(integer): either 11 or 12.download(boolean): if True, then all needed data files will be auto-downloaded.
Returns a pymangle object that can be evaluated with mask.weight(ra_deg, dec_deg). The return value is either 0, or close to 1 (e.g. 0.98).
Note: requires pymangle! (Not a dependency by default.)
- kszx.sdss.read_fits_catalog(filename, is_randcat, name=None, extra_columns=[])¶
Reads FITS file in SDSS catalog format.
Intended as a helper for read_galaxies() or read_randoms(), but may be useful elsewhere.
Function arguments:
filename(string): should end in.fits.is_randcat(boolean): True for a random catalog, False for a galaxy catalog. (Determines which column names are expected).name(str, optional): name of Catalog, passed tokszx.Catalogconstructor.extra_columns(list of string): extra columns to read (if any).
Returns a
kszx.Catalogobject.
- kszx.sdss.download(survey, dr=12, mask=False, qpm=False, pthalos=False)¶
Downloads SDSS data products (galaxies, randoms, and optionally mocks + mangle mask) for a given survey.
Can be called from command line:
python -m kszx download_sdss.Function arguments:
survey(str): either ‘CMASS_North’, ‘CMASS_South’, ‘LOWZ_North’, ‘LOWZ_South’, ‘CMASSLOWZTOT_North’, ‘CMASSLOWZTOT_South’, ‘CLASSLOWZE2_North’, or ‘CMASSLOWZE3_North’.dr(integer): either 11 or 12.mask(boolean): if True, then mangle mask will be downloaded (in addition to galaxies and randoms).qpm(boolean): if True, then QPM mocks will be downloaded (DR12 only).pthalos(boolean): if True, then PTHALOS mocks will be downloaded (DR11 only).