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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
703069b2e30ccc4c43ef661f34c958d462bc07d1220563a5f030c78834e90086
|
|
| MD5 |
82d4d649edd65cea7453fe5fd56d10e3
|
|
| BLAKE2b-256 |
8dde32ed7c5874ef787a59f49e6652242422d38c2733ae152dd2e9127d92beb2
|
Provenance
The following attestation bundles were made for cabaret-0.3.0.tar.gz:
Publisher:
publish.yml on ppp-one/cabaret
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cabaret-0.3.0.tar.gz -
Subject digest:
703069b2e30ccc4c43ef661f34c958d462bc07d1220563a5f030c78834e90086 - Sigstore transparency entry: 529236460
- Sigstore integration time:
-
Permalink:
ppp-one/cabaret@14b17b0a33d2e74a5059226385d44eff5f406535 -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/ppp-one
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14b17b0a33d2e74a5059226385d44eff5f406535 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bc88929dee03867fd1f0d2a9f61843c2b2c51dfcc00dd9ce519aa1cb2184fe5
|
|
| MD5 |
eccab5bd98165459235f6d59a4fc5e31
|
|
| BLAKE2b-256 |
ccf3769dd50eaf021e998b60a3abe0fb24c6914e48b6b93d6d6b6375ce1bbd6c
|
Provenance
The following attestation bundles were made for cabaret-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on ppp-one/cabaret
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cabaret-0.3.0-py3-none-any.whl -
Subject digest:
9bc88929dee03867fd1f0d2a9f61843c2b2c51dfcc00dd9ce519aa1cb2184fe5 - Sigstore transparency entry: 529236471
- Sigstore integration time:
-
Permalink:
ppp-one/cabaret@14b17b0a33d2e74a5059226385d44eff5f406535 -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/ppp-one
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14b17b0a33d2e74a5059226385d44eff5f406535 -
Trigger Event:
push
-
Statement type: