Construction of templates
Stellar templates
Handles the creation of the stellar models.
StellarModel
Bases: TemplateFramework
The StellarModel is responsible for the creation of the stellar template for each sub-Instrument.
It allows the user to apply spectral_conditions to select the observations that will be in use for this process.
This object supports the following user parameters:
Note: Also check the User parameters of the parent classes for further customization options of SBART Note: All disk- and user-facing interactions are handled by the parent class
Source code in src/ASTRA/template_creation/StellarModel.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 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 | |
model_type = 'Stellar'
class-attribute
instance-attribute
template_map: dict[STELLAR_CREATION_MODE, StellarTemplate] = {STELLAR_CREATION_MODE.Sum: SumStellar, STELLAR_CREATION_MODE.OBSERVATION: OBS_Stellar, STELLAR_CREATION_MODE.Median: MedianStellar, STELLAR_CREATION_MODE.PHOENIX: PHOENIX}
class-attribute
iteration_number = 0
instance-attribute
RV_source = None
instance-attribute
RV_keyword: str
property
RV keyword to use when aligning observations.
Generate_Model(dataClass: DataClass | None, template_configs: Optional[UI_DICT] = None, conditions: Optional[ConditionModel] = None, force_computation: bool = False, store_templates: bool = True, previous_sbart_rv=None) -> None
Apply the spectral conditions to decide which observations to use.
Then, returns to the model generation as defined in the parent implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataClass
|
[type]
|
DataClass with the observations |
required |
template_configs
|
dict
|
Dictionary with the parameters needed to control the creation of the template. Each one has its own set of requirements |
None
|
conditions
|
Optional[ConditionModel]
|
Either None (to not select the OBS that will be used) or :py:mod: |
None
|
force_computation
|
bool
|
If True, recompute the stellar templates, even if they exist on disk. By default False |
False
|
store_templates
|
bool
|
If True [default], store the templates to disk |
True
|
previous_sbart_rv
|
Object that s-BART loaded from disk, containing the RVs from a previous iteration |
None
|
Notes
- The conditions that are passed to the StellarModel are only used for the creation of the stellar template. This will not reject observations from the RV extraction
Source code in src/ASTRA/template_creation/StellarModel.py
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 | |
initialize_modelling_interfaces(new_properties)
get_interpol_modes() -> set[str]
get_orders_to_skip(subInst: str) -> set[int]
Compute orders to skip on a given subInstrument.
GIven by the orders that the stellar template rejected.
Args: subInst (str): sub-Instrument name
Raises: BadTemplateError: No valid template for the subInstrument
Returns: Set[int]: Set of bad orders.
Source code in src/ASTRA/template_creation/StellarModel.py
load_templates_from_disk() -> None
Load stellar templates from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
[description] |
required |
Different models for the stellar template.
OBS_stellar
OBS_Stellar
Bases: StellarTemplate
Stellar template from the observation with the highest SNR (computed as a sum over all spectral orders).
Source code in src/ASTRA/template_creation/stellar_templates/OBS_stellar.py
method_name = 'OBSERVATION'
class-attribute
instance-attribute
PHOENIX_STELLAR
PHOENIX
Bases: StellarTemplate
Stellar template from a PHOENIX template.
Source code in src/ASTRA/template_creation/stellar_templates/PHOENIX_STELLAR.py
method_name = 'PHOENIX'
class-attribute
instance-attribute
store_metrics()
Source code in src/ASTRA/template_creation/stellar_templates/PHOENIX_STELLAR.py
Stellar_Template
Base class for stellar template.
StellarTemplate
Bases: BaseTemplate, Spectral_Modelling
Parent class of all StellarTemplates.
Implementing a common set of user configurations, data storage operations, among others.
User parameters:
========================= ================ ================ ================================= ================ Parameter name Mandatory Default Value Valid Values Comment ========================= ================ ================ ================================= ================ NUMBER_WORKERS False 1 Integer >= 0 [2] MEMORY_SAVE_MODE False False boolean [3] MINIMUM_NUMBER_OBS False 3 Integer >= 0 [4] ========================= ================ ================ ================================= ================
[1] - How to propagate the spectral uncertainties [2] - Number of jobs at once [3] - Save RAM by clearing the frame's S2D arrays from memory after using them [4] - Minimum number of valid observations needed to proceed with template creation
.. note::
This class also uses the User parameters defined by the :class:~ASTRAComponents.Modelling.Spectral_Modelling
class
.. note:: Also check the User parameters of the parent classes for further customization options of SBART
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
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 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 | |
template_type = 'Stellar'
class-attribute
instance-attribute
method_name = 'Base'
class-attribute
instance-attribute
rejection_array = None
instance-attribute
frameIDs_to_use: list[int] = []
instance-attribute
shm = {}
instance-attribute
package_pool = None
instance-attribute
output_pool = None
instance-attribute
target_name = None
instance-attribute
used_fpaths = []
instance-attribute
sourceRVs: Optional[List] = None
instance-attribute
header_information = {}
instance-attribute
wave_air = None
instance-attribute
storage_name: str
property
Return the storage name for the stellar templates.
Will include the name of the method, the RV source for the aligmenet
iteration_number: int
property
Get current iteration number.
RV_keyword: str
property
RV keyword to use when aligning observations.
create_stellar_template(dataClass, conditions, reference_frame: None | Frame = None) -> None
Trigger the start of the creatoin of the stellar template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataClass
|
:class:`~ASTRAdata_objects.DataClass.DataClass`
|
Data |
required |
conditions
|
Apply conditions over the frames that will be used to create the stellar template |
required | |
reference_frame
|
None | Frame
|
|
None
|
Raises:
| Type | Description |
|---|---|
StopComputationError
|
If the computations is triggered by some event |
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
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 | |
post_process_template(dataClass: DataClass) -> None
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
add_new_frame_to_template(frame: Frame)
Allow to inject a new observation into a pre-existing model.
This base function checks for a match on the different flux corrections and ensures that the loaded Flag is set to False, so that it is possible to update the disk products afterwards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Frame
|
A new frame to inject into the stellar template |
required |
Raises:
| Type | Description |
|---|---|
custom_exceptions.InvalidConfiguration:
|
If the flux corrections of the Frame do not match those from the stellar template |
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
evaluate_bad_orders() -> None
Compute orders with too many points masked.
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
check_if_used_frameID(frameID: int) -> bool
Return true if the frameID was used for the construction of the template.
trigger_data_storage(clobber: bool) -> None
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
get_miscInfo_of_template() -> Dict[str, Any]
Get miscellaneous information from the stellar template, to be stored in output directory.
Returns: Dict[str, Any]: Dictonary with key, value information (in json-compatible format) to be stored
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
store_template(clobber: bool) -> None
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
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 | |
store_metrics() -> None
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
remove_telluric_features(Telluric_Template: TelluricModel) -> None
Remove telluric features from the stellar template.
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
load_from_file(root_path, loading_path: str) -> None
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
convert_to_shared_mem(custom_size: Optional[Iterable[float]] = None) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
Convert stellar template into shared memory arrays (used for construction of the model).
cleanup_shared_memory() -> None
update_RV_source_info(iteration_number: int, RV_source: str, merged_source: bool)
Update information from the RV source.
Args: iteration_number (int): Current iteration number RV_source (str): Name of the source merged_source (bool): merged RVs or not.
Source code in src/ASTRA/template_creation/stellar_templates/Stellar_Template.py
median_stellar
MedianStellar
Bases: StellarTemplate
Stellar template constructed as a median.
User parameters:
This object doesn't introduce unique user parameters.
Note: Check the User parameters of the parent classes for further customization options of this class
Source code in src/ASTRA/template_creation/stellar_templates/median_stellar.py
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 | |
method_name = 'Median'
class-attribute
instance-attribute
launch_parallel(dataClass)
Source code in src/ASTRA/template_creation/stellar_templates/median_stellar.py
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 | |
perform_calculations(in_queue, out_queue, buffer_info, **kwargs)
Compute the stellar template from the input S2D data. Accesses the data from shared memory arrays!
Source code in src/ASTRA/template_creation/stellar_templates/median_stellar.py
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 | |
sum_stellar
SumStellar
Bases: StellarTemplate
Typical stellar template, constructed by shifting all observations to a common rest frame.
(i.e. by removing their stellar RVs) and computing a mean of all observations. Uncertainties can be propagated either through an analytical formula or by interpolating the original uncertainties of each observation.
Note: Check the User parameters of the parent classes for further customization options of this class
Source code in src/ASTRA/template_creation/stellar_templates/sum_stellar.py
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 | |
method_name = choices.STELLAR_CREATION_MODE.Sum.value
class-attribute
instance-attribute
launch_parallel(dataClass: DataClass, reference_frame: None | Frame)
Launch parallel computation of the stellar template.
Raises: BadTemplateError: The worker dies and computation is halted.
Source code in src/ASTRA/template_creation/stellar_templates/sum_stellar.py
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 | |
add_new_frame_to_template(frame: Frame)
Add an individual frame to template.
Source code in src/ASTRA/template_creation/stellar_templates/sum_stellar.py
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 | |
perform_calculations(in_queue, out_queue, buffer_info, **kwargs)
Compute the stellar template from the input S2D data.
Accesses the data from shared memory arrays!
Source code in src/ASTRA/template_creation/stellar_templates/sum_stellar.py
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 | |
Telluric templates
Handle Telluric models.
TelluricModel
Bases: TemplateFramework
The TelluricModel is responsible for the creation of the telluric template for each sub-Instrument.
This object supports the following user parameters:
User parameters:
================================ ================ ================ Parameter name Mandatory Default Value ================================ ================ ================ CREATION_MODE True ---- APPLICATION_MODE False removal EXTENSION_MODE False lines ================================ ================ ================
Note: Also check the User parameters of the parent classes for further customization options of SBART
Source code in src/ASTRA/template_creation/TelluricModel.py
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 | |
model_type = 'Telluric'
class-attribute
instance-attribute
template_map: dict[TELLURIC_CREATION_MODE, TelluricTemplate] = {TELLURIC_CREATION_MODE.telfit: TelfitTelluric, TELLURIC_CREATION_MODE.OHemission: OHemissionTelluric}
class-attribute
is_for_removal: bool
property
True if the template will be used to remove telluric features.
is_for_correction: bool
property
True if the template will be used to correct telluric features.
load_templates_from_disk() -> None
request_template(subInstrument: str) -> Type[BaseTemplate]
Return the template for a given sub-Instrument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subInstrument
|
str
|
"name" of the subInstrument |
required |
Returns:
| Type | Description |
|---|---|
Requested telluric Template
|
|
Source code in src/ASTRA/template_creation/TelluricModel.py
Generate_Model(dataClass: DataClass, telluric_configs: dict, force_computation: bool = False, store_templates: bool = True) -> None
Generate a telluric model for all subInstruments with data, as defined in the parent implementation.
Afterwards, allow to combine the telluric model of all sub-Instruments into a single telluric binary model which will then be used for all available observations.
[Warning: the combination is yet to be implemented]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataClass
|
:class:`~ASTRAdata_objects.DataClass`
|
DataClass with the observations |
required |
telluric_configs
|
dict
|
Dictionary with the parameters needed to control the creation of the telluric template, following the specifications of the templates. |
required |
force_computation
|
bool
|
If False, it will attempt to lead the telluric template from disk before trying to compute them. If True, always compute telluric template, even if it exists |
False
|
store_templates
|
bool
|
If True (default) store to disk |
True
|
Source code in src/ASTRA/template_creation/TelluricModel.py
merge_templates() -> None
Merge the telluric template of all sub-Instruments to create a master telluric binary template.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
The method is yet to be implemented |
Source code in src/ASTRA/template_creation/TelluricModel.py
Different models for the creation of telluric masks from synthetic spectra of Earth's transmittance profile.
Telluric_Template
TelluricTemplate
Bases: BaseTemplate
BaseClass of a telluric template, with all the necessary functionalities.
Inherits from the BaseTemplate, similarly to the stellar templates. The telluric template does not have the same shape as the S2D spectra. As we only need the wavelength regions in which it has detected a feature, we can preserve the original shape of the transmittance spectra.
User parameters:
================================ ================ ================ ================ ================ Parameter name Mandatory Default Value Valid Values Comment ================================ ================ ================ ================ ================ continuum_percentage_drop False 1 Inside [0, 100] [1] force_download False False boolean [2] ================================ ================ ================ ================ ================
- [1]: Minimum drop (in relation to continuum level) needed to flag a point as a telluric feature
- [2]: Force the download of all necessary data products, even if not necessary
Note: Also check the User parameters of the parent classes for further customization options of SBART
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
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 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 | |
template_type = 'Telluric'
class-attribute
instance-attribute
method_name = 'Base'
class-attribute
instance-attribute
transmittance_wavelengths = None
instance-attribute
transmittance_spectra = None
instance-attribute
BERVS: list[float] = []
instance-attribute
MAXBERV = None
instance-attribute
template: np.ndarray = None
instance-attribute
use_approximated_BERV_correction = False
instance-attribute
spectra
property
writable
contaminated_regions: list
property
List of contaminated regions.
storage_name: str
property
for_feature_removal: bool
property
for_feature_correction: bool
property
get_data_from_spectral_order(order: int, include_invalid: bool = False)
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
get_data_from_full_spectrum()
load_information_from_DataClass(dataClass: DataClass) -> None
Load the necessary information from the dataClass to generate the models.
Loads: - BERV information (for the telluric removal) - Generates the model information (i.e. populates priors and bounds of self._fitModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataClass
|
DataClass
|
|
required |
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
create_telluric_template(dataClass, custom_frameID: Optional[int] = None) -> None
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
update_extension_mode(new_mode: TELLURIC_EXTENSION) -> None
Update the telluric extension mode.
Args: new_mode (TELLURIC_EXTENSION): New mode.
Raises: custom_exceptions.InvalidConfiguration: Mode is not recognized
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
ingest_new_rolling_observations(dataClass)
Ingest new observations into a rolling mode template.
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
create_binary_template(continuum_level) -> None
Transform transmittance spectra to binary template, based on percentage deviations from the continuum level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
continuum_level
|
ndarray()
|
Continuum level that is estimated by the children classes |
required |
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
build_blocks() -> None
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
store_metrics()
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
trigger_data_storage(*args, **kwargs) -> NoReturn
store_template(clobber: bool)
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
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 | |
load_from_file(root_path: Path, loading_path: str) -> None
TODO: save and load the actual flag to disk!
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_path
|
Path
|
|
required |
loading_path
|
str
|
|
required |
Source code in src/ASTRA/template_creation/telluric_templates/Telluric_Template.py
telluric_from_OHemission
RESOURCES_PATH = Path(__file__).parent.parent.parent / 'resources'
module-attribute
OHemissionTelluric
Bases: TelluricTemplate
Telluric mask for OH emission lines.
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_OHemission.py
method_name = choices.TELLURIC_CREATION_MODE.OHemission.value
class-attribute
instance-attribute
create_telluric_template(dataClass: DataClass, custom_frameID: Optional[int] = None) -> None
Create model for OH emission.
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_OHemission.py
telluric_from_telfit
RESOURCES_PATH = Path(__file__).parent.parent.parent / 'resources'
module-attribute
atmospheric_profiles_coords_dict = {'HARPS': '-70.7-29.3', 'NIRPS': '-70.7-29.3', 'ESPRESSO': '-70.4-24.6', 'POET': '-70.4-24.6', 'HARPSN': '-17.9+28.8', 'CARMENES': '-2.5+37.2', 'CALIB_CARMENES': '-2.5+37.2', 'MAROONX': '-155.5+19.8'}
module-attribute
TelfitTelluric
Bases: TelluricTemplate
Create Earth's transmittance spectra from TelFit.
It will be configured with the night with the highest relative humidity.
Atmosphere profiles are downloaded to ensure that we get the best model possible
User parameters: ================================ ================ ================ ================ ================ Parameter name Mandatory Default Value Valid Values Comment ================================ ================ ================ ================ ================ TELFIT_HUMIDITY_THRESHOLD False None Numerical [1] ================================ ================ ================ ================ ================
.. note:: [1] - Value used to enforce a maximum value for the humidity. If this is set any negative value, use the maximum humidity from the loaded observations
.. note:: Also check the User parameters of the parent classes for further customization options of SBART
.. warning:: Telfit is not installed by default with SBART!
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_telfit.py
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 | |
method_name = choices.TELLURIC_CREATION_MODE.telfit.value
class-attribute
instance-attribute
modeler = None
instance-attribute
configure_modeler(dataclass) -> None
See https://www.eso.org/sci/software/pipelines/skytools/molecfit#gdas
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_telfit.py
create_telluric_template(dataClass: DataClass, custom_frameID: Optional[int] = None) -> None
Create a telluric template from a TelFit transmission spectra [1].
The model is created for the date in which the reference observation was made.
It estimates the continuum level and classifies each point that shows a decrease of 1% as a telluric line. Furthermore, it creates a window of 6 points to each side of a detection, to attempt to pick up the wings of the telluric line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataClass
|
DataClass
|
DataClass object |
required |
custom_frameID
|
Optional[int]
|
If Not None, does not search for the "optimal" frameID to use as a basis |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Telluric (binary) spectrum, for the wavelengths present in the input array |
Notes
[1] https://github.com/kgullikson88/Telluric-Fitter
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_telfit.py
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 | |
store_metrics()
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_telfit.py
fun(params, modeler, loc, OBS_properties, freqs, control_dict, grid) -> None
Source code in src/ASTRA/template_creation/telluric_templates/telluric_from_telfit.py
construct_gdas_filename(instrument, datetime)
Construct the filename as in GDAS archive
Args: instrument (str): Instrument name datetime (str): Date and time, as in the header of fits files
Raises: custom_exceptions.InvalidConfiguration: description
Returns: type: description