sorcha.modules.PPRandomizeMeasurements
Attributes
Functions
|
Wrapper function to perform randomisation of astrometry and photometry around |
|
Randomize astrometry with a normal distribution around the actual RADEC pointing. |
|
Sample n points randomly (normal distribution) on a region on the unit (hyper-)sphere. |
|
Randomize photometry with normal distribution around magName value. |
|
AB ugriz system (f0 = 3631 Jy) to magnitude conversion. |
|
AB ugriz system (f0 = 3631 Jy) magnitude to flux conversion. |
|
Convert ICRF xyz to Right Ascension and Declination. |
|
Convert Right Ascension and Declination to ICRF xyz unit vector. |
Module Contents
- randomizeAstrometryAndPhotometry(observations, sconfigs, module_rngs, verbose=False)[source]
Wrapper function to perform randomisation of astrometry and photometry around their uncertainties. Calls randomizePhotometry() and randomizeAstrometry().
Adds the following columns to the dataframe: - trailedSourceMag - PSFMag - AstRATrue(deg) - AstDecTrue(deg)
- Parameters:
observations (pandas dataframe) -- Dataframe containing observations.
sconfigs (dataclass) -- Dataclass of configuration file arguments.
module_rngs (PerModuleRNG) -- A collection of random number generators (per module).
verbose (bool, default=False) -- Verbosity on or off.
- Returns:
observations -- Original input dataframe with RA and Dec columns and trailedSourceMag and PSFMag columns randomized around astrometric and photometric sigma. Original RA and Dec/magnitudes stored in separate columns.
- Return type:
pandas dataframe
- randomizeAstrometry(df, module_rngs, raName='RA_deg', decName='Dec_deg', raOrigName='RATrue_deg', decOrigName='DecTrue_deg', sigName='AstSig(deg)', radecUnits='deg', sigUnits='mas')[source]
Randomize astrometry with a normal distribution around the actual RADEC pointing. The randomized values replace the original astrometry, with the original values stored in separate columns.
Adds the following columns to the observations dataframe:
AstRATrue(deg)
AstDecTrue(deg)
- Parameters:
df (pandas dataframe) -- Dataframe containing astrometry and sigma.
module_rngs (PerModuleRNG) -- A collection of random number generators (per module).
ra_Name (string, default="RA_deg") -- "df" dataframe column name for the right ascension.
dec_Name (string, default="Dec_deg") -- "df" dataframe column name for the declination.
raOrigName (string, default="RATrue_deg") -- "df" dataframe column name for where to store original right ascension.
decOrigName (string, default="DecTrue_deg") -- "df" dataframe column name for where to store original declination.
sigName (string, default="AstSig(deg)") -- "df" dataframe column name for the standard deviation, uncertainty in the astrometric position.
radecUnits (string, default="deg") -- Units for RA and Dec ('deg'/'rad'/'mas').
sigUnits (string, default="mas") -- Units for standard deviation ('deg'/'rad'/'mas').
- Returns:
df -- original input dataframe with RA and Dec columns randomized around astrometric sigma and original RA and Dec stored in separate columns
- Return type:
pandas dataframe
Notes
Covariances in RADEC are currently not supported. The routine calculates a normal distribution on the unit sphere, so as to allow for a correct modeling of the poles. Distributions close to the poles may look odd in RADEC.
- sampleNormalFOV(center, sigma, module_rngs, ndim=3)[source]
Sample n points randomly (normal distribution) on a region on the unit (hyper-)sphere.
- Parameters:
center (float) -- Center of hpyer-sphere: can be an [n, ndim] dimensional array, but only if n == npoints.
sigma (n-dimensional array) -- 1 sigma distance on unit sphere [radians]x
module_rngs (PerModuleRNG) -- A collection of random number generators (per module).
ndim (integer, default=3) -- Dimension of hyper-sphere.
- Returns:
vec -- Size [npoints, ndim]
- Return type:
numpy array
- randomizePhotometry(df, module_rngs, magName='Filtermag', magRndName='FiltermagRnd', sigName='FiltermagSig')[source]
Randomize photometry with normal distribution around magName value.
- Parameters:
df (pandas dataframe) -- Dataframe containing astrometry and sigma.
module_rngs (PerModuleRNG) -- A collection of random number generators (per module).
magName (string, default="Filtermag") -- 'df' column name of apparent magnitude.
magRndName (string, default="FiltermagRnd") -- 'df' column name for storing randomized apparent magnitude,
sigName (float, default="FiltermagSig") -- 'df' column name for magnitude standard deviation.
- Returns:
randomized magnitudes for each row in 'df'
- Return type:
array of floats
Notes
The normal distribution here is in magnitudes while it should be in flux. This will fail for large sigmas. Should be fixed at some point.
We assume that apparent magnitudes are stored within 'df' and that 'magName' corresponds to the corresponding column within 'df'
'df' is also modified with added column magRndNam to store the randomize apparent magnitude
- flux2mag(f, f0=3631)[source]
AB ugriz system (f0 = 3631 Jy) to magnitude conversion.
- Parameters:
f (float or array of floats) -- flux. [Units : Jy].
f0 (float, default= 3631) -- Zero point flux.
- Returns:
mag -- pogson magnitude. [Units: mag]
- Return type:
float or array of floats
- mag2flux(mag, f0=3631)[source]
AB ugriz system (f0 = 3631 Jy) magnitude to flux conversion.
- Parameters:
mag (float or rray of floats) -- Pogson magnitude. [Units: mag]
f0 (float, default=3631) -- Zero point flux.
- Returns:
f (float/array of floats)
- Return type:
flux [Units: Jy].
- icrf2radec(x, y, z, deg=True)[source]
Convert ICRF xyz to Right Ascension and Declination. Geometric states on unit sphere, no light travel time/aberration correction.
- Parameters:
x (floats/arrays of floats) -- 3D vector of unit length (ICRF)
y (floats/arrays of floats) -- 3D vector of unit length (ICRF)
z (floats/arrays of floats) -- 3D vector of unit length (ICRF)
deg (boolean, default=True) -- True for angles in degrees, False for angles in radians.
- Returns:
ra (float or array of floats) -- Right Ascension. [Units: deg]
dec (float or array of floats) -- Declination. [Units: deg]
- radec2icrf(ra, dec, deg=True)[source]
Convert Right Ascension and Declination to ICRF xyz unit vector. Geometric states on unit sphere, no light travel time/aberration correction.
- Parameters:
ra (float or array of floats) -- Right Ascension. [Units: deg]
dec (float or array of floats) -- Declination. [Units deg]
deg (boolean, default=True) -- True for angles in degrees, False for angles in radians.
- Returns:
array([x, y, z]) -- 3D vector of unit length (ICRF)
- Return type:
arrays/matrix of floats