utils
photXclus.utils
cat2hpx(lon, lat, nside, radec=True)
Convert a catalogue to a HEALPix map of number counts per resolution element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lon
|
(ndarray, ndarray)
|
Coordinates of the sources in degree. If radec=True, assume input is in the icrs coordinate system. Otherwise assume input is glon, glat |
required |
lat
|
(ndarray, ndarray)
|
Coordinates of the sources in degree. If radec=True, assume input is in the icrs coordinate system. Otherwise assume input is glon, glat |
required |
nside
|
int
|
HEALPix nside of the target map |
required |
radec
|
bool
|
Switch between R.A./Dec and glon/glat as input coordinate system. |
True
|
Return
hpx_map : ndarray HEALPix map of the catalogue number counts in Galactic coordinates
Source code in photXclus/utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
hpd_grid(sample, alpha=0.05, roundto=4)
Calculate highest posterior density (HPD) of array for given alpha. The HPD is the minimum width Bayesian credible interval (BCI). The function works for multimodal distributions, returning more than one mode
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
Numpy array or python list
|
An array containing MCMC samples |
required |
alpha
|
float
|
Desired probability of type I error (defaults to 0.05) |
0.05
|
roundto
|
Number of digits after the decimal point for the results |
4
|
Returns:
| Name | Type | Description |
|---|---|---|
hpd |
list with the highest density interval
|
|
x |
array with grid points where the density was evaluated
|
|
y |
array with the density values
|
|
modes |
list listing the values of the modes
|
|
Source code in photXclus/utils.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |