display
Display subsystem for tables and plots.
This package contains user-facing facades and backend implementations to render tabular data and plots in different environments.
- Tables: see :mod:
easydiffraction.display.tablesand the engines in :mod:easydiffraction.display.tablers. - Plots: see :mod:easydiffraction.display.plottingand the engines in :mod:easydiffraction.display.plotters.
base
Common base classes for display components and their factories.
RendererBase
Bases: SingletonBase, ABC
Base class for display components with pluggable engines.
Subclasses provide a factory and a default engine. This class manages the active backend instance and exposes helpers to inspect supported engines in a table-friendly format.
Source code in src/easydiffraction/display/base.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 | |
engine
property
writable
Return the name of the currently active rendering engine.
Returns:
| Type | Description |
|---|---|
str
|
Identifier of the active engine. |
show_config()
abstractmethod
Display the current renderer configuration.
Source code in src/easydiffraction/display/base.py
81 82 83 84 | |
show_current_engine()
Display the currently selected engine.
Source code in src/easydiffraction/display/base.py
100 101 102 103 | |
show_supported_engines()
List supported engines with descriptions in a table.
Source code in src/easydiffraction/display/base.py
86 87 88 89 90 91 92 93 94 95 96 97 98 | |
RendererFactoryBase
Bases: ABC
Base factory that manages discovery and creation of backends.
Source code in src/easydiffraction/display/base.py
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 | |
create(engine_name)
classmethod
Create a backend instance for the given engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine_name
|
str
|
Identifier of the engine to instantiate as listed in
|
required |
Returns:
| Type | Description |
|---|---|
object
|
A new backend instance corresponding to |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the engine name is not supported. |
Source code in src/easydiffraction/display/base.py
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 | |
descriptions()
classmethod
Return (name, description) pairs for each engine.
Source code in src/easydiffraction/display/base.py
142 143 144 145 146 | |
supported_engines()
classmethod
Return a list of supported engine identifiers.
Source code in src/easydiffraction/display/base.py
137 138 139 140 | |
plotters
Plotting backends.
This subpackage implements plotting engines used by the high-level plotting facade:
- :mod:
.asciifor terminal-friendly ASCII plots. - :mod:.plotlyfor interactive plots in notebooks or browsers.
ascii
ASCII plotting backend.
Renders compact line charts in the terminal using asciichartpy. This
backend is well suited for quick feedback in CLI environments and keeps
a consistent API with other plotters.
AsciiPlotter
Bases: PlotterBase
Terminal-based plotter using ASCII art.
Source code in src/easydiffraction/display/plotters/ascii.py
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 | |
plot_powder(x, y_series, labels, axes_labels, title, height=None)
Render a line plot for powder diffraction data.
Suitable for powder diffraction data where intensity is plotted against an x-axis variable (2θ, TOF, d-spacing). Uses ASCII characters for terminal display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
object
|
1D array-like of x values (only used for range display). |
required |
y_series
|
object
|
Sequence of y arrays to plot. |
required |
labels
|
object
|
Series identifiers corresponding to y_series. |
required |
axes_labels
|
object
|
Ignored; kept for API compatibility. |
required |
title
|
str
|
Figure title printed above the chart. |
required |
height
|
int | None
|
Number of text rows to allocate for the chart. |
None
|
Source code in src/easydiffraction/display/plotters/ascii.py
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 | |
plot_scatter(x, y, sy, axes_labels, title, height=None)
Render a scatter plot with error bars in ASCII.
Source code in src/easydiffraction/display/plotters/ascii.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
plot_single_crystal(x_calc, y_meas, y_meas_su, axes_labels, title, height=None)
Render a scatter plot for single crystal diffraction data.
Creates an ASCII scatter plot showing measured vs calculated values with a diagonal reference line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_calc
|
object
|
1D array-like of calculated values (x-axis). |
required |
y_meas
|
object
|
1D array-like of measured values (y-axis). |
required |
y_meas_su
|
object
|
1D array-like of measurement uncertainties (ignored in ASCII mode). |
required |
axes_labels
|
object
|
Pair of strings for the x and y titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Number of text rows for the chart (default: 15). |
None
|
Source code in src/easydiffraction/display/plotters/ascii.py
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 | |
base
Abstract base and shared constants for plotting backends.
PlotterBase
Bases: ABC
Abstract base for plotting backends.
Implementations accept x values, multiple y-series, optional labels and render a plot to the chosen medium.
Two main plot types are supported: - plot_powder: Line plots for
powder diffraction patterns (intensity vs. 2θ/TOF/d-spacing). -
plot_single_crystal: Scatter plots comparing measured vs.
calculated values (e.g., F²meas vs F²calc for single crystal).
Source code in src/easydiffraction/display/plotters/base.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 | |
plot_powder(x, y_series, labels, axes_labels, title, height)
abstractmethod
Render a line plot for powder diffraction data.
Suitable for powder diffraction data where intensity is plotted against an x-axis variable (2θ, TOF, d-spacing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
object
|
1D array of x-axis values. |
required |
y_series
|
object
|
Sequence of y arrays to plot. |
required |
labels
|
object
|
Identifiers corresponding to y_series. |
required |
axes_labels
|
object
|
Pair of strings for the x and y titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Backend-specific height (text rows or pixels). |
required |
Source code in src/easydiffraction/display/plotters/base.py
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 | |
plot_scatter(x, y, sy, axes_labels, title, height)
abstractmethod
Render a scatter plot with error bars.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
object
|
1-D array of x-axis values. |
required |
y
|
object
|
1-D array of y-axis values. |
required |
sy
|
object
|
1-D array of y uncertainties. |
required |
axes_labels
|
object
|
Pair of strings for x and y axis titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Backend-specific height (text rows or pixels). |
required |
Source code in src/easydiffraction/display/plotters/base.py
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 | |
plot_single_crystal(x_calc, y_meas, y_meas_su, axes_labels, title, height)
abstractmethod
Render a scatter plot for single crystal diffraction data.
Suitable for single crystal diffraction data where measured values are plotted against calculated values with error bars.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_calc
|
object
|
1D array of calculated values (x-axis). |
required |
y_meas
|
object
|
1D array of measured values (y-axis). |
required |
y_meas_su
|
object
|
1D array of measurement uncertainties. |
required |
axes_labels
|
object
|
Pair of strings for the x and y titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Backend-specific height (text rows or pixels). |
required |
Source code in src/easydiffraction/display/plotters/base.py
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 | |
XAxisType
Bases: str, Enum
X-axis types for diffraction plots.
Values match attribute names in data models for direct use with
getattr(pattern, x_axis).
Source code in src/easydiffraction/display/plotters/base.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
plotly
Plotly plotting backend.
Provides an interactive plotting implementation using Plotly. In notebooks, figures are displayed inline; in other environments a browser renderer may be used depending on configuration.
PlotlyPlotter
Bases: PlotterBase
Interactive plotter using Plotly for notebooks and browsers.
Source code in src/easydiffraction/display/plotters/plotly.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 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 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 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 | |
plot_powder(x, y_series, labels, axes_labels, title, height=None)
Render a line plot for powder diffraction data.
Suitable for powder diffraction data where intensity is plotted against an x-axis variable (2θ, TOF, d-spacing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
object
|
1D array-like of x-axis values. |
required |
y_series
|
object
|
Sequence of y arrays to plot. |
required |
labels
|
object
|
Series identifiers corresponding to y_series. |
required |
axes_labels
|
object
|
Pair of strings for the x and y titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Ignored; Plotly auto-sizes based on renderer. |
None
|
Source code in src/easydiffraction/display/plotters/plotly.py
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 | |
plot_scatter(x, y, sy, axes_labels, title, height=None)
Render a scatter plot with error bars via Plotly.
Source code in src/easydiffraction/display/plotters/plotly.py
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 | |
plot_single_crystal(x_calc, y_meas, y_meas_su, axes_labels, title, height=None)
Render a scatter plot for single crystal diffraction data.
Suitable for single crystal diffraction data where measured values are plotted against calculated values with error bars and a diagonal reference line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_calc
|
object
|
1D array-like of calculated values (x-axis). |
required |
y_meas
|
object
|
1D array-like of measured values (y-axis). |
required |
y_meas_su
|
object
|
1D array-like of measurement uncertainties. |
required |
axes_labels
|
object
|
Pair of strings for the x and y titles. |
required |
title
|
str
|
Figure title. |
required |
height
|
int | None
|
Ignored; Plotly auto-sizes based on renderer. |
None
|
Source code in src/easydiffraction/display/plotters/plotly.py
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 | |
plotting
Plotting facade for measured and calculated patterns.
Uses the common :class:RendererBase so plotters and tablers share a
consistent configuration surface and engine handling.
Plotter
Bases: RendererBase
User-facing plotting facade backed by concrete plotters.
Source code in src/easydiffraction/display/plotting.py
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 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 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 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | |
height
property
writable
Plot height (rows for ASCII, pixels for Plotly).
plot_calc(pattern, expt_name, expt_type, x_min=None, x_max=None, x=None)
Plot calculated pattern using the current engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
object
|
Object with x-axis arrays ( |
required |
expt_name
|
str
|
Experiment name for the title. |
required |
expt_type
|
object
|
Experiment type with scattering/beam enums. |
required |
x_min
|
object
|
Optional minimum x-axis limit. |
None
|
x_max
|
object
|
Optional maximum x-axis limit. |
None
|
x
|
object
|
X-axis type ( |
None
|
Source code in src/easydiffraction/display/plotting.py
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 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
plot_meas(pattern, expt_name, expt_type, x_min=None, x_max=None, x=None)
Plot measured pattern using the current engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
object
|
Object with x-axis arrays ( |
required |
expt_name
|
str
|
Experiment name for the title. |
required |
expt_type
|
object
|
Experiment type with scattering/beam enums. |
required |
x_min
|
object
|
Optional minimum x-axis limit. |
None
|
x_max
|
object
|
Optional maximum x-axis limit. |
None
|
x
|
object
|
X-axis type ( |
None
|
Source code in src/easydiffraction/display/plotting.py
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 | |
plot_meas_vs_calc(pattern, expt_name, expt_type, x_min=None, x_max=None, show_residual=False, x=None)
Plot measured and calculated series and optional residual.
Supports both powder and single crystal data with a unified API.
For powder diffraction: - x='two_theta', 'time_of_flight', or 'd_spacing' - Auto-detected from beam mode if not specified
For single crystal diffraction: - x='intensity_calc' (default): scatter plot - x='d_spacing' or 'sin_theta_over_lambda': line plot
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
object
|
Data pattern object with meas/calc arrays. |
required |
expt_name
|
str
|
Experiment name for the title. |
required |
expt_type
|
object
|
Experiment type with sample_form, scattering, and beam enums. |
required |
x_min
|
object
|
Optional minimum x-axis limit. |
None
|
x_max
|
object
|
Optional maximum x-axis limit. |
None
|
show_residual
|
bool
|
If |
False
|
x
|
object
|
X-axis type. If |
None
|
Source code in src/easydiffraction/display/plotting.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | |
plot_param_series(unique_name, versus_name, experiments, parameter_snapshots)
Plot a parameter's value across sequential fit results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
str
|
Unique name of the parameter to plot. |
required |
versus_name
|
str | None
|
Name of the diffrn descriptor to use as the x-axis (e.g.
|
required |
experiments
|
object
|
Experiments collection for accessing diffrn conditions. |
required |
parameter_snapshots
|
dict[str, dict[str, dict]]
|
Per-experiment parameter value snapshots keyed by experiment name, then by parameter unique name. |
required |
Source code in src/easydiffraction/display/plotting.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | |
show_config()
Display the current plotting configuration.
Source code in src/easydiffraction/display/plotting.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
x_max
property
writable
Maximum x-axis limit.
x_min
property
writable
Minimum x-axis limit.
PlotterEngineEnum
Bases: str, Enum
Available plotting engine backends.
Source code in src/easydiffraction/display/plotting.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
default()
classmethod
Select default engine based on environment.
Source code in src/easydiffraction/display/plotting.py
37 38 39 40 41 42 43 44 | |
description()
Human-readable description for UI listings.
Source code in src/easydiffraction/display/plotting.py
46 47 48 49 50 51 52 | |
PlotterFactory
Bases: RendererFactoryBase
Factory for plotter implementations.
Source code in src/easydiffraction/display/plotting.py
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
tablers
Tabular rendering backends.
This subpackage provides concrete implementations for rendering tables in different environments:
- :mod:
.richfor terminal and notebooks using the Rich library. - :mod:.pandasfor notebooks using DataFrame Styler.
base
Low-level backends for rendering tables.
This module defines the abstract base for tabular renderers and small helpers for consistent styling across terminal and notebook outputs.
TableBackendBase
Bases: ABC
Abstract base class for concrete table backends.
Subclasses implement the render method which receives an index-
aware pandas DataFrame and the alignment for each column header.
Source code in src/easydiffraction/display/tablers/base.py
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 | |
render(alignments, df, display_handle=None)
abstractmethod
Render the provided DataFrame with backend-specific styling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignments
|
object
|
Iterable of column justifications (e.g., |
required |
df
|
object
|
Index-aware DataFrame with data to render. |
required |
display_handle
|
object | None
|
Optional environment-specific handle to enable in-place updates. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
Backend-defined return value (commonly |
Source code in src/easydiffraction/display/tablers/base.py
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 | |
pandas
Pandas-based table renderer for notebooks using DataFrame Styler.
PandasTableBackend
Bases: TableBackendBase
Render tables using the pandas Styler in Jupyter environments.
Source code in src/easydiffraction/display/tablers/pandas.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 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 | |
render(alignments, df, display_handle=None)
Render a styled DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignments
|
object
|
Iterable of column justifications (e.g. 'left'). |
required |
df
|
object
|
DataFrame whose index is displayed as the first column. |
required |
display_handle
|
object | None
|
Optional IPython DisplayHandle to update an existing output area in place when running in Jupyter. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
Backend-defined return value (commonly |
Source code in src/easydiffraction/display/tablers/pandas.py
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 | |
rich
Rich-based table renderer for terminals and notebooks.
RichTableBackend
Bases: TableBackendBase
Render tables to terminal or Jupyter using the Rich library.
Source code in src/easydiffraction/display/tablers/rich.py
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 | |
render(alignments, df, display_handle=None)
Render a styled table using Rich.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignments
|
object
|
Iterable of text-align values for columns. |
required |
df
|
object
|
Index-aware DataFrame to render. |
required |
display_handle
|
object
|
Optional environment handle for in-place updates. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
Backend-defined return value (commonly |
Source code in src/easydiffraction/display/tablers/rich.py
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 | |
tables
Table rendering engines: console (Rich) and Jupyter (pandas).
TableEngineEnum
Bases: str, Enum
Available table rendering backends.
Source code in src/easydiffraction/display/tables.py
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 | |
default()
classmethod
Select default engine based on environment.
Returns Pandas when running in Jupyter, otherwise Rich.
Source code in src/easydiffraction/display/tables.py
26 27 28 29 30 31 32 33 34 35 36 37 | |
description()
Return a human-readable description of this table engine.
Returns:
| Type | Description |
|---|---|
str
|
Description string for the current enum member. |
Source code in src/easydiffraction/display/tables.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
TableRenderer
Bases: RendererBase
Renderer for tabular data with selectable engines (singleton).
Source code in src/easydiffraction/display/tables.py
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 | |
render(df, display_handle=None)
Render a DataFrame as a table using the active backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
object
|
DataFrame with a two-level column index where the second level provides per-column alignment. |
required |
display_handle
|
object | None
|
Optional environment-specific handle used to update an existing output area in-place (e.g., an IPython DisplayHandle or a terminal live handle). |
None
|
Returns:
| Type | Description |
|---|---|
object
|
Backend-specific return value (usually |
Source code in src/easydiffraction/display/tables.py
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 | |
show_config()
Display minimal configuration for this renderer.
Source code in src/easydiffraction/display/tables.py
67 68 69 70 71 72 73 74 75 76 | |
TableRendererFactory
Bases: RendererFactoryBase
Factory for creating tabler instances.
Source code in src/easydiffraction/display/tables.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
utils
JupyterScrollManager
Ensures Jupyter output cells are not scrollable (once).
Source code in src/easydiffraction/display/utils.py
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 | |
disable_jupyter_scroll()
classmethod
Inject CSS to prevent output cells from being scrollable.
Source code in src/easydiffraction/display/utils.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |