RandomSDSS
Generate random points within SDSS DR8 to DR16 footprint.
- exception randomsdss.PolygonNotFoundError[source]
Bases:
FileNotFoundError
Raised when the .ply file doesn’t exists.
- class randomsdss.DR(dr, catalog)[source]
Bases:
object
Base Data Release class.
- Parameters
dr (str) – Data Release name: e.g DR16.
catalog (str) – Catalog name within the specified data release: e.g. BOSS.
- box_random(ra_min, ra_max, dec_min, dec_max, size)[source]
Generate random RA, DEC points within a box.
- Parameters
ra_min (float) – Right Ascension lower bound in degrees.
ra_max (float) – Right Ascension upper bound in degrees.
dec_min (float) – Declination lower bound in degrees.
dec_max (float) – Declination upper bound in degrees.
size (int) – Number of random points to generate.
- Returns
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- contains(ra, dec)[source]
Check if point is inside the catalog area.
- Parameters
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- Returns
True if inside, False otherwise.
- Return type
bool
- polyid(ra, dec)[source]
Get polygon id of input point.
- Parameters
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- Returns
pid – Polygon id. -1 if outside of catalog area.
- Return type
numpy.ndarray
- polyid_and_weight(ra, dec)[source]
Get polygon id and weight of input point.
- Parameters
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- Returns
pid (numpy.ndarray) – Polygon id. -1 if outside of catalog area.
weight (numpy.ndarray) – Poligon weight. 0 if outside of catalog area.
- set_weights(weights)[source]
Set new weights for polygons.
- Parameters
weight (float or numpy.ndarray) – Poligons weights.
- sky_random(size)[source]
Generate random RA, DEC points.
- Parameters
size (int) – Number of random points to generate.
- Returns
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- weight(ra, dec)[source]
Get polygon weight of input point.
- Parameters
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- Returns
weight – Poligon weight. 0 if outside of catalog area.
- Return type
numpy.ndarray
- property area
Get the area of the catalog.
- property npoly
Get the number of polygons.
- property weights
Array of polygons weights.
- class randomsdss.DR10(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR11(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR12(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR13(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR14(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR15(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR16(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR8(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- class randomsdss.DR9(catalog='SDSS')
Bases:
randomsdss.randomsdss.DR
- randomsdss.sky_random(dr='DR16', catalog='SDSS', size=10000)[source]
Generate random RA, DEC values within the specified DR and catalog.
- Parameters
dr (str) – Data Release name: e.g DR16.
catalog (str) – Catalog name within the specified data release: e.g. BOSS.
size (int) – Number of random points to generate.
- Returns
ra (numpy.ndarray) – Right Ascension in degrees.
dec (numpy.ndarray) – Declination in degrees.
- randomsdss.z_random(z, size=10000, weights=None, seed=None)[source]
Generate random redshift values following the input distribution.
This function uses scipy.stats.gaussian_kde to compute the Probability Density Distribution (PDF).
- Parameters
z (numpy.ndarray) – Redhisft sample to generate a PDF and extract random points.
size (int) – Number of random points to generate.
weights (numpy.ndarray) – Weigths of each redshift value to compute a weigthed PDF.
seed (int) – Set random seed.
- Returns
z_rand – Random redshifts.
- Return type
numpy.ndarray