Artificial Image Simulator
Artificial_Image_Simulator
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 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 | |
__init__(ccd_operation_mode, channel_id, ccd_temperature)
Initialize the class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ccd_operation_mode |
dict[str, int | float | str]
|
A python dictionary of the CCD operation mode. The allowed keywords are: em_mode, em_gain, preamp readout, binn, t_exp, and image_size. |
required |
channel_id |
[1, 2, 3, 4]
|
Channel id. |
required |
ccd_temperature |
float | int
|
CCD temperature. |
required |
Example
ccd_operation_mode = {
'em_mode': 'Conv',
'em_gain': 1,
'preamp': 1,
'readout': 1,
'binn': 1,
't_exp': 1,
'image_size': 100
}
ais = Artificial_Image_Simulator(ccd_operation_mode,
channel_id=1, ccd_temperature=-70)
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
apply_Serkowski_curve(pol_BVRI, PA=0)
Apply the Serkowski curve to the SED of the star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pol_BVRI |
dict
|
A python dictionary containing the polarization values of the filters BVRI in percentage. |
required |
PA |
float
|
Polarization angle in degrees. |
0
|
Example
pol_BVRI = {'B':8, 'V': 8.5, 'R': 7.2, 'I':6}
AIS.apply_Serkowski_curve(pol.BVRI)
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
apply_atmosphere_spectral_response(air_mass=1.0, sky_condition='photometric')
Apply the atmosphere spectral response.
This functions applies the atmosphere spectral response on the Spectral Energy Distribution of the source and the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
air_mass |
int | float
|
The air mass in the light path. |
1.0
|
sky_condition |
str
|
The sky condition. According to the value provided for this variable, a different extinction coeficient for the atmosphere will be selected. |
'photometric'
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
apply_circular_polarization(percent_pol=100, orientation='left')
Apply ciruclar polarization in SED.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
percent_pol |
float
|
Percentage of polarization. |
100
|
orientation |
str
|
Orientation of the polarization. |
'left'
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
apply_linear_polarization(percent_pol=100, pol_angle=0)
Apply a linear polarization to the SED of the object and the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
percent_pol |
float
|
Percentage of polarization. |
100
|
pol_angle |
float
|
Polarization angle in degrees. If the selected polarization mode were linear, the polarization angle must be provided. |
0
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
apply_polarization(stokes=[])
Apply a generic polarization to the SED.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stokes |
list
|
A list with the q, u, and v Stokes parameters. |
[]
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
251 252 253 254 255 256 257 258 259 | |
apply_sparc4_spectral_response(acquisition_mode, calibration_wheel='', retarder_waveplate='half', retarder_waveplate_angle=0)
Apply the SPARC4 spectral response.
This functions applies the SPARC4 spectral response to the Spectral Energy Distribution of the source and the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
acquisition_mode |
str
|
The acquisition mode of the sparc4. |
required |
calibration_wheel |
str
|
The optical component of the calibration wheel. This parameter provides to the user the options of using the real or the ideal versions of the optical components of the calibration wheel. Based on the provided value, AIS will apply the correspondent Stoke matrix. It should be highlighted that the transmission of the optical component still be applied. |
''
|
retarder_waveplate |
str
|
The waveplate for polarimetric measurements. This parameter is used only if the acquisition_mode is 'polarimetry'. |
'half'
|
retarder_waveplate_angle |
int | float
|
The angle of the retarder waveplate in degrees. If the acquisition mode of SPARC4 is polarimetry, the retarder waveplate angle should be provided. |
0
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
apply_telescope_spectral_response(date='20230329')
Apply the telescope spectral response.
This functions applies the telescope spectral response to the Spectral Energy Distribution of the source and the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date |
Date of the transmission curve of the telescope. |
'20230329'
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
calculate_exposure_time(snr=100, seeing=1.5)
Calculate the exposure time required for a given Signal-to-Noise Ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snr |
float
|
Signal-to-noise ratio. Defaults to 100. |
100
|
seeing |
float
|
Seeing of the object. Defaults to 1.5. |
1.5
|
Returns:
| Type | Description |
|---|---|
float
|
The minimum exposure time required to meet the provided SNR. |
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_artificial_image(image_path, star_coordinates, seeing=1, seed=1)
Create an artificial image.
This function creates a FITS file of an artificial image, similator to those acquired using the SPARC4 scientific cameras.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
star_coordinates |
tuple
|
The coordinates in pixels of the star in the image. |
required |
seeing |
float
|
The seeing of the star. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_background_image(image_path, images=1, seed=1)
Create a background image.
This function creates an image of the sky background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
images |
int
|
The number of images to be created. The default is 1. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_bias_image(image_path, images=1, seed=1)
Create a bias image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
images |
int
|
The number of bias images to be created. The default is 1. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_dark_image(image_path, images=1, seed=1)
Create a dark image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
images |
int
|
The number of dark images to be created. The default is 1. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_flat_image(image_path, images=1, seed=1)
Create a flat image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
images |
int
|
The number of flat images to be created. The default is 1. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_random_image(image_path, number_stars=10, seeing=1, seed=1)
Create a random star image.
This function creates an artificial image with a set of random stars. The number of star created by the function can be provided to the class. Otherwise, the number 10 will be used. Then, all the star images will be sumed with the background image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path |
str
|
The path where the FITS file will be saved. |
required |
number_stars |
The number of stars in the image. |
10
|
|
seeing |
float
|
The seeing of the star. |
1
|
seed |
float
|
The seed used to create the image. Default to 1. |
1
|
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_sky_sed(moon_phase)
Create the Spectral Energy Distribution of the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moon_phase |
[new, 'first quarter', 'third quarter', full]
|
The phase of the moon. |
required |
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
307 308 309 310 311 312 313 314 315 | |
create_source_sed_blackbody(magnitude, wavelength_interval=(), temperature=0)
Calculate the star SED based on the balckbody distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnitude |
int | float
|
The magnitude of the astronomical object in the V band. The magnitude is used to calculate the effective flux of the astronomical object. |
required |
wavelength_interval |
tuple
|
The wavelength interval, in nm, of the astronomical object. This parameter must be a tuple with three elements, where the first element is the initial wavelength, the second element is the final wavelength and the third element is the number of elements in the array. |
()
|
temperature |
int | float
|
The blackbody temperature of the astronomical object in Kelvin. |
0
|
Returns:
| Type | Description |
|---|---|
ndarray:
|
ndarray: The SED of the astronomical object in photons/m/s. |
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
create_source_sed_spectral_library(magnitude, wavelength_interval=(), spectral_type='')
Calculate the star SED based on a library of spectral standard stars.
The spectral response and the wavelength of the object are obtained using a library of spectral types. These spectrums are taken from the Library of Stellar Spectrum of ESO, and they can be found at: https://www.eso.org/sci/facilities/paranal/decommissioned/isaac/tools/lib.html. The level of the spectral response is adjusted using the magnitude of the object in the V band.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnitude |
int | float
|
The magnitude of the astronomical object in the V band. The magnitude is used to calculate the effective flux of the astronomical object. |
required |
wavelength_interval |
tuple
|
The wavelength interval, in nm, of the astronomical object. This parameter must be a tuple with three elements, where the first element is the initial wavelength, the second element is the final wavelength and the third element is the number of elements in the array. |
()
|
spectral_type |
str
|
The spectral type of the star that will be used to calculate the SED.
This parameter is used only if the calculation_method is 'spectral_standard'.
The available spectral types can be found using
the |
''
|
Returns:
| Type | Description |
|---|---|
ndarray:
|
ndarray: The SED of the astronomical object in photons/m/s. |
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
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 | |
print_available_spectral_types()
Print the available spectral types.
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
302 303 304 305 | |
write_source_sed(wavelength, sed)
Write a customized source SED into the class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength |
ndarray
|
The wavelength interval of the source in nm. |
required |
sed |
ndarray
|
Spectral Energy Distribution of the source in W/(m2.m). |
required |
Source code in AIS/Artificial_Image_Simulator/artificial_image_simulator.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |