Command Line Interface
This guide covers all aspects of using NullStrike from the command line, including basic usage, advanced options, and troubleshooting.
Basic Usage
Simple Analysis
The most basic command runs a complete analysis:
Example:
This will:
1. Load the C2M
model from custom_models/C2M.py
2. Use options from custom_options/options_C2M.py
(if exists) or defaults
3. Run complete identifiability analysis
4. Generate visualizations
5. Save results to results/C2M/
Specify Options File
Use a specific configuration file:
Example:
This loads options from custom_options/options_custom_C2M.py
.
Command Line Options
Parameters-Only Mode
For quick analysis without visualizations:
When to use: - Quick testing during model development - Large models where visualization is slow - Debugging model definitions - When only identifiability results are needed
Example:
Help and Version
Get help information:
Get version information:
Complete Command Syntax
Argument Details
Argument | Required | Description | Default |
---|---|---|---|
model_name |
No | Model to analyze | calibration_single |
options_file |
No | Configuration file | options_{model_name} or options_default |
--parameters-only |
No | Skip visualizations | Full analysis |
--help |
No | Show help message | - |
--version |
No | Show version info | - |
Usage Patterns
Development Workflow
During model development, use this progression:
# 1. Quick syntax check
nullstrike my_model --parameters-only
# 2. Full analysis with default options
nullstrike my_model
# 3. Custom analysis with specific options
nullstrike my_model options_my_custom
Batch Analysis
Analyze multiple models:
# Analyze several built-in models
nullstrike C2M
nullstrike Bolie
nullstrike calibration_single
# Analyze with different configurations
nullstrike my_model options_config1
nullstrike my_model options_config2
Comparative Analysis
Compare different model variants:
Working with Different Models
Built-in Models
NullStrike includes several pre-defined models:
# Pharmacokinetic models
nullstrike C2M # Two-compartment model
nullstrike C2M_2outputs # Two-compartment with multiple outputs
# Biological models
nullstrike Bolie # Glucose-insulin dynamics
nullstrike calibration_single # Enzyme kinetics
nullstrike calibration_double # Two-enzyme system
# Test models
nullstrike SimpleExample # Basic linear system
nullstrike 1A_integral # Control theory example
Custom Models
For your own models in custom_models/
:
# Analyze custom model
nullstrike my_pharmacokinetic_model
# With custom options
nullstrike my_model options_my_model
Model Discovery
List available models:
Output and Results
Output Locations
Results are saved to:
results/
└── {model_name}/
├── analysis_report.txt
├── nullspace_analysis.txt
├── observability_matrix.txt
├── visualizations/
└── checkpoints/
Progress Monitoring
During analysis, you'll see progress information:
=== NULLSTRIKE ANALYSIS: C2M ===
Loading model: C2M
Loading options: options_C2M
=== STRIKE-GOLDD Analysis ===
Computing Lie derivatives... [■■■■■■ ] 60%
Building observability matrix... Done
Rank analysis... Done
Found 2 identifiable parameters out of 4
=== Nullspace Analysis ===
Computing nullspace basis... Done
Nullspace dimension: 2
Identifying parameter combinations... Done
Found 2 identifiable combinations
=== Visualization Generation ===
Creating 3D manifolds... [■■■■ ] 40%
Creating 2D projections... [■■■■■■■■ ] 80%
Building parameter graph... Done
Analysis complete!
Results saved to: results/C2M/
Total computation time: 45.3 seconds
Understanding Output Messages
Advanced Usage
Environment Variables
Control NullStrike behavior with environment variables:
# Set custom model/options directories
export NULLSTRIKE_MODELS_DIR="/path/to/my/models"
export NULLSTRIKE_OPTIONS_DIR="/path/to/my/options"
# Set visualization backend
export MPLBACKEND=Agg # For headless systems
# Run analysis
nullstrike my_model
Integration with Scripts
Use NullStrike in shell scripts:
#!/bin/bash
# analyze_all_models.sh
models=("C2M" "Bolie" "calibration_single")
for model in "${models[@]}"; do
echo "Analyzing $model..."
nullstrike "$model" --parameters-only
if [ $? -eq 0 ]; then
echo "$model analysis complete"
else
echo "ERROR: $model analysis failed"
fi
done
Performance Monitoring
Time your analyses:
# Time a single analysis
time nullstrike C2M
# Compare performance
time nullstrike simple_model
time nullstrike complex_model
Memory Usage
Monitor memory for large models:
# On Linux/macOS
/usr/bin/time -v nullstrike large_model
# Monitor with top/htop during analysis
nullstrike large_model &
htop -p $!
Troubleshooting
Common Command Line Issues
Error: command not found: nullstrike
Solutions:
Error: Error: Model file 'my_model.py' not found
Solutions:
Runtime Errors
Symptoms: Analysis hangs or crashes during STRIKE-GOLDD phase
Solutions:
Symptoms: Analysis completes but no plots generated
Solutions:
Performance Issues
Problem: Analysis takes very long time
Solutions:
Integration with Other Tools
IDE Integration
Use NullStrike from within IDEs:
VS Code:
{
"name": "Run NullStrike",
"type": "shell",
"command": "nullstrike",
"args": ["${workspaceFolder}/my_model"],
"group": "build"
}
PyCharm:
Configure external tool with command nullstrike
and arguments $FileDirName$
.
Jupyter Notebooks
Run NullStrike from Jupyter:
# In Jupyter cell
!nullstrike my_model --parameters-only
# Or using subprocess for better control
import subprocess
result = subprocess.run(['nullstrike', 'my_model'],
capture_output=True, text=True)
print(result.stdout)
Continuous Integration
Include NullStrike in CI pipelines:
# GitHub Actions example
- name: Test Models
run: |
nullstrike test_model --parameters-only
if [ $? -ne 0 ]; then exit 1; fi
Best Practices
Command Line Workflow
- Start simple: Use
--parameters-only
for initial testing - Check syntax: Verify model and options files load correctly
- Incremental analysis: Start with simple models, add complexity
- Monitor progress: Watch output for bottlenecks
- Save results: Don't overwrite important analysis results
Debugging Strategy
- Isolate issues: Test model and options separately
- Use minimal examples: Start with simple test cases
- Check file paths: Verify all files exist and are accessible
- Monitor resources: Watch CPU and memory usage
- Read error messages: Pay attention to specific error details
Production Usage
- Script analyses: Automate repeated analyses with shell scripts
- Document commands: Keep records of successful command patterns
- Version control: Track model and options files in git
- Backup results: Save important analysis results
- Performance testing: Benchmark analysis times for planning
Further Reading
- Model Definition Guide: Creating models for analysis
- Configuration Guide: Setting up options files
- Python API: Programmatic interface
- Advanced Features: Batch processing and automation
Command Line Efficiency
- Use tab completion for model names
- Create aliases for common commands:
alias nsp="nullstrike --parameters-only"
- Keep a history of successful commands for reference
- Use
--parameters-only
during development to save time