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.0.tar.gz (480.1 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.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cabaret-0.3.0.tar.gz
  • Upload date:
  • Size: 480.1 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.0.tar.gz
Algorithm Hash digest
SHA256 703069b2e30ccc4c43ef661f34c958d462bc07d1220563a5f030c78834e90086
MD5 82d4d649edd65cea7453fe5fd56d10e3
BLAKE2b-256 8dde32ed7c5874ef787a59f49e6652242422d38c2733ae152dd2e9127d92beb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cabaret-0.3.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: cabaret-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bc88929dee03867fd1f0d2a9f61843c2b2c51dfcc00dd9ce519aa1cb2184fe5
MD5 eccab5bd98165459235f6d59a4fc5e31
BLAKE2b-256 ccf3769dd50eaf021e998b60a3abe0fb24c6914e48b6b93d6d6b6375ce1bbd6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cabaret-0.3.0-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