API
starbox.calibrate
Radio telescope visibility calibration components.
This module provides classes and functions for calibrating radio telescope visibility data.
Classes:
| Name | Description |
|---|---|
Solutions |
Class for handling calibration solutions. |
Solver |
Class for solving for calibration solutions. |
Solutions
dataclass
Class for handling calibration solutions.
Attributes:
| Name | Type | Description |
|---|---|---|
station_phase_gains |
ndarray
|
Phase gains for each station. |
Source code in src/starbox/calibrate/solutions.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
apply(visibilities)
Apply phase-only calibration solutions to visibilities.
The visibility corruption model is
V_obs = g_i * conj(g_j) * V_true
so calibration applies the inverse factor per baseline.
Source code in src/starbox/calibrate/solutions.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
Solver
Class to handle calibration solving.
Source code in src/starbox/calibrate/solver.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
solve(observed_visibilities, model_visibilities, n_stations)
Estimate calibration solutions from observed and model visibilities.
Source code in src/starbox/calibrate/solver.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
starbox.config
Module for configuration schemas.
Exports
- ObservationConfig: Configuration schema for observations.
- SkyModelConfig: Configuration schema for sky models.
- TelescopeConfig: Configuration schema for telescopes.
- TelescopeSiteConfig: Configuration schema for telescope sites.
- CorruptionsConfig: Configuration schema for corruptions.
- SolverConfig: Configuration schema for solvers.
- ExperimentConfig: Configuration schema for experiments.
CorruptionsConfig
Bases: BaseModel
Configuration schema for the Corruptions.
Source code in src/starbox/config/corruptions.py
6 7 8 9 10 11 12 13 | |
ExperimentConfig
Bases: BaseModel
Configuration for a simulation experiment.
Source code in src/starbox/config/experiment.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
ObservationConfig
Bases: BaseModel
Configuration schema for the Observation.
Source code in src/starbox/config/observation.py
6 7 8 9 10 11 12 13 14 15 16 17 18 | |
SkyModelConfig
Bases: BaseModel
Configuration schema for the SkyModel.
Source code in src/starbox/config/skymodel.py
6 7 8 9 10 11 12 13 | |
SolverConfig
Bases: BaseModel
Configuration schema for the solver.
Source code in src/starbox/config/solver.py
6 7 8 9 10 11 12 13 14 15 16 | |
TelescopeConfig
Bases: BaseModel
Configuration schema for the Telescope.
Source code in src/starbox/config/telescope.py
14 15 16 17 18 19 20 | |
TelescopeSiteConfig
Bases: BaseModel
Configuration schema for the Telescope site.
Source code in src/starbox/config/telescope.py
6 7 8 9 10 11 | |
starbox.factory
Module for building simulation components.
Functions to build sky models, observations, and telescopes.
Exports
- build_skymodel: Function to build sky models.
- build_observation: Function to build observations.
- build_telescope: Function to build telescopes.
- build_corruptions: Function to build corruptions.
- build_solver: Function to build solvers.
build_corruptions(cfg)
Build a Corruptions instance from a CorruptionsConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
CorruptionsConfig
|
The CorruptionsConfig instance. |
required |
Returns: A Corruptions instance.
Source code in src/starbox/factory/corruptions.py
7 8 9 10 11 12 13 14 15 | |
build_observation(config)
Build an Observation from its configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ObservationConfig
|
The Observation configuration. |
required |
Returns: The built Observation.
Source code in src/starbox/factory/observation.py
7 8 9 10 11 12 13 14 15 | |
build_skymodel(cfg)
Build a SkyModel from a SkyModelConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
SkyModelConfig
|
Configuration for the sky model. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SkyModel |
SkyModel
|
The constructed sky model. |
Source code in src/starbox/factory/skymodel.py
7 8 9 10 11 12 13 14 15 16 | |
build_solver(cfg)
Build a Solver instance from the given configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
SolverConfig
|
Configuration for the solver. |
required |
Returns: An instance of Solver.
Source code in src/starbox/factory/solver.py
7 8 9 10 11 12 13 14 15 | |
build_telescope(cfg, name='Telescope')
Build a Telescope from a TelescopeConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
TelescopeConfig
|
Configuration for the telescope. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Telescope |
Telescope
|
The constructed telescope. |
Source code in src/starbox/factory/telescope.py
7 8 9 10 11 12 13 14 15 16 | |
starbox.image
Radio telescope visibility imaging components.
This module provides classes and functions for creating images from radio telescope visibility data.
Classes:
| Name | Description |
|---|---|
Imager |
Class for gridding and imaging radio telescope visibilities. |
Imager
Class for handling image processing.
Source code in src/starbox/image/imager.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
__init__(grid_size=256, fov_deg=5.0)
Initialize the Imager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_size
|
int
|
Number of pixels along each image axis. |
256
|
fov_deg
|
float
|
Imaged field of view in degrees. |
5.0
|
Source code in src/starbox/image/imager.py
12 13 14 15 16 17 18 19 20 21 22 | |
grid(visibilities)
Grid visibilities onto a regular uv grid using nearest-neighbour mapping, using all times and frequency channels.
Notes
- Uses uniform weighting (simple sum).
- Adds Hermitian symmetric samples to encourage a real dirty image.
- Grid is centered: DC is at (grid_size//2, grid_size//2).
Source code in src/starbox/image/imager.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
ifft(gridded_visibilities)
Inverse FFT uv-grid -> dirty image. Because the grid is centered (DC at centre), use ifftshift before ifft2.
Source code in src/starbox/image/imager.py
127 128 129 130 131 132 133 134 | |
image(visibilities)
Create an image from visibilities.
Source code in src/starbox/image/imager.py
136 137 138 139 140 | |
starbox.io
I/O module.
Contains functions and classes for reading and writing configuration files.
Functions:
| Name | Description |
|---|---|
- save |
Save experiment configuration data to a file. |
starbox.predict
Radio telescope visibility prediction components.
This module provides functions for predicting radio telescope visibility data.
Functions:
| Name | Description |
|---|---|
predict_visibilities |
Function to predict visibilities. |
predict_visibilities(telescope, skymodel, observation)
Predict visibilities given a telescope, sky model, and observation.
Source code in src/starbox/predict/predict.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
starbox.simulate
Radio telescope simulation components.
This module provides classes and functions for simulating random radio telescope array configurations and sky models.
Classes:
| Name | Description |
|---|---|
Telescope |
A class representing a radio telescope array with random antenna configurations. |
SkyModel |
A class for simulating sky models with random sources. |
Observation |
A class representing an observation setup including time and frequency parameters. |
Corruptions |
A class for simulating corruptions to the observed signal. |
Corruptions
A class representing corruptions to apply to a signal.
Attributes:
| Name | Type | Description |
|---|---|---|
rms_noise |
The RMS noise level to add to the visibilities. |
|
station_phase_gain |
Phase gain errors for each station. |
Source code in src/starbox/simulate/corruptions.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
apply(visibility_set)
Apply the corruptions to the given visibilities.
Source code in src/starbox/simulate/corruptions.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Observation
Observation configuration and derived sampling grids.
Source code in src/starbox/simulate/observation.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
gmst_rad
property
Return the times converted to Greenwich mean sidereal time.
phase_centre_rad
property
Return the phase centre in radians.
pointing_centre_rad
property
Return the pointing centre in radians.
SkyModel
A class representing a sky model.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The name of the sky model. |
|
ra_deg |
Right ascension of sources in degrees. |
|
dec_deg |
Declination of sources in degrees. |
|
flux_jy |
Flux densities of sources in Jansky. |
|
config |
The SkyModelConfig used to generate this sky model. |
Source code in src/starbox/simulate/skymodel.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
equals(other, atol=0.0, rtol=0.0)
Check equality with another SkyModel within a tolerance.
Source code in src/starbox/simulate/skymodel.py
52 53 54 55 56 57 58 59 60 61 | |
Telescope
A class representing a radio telescope array.
Source code in src/starbox/simulate/telescope.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
__init__(cfg, name='Telescope')
Initialize the Telescope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
TelescopeConfig
|
TelescopeConfig instance containing configuration parameters. |
required |
name
|
str
|
Name of the telescope. |
'Telescope'
|
Source code in src/starbox/simulate/telescope.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
starbox.viz
Visualization module.
This module provides functions for plotting radio telescope array configurations, sky models, uv-coverage, calibration solutions and images.
Functions:
| Name | Description |
|---|---|
plot_telescope |
Plot the array configuration of a telescope. |
plot_sky_model |
Plot the sky model sources. |
plot_uv_coverage |
Plot the UV coverage given UVW coordinates. |
plot_gains |
Plot the calibration solutions. |
plot_image |
Plot the 2D image data. |
plot_gains(solutions, station_index=0)
Plot the gain phase for a single station.
Rendering one station at a time keeps the figure payload small enough for notebook frontends such as marimo.
Source code in src/starbox/viz/plot.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
plot_image(image, title='Imaged Sky', fov_deg=None, height=350, zmin=None, zmax=None, color_continuous_scale=None)
Plot the image.
Source code in src/starbox/viz/plot.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
plot_sky_model(sky_model)
Plot the sky model sources.
Source code in src/starbox/viz/plot.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
plot_telescope(telescope)
Plot the array configuration given antenna coordinates.
Source code in src/starbox/viz/plot.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
plot_uv_coverage(uvw_coordinates, freqs_hz, title='UV Coverage', max_timesteps=10)
Plot UV coverage points in wavelength units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uvw_coordinates
|
ndarray
|
|
required |
freqs_hz
|
ndarray
|
Channel frequencies in Hz used to convert UV coordinates from meters to wavelengths using the mean frequency. |
required |
title
|
str
|
Plot title. |
'UV Coverage'
|
max_timesteps
|
int
|
Maximum number of timesteps to plot. If the input has more timesteps, they will be downsampled evenly across time. |
10
|
Shows all UV sample points (positive and mirrored conjugates) colored by time. Downsamples in time if necessary to keep the Plotly payload manageable.
Source code in src/starbox/viz/plot.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
starbox.visibility
Data class for visibility set.
VisibilitySet
dataclass
A data class representing a set of visibilities.
Attributes:
| Name | Type | Description |
|---|---|---|
vis |
ndarray
|
Complex visibilities with shape (time, baseline, chan). |
uvw_m |
ndarray
|
UVW coordinates in meters with shape (time, baseline, 3). |
station1 |
ndarray
|
Indices of the first station for each baseline. |
station2 |
ndarray
|
Indices of the second station for each baseline. |
times_mjd |
ndarray
|
Times of the observations in Modified Julian Date. |
freqs_hz |
ndarray
|
Frequencies of the channels in Hz. |
weights |
ndarray
|
Weights for each visibility with shape (time, baseline, chan). |
Source code in src/starbox/visibility.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
num_stations
property
Get the number of unique stations in the visibility set.
station_ids
property
Get the unique station IDs from the baseline indices.