A powerful VSCode extension that provides a comprehensive graphical user interface for the Funz parametric simulation framework. This extension makes it easy to configure, run, and analyze parametric simulations without needing to use command-line tools.
The main interface for configuring and running simulations:
- Model Selection: Browse and select from available Funz models in your workspace
- Template Management: Select input template files containing variables and formulas
- Variable Detection: Automatically detect variables (
$var) and formulas (@{expr}) in templates - Variable Configuration:
- Set single values or arrays for grid search
- Support for numeric, string, and array values
- Visual indication of parameter vs computed variables
- Output Selection: Choose which outputs to extract from simulation results
- Execution Control:
- Compile templates without running simulations
- Run full parametric studies with progress tracking
- Configure calculators (local shell, remote SSH, etc.)
Interactive dataframe visualization for simulation results:
- Table View: Display results in a clean, sortable table
- Statistics: Overview of total runs, parameters, and outputs
- Filtering: Search and filter results in real-time
- Export: Export results to CSV format
- Auto-detection: Automatically distinguishes parameter columns from output columns
Three dedicated sidebar panels:
- Models View: Browse available Funz models with configuration details
- Variables View: See detected variables in the current template
- Results View: Quick access to results directories in your workspace
Funz: Open Control Panel- Open the main control panelFunz: Open Results Viewer- View simulation resultsFunz: Detect Variables in Current File- Detect variables in active fileFunz: Run Simulation- Configure and run a simulationFunz: Compile Template- Compile template with variablesFunz: Parse Output- Parse results from a directoryFunz: Refresh Model List- Reload available models
- Auto-detection: Automatically detect template files and variables
- File Watchers: Real-time updates when models or results change
- Progress Tracking: Live output during simulation execution
- Context Menus: Right-click on files and folders for quick actions
- Syntax Awareness: Recognizes Funz variable (
$) and formula (@) syntax
- Python 3.7+ with the
fzpackage installed - VSCode 1.85.0 or higher
pip install fzOr for development:
git clone https://github.com/Funz/fz.git
cd fz
pip install -e .This extension contributes the following settings:
funz.pythonPath: Path to Python executable with fz package (default:"python")funz.modelsDirectory: Directory containing Funz model configurations (default:".fz/models")funz.resultsDirectory: Default directory for simulation results (default:"results")funz.maxWorkers: Maximum number of parallel workers (default:4)funz.autoDetectVariables: Automatically detect variables when opening files (default:true)funz.defaultCalculator: Default calculator for simulations (default:"sh://bash")
Create a Funz workspace structure:
my-project/
βββ .fz/
β βββ models/
β βββ mymodel.json
βββ templates/
β βββ input.txt
βββ results/
Create a model file in .fz/models/mymodel.json:
{
"varprefix": "$",
"formulaprefix": "@",
"delim": "{}",
"commentline": "#",
"interpreter": "python",
"output": {
"result_value": "grep 'Result:' output.txt | awk '{print $2}'"
}
}Create templates/input.txt with variables:
# Simulation Input File
temperature=$temperature
pressure=$pressure
volume=@{$temperature * $pressure / 8.314}
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run
Funz: Open Control Panel - Select your template file
- Select your model
- Click "Detect Variables"
- Set variable values (single or arrays)
- Configure calculator and results directory
- Click "Run Simulation"
- Open Command Palette
- Run
Funz: Open Results Viewer - Select your results directory
- Choose the model
- Click "Load Results"
In the Control Panel:
temperature:25pressure:101325
This runs a single simulation with these values.
In the Control Panel:
temperature:[10, 20, 30](array)pressure:[101325, 202650](array)
This runs 6 simulations (3 Γ 2 Cartesian product):
- (10, 101325), (10, 202650)
- (20, 101325), (20, 202650)
- (30, 101325), (30, 202650)
Local Shell:
sh://bash run_simulation.sh
Remote SSH:
ssh://user@server/path/to/run.sh
Multiple Calculators (Parallel): Configure multiple calculator entries to run simulations in parallel across different compute resources.
funz-vscode/
βββ src/
β βββ extension.ts # Main extension entry point
β βββ funz/
β β βββ FunzService.ts # Core Funz integration
β βββ panels/
β β βββ FunzControlPanel.ts # Main control panel
β β βββ FunzResultsViewer.ts # Results visualization
β βββ providers/
β β βββ FunzModelsProvider.ts # Sidebar models view
β β βββ FunzVariablesProvider.ts # Sidebar variables view
β β βββ FunzResultsProvider.ts # Sidebar results view
β βββ utils/
β βββ getNonce.ts # Security utilities
βββ package.json # Extension manifest
βββ tsconfig.json # TypeScript config
FunzService: Wraps Funz CLI commands (fzi, fzc, fzo, fzr) with a clean TypeScript API
FunzControlPanel: Webview-based UI for:
- Model and template selection
- Variable detection and configuration
- Simulation execution
FunzResultsViewer: Webview-based dataframe viewer for:
- Displaying results in table format
- Filtering and searching
- Exporting to CSV
Tree Data Providers: Sidebar navigation for models, variables, and results
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode for development
npm run watch
# Package extension
npm run package- Open this project in VSCode
- Press
F5to launch Extension Development Host - Test the extension in the new window
# Package as VSIX
vsce package
# Publish to marketplace
vsce publishThis extension integrates with the Funz Python package (fz) and uses the following commands:
- fzi: Parse input files and detect variables
- fzc: Compile templates with variable substitution
- fzo: Parse output files and extract results
- fzr: Run complete parametric simulations
All commands are executed through Python subprocess calls, with progress tracking and error handling.
Contributions are welcome! Please feel free to submit issues or pull requests.
- Additional visualization types (charts, plots)
- Model editor with syntax highlighting
- Advanced filtering and data analysis
- Integration with cloud compute resources
- Support for additional calculators
- Performance optimizations
Ensure the fz package is installed in your Python environment:
pip install fz
# or check installation
python -m fz.fzi --helpCreate a .fz/models/ directory in your workspace and add model JSON files.
Ensure your template uses the correct variable prefix (default: $) and that you've selected the appropriate model.
- Check that the calculator path is correct
- Verify your simulation script has execute permissions
- Review the output in the Funz Simulation output channel
MIT License - see LICENSE file for details
This extension is a GUI wrapper for the Funz framework, developed by the Funz organization.
Enjoy parametric simulations with Funz GUI! π