QuantumEfficiencyMapPixelDefect#
- class cabaret.camera.QuantumEfficiencyMapPixelDefect(name: str = 'defect', rate: float = 0.0, seed: int = 0, apply_before_base: bool = True, _rng: Generator | None = None, _pixels: ndarray | None = None, quantum_efficiency_std: float = 0.1, quantum_efficiency_map: ndarray | None = None)[source]#
A pixel defect that simulates variations in quantum efficiency across the sensor.
Examples
>>> from cabaret import Observatory, Sources >>> pixel_defects = { ... "qe": {"type": "quantum_efficiency_map", "quantum_efficiency_std": 0.5} ... } >>> observatory = Observatory(camera={"pixel_defects": pixel_defects}) >>> sources = Sources.get_test_sources() >>> ra, dec = sources.center >>> _, clean_image, image = observatory.generate_image_stack( ... exp_time=3, ra=ra, dec=dec, sources=sources, convert_all_to_adu=True ... )
To plot the images, you can use the plot_image function from cabaret.plot:
>>> from cabaret.plot import plot_image >>> import matplotlib.pyplot as plt >>> fig, axes = plt.subplots(1, 3, figsize=(10, 5), sharex=True, sharey=True) >>> _ = plot_image(clean_image, ax=axes[0], title="Image without defects") >>> _ = plot_image(image, ax=axes[1], title="Image with QE defects") >>> _ = plot_image( ... observatory.camera.pixel_defects["qe"].quantum_efficiency_map, ... ax=axes[2], title="Quantum Efficiency Map" ... ) >>> plt.subplots_adjust(wspace=0.3, hspace=0.3) >>> plt.show()
Methods
__init__([name, rate, seed, ...])generate_quantum_efficiency_map(camera)introduce_pixel_defect(image, camera[, seed])Introduce the defect into the image.
number_of_defect_pixels(camera)Calculate the number of pixels affected by the defect.
set_pixels(pixels, camera)Set the pixels for the defect.
Attributes
apply_before_baseQuantum efficiency variations are a function of the light signal
nameName of the defect.
pixelsPixel coordinates affected by the defect.
quantum_efficiency_mapQuantum efficiency map (2D array).
quantum_efficiency_stdStandard deviation of the quantum efficiency variations.
rateFraction of pixels affected by the defect.
rngRandom number generator instance.
seedRandom seed for reproducibility.