Global Settings
The toast module has several global settings that can be configured at runtime with environment variables or by explicitly calling functions in the package.
toast
Time Ordered Astrophysics Scalable Tools (TOAST) is a software package designed to allow the processing of data from telescopes that acquire data as timestreams (rather than images).
Runtime behavior of this package can be controlled by setting some environment variables (before importing the package):
TOAST_LOGLEVEL=
TOAST_FUNCTIME=
TOAST_GPU_OPENMP=
TOAST_GPU_MEM_GB=
TOAST_GPU_JAX=
TOAST_GPU_HYBRID_PIPELINES=
OMP_NUM_THREADS=
OMP_TARGET_OFFLOAD=[MANDATORY | DISABLED | DEFAULT] * If the TOAST_GPU_OPENMP environment variable is set, this standard OpenMP environment variable controls the offload behavior.
MPI_DISABLE=pshmem
package used by toast.
CUDA_MEMPOOL_FRACTION=
__version__ = env.version()
module-attribute
env = Environment.get()
module-attribute
interval_dtype = build_interval_dtype()
module-attribute
relfile = os.path.join(thisdir, 'RELEASE')
module-attribute
thisdir = os.path.abspath(os.path.dirname(__file__))
module-attribute
Comm
Bases: object
Class which represents a two-level hierarchy of MPI communicators.
A Comm object splits the full set of processes into groups of size
groupsize
. If groupsize does not divide evenly into the size of the given
communicator, then some processes remain idle.
A Comm object stores several MPI communicators: The "world" communicator given here, which contains all processes to consider, a "group" communicator (one per group), and a "rank" communicator which contains the processes with the same group-rank across all groups.
This object also stores a "node" communicator containing all processes with access to the same shared memory, and a "node rank" communicator for processes with the same rank on a node. There is a node rank communicator for all nodes and also one for within the group.
Additionally, there is a mechanism for creating and caching row / column communicators for process grids within a group.
If MPI is not enabled, then all communicators are set to None. Additionally, there may be cases where MPI is enabled in the environment, but the user wishes to disable it when creating a Comm object. This can be done by passing MPI.COMM_SELF as the world communicator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
world
|
Comm
|
the MPI communicator containing all processes. |
None
|
groupsize
|
int
|
the size of each process group. |
0
|
Source code in toast/mpi.py
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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
|
comm_group
property
The communicator shared by processes within this group.
comm_group_node
property
The communicator shared by group processes on the same node.
comm_group_node_rank
property
The communicator shared by group processes with the same node rank on nodes within the group.
comm_group_rank
property
The communicator shared by processes with the same group_rank.
comm_world
property
The world communicator.
comm_world_node
property
The communicator shared by world processes on the same node.
comm_world_node_rank
property
The communicator shared by world processes with the same node rank across all nodes.
group
property
The group containing this process.
group_rank
property
The rank of this process in the group communicator.
group_size
property
The size of the group containing this process.
ngroups
property
The number of process groups.
world_rank
property
The rank of this process in the world communicator.
world_size
property
The size of the world communicator.
comm_row_col(process_rows)
Return the row and column communicators for this group and grid shape.
This function will create and / or return the communicators needed for a given process grid. The return value is a dictionary with the following keys:
- "row": The row communicator.
- "col": The column communicator.
- "row_node": The node-local communicator within the row communicator
- "col_node": The node-local communicator within the col communicator
- "row_rank_node": The communicator across nodes among processes with
the same node-rank within the row communicator.
- "col_rank_node": The communicator across nodes among processes with
the same node-rank within the column communicator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
process_rows
|
int
|
The number of rows in the process grid. |
required |
Returns:
Type | Description |
---|---|
dict
|
The communicators for this grid shape. |
Source code in toast/mpi.py
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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
|
Data
Bases: MutableMapping
Class which represents distributed data
A Data object contains a list of observations assigned to each process group in the Comm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comm
|
class: |
Comm()
|
|
view
|
bool
|
If True, do not explicitly clear observation data on deletion. |
False
|
Source code in toast/data.py
16 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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
|
comm
property
The toast.Comm over which the data is distributed.
obs = []
instance-attribute
The list of observations.
accel_clear()
Delete all accelerator data.
Source code in toast/data.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
|
accel_create(names)
Create a set of data objects on the device.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods. If the data already exists on the device then no action is taken.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/data.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
|
accel_delete(names)
Delete a specific set of device objects
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/data.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
|
accel_update_device(names)
Copy a set of data objects to the device.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/data.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
|
accel_update_host(names)
Copy a set of data objects to the host.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/data.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
|
all_local_detectors(selection=None, flagmask=0)
Get the superset of local detectors in all observations.
This builds up the result from calling select_local_detectors()
on
all observations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selection
|
list
|
Only consider this list of detectors |
None
|
flagmask
|
int
|
Apply this det_mask to the detector selection in each observation. |
0
|
Returns:
Type | Description |
---|---|
list
|
The list of all local detectors across all observations. |
Source code in toast/data.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
clear()
Clear the list of observations.
Source code in toast/data.py
69 70 71 72 73 74 75 76 77 78 |
|
detector_units(det_data)
Get the detector data units for a given field.
This verifies that the specified detector data field has the same units in all observations where it occurs, and returns that unit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
det_data
|
str
|
The detector data field. |
required |
Returns:
Type | Description |
---|---|
Unit
|
The unit used across all observations. |
Source code in toast/data.py
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 |
|
info(handle=None)
Print information about the distributed data.
Information is written to the specified file handle. Only the rank 0 process writes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handle
|
descriptor
|
file descriptor supporting the write() method. If None, use print(). |
None
|
Returns:
Type | Description |
---|---|
None |
Source code in toast/data.py
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 |
|
select(obs_index=None, obs_name=None, obs_uid=None, obs_session_name=None, obs_key=None, obs_val=None)
Create a new Data object with a subset of observations.
The returned Data object just has a view of the original observations (they are not copied).
The list of observations in the new Data object is a logical OR of the criteria passed in: * Index location in the original list of observations * Name of the observation * UID of the observation * Session of the observation * Existence of the specified dictionary key * Required value of the specified dictionary key
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obs_index
|
int
|
Observation location in the original list. |
None
|
obs_name
|
str
|
The observation name or a compiled regular expression object to use for matching. |
None
|
obs_uid
|
int
|
The observation UID to select. |
None
|
obs_session_name
|
str
|
The name of the session. |
None
|
obs_key
|
str
|
The observation dictionary key to examine. |
None
|
obs_val
|
str
|
The required value of the observation dictionary key or a compiled regular expression object to use for matching. |
None
|
Returns:
Type | Description |
---|---|
Data
|
A new Data object with references to the orginal metadata and a subset of observations. |
Source code in toast/data.py
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 |
|
split(obs_index=False, obs_name=False, obs_uid=False, obs_session_name=False, obs_key=None, require_full=False)
Split the Data object.
Create new Data objects that have views into unique subsets of the observations (the observations are not copied). Only one "criteria" may be used to perform this splitting operation. The observations may be split by index in the original list, by name, by UID, by session, or by the value of a specified key.
The new Data objects are returned in a dictionary whose keys are the value of
the selection criteria (index, name, uid, or value of the key). Any observation
that cannot be placed (because it is missing a name, uid or key) will be ignored
and not added to any of the returned Data objects. If the require_full
parameter is set to True, such situations will raise an exception.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obs_index
|
bool
|
If True, split by index in original list of observations. |
False
|
obs_name
|
bool
|
If True, split by observation name. |
False
|
obs_uid
|
bool
|
If True, split by observation UID. |
False
|
obs_session_name
|
bool
|
If True, split by session name. |
False
|
obs_key
|
str
|
Split by values of this observation key. |
None
|
require_full
|
bool
|
If True, every observation must be placed in the output. |
False
|
Returns:
Type | Description |
---|---|
OrderedDict
|
The dictionary of new Data objects. |
Source code in toast/data.py
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 |
|
Environment
Bases: pybind11_builtins.pybind11_object
Global runtime environment.
This singleton class provides a unified place to parse environment variables at runtime and to change global settings that impact the overall package.
__doc__ = '\n Global runtime environment.\n\n This singleton class provides a unified place to parse environment\n variables at runtime and to change global settings that impact the\n overall package.\n\n '
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__ = 'toast._libtoast'
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__init__(*args, **kwargs)
method descriptor
Initialize self. See help(type(self)) for accurate signature.
__repr__()
method descriptor
repr(self: toast._libtoast.Environment) -> str
current_threads()
method descriptor
current_threads(self: toast._libtoast.Environment) -> int
Return the current threading concurrency in use.
disable_function_timers()
method descriptor
disable_function_timers(self: toast._libtoast.Environment) -> None
Explicitly disable function timers.
enable_function_timers()
method descriptor
enable_function_timers(self: toast._libtoast.Environment) -> None
Explicitly enable function timers.
function_timers()
method descriptor
function_timers(self: toast._libtoast.Environment) -> bool
Return True if function timing has been enabled.
get()
method descriptor
get() -> toast._libtoast.Environment
Get a handle to the global environment class.
get_acc()
method descriptor
get_acc(self: toast._libtoast.Environment) -> tuple
Get the OpenACC device properties.
Returns:
Type | Description |
---|---|
tuple
|
The (num devices, proc per device, my device) integers. |
log_level()
method descriptor
log_level(self: toast._libtoast.Environment) -> str
Return the string of the current Logging level.
max_threads()
method descriptor
max_threads(self: toast._libtoast.Environment) -> int
Returns the maximum number of threads used by compiled code.
set_acc()
method descriptor
set_acc(self: toast._libtoast.Environment, n_acc_device: int, n_acc_proc_per_device: int, my_acc_device: int) -> None
Set the OpenACC device properties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_acc_device
|
int
|
The number of accelerator devices. |
required |
n_acc_proc_per_device
|
int
|
The number of processes sharing each device. |
required |
my_acc_device
|
int
|
The device to use for this process. |
required |
Returns:
Type | Description |
---|---|
None |
set_log_level()
method descriptor
set_log_level(self: toast._libtoast.Environment, level: str) -> None
Set the Logging level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
str
|
one of DEBUG, INFO, WARNING, ERROR or CRITICAL. |
required |
Returns:
Type | Description |
---|---|
None |
set_threads()
method descriptor
set_threads(self: toast._libtoast.Environment, nthread: int) -> None
Set the number of threads in use.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nthread
|
int
|
The number of threads to use. |
required |
Returns:
Type | Description |
---|---|
None |
signals()
method descriptor
signals(self: toast._libtoast.Environment) -> list[str]
Return a list of the currently available signals.
tod_buffer_length()
method descriptor
tod_buffer_length(self: toast._libtoast.Environment) -> int
Returns the number of samples to buffer for TOD operations.
version()
method descriptor
version(self: toast._libtoast.Environment) -> str
Return the current source code version string.
Focalplane
Bases: object
Class representing the focalplane for one observation.
The detector_data Table may store arbitrary columns, but several are required. They include:
"name": The detector name.
"quat": Each row should be a 4-element numpy array.
"gamma": If using a half wave plate, we need the rotation angle of the
detector polarization orientation from the focalplane frame X-axis.
Some columns are optional:
"uid": Unique integer ID for each detector. Computed from detector name if
not specified.
"pol_angle": Quantity to specify the polarization angle. Default assumes
the polarization sensitive direction is aligned with the detector
quaternion rotation. Computed if not specified.
"pol_leakage": Float value "epsilon" between 0-1. Set to zero by default.
"pol_efficiency": Float value "eta" = (1 - epsilon) / (1 + epsilon). Set
to one by default.
"fwhm": Quantity with the nominal beam FWHM. Used for plotting and for
smoothing of simulated sky signal with PySM.
"bandcenter": Quantity for the band center. Used for bandpass integration
with PySM simulations.
"bandwidth": Quantity for width of the band. Used for bandpass integration
with PySM simulations.
"psd_net": The detector sensitivity. Quantity used to create a synthetic
noise model with the DefaultNoiseModel operator.
"psd_fknee": Quantity used to create a synthetic noise model with the
DefaultNoiseModel operator.
"psd_fmin": Quantity used to create a synthetic noise model with the
DefaultNoiseModel operator.
"psd_alpha": Quantity used to create a synthetic noise model with the
DefaultNoiseModel operator.
"elevation_noise_a" and "elevation_noise_c": Parameters of elevation scaling
noise model: PSD_{out} = PSD_{ref} * (a / sin(el) + c)^2. Only applicable
to ground data.
"pwv_a0", "pwv_a1" and "pwv_a2": quadratic fit of the NET modulation by
PWV. Only applicable to ground data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detector_data
|
QTable
|
Table of detector properties. |
None
|
field_of_view
|
Quantity
|
Angular diameter of the focal plane. Used to increase the effective size of the focalplane when simulating atmosphere, etc. Will be calculated from the detector offsets by default. |
None
|
sample_rate
|
Quantity
|
The common (nominal) sample rate for all detectors. |
None
|
thinfp
|
int
|
Only sample the detectors in the file. |
None
|
Source code in toast/instrument.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 |
|
detector_groups(column)
Group detectors by a common value in one property.
This returns a dictionary whose keys are the unique values of the specified detector_data column. The values for each key are a list of detectors that have that value. This can be useful for creating detector sets for data distribution or for considering detectors with correlations.
Since the column values will be used for dictionary keys, the column must be a data type which is hashable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column
|
str
|
The detector_data column. |
required |
Returns:
Type | Description |
---|---|
dict
|
The detector names grouped by unique column values. |
Source code in toast/instrument.py
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 |
|
load_hdf5(handle, comm=None, **kwargs)
Load the focalplane from an HDF5 group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handle
|
Group
|
The group containing the "focalplane" dataset. |
required |
comm
|
Comm
|
If loading from a file, optional communicator to broadcast across. |
None
|
Returns:
Type | Description |
---|---|
None |
Source code in toast/instrument.py
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
|
save_hdf5(handle, comm=None, **kwargs)
Save the focalplane to an HDF5 group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handle
|
Group
|
The parent group of the focalplane dataset. |
required |
comm
|
Comm
|
If loading from a file, optional communicator to broadcast across. |
None
|
Returns:
Type | Description |
---|---|
None |
Source code in toast/instrument.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 |
|
GlobalTimers
Bases: pybind11_builtins.pybind11_object
Global timer registry.
This singleton class stores timers that can be started / stopped anywhere in the code to accumulate the total time for different operations.
__doc__ = '\n Global timer registry.\n\n This singleton class stores timers that can be started / stopped\n anywhere in the code to accumulate the total time for different\n operations.\n '
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__ = 'toast._libtoast'
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__init__(*args, **kwargs)
method descriptor
Initialize self. See help(type(self)) for accurate signature.
clear_all()
method descriptor
clear_all(self: toast._libtoast.GlobalTimers) -> None
Clear all global timers.
collect()
method descriptor
collect(self: toast._libtoast.GlobalTimers) -> dict
Stop all timers and return the current state.
Returns:
Type | Description |
---|---|
dict
|
A dictionary of Timers. |
get()
method descriptor
get() -> toast._libtoast.GlobalTimers
Get a handle to the singleton class.
is_running()
method descriptor
is_running(self: toast._libtoast.GlobalTimers, name: str) -> bool
Is the specified timer running?
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the global timer. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the timer is running, else False. |
names()
method descriptor
names(self: toast._libtoast.GlobalTimers) -> list[str]
Return the names of all currently registered timers.
Returns:
Type | Description |
---|---|
list
|
The names of the timers. |
report()
method descriptor
report(self: toast._libtoast.GlobalTimers) -> None
Report results of all global timers to STDOUT.
seconds()
method descriptor
seconds(self: toast._libtoast.GlobalTimers, name: str) -> float
Get the elapsed time for a timer.
The timer must be stopped.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the global timer. |
required |
Returns:
Type | Description |
---|---|
float
|
The elapsed time in seconds. |
start()
method descriptor
start(self: toast._libtoast.GlobalTimers, name: str) -> None
Start the specified timer.
If the named timer does not exist, it is first created before being started.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the global timer. |
required |
Returns:
Type | Description |
---|---|
None |
stop()
method descriptor
stop(self: toast._libtoast.GlobalTimers, name: str) -> None
Stop the specified timer.
The timer must already exist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the global timer. |
required |
Returns:
Type | Description |
---|---|
None |
stop_all()
method descriptor
stop_all(self: toast._libtoast.GlobalTimers) -> None
Stop all global timers.
GroundSite
Bases: Site
Site on the Earth.
This represents a fixed location on the Earth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Site name |
required |
lat
|
Quantity
|
Site latitude. |
required |
lon
|
Quantity
|
Site longitude. |
required |
alt
|
Quantity
|
Site altitude. |
required |
uid
|
int
|
Unique identifier. If not specified, constructed from a hash of the site name. |
None
|
weather
|
Weather
|
Weather information for this site. |
None
|
Source code in toast/instrument.py
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 |
|
IntervalList
Bases: Sequence
, AcceleratorObject
An list of Intervals which supports logical operations.
The timestamps define the valid local range of intervals. When constructing from intervals, timespans, or samplespans, the inputs are truncated to the allowed range given by the timestamps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timestamps
|
array
|
Array of local sample times, required. |
required |
intervals
|
list
|
An existing IntervalsList or raw intervals array. |
None
|
timespans
|
list
|
A list of tuples containing start and stop times. |
None
|
samplespans
|
list
|
A list of tuples containing first and last (inclusive) sample ranges. |
None
|
Source code in toast/intervals.py
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 |
|
ObsMat
Bases: object
Observation Matrix class
Source code in toast/ops/obsmat.py
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 |
|
Observation
Bases: MutableMapping
Class representing the data for one observation.
An Observation stores information about data distribution across one or more MPI processes and is a container for four types of objects:
* Local detector data (unique to each process).
* Shared data that has one common copy for every node spanned by the
observation.
* Intervals defining spans of data with some common characteristic.
* Other arbitrary small metadata.
Small metadata can be stored directly in the Observation using normal square bracket "[]" access to elements (an Observation is a dictionary). Groups of detector data (e.g. "signal", "flags", etc) can be accessed in the separate detector data dictionary (the "detdata" attribute). Shared data can be similarly stored in the "shared" attribute. Lists of intervals are accessed in the "intervals" attribute and data views can use any interval list to access subsets of detector and shared data.
Notes on distributed use with MPI
The detector data within an Observation is distributed among the processes in an MPI communicator. The processes in the communicator are arranged in a rectangular grid, with each process storing some number of detectors for a piece of time covered by the observation. The most common configuration (and the default) is to make this grid the size of the communicator in the "detector direction" and a size of one in the "sample direction"::
MPI det1 sample(0), sample(1), sample(2), ...., sample(N-1)
rank 0 det2 sample(0), sample(1), sample(2), ...., sample(N-1)
----------------------------------------------------------------------
MPI det3 sample(0), sample(1), sample(2), ...., sample(N-1)
rank 1 det4 sample(0), sample(1), sample(2), ...., sample(N-1)
So each process has a subset of detectors for the whole span of the observation time. You can override this shape by setting the process_rows to something else. For example, process_rows=1 would result in this::
MPI rank 0 | MPI rank 1
----------------------------------+----------------------------
det1 sample(0), sample(1), ..., | ...., sample(N-1)
det2 sample(0), sample(1), ..., | ...., sample(N-1)
det3 sample(0), sample(1), ..., | ...., sample(N-1)
det4 sample(0), sample(1), ..., | ...., sample(N-1)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comm
|
Comm
|
The toast communicator containing information about the process group for this observation. |
required |
telescope
|
Telescope
|
An instance of a Telescope object. |
required |
n_samples
|
int
|
The total number of samples for this observation. |
required |
name
|
str
|
(Optional) The observation name. |
None
|
uid
|
int
|
(Optional) The Unique ID for this observation. If not specified, the UID will be computed from a hash of the name. |
None
|
session
|
Session
|
The observing session that this observation is contained in or None. |
None
|
detector_sets
|
list
|
(Optional) List of lists containing detector names. These discrete detector sets are used to distribute detectors- a detector set will always be within a single row of the process grid. If None, every detector is a set of one. |
None
|
sample_sets
|
list
|
(Optional) List of lists of chunk sizes (integer numbers of samples). These discrete sample sets are used to distribute sample data. A sample set will always be within a single column of the process grid. If None, any distribution break in the sample direction will happen at an arbitrary place. The sum of all chunks must equal the total number of samples. |
None
|
process_rows
|
int
|
(Optional) The size of the rectangular process grid in the detector direction. This number must evenly divide into the size of comm. If not specified, defaults to the size of the communicator. |
None
|
Source code in toast/observation.py
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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
|
all_detector_sets
property
(list): The total list of detector sets for this observation.
all_detectors
property
(list): All detectors stored in this observation.
all_sample_sets
property
(list): The input full list of sample sets used in data distribution
comm
property
(toast.Comm): The overall communicator.
comm_col
property
(mpi4py.MPI.Comm): The communicator for processes in the same column (or None).
comm_col_rank
property
(int): The rank of this process in the column communicator.
comm_col_size
property
(int): The number of processes in the column communicator.
comm_row
property
(mpi4py.MPI.Comm): The communicator for processes in the same row (or None).
comm_row_rank
property
(int): The rank of this process in the row communicator.
comm_row_size
property
(int): The number of processes in the row communicator.
local_detector_flags
property
(dict): The local per-detector flags
local_detector_sets
property
(list): The detector sets assigned to this process (or None).
local_detectors
property
(list): The detectors assigned to this process.
local_index_offset
property
The first sample on this process, relative to the observation start.
local_sample_sets
property
(list): The sample sets assigned to this process (or None).
n_all_samples
property
(int): the total number of samples in this observation.
n_local_samples
property
The number of local samples on this process.
name
property
(str): The name of the observation.
session
property
(Session): The Session instance for this observation.
telescope
property
(Telescope): The Telescope instance for this observation.
uid
property
(int): The Unique ID for this observation.
accel_create(names)
Create a set of data objects on the device.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/observation.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
|
accel_update_device(names)
Copy data objects to the device.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/observation.py
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
|
accel_update_host(names)
Copy data objects from the device.
This takes a dictionary with the same format as those used by the Operator provides() and requires() methods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
dict
|
Dictionary of lists. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/observation.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
|
duplicate(times=None, meta=None, shared=None, detdata=None, intervals=None)
Return a copy of the observation and all its data.
The times field should be the name of the shared field containing timestamps. This is used when copying interval lists to the new observation so that these objects reference the timestamps within this observation (rather than the old one). If this is not specified and some intervals exist, then an exception is raised.
The meta, shared, detdata, and intervals list specifies which of those objects to copy to the new observation. If these are None, then all objects are duplicated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
times
|
str
|
The name of the timestamps shared field. |
None
|
meta
|
list
|
List of metadata objects to copy, or None. |
None
|
shared
|
list
|
List of shared objects to copy, or None. |
None
|
detdata
|
list
|
List of detdata objects to copy, or None. |
None
|
intervals
|
list
|
List of intervals objects to copy, or None. |
None
|
Returns:
Type | Description |
---|---|
Observation
|
The new copy of the observation. |
Source code in toast/observation.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
|
memory_use()
Estimate the memory used by shared and detector data.
This sums the memory used by the shared and detdata attributes and returns the total on all processes. This function is blocking on the observation communicator.
Returns:
Type | Description |
---|---|
int
|
The number of bytes of memory used by timestream data. |
Source code in toast/observation.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
|
redistribute(process_rows, times=None, override_sample_sets=False, override_detector_sets=False, return_global_intervals=False)
Take the currently allocated observation and redistribute in place.
This changes the data distribution within the observation. After re-assigning all detectors and samples, the currently allocated shared data objects and detector data objects are redistributed using the observation communicator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
process_rows
|
int
|
The size of the new process grid in the detector direction. This number must evenly divide into the size of the observation communicator. |
required |
times
|
str
|
The shared data field representing the timestamps. This is used to recompute the intervals after redistribution. |
None
|
override_sample_sets
|
(False, None or list)
|
If not False, override existing sample set boundaries in the redistributed data. |
False
|
override_detector_sets
|
(False, None or list)
|
If not False, override existing detector set boundaries in the redistributed data. |
False
|
return_global_intervals
|
bool
|
Return a list of global intervals for reference |
False
|
Returns:
Type | Description |
---|---|
None or global_intervals |
Source code in toast/observation.py
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
|
select_local_detectors(selection=None, flagmask=0)
Get the local detectors assigned to this process.
This takes the full list of local detectors and optionally prunes them by the specified selection and / or applies per-detector flags with the given mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
selection
|
list
|
Only return detectors in this set. |
None
|
flagmask
|
uint8
|
Apply this mask to per-detector flags and only include detectors with a result of zero (good). |
0
|
Returns:
Type | Description |
---|---|
list
|
The selected detectors. |
Source code in toast/observation.py
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 |
|
set_local_detector_flags(vals)
Set the per-detector flagging.
This resets the per-detector flags to the specified values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vals
|
dict
|
The flag values for one or more detectors. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/observation.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
|
update_local_detector_flags(vals)
Update the per-detector flagging.
This does a bitwise OR with the existing flag values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vals
|
dict
|
The flag values for one or more detectors. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in toast/observation.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
PixelData
Bases: AcceleratorObject
Distributed map-domain data.
The distribution information is stored in a PixelDistribution instance passed to the constructor. Each process has local data stored in one or more "submaps".
Although multiple processes may have the same submap of data stored locally, only one process is considered the "owner". This ownership is used when serializing the data and when doing reductions in certain cases. Ownership can be set to either the lowest rank process which has the submap or to a balanced distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dist
|
PixelDistribution
|
The distribution of submaps. |
required |
dtype
|
dtype
|
A numpy-compatible dtype for each element of the data. The only supported types are 1, 2, 4, and 8 byte signed and unsigned integers, 4 and 8 byte floating point numbers, and 4 and 8 byte complex numbers. |
required |
n_value
|
int
|
The number of values per pixel. |
1
|
units
|
Unit
|
The units of the map data. |
dimensionless_unscaled
|
Source code in toast/pixels.py
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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 |
|
distribution
property
(PixelDistribution): The distribution information.
dtype
property
(numpy.dtype): The data type of the values.
n_value
property
(int): The number of non-zero values per pixel.
units
property
(Unit): The map data units.
broadcast_map(fdata, comm_bytes=10000000)
Distribute a map located on a single process.
The root process takes a map in memory and distributes it. Chunks of submaps are broadcast to all processes, and each process copies data to its local submaps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fdata
|
array
|
The input data (only significant on process 0). |
required |
comm_bytes
|
int
|
The approximate message size to use. |
10000000
|
Returns:
Type | Description |
---|---|
None |
Source code in toast/pixels.py
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 |
|
clear()
Delete the underlying memory.
This will forcibly delete the C-allocated memory and invalidate all python references to this object. DO NOT CALL THIS unless you are sure all references are no longer being used and you are about to delete the object.
Source code in toast/pixels.py
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
|
comm_nsubmap(bytes)
Given a buffer size, compute the number of submaps to communicate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bytes
|
int
|
The number of bytes. |
required |
Returns:
Type | Description |
---|---|
int
|
The number of submaps in each buffer. |
Source code in toast/pixels.py
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
|
duplicate()
Create a copy of the data with the same distribution.
Returns:
Type | Description |
---|---|
PixelData
|
A duplicate of the instance with copied data but the same distribution. |
Source code in toast/pixels.py
628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
forward_alltoallv()
Communicate submaps into buffers on the owning process.
On the first call, some initialization is done to compute send and receive displacements and counts. A persistent receive buffer is allocated. Submap data is sent to their owners simultaneously using alltoallv.
Returns:
Type | Description |
---|---|
None. |
Source code in toast/pixels.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 |
|
reset()
Set memory to zero
Source code in toast/pixels.py
560 561 562 563 564 |
|
reverse_alltoallv()
Communicate submaps from the owning process back to all processes.
Returns:
Type | Description |
---|---|
None. |
Source code in toast/pixels.py
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
|
setup_allreduce(n_submap)
Check that allreduce buffers exist and create them if needed.
Source code in toast/pixels.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
setup_alltoallv()
Check that alltoallv buffers exist and create them if needed.
Source code in toast/pixels.py
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 |
|
stats(comm_bytes=10000000)
Compute some simple statistics of the pixel data.
The map should already be consistent across all processes with overlapping submaps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comm_bytes
|
int
|
The approximate message size to use. |
10000000
|
Returns:
Type | Description |
---|---|
dict
|
The computed properties on rank zero, None on other ranks. |
Source code in toast/pixels.py
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 |
|
sync_allreduce(comm_bytes=10000000)
Perform a buffered allreduce of the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comm_bytes
|
int
|
The approximate message size to use. |
10000000
|
Returns:
Type | Description |
---|---|
None. |
Source code in toast/pixels.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
|
sync_alltoallv(local_func=None)
Perform operations on locally owned submaps using Alltoallv communication.
On the first call, some initialization is done to compute send and receive displacements and counts. A persistent receive buffer is allocated. Submap data is sent to their owners simultaneously using alltoallv. Each process does a local operation on their owned submaps before sending the result back with another alltoallv call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
local_func
|
function
|
A function for processing the local submap data. |
None
|
Returns:
Type | Description |
---|---|
None. |
Source code in toast/pixels.py
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 |
|
update_units(new_units)
Update the units associated with the data.
Source code in toast/pixels.py
586 587 588 |
|
PixelDistribution
Bases: AcceleratorObject
Class representing the distribution of submaps.
This object is used to describe the properties of a pixelization scheme and which "submaps" are strored on each process. The size of the submap can be tuned to balance storage (smaller submap size means fewer wasted pixels stored) and ease of indexing (larger submap size means faster global-to-local pixel lookups).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_pix
|
int
|
the total number of pixels. |
None
|
n_submap
|
int
|
the number of submaps to use. |
1000
|
local_submaps
|
array
|
the list of local submaps (integers). |
None
|
comm
|
Comm
|
The MPI communicator or None. |
None
|
Source code in toast/pixels.py
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 |
|
all_hit_submaps
property
(array): The list of submaps local to atleast one process.
alltoallv_info
property
Return the offset information for Alltoallv communication.
This returns a tuple containing
- The send displacements for the Alltoallv submap gather
- The send counts for the Alltoallv submap gather
- The receive displacements for the Alltoallv submap gather
- The receive counts for the Alltoallv submap gather
- The locations in the receive buffer of each submap.
comm
property
(mpi4py.MPI.Comm): The MPI communicator used (or None)
global_submap_to_local
property
(array): The mapping from global submap to local.
local_submaps
property
(array): The list of local submaps or None if process has no data.
n_local_submap
property
(int): The number of submaps stored on this process.
n_pix
property
(int): The global number of pixels.
n_pix_submap
property
(int): The number of pixels in each submap.
n_submap
property
(int): The total number of submaps.
owned_submaps
property
The submaps owned by this process.
submap_owners
property
The owning process for every hit submap.
This information is used in several other operations, including serializing PixelData objects to a single process and also communication needed for reducing data globally.
clear()
Delete the underlying memory.
This will forcibly delete the C-allocated memory and invalidate all python references to this object. DO NOT CALL THIS unless you are sure all references are no longer being used and you are about to delete the object.
Source code in toast/pixels.py
113 114 115 116 117 118 119 120 121 122 123 124 |
|
global_pixel_to_local(gl)
Convert global pixel indices into local pixel indices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gl
|
array
|
The global pixel numbers. |
required |
Returns:
Type | Description |
---|---|
array
|
The local raw (flat packed) buffer index for each pixel. |
Source code in toast/pixels.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
global_pixel_to_submap(gl)
Convert global pixel indices into the local submap and pixel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gl
|
array
|
The global pixel numbers. |
required |
Returns:
Type | Description |
---|---|
tuple
|
A tuple of arrays containing the local submap index (int) and the pixel index local to that submap (int). |
Source code in toast/pixels.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
SpaceSite
Bases: Site
Site with no atmosphere.
This represents a location beyond the Earth's atmosphere. In practice, this should be sub-classed for real satellite experiments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Site name |
required |
uid
|
int
|
Unique identifier. If not specified, constructed from a hash of the site name. |
None
|
Source code in toast/instrument.py
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 |
|
Telescope
Bases: object
Class representing telescope properties for one observation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the telescope. |
required |
uid
|
int
|
The Unique ID of the telescope. If not specified, constructed from a hash of the site name. |
None
|
focalplane
|
Focalplane
|
The focalplane for this observation. |
None
|
site
|
Site
|
The site of the telescope for this observation. |
None
|
Source code in toast/instrument.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 |
|
Timer
Bases: pybind11_builtins.pybind11_object
Simple timer class.
This class is just a timer that you can start / stop / clear and report the results. It tracks the elapsed time and the number of times it was started.
__doc__ = '\n Simple timer class.\n\n This class is just a timer that you can start / stop / clear\n and report the results. It tracks the elapsed time and the number\n of times it was started.\n\n '
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__module__ = 'toast._libtoast'
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__getstate__()
method descriptor
getstate(self: toast._libtoast.Timer) -> tuple
__init__()
method descriptor
init(args, *kwargs) Overloaded function.
-
init(self: toast._libtoast.Timer) -> None
-
init(self: toast._libtoast.Timer, init_time: float, init_calls: int) -> None
Create the timer with some initial state. Used mainly when pickling / communicating the timer. The timer is created in the "stopped" state. Args: init_time (float): Initial elapsed seconds. init_calls (int): Inital number of calls.
__repr__()
method descriptor
repr(self: toast._libtoast.Timer) -> str
__setstate__()
method descriptor
setstate(self: toast._libtoast.Timer, arg0: tuple) -> None
calls()
method descriptor
calls(self: toast._libtoast.Timer) -> int
Return the number of calls.
Returns:
Type | Description |
---|---|
int
|
The number of calls (if timer is stopped) else 0. |
clear()
method descriptor
clear(self: toast._libtoast.Timer) -> None
Clear the timer.
elapsed_seconds()
method descriptor
elapsed_seconds(self: toast._libtoast.Timer) -> float
Return the elapsed seconds from a running timer without modifying the timer state.
Returns:
Type | Description |
---|---|
float
|
The elapsed seconds (if timer is running). |
is_running()
method descriptor
is_running(self: toast._libtoast.Timer) -> bool
Is the timer running?
Returns:
Type | Description |
---|---|
bool
|
True if the timer is running, else False. |
report()
method descriptor
report(self: toast._libtoast.Timer, message: str) -> None
Report results of the timer to STDOUT.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
A message to prepend to the timing results. |
required |
Returns:
Type | Description |
---|---|
None |
report_clear()
method descriptor
report_clear(self: toast._libtoast.Timer, message: str) -> None
Report results of the timer to STDOUT and clear the timer.
If the timer was running, it is stopped before reporting and clearing and then restarted. If the timer was stopped, then it is left in the stopped state after reporting and clearing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
A message to prepend to the timing results. |
required |
Returns:
Type | Description |
---|---|
None |
report_elapsed()
method descriptor
report_elapsed(self: toast._libtoast.Timer, message: str) -> None
Report results of a running timer to STDOUT without modifying the timer state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
str
|
A message to prepend to the timing results. |
required |
Returns:
Type | Description |
---|---|
None |
seconds()
method descriptor
seconds(self: toast._libtoast.Timer) -> float
Return the elapsed seconds.
Returns:
Type | Description |
---|---|
float
|
The elapsed seconds (if timer is stopped) else -1. |
start()
method descriptor
start(self: toast._libtoast.Timer) -> None
Start the timer.
stop()
method descriptor
stop(self: toast._libtoast.Timer) -> None
Stop the timer.
Weather
Bases: object
Base class representing the weather for one observation.
This class returns the nominal weather properties for an observation. Currently these are constant, under the assumption that the weather changes slowly during a good science observation.
This base class can be used directly to hold values specified at construction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
datetime
|
A python date/time in UTC. |
None
|
ice_water
|
Quantity
|
Precipitable ice water. |
None
|
liquid_water
|
Quantity
|
Precipitable liquid water. |
None
|
pwv
|
Quantity
|
Precipitable water vapor. |
None
|
humidity
|
Quantity
|
Specific humidity at 10m altitude. |
None
|
surface_pressure
|
Quantity
|
Surface pressure. |
None
|
surface_temperature
|
Quantity
|
Surface temperature. |
None
|
air_temperature
|
Quantity
|
Air temperature at 10m altitude. |
None
|
west_wind
|
Quantity
|
Eastward moving wind at 10m altitude. |
None
|
south_wind
|
Quantity
|
Northward moving wind at 10m altitude. |
None
|
Source code in toast/weather.py
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 |
|
air_temperature
property
10-meter air temperature [K].
humidity
property
10-meter specific humidity [kg/kg]
ice_water
property
Total precipitable ice water [kg/m^2] (also [mm]).
liquid_water
property
Total precipitable liquid water [kg/m^2] (also [mm]).
pwv
property
Total precipitable water vapor [kg/m^2] (also [mm]).
south_wind
property
10-meter northward wind [m/s].
surface_pressure
property
Surface pressure [Pa].
surface_temperature
property
Surface skin temperature [K].
time
property
The time for these weather properties.
west_wind
property
10-meter eastward wind [m/s].
create_from_config(conf)
Instantiate classes in a configuration.
This iteratively instantiates classes defined in the configuration, replacing object names with references to those objects. References to other objects in the config are specified with the string '@config:' followed by a UNIX-style "path" where each element of the path is a dictionary key in the config. For example:
@config:/operators/pointing
Would reference an object at conf["operators"]["pointing"]. Object references like this only work if the target of the reference is a built-in type (str, float, int, etc) or a class derived from TraitConfig.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conf
|
dict
|
the configuration |
required |
Returns:
Type | Description |
---|---|
SimpleNamespace
|
A namespace containing the sections and instantiated objects specified in the original config structure. |
Source code in toast/traits.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
|
fake_hexagon_focalplane(n_pix=7, width=5.0 * u.degree, sample_rate=1.0 * u.Hz, epsilon=0.0, fwhm=10.0 * u.arcmin, bandcenter=150 * u.GHz, bandwidth=20 * u.GHz, psd_net=0.1 * u.K * np.sqrt(1 * u.second), psd_fmin=0.0 * u.Hz, psd_alpha=1.0, psd_fknee=0.05 * u.Hz, fwhm_sigma=0.0 * u.arcmin, bandcenter_sigma=0 * u.GHz, bandwidth_sigma=0 * u.GHz, random_seed=123456)
Create a simple focalplane model for testing.
This function creates a basic focalplane with hexagon-packed pixels, each with two orthogonal detectors. It is intended for unit tests, benchmarking, etc where a Focalplane is needed but the details are less important. In addition to nominal detector properties, this function adds other simulation-specific parameters to the metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_pix
|
int
|
The number of pixels with hexagonal packing (e.g. 1, 7, 19, 37, 61, etc). |
7
|
width
|
Quantity
|
The angular width of the focalplane field of view on the sky. |
5.0 * degree
|
sample_rate
|
Quantity
|
The sample rate for all detectors. |
1.0 * Hz
|
epsilon
|
float
|
The cross-polar response for all detectors. |
0.0
|
fwhm
|
Quantity
|
The beam FWHM |
10.0 * arcmin
|
bandcenter
|
Quantity
|
The detector band center. |
150 * GHz
|
bandwidth
|
Quantity
|
The detector band width. |
20 * GHz
|
psd_net
|
Quantity
|
The Noise Equivalent Temperature of each detector. |
0.1 * K * sqrt(1 * second)
|
psd_fmin
|
Quantity
|
The frequency below which to roll off the 1/f spectrum. |
0.0 * Hz
|
psd_alpha
|
float
|
The spectral slope. |
1.0
|
psd_fknee
|
Quantity
|
The 1/f knee frequency. |
0.05 * Hz
|
fwhm_sigma
|
Quantity
|
Draw random detector FWHM values from a normal distribution with this width. |
0.0 * arcmin
|
bandcenter_sigma
|
Quantity
|
Draw random bandcenter values from a normal distribution with this width. |
0 * GHz
|
bandwidth_sigma
|
Quantity
|
Draw random bandwidth values from a normal distribution with this width. |
0 * GHz
|
random_seed
|
int
|
The seed to use for numpy random. |
123456
|
Returns:
Type | Description |
---|---|
Focalplane
|
The fake focalplane. |
Source code in toast/instrument_sim.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
|
get_world()
Retrieve the default world communicator and its properties.
If MPI is enabled, this returns MPI.COMM_WORLD and the process rank and number of processes. If MPI is disabled, this returns None for the communicator, zero for the rank, and one for the number of processes.
Returns:
Type | Description |
---|---|
tuple
|
The communicator, number of processes, and rank. |
Source code in toast/mpi.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
job_group_size(world_comm, job_args, schedule=None, obs_times=None, focalplane=None, num_dets=None, sample_rate=None, det_copies=2, full_pointing=False)
Given parameters about the job, estimate the best group size.
Using the provided information, this function determines the distribution of MPI processes across nodes and selects the group size to be a whole number of nodes with the following criteria:
- The nodes per group divides evenly into the total number of nodes.
- The nodes in one group have enough total memory to fit the largest
observation.
- If possible, the observations are load balanced (in terms of memory) across
the groups.
Args:
Returns:
Type | Description |
---|---|
int
|
The best number of processes in a group. |
Source code in toast/job.py
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 |
|
load_config(file, input=None, comm=None)
Load a config file in a supported format.
This loads the document into a config dictionary. If input is specified, the file contents are merged into this dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str
|
The file to load. |
required |
input
|
dict
|
Append to this dictionary. |
None
|
Returns:
Type | Description |
---|---|
dict
|
The result. |
Source code in toast/config/cli.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 |
|
parse_config(parser, operators=list(), templates=list(), prefix='', opts=None)
Load command line arguments associated with object properties.
This function:
* Adds a "--config" option to the parser which accepts multiple config file
paths to load.
* Adds "--default_toml" and "--default_json" options to dump the default config
options to files.
* Adds a option "--job_group_size" to provide the commonly used option for
setting the group size of the TOAST communicator.
* Adds arguments for all object parameters in the defaults for the specified
classes.
* Builds a config dictionary starting from the defaults, updating these using
values from any config files, and then applies any overrides from the
commandline.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parser
|
ArgumentParser
|
The argparse parser. |
required |
operators
|
list
|
The operator instances to configure from files or commandline. These instances should have their "name" attribute set to something meaningful, since that name is used to construct the commandline options. An enable / disable option is created for each, which toggles the TraitConfig base class "disabled" trait. |
list()
|
templates
|
list
|
The template instances to add to the commandline. These instances should have their "name" attribute set to something meaningful, since that name is used to construct the commandline options. An enable / disable option is created for each, which toggles the TraitConfig base class "disabled" trait. |
list()
|
prefix
|
str
|
Optional string to prefix all options by. |
''
|
opts
|
list
|
If not None, parse arguments from this list instead of sys.argv. |
None
|
Returns:
Type | Description |
---|---|
tuple
|
The (config dictionary, args). The args namespace contains all the remaining parameters after extracting the operator and template options. |
Source code in toast/config/cli.py
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 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
Accelerator Use
TOAST supports the use of JAX for offloading some operations. To enable this...