data
xsb_fluc.data.cluster
¶
Cluster
¶
Data container for a cluster observation/mosaic as defined by pyproffit.
Attributes:
Name | Type | Description |
---|---|---|
img |
ndarray
|
Image data |
exp |
ndarray
|
Exposure map |
bkg |
ndarray
|
Background map |
nh |
ndarray
|
Hydrogen column density map |
wcs |
WCS
|
WCS object |
header |
Header
|
Header object |
degree_per_pixel |
Quantity
|
Angular size of a pixel in degrees |
kpc_per_pixel |
Quantity
|
Angular size of a pixel in kpc |
shape |
tuple
|
Shape of the image |
x_c |
float
|
X coordinate of the cluster center |
y_c |
float
|
Y coordinate of the cluster center |
y_ref |
ndarray
|
Y coordinate of the image |
x_ref |
ndarray
|
X coordinate of the image |
coords |
SkyCoord
|
Coordinates of the image |
z |
float
|
Redshift of the cluster |
r_500 |
Quantity
|
Radius of the cluster at 500 times the critical density. |
t_500 |
Quantity
|
Angular radius of the cluster at 500 times the critical density. |
center |
SkyCoord
|
Coordinates of the cluster center |
name |
str
|
Name of the cluster |
imglink |
str
|
Path to the image file |
explink |
str
|
Path to the exposure map file |
bkglink |
str
|
Path to the background map file |
cosmo |
FlatLambdaCDM
|
Cosmology used to compute the angular and physical sizes |
regions |
Regions
|
Regions to exclude from the analysis |
unmasked_img |
ndarray
|
Unmasked image data |
unmasked_exposure |
ndarray
|
Unmasked exposure map |
Source code in src/xsb_fluc/data/cluster.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
__init__(imglink, explink=None, bkglink=None, reglink=None, nhlink=None, redshift=0.0, r_500=None, t_500=None, ra=None, dec=None, name=None)
¶
Constructor for the Cluster class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
imglink
|
str
|
Path to the image file |
required |
explink
|
str
|
Path to the exposure map file |
None
|
bkglink
|
str
|
Path to the background map file |
None
|
redshift
|
float
|
Redshift of the cluster |
0.0
|
r_500
|
Quantity
|
Radius of the cluster at 500 times the critical density. Either r_500 or t_500 must be provided. |
None
|
t_500
|
Quantity
|
Angular radius of the cluster at 500 times the critical density. Either r_500 or t_500 must be provided. |
None
|
ra
|
float | Quantity
|
Right ascension of the cluster center |
None
|
dec
|
float | Quantity
|
Declination of the cluster center |
None
|
name
|
str
|
Name of the cluster |
None
|
Source code in src/xsb_fluc/data/cluster.py
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
flatten(r_500_percent=1.0)
¶
Flatten the data in a 1D array and remove pixels outside the specified radius. It also removes pixels with no exposure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r_500_percent
|
float
|
Radius of the cluster in units of r_500 |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
cluster |
A new Cluster object with the flattened data. |
Warning
This function does not act in place, and instead return a new object.
Source code in src/xsb_fluc/data/cluster.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
from_catalog_row(row)
classmethod
¶
DEPRECATED: Build a cluster object from a row in the X-COP catalog
Source code in src/xsb_fluc/data/cluster.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
load_nh(nh_file)
¶
Load the hydrogen column density map
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nh_file
|
str
|
Path to the hydrogen column density map file |
required |
Source code in src/xsb_fluc/data/cluster.py
175 176 177 178 179 180 181 182 183 184 185 |
|
plot_cluster()
¶
Helper function to plot the observation components
Source code in src/xsb_fluc/data/cluster.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
rebin(factor)
¶
Rebin the data by a factor of factor
. It uses the astropy block_reduce function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factor
|
int
|
Rebinning factor |
required |
Returns:
Name | Type | Description |
---|---|---|
cluster |
A new Cluster object with the rebinned data. |
Warning
This function does not act in place, and instead return a new object.
Source code in src/xsb_fluc/data/cluster.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
reduce_fov(mean_model, r500_cut)
¶
Reduce the field of view to a given radius in units of r_500, using the best-fit mean model, which includes ellipticity for the cluster shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mean_model
|
MeanModel
|
Best-fit mean model |
required |
r500_cut
|
float
|
Radius in units of r_500 |
required |
Returns:
Name | Type | Description |
---|---|---|
cluster |
A new Cluster object with the reduced field of view. |
Warning
This function does not act in place, and instead return a new object.
Source code in src/xsb_fluc/data/cluster.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
reduce_to_r500(r500_cut=1.0)
¶
Reduce the field of view to a given radius in units of r_500. This does not take into account the ellipticity of the cluster, and simply assumes a circular symetry and uses the first proposed center to compute the radius.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
r500_cut
|
float
|
Radius in units of r_500 |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
cluster |
A new Cluster object with the reduced field of view. |
Warning
This function does not act in place, and instead return a new object.
Source code in src/xsb_fluc/data/cluster.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
|
region(region_file)
¶
Filter out regions provided in an input DS9 region file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region_file
|
str
|
Path to region file. Accepted region file formats are fk5 and image. |
required |
Source code in src/xsb_fluc/data/cluster.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
voronoi(voronoi_file, rebin_factor=5, exclusion=1, t_500_percent=1.0)
¶
Load the voronoi binning map. It must be produced using the vorbin package. See https://pypi.org/project/vorbin/ for more information and especially the scripts/voronoi.ipynb notebook for an example of how to generate the map.
Rebin the data using the previously loaded voronoi map. It assumes that the Voronoi binning algorithm has been run on the data with a first rough 4x4 rebinning, which I used to accelerate the computation of maps.
Danger
This function contains a lot of hard-coded values that should be changed.
It requires the user to precisely remember how the data was processed before
using the vorbin
package and try to applies the same to the untouched cluster
data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
voronoi_file
|
str
|
Path to the voronoi map file |
required |
rebin_factor
|
int
|
Rebinning factor |
5
|
exclusion
|
float
|
factor used in |
1
|
t_500_percent
|
float
|
Radius of the cluster in units of t_500 when selecting pixels |
1.0
|
Returns:
Name | Type | Description |
---|---|---|
cluster |
A new Cluster object with the rebinned data. |
Warning
This function does not act in place, and instead return a new object.
Source code in src/xsb_fluc/data/cluster.py
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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
xsb_fluc.data.mean_model
¶
MeanModel
¶
Awfully coded class to handle the results of the mean model fitting.
Attributes:
Name | Type | Description |
---|---|---|
data |
the cluster data. |
|
mean_model |
the mean model function. |
|
radius |
the radius function. |
|
angle |
the angle function. |
|
inference_data |
the inference data. |
|
true_image |
the true image. |
|
posterior_median |
the posterior median. |
|
posterior_params |
the posterior parameters. |
|
ellipse_params |
the ellipse parameters. |
|
number_of_samples |
the number of samples. |
|
best_fit |
the best fit image. |
Source code in src/xsb_fluc/data/mean_model.py
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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
ang
property
¶
Return best-fit angle for each pixel.
angle_sample
property
¶
Return a sample of angles for each pixel.
fluctuation_absolute
property
¶
Return the absolute fluctuation map.
fluctuation_relative
property
¶
Return the relative fluctuation map.
rad
property
¶
Return best-fit radius for each pixel.
rad_sample
property
¶
Return a sample of radii for each pixel.
__init__(data, inference_data, model='all')
¶
Constructor for the MeanModel
class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Cluster
|
the cluster data. |
required |
inference_data
|
InferenceData
|
the inference data. |
required |
model
|
(artefact of code from the X-COP paper). |
'all'
|
Source code in src/xsb_fluc/data/mean_model.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
from_data(data)
classmethod
¶
Load the mean model associated to a given cluster if it exists.
Source code in src/xsb_fluc/data/mean_model.py
99 100 101 102 103 104 105 106 107 |
|
power_spectrum_absolute(scales=np.geomspace(0.05, 1.0, 20), mask=None)
¶
Compute the absolute power spectrum with a given mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scales
|
array of scales to compute the power spectrum. |
geomspace(0.05, 1.0, 20)
|
|
mask
|
mask to apply to the data. |
None
|
Warning
This function might not work ?
Source code in src/xsb_fluc/data/mean_model.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
power_spectrum_relative(mask=None)
¶
Compute the relative power spectrum with a given mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scales
|
array of scales to compute the power spectrum. |
required | |
mask
|
mask to apply to the data. |
None
|
Warning
This function might not work ?
Source code in src/xsb_fluc/data/mean_model.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|