dsigma.helpers module
Convenience functions for the dsigma pipeline.
- dsigma.helpers.cartesian_to_spherical(x, y, z)
Convert cartesian coordinates to spherical coordinates.
- Parameters
- xfloat or numpy.ndarray
x-coordinate.
- yfloat or numpy.ndarray
y-coordinate.
- zfloat or numpy.ndarray
z-coordinate.
- Returns
- ra, decfloat or numpy.ndarray
Spherical coordinates.
- dsigma.helpers.dsigma_table(table, table_type, survey=None, version=None, copy=False, verbose=True, e_2_convention=None, **kwargs)
Convert a table into a table accepted by
dsigma
.Convenience function to convert a table into an astropy table that is easily parsed by
dsigma
. Specifically, this table will have all necessary columns fordsigma
to work.- Parameters
- tableobject
Input table. This can be any object easily converted into an astropy table. For example, a structured numpy array, a list of dictionaries or an astropy table all work.
- table_typestring
String describing the table type. Valid choices are ‘lens’, ‘source’ or ‘calibration’.
- surveystring, optional
String describing the specific survey. Providing the survey makes the function look for specific keys in the input table. Default is None.
- versionstring, optional
If a survey is provided, one can specify the version or data release of the survey. If None, it will assume the most recent public vercsion. Default is None.
- copyboolean, optional
Whether the output table shares memory with the input table. Setting to False can save memory. However, data will be corupted if the original input table is manipulated. Default is False.
- verboseboolean, optional
Whether to output information about the assignments. Default is True.
- e_2_conventionstring, optional
Whether to switch the sign of e_2 in the input catalog. If ‘standard’, e_2 is not changed. On the other hand, if ‘flipped’, the sign of e_2 will be changed. If None, it defaults to ‘standard’ unless overwritten by the specific survey. Default is None.
- **kwargsdict, optional
This function has a set of default keys for columns in the input table that it associates with certain data. These default choices might be overwritten by survey-specific keys. If that does not work sufficiently, keys can be overwritten by the user with this argument. For example,
ra='R.A.'
would associate the right ascensions with theR.A.
key in the input table. Alternatively, one can also provide numbers that will be applied to all entries. This only really makes sense for weights that one wants to ignore, i.e.w_sys=1
.
- Returns
- table_outastropy.table.Table
Table with all necessary data to be parsed by
dsigma
.
- Raises
- ValueError
If table_type, survey or e_2_convention are not valid options.
- RuntimeError
If the input table contains masked data.
- dsigma.helpers.spherical_to_cartesian(ra, dec)
Convert spherical coordinates to cartesian coordinates on a unit sphere.
- Parameters
- rafloat or numpy.ndarray
Right ascension.
- decfloat or numpy.ndarray
Declination.
- Returns
- x, y, zfloat or numpy.ndarray
Cartesian coordinates.