Skip to main content

No project description provided

Project description

cabaret

cabaret is a Python package to simulate astronomical images using the GAIA catalog of stars.

Installation

You can install cabaret in a Python (>=3.11) environment with

pip install cabaret

or from a local clone

git clone https://github.com/ppp-one/cabaret
pip install -e cabaret

You can test the package has been properly installed with

python -c "import cabaret"

Example

Basic image

To generate an image from RA/DEC coordinates, run:

import cabaret

image = cabaret.generate_image(
    ra=12.33230,  # right ascension in degrees
    dec=30.4343,  # declination in degrees
    exp_time=10,  # exposure time in seconds
)

To display the image (matplotlib required here):

import matplotlib.pyplot as plt
import numpy as np

med = np.median(science)
std = np.std(science)

fig, ax = plt.subplots()
img = ax.imshow(science, cmap="gray", vmin=med - 1 * std, vmax=med + 1 * std)
cbar = plt.colorbar(img, ax=ax)
colorbar.set_label("Intensity (ADU)")
plt.show()

Configuring an Observatory

You can customize the physical characteristics of the observatory by defining and passing Camera, Telescope, and Site objects.

import datetime
import cabaret

# Define the observatory with specific characteristics
observatory = cabaret.Observatory(
    name="MyObservatory",
    camera=cabaret.Camera(
        name="MyCamera",
        height=1024,  # Height of the camera in pixels
        width=1024,  # Width of the camera in pixels
        read_noise=10,  # Read noise in electrons
        gain=1,  # Gain in e-/ADU
        pixel_defects=dict(
            cold_pixels=dict(rate=0.005, value=300, seed=42)  # defaults to ConstantPixelDefect
        ),
    ),
    focuser=cabaret.Focuser(best_position=10_000, scale=100, max_seeing_multiplier=5.0),
    site=cabaret.Site(sky_background=21.0, seeing=1.5),
    telescope=cabaret.Telescope(diameter=1.0, focal_length=8.0),
)

# Generate an image with the configured observatory
image = observatory.generate_image(
    ra=12.33230,  # right ascension in degrees
    dec=30.4343,  # declination in degrees
    exp_time=10,  # exposure time in seconds
    dateobs=datetime.datetime.now(datetime.UTC),  # time of observation
)

You can easily save your observatory configuration to a YAML file:

observatory.save_to_yaml("path/to/config_file.yaml")

To load a previously saved configuration, you can use:

observatory.load_from_yaml("path/to/config_file.yaml")

Additionally, you can generate images from a list of Sources

sources = cabaret.Sources.from_arrays(
    ra=[10.64, 10.68], dec=[10.68, 41.22], fluxes=[169435.6, 52203.9]
)
image = observatory.generate_image(
    ra=sources.ra.deg.mean(),
    dec=sources.dec.deg.mean(),
    exp_time=10,
    seed=0,
    sources=sources,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cabaret-0.3.1.tar.gz (480.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cabaret-0.3.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file cabaret-0.3.1.tar.gz.

File metadata

  • Download URL: cabaret-0.3.1.tar.gz
  • Upload date:
  • Size: 480.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cabaret-0.3.1.tar.gz
Algorithm Hash digest
SHA256 67e00a698ce05adc28776ad3e46c34e4256568e5a0403bf3a231d8607e8afc9e
MD5 41ef4d493c6ab61c23eaa5d72a0e16ab
BLAKE2b-256 e1f577811a9243c559aa7fe4f706289f1c8be495d104c7896823eb2c18569d4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cabaret-0.3.1.tar.gz:

Publisher: publish.yml on ppp-one/cabaret

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cabaret-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: cabaret-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cabaret-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfd83f6f1f673213f0250a40f2a7bf537db99dfdb1932dc2f3dbc98989164d94
MD5 b21df8a01a04f9ecff36eda2fb7c323f
BLAKE2b-256 3f75a8ca4a0c1b06dd401f328e79279a899e63e4095baff8cdef78fef4ab2cde

See more details on using hashes here.

Provenance

The following attestation bundles were made for cabaret-0.3.1-py3-none-any.whl:

Publisher: publish.yml on ppp-one/cabaret

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page