Observatory#
- class cabaret.Observatory(name: str = 'Observatory', camera: Camera | dict = Camera(name='gaia-camera-simulated', width=1024, height=1024, bin_x=1, bin_y=1, pitch=13.5, plate_scale=None, max_adu=65535, well_depth=65535, bias=300, gain=1.0, read_noise=6.2, dark_current=0.2, average_quantum_efficiency=0.8, rotation=0.0, pixel_defects={}), focuser: Focuser | dict = Focuser(position=10000, best_position=10000, scale=100, max_seeing_multiplier=5.0), telescope: Telescope | dict = Telescope(focal_length=8.0, diameter=1.0, collecting_area=0.7853981633974483), site: Site | dict = Site(sky_background=150, seeing=1.3, latitude=None, longitude=None, elevation=None, sun_altitude=None))[source]#
Observatory configuration.
Examples
>>> from datetime import datetime, UTC >>> dateobs = datetime.now(UTC) >>> from cabaret.observatory import Observatory >>> observatory = Observatory()
Query Gaia for sources and generate an image:
>>> image = observatory.generate_image( ... ra=12.3323, dec=30.4343, exp_time=10, dateobs=dateobs, seed=0 ... )
Or using a set of predefined sources:
>>> from cabaret.sources import Sources >>> sources = Sources.from_arrays( ... ra=[10.64, 10.68], dec=[10.68, 41.22], fluxes=[169435.6, 52203.9] ... ) >>> img = observatory.generate_image( ... ra=sources.ra.deg.mean(), ... dec=sources.dec.deg.mean(), ... exp_time=10, ... seed=0, ... sources=sources, ... )
If you have matplotlib installed, you can visualize the image using cabaret’s plot utility:
>>> import matplotlib.pyplot as plt >>> from cabaret.plot import plot_image >>> _ = plot_image(image, title="Simulated Image") >>> plt.show()
Methods
__init__([name, camera, focuser, telescope, ...])copy()Create a deep copy of the Observatory instance.
from_dict(config)Create an Observatory instance from a configuration dictionary.
generate_fits_image(ra, dec, exp_time, ...)Generate a simulated FITS image of the sky.
generate_image(ra, dec, exp_time, dateobs, ...)Generate a simulated image of the sky.
generate_image_stack(ra, dec, exp_time, ...)Generate a stack of images from different stages in the image simulation pipeline.
load_from_yaml(file_path)Load Observatory configuration from a YAML file.
save_to_yaml(file_path)Save Observatory configuration to a YAML file.
to_dict()Convert the Observatory configuration to a dictionary.
Attributes
nameObservatory name.
cameraCamera configuration.
focuserFocuser configuration.
telescopeTelescope configuration.
siteSite configuration.