DocsScripting
Python Scripting
CyxWiz Engine includes a powerful embedded Python scripting system for interactive data analysis, model building, and training automation.
Overview
The scripting system provides:
- Embedded Python Interpreter: Full Python 3.x environment
- Notebook-Style Editor: Cell-based .cyx script format
- Interactive Console: REPL for quick commands
- Plot Integration: Matplotlib renders inline
- Debugging: Breakpoints and variable inspection
- MATLAB Compatibility: Familiar function aliases
Quick Start
Console (Interactive)
Press Ctrl+` to open the Console:
>>> import pycyxwiz as cx >>> t = cx.Tensor.random([3, 3]) >>> print(t.shape()) [3, 3]
Script Editor
Press Ctrl+N to create a new script:
%%code
import pycyxwiz as cx
import numpy as np
# Create data
data = np.random.randn(100, 10)
tensor = cx.Tensor.from_numpy(data)
print("Shape:", tensor.shape())Cell-Based Notebooks
Write code in discrete cells with different types:
%%code # Cell 1: Setup import pycyxwiz as cx %%code # Cell 2: Processing result = cx.linalg.svd([[1, 2], [3, 4]]) print(result) %%markdown ## Documentation This cell contains markdown text.
Inline Plotting
Matplotlib figures render directly in the editor:
%%code
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
plt.plot(x, np.sin(x))
plt.title('Sine Wave')
plt.show() # Renders below the cellAvailable Modules
Built-in Modules
| pycyxwiz | CyxWiz backend bindings |
| numpy | Numerical computing |
| matplotlib | Plotting and visualization |
| pandas | Data manipulation |
| scipy | Scientific computing |
pycyxwiz Submodules
import pycyxwiz as cx cx.linalg # Linear algebra cx.signal # Signal processing cx.stats # Statistics/clustering cx.timeseries # Time series analysis
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| New Script | Ctrl+N |
| Save | Ctrl+S |
| Run All | F5 |
| Run Cell | Shift+Enter |
| Stop Execution | Ctrl+C |
| Toggle Console | Ctrl+` |
| Insert Cell Below | Ctrl+Enter |
| Delete Cell | Ctrl+Shift+D |
Script Execution States
| State | Display | Meaning |
|---|---|---|
| Idle | [ ] | Not executed |
| Queued | [*] | Waiting to run |
| Running | [*] | Currently executing |
| Success | [1] | Completed (shows execution count) |
| Error | [!] | Failed with exception |
File Types
.cyx
CyxWiz notebook script with cell-based execution and markdown support.
.py
Standard Python script for traditional sequential execution.
Best Practices
%%code
# Cell 1: Imports
import pycyxwiz as cx
import numpy as np
%%code
# Cell 2: Configuration
CONFIG = {
'learning_rate': 0.001,
'epochs': 100
}
%%code
# Cell 3: Data Loading
data = load_data()
%%markdown
# Experiment Notes
Document your experiments with markdown cells.
%%code
# Cell 4: Training
train(data, CONFIG)