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
        ),
    ),
    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")

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.2.0.tar.gz (476.0 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.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cabaret-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3744cd41fcf68e41404cdf59593df3182bed147cef18513d5de5480fb588fdd8
MD5 127607158abd4c2b9a1b308a95da94fe
BLAKE2b-256 d7fd1550dad98238e4b78b4be16b484070039b65db77cb2aa0432767ce474f7b

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for cabaret-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5531893df6a27c0b5cf62eedb9c0e2bc380fa326dffd425eb4677d2cf9aa42f
MD5 89e61ea8a3cd2c57839266db0c05f072
BLAKE2b-256 ae50662d6212f491c6284e31a835f401a8d29358951a921e40f5938e204d96e1

See more details on using hashes here.

Provenance

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