Visualization Module¶
Interactive Panel/HoloViews visualization framework for OVRO-LWA datasets.
All dependencies are optional — install with
pip install 'ovro_lwa_portal[visualization]'.
For usage examples, see the Interactive Visualization guide.
Module Entry Points¶
Interactive visualization framework for OVRO-LWA datasets.
This module provides Panel/HoloViews-based interactive explorers for radio astronomy data. All dependencies are optional — install with:
pip install 'ovro_lwa_portal[visualization]'
Examples:
>>> ds = ovro_lwa_portal.open_dataset("path/to/data.zarr")
>>> ds.radport.explore_image() # Launch interactive image explorer
>>> ds.radport.explore() # Launch full exploration dashboard
ImageExplorer(ds, **kwargs)
¶
Create an interactive image explorer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
**kwargs
|
Any
|
Passed to :class: |
{}
|
Returns:
| Type | Description |
|---|---|
ImageExplorer
|
Explorer instance. Call |
Source code in src/ovro_lwa_portal/viz/__init__.py
DynamicSpectrumExplorer(ds, **kwargs)
¶
Create an interactive dynamic spectrum explorer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
**kwargs
|
Any
|
Passed to :class: |
{}
|
Returns:
| Type | Description |
|---|---|
DynamicSpectrumExplorer
|
Explorer instance. Call |
Source code in src/ovro_lwa_portal/viz/__init__.py
CutoutExplorer(ds, **kwargs)
¶
Create an interactive cutout explorer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
**kwargs
|
Any
|
Passed to :class: |
{}
|
Returns:
| Type | Description |
|---|---|
CutoutExplorer
|
Explorer instance. Call |
Source code in src/ovro_lwa_portal/viz/__init__.py
SkyViewer(ds, **kwargs)
¶
Create an interactive sky viewer with Aladin Lite.
Overlays OVRO-LWA data on astronomical survey backgrounds (DSS, WISE, Planck, etc.) with real-time panning, zooming, and coordinate exploration. Requires WCS header in the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset with WCS header to explore. |
required |
**kwargs
|
Any
|
Passed to :class: |
{}
|
Returns:
| Type | Description |
|---|---|
SkyViewer
|
Sky viewer instance. Call |
Source code in src/ovro_lwa_portal/viz/__init__.py
create_exploration_dashboard(ds, **kwargs)
¶
Create a comprehensive exploration dashboard.
Combines image, dynamic spectrum, and cutout explorers into a tabbed dashboard layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
**kwargs
|
Any
|
Passed to :func: |
{}
|
Returns:
| Type | Description |
|---|---|
Viewable
|
Panel tabbed layout with all explorers. |
Source code in src/ovro_lwa_portal/viz/__init__.py
Explorer Classes¶
ImageExplorer¶
ImageExplorer
¶
Bases: Parameterized
Interactive image explorer with time/frequency/polarization selection.
Uses an LRU cache — first view of each (time, freq) slice takes one S3 read (~3s), subsequent views of the same slice are instant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
max_size
|
int
|
Maximum pixels per spatial side after downsampling (controls stride). Lower values are faster but coarser. Default 512. |
_MAX_DISPLAY_SIZE
|
Source code in src/ovro_lwa_portal/viz/explorers.py
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 | |
panel()
¶
Return the complete Panel layout.
Source code in src/ovro_lwa_portal/viz/explorers.py
DynamicSpectrumExplorer¶
DynamicSpectrumExplorer
¶
Bases: Parameterized
Interactive dynamic spectrum explorer with linked views.
Uses the accessor's dynamic_spectrum() method which batches all
pixel extractions via dask.compute() — much faster than 100
sequential reads. Linked spectrum/light curve use the accessor's
single-frame methods (one chunk read each).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
Source code in src/ovro_lwa_portal/viz/explorers.py
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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
panel()
¶
Return the complete Panel layout with linked views.
Source code in src/ovro_lwa_portal/viz/explorers.py
CutoutExplorer¶
CutoutExplorer
¶
Bases: Parameterized
Interactive cutout explorer with linked light curve and spectrum.
Uses an LRU-cached cube for spatial subsetting — fast for single frames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
max_size
|
int
|
Maximum pixels per spatial side after downsampling (controls stride). Lower values are faster but coarser. Default 512. |
_MAX_DISPLAY_SIZE
|
Source code in src/ovro_lwa_portal/viz/explorers.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
panel()
¶
Return the complete Panel layout with linked views.
Source code in src/ovro_lwa_portal/viz/explorers.py
SkyViewer¶
SkyViewer
¶
Bases: Parameterized
Interactive sky viewer with OVRO-LWA data overlaid on survey backgrounds.
Uses ipyaladin (Aladin Lite) to provide a real-time, pannable, zoomable celestial sky view. The OVRO-LWA image is projected onto the sky using the dataset's WCS header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset with WCS header. |
required |
Examples:
Source code in src/ovro_lwa_portal/viz/sky_viewer.py
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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
panel()
¶
Return the complete Panel layout with sky viewer.
Returns:
| Type | Description |
|---|---|
Viewable
|
Panel layout with Aladin sky viewer and controls. |
Source code in src/ovro_lwa_portal/viz/sky_viewer.py
Data Bridge¶
Internal utilities for converting accessor outputs to HoloViews elements.
PreloadedCube¶
PreloadedCube
¶
Cached, spatially downsampled accessor for OVRO-LWA datasets.
Instead of loading the full data cube into memory, this class loads individual 2D slices on demand with strided downsampling and caches them. For the dynamic spectrum (all times x freqs at one pixel), it precomputes a small downsampled cube lazily.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset (may be dask-backed / remote). |
required |
var
|
str
|
Data variable to use (default |
'SKY'
|
pol
|
int
|
Polarization index. |
0
|
max_size
|
int
|
Maximum spatial dimension size after downsampling. |
_MAX_DISPLAY_SIZE
|
Source code in src/ovro_lwa_portal/viz/_data.py
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 | |
bounds
property
¶
Image bounds as (l_left, m_bottom, l_right, m_top).
image(time_idx=0, freq_idx=0)
¶
Get a 2D image slice, transposed for display (m, l) → (y, x).
dynamic_spectrum(l_idx, m_idx)
¶
Get a 2D (time, freq) dynamic spectrum at a display pixel.
Loads all slices not yet in cache, then extracts the pixel.
Source code in src/ovro_lwa_portal/viz/_data.py
light_curve(l_idx, m_idx, freq_idx)
¶
Get a 1D time series at a display pixel and frequency.
Source code in src/ovro_lwa_portal/viz/_data.py
spectrum(l_idx, m_idx, time_idx)
¶
Get a 1D frequency spectrum at a display pixel and time.
Source code in src/ovro_lwa_portal/viz/_data.py
nearest_lm_idx(l, m)
¶
Find nearest display pixel indices for given l, m values.
Source code in src/ovro_lwa_portal/viz/_data.py
Element Factories¶
sky_image_element(cube, *, time_idx=0, freq_idx=0, robust=True, mask_radius=None)
¶
Create an hv.Image from the cached cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
PreloadedCube
|
Data cube. |
required |
time_idx
|
int
|
Slice indices. |
0
|
freq_idx
|
int
|
Slice indices. |
0
|
robust
|
bool
|
Use 2nd/98th percentile for color limits. |
True
|
mask_radius
|
int
|
Circular mask radius in pixels. |
None
|
Returns:
| Type | Description |
|---|---|
Image
|
|
Source code in src/ovro_lwa_portal/viz/_data.py
cutout_image_element(cube, *, l_center=0.0, m_center=0.0, dl=0.1, dm=0.1, time_idx=0, freq_idx=0, robust=True)
¶
Create an hv.Image of a spatial cutout from the cached cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
PreloadedCube
|
Data cube. |
required |
l_center
|
float
|
Center coordinates. |
0.0
|
m_center
|
float
|
Center coordinates. |
0.0
|
dl
|
float
|
Half-extent. |
0.1
|
dm
|
float
|
Half-extent. |
0.1
|
time_idx
|
int
|
Slice indices. |
0
|
freq_idx
|
int
|
Slice indices. |
0
|
robust
|
bool
|
Use robust color scaling. |
True
|
Returns:
| Type | Description |
|---|---|
Image
|
|
Source code in src/ovro_lwa_portal/viz/_data.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
dynamic_spectrum_element(cube, *, l=0.0, m=0.0, robust=True)
¶
Create an hv.Image of a dynamic spectrum from the cached cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
PreloadedCube
|
Data cube. |
required |
l
|
float
|
Direction cosine coordinates. |
0.0
|
m
|
float
|
Direction cosine coordinates. |
0.0
|
robust
|
bool
|
Use 2nd/98th percentile for color limits. |
True
|
Returns:
| Type | Description |
|---|---|
Image
|
|
Source code in src/ovro_lwa_portal/viz/_data.py
light_curve_element(cube, *, l=0.0, m=0.0, freq_idx=0)
¶
Create an hv.Curve of a light curve from the cached cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
PreloadedCube
|
Data cube. |
required |
l
|
float
|
Direction cosine coordinates. |
0.0
|
m
|
float
|
Direction cosine coordinates. |
0.0
|
freq_idx
|
int
|
Frequency index. |
0
|
Returns:
| Type | Description |
|---|---|
Curve
|
|
Source code in src/ovro_lwa_portal/viz/_data.py
spectrum_element(cube, *, l=0.0, m=0.0, time_idx=0)
¶
Create an hv.Curve of a frequency spectrum from the cached cube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube
|
PreloadedCube
|
Data cube. |
required |
l
|
float
|
Direction cosine coordinates. |
0.0
|
m
|
float
|
Direction cosine coordinates. |
0.0
|
time_idx
|
int
|
Time index. |
0
|
Returns:
| Type | Description |
|---|---|
Curve
|
|
Source code in src/ovro_lwa_portal/viz/_data.py
Components¶
Reusable styled HoloViews components for OVRO-LWA visualization.
Provides consistent styling defaults and common plot configurations used across the explorer classes.
COLORMAPS = ['inferno', 'viridis', 'plasma', 'magma', 'cividis', 'gray']
module-attribute
¶
style_sky_image(img, *, cmap='inferno')
¶
Apply standard styling to a sky image element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img
|
Image
|
HoloViews image element. |
required |
cmap
|
str
|
Colormap name. |
'inferno'
|
Returns:
| Type | Description |
|---|---|
Image
|
Styled image. |
Source code in src/ovro_lwa_portal/viz/components.py
style_spectrum_image(img, *, cmap='inferno')
¶
Apply standard styling to a dynamic spectrum image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img
|
Image
|
HoloViews image element. |
required |
cmap
|
str
|
Colormap name. |
'inferno'
|
Returns:
| Type | Description |
|---|---|
Image
|
Styled image. |
Source code in src/ovro_lwa_portal/viz/components.py
style_curve(curve)
¶
Apply standard styling to a curve element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
Curve
|
HoloViews curve element. |
required |
Returns:
| Type | Description |
|---|---|
Curve
|
Styled curve. |
Source code in src/ovro_lwa_portal/viz/components.py
Dashboards¶
create_exploration_dashboard(ds, *, max_size=512)
¶
Create a comprehensive exploration dashboard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
OVRO-LWA dataset to explore. |
required |
max_size
|
int
|
Maximum pixels per spatial side after downsampling. Lower values are faster but coarser. Default 512. |
512
|
Returns:
| Type | Description |
|---|---|
Tabs
|
Tabbed layout with all explorers. |
Source code in src/ovro_lwa_portal/viz/dashboards.py
Accessor Integration¶
The radport xarray accessor exposes the visualization framework through
convenience methods:
| Accessor Method | Explorer |
|---|---|
ds.radport.explore() |
Full tabbed dashboard |
ds.radport.explore_image() |
ImageExplorer |
ds.radport.explore_dynamic_spectrum() |
DynamicSpectrumExplorer |
ds.radport.explore_sky() |
SkyViewer |