Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
700 changes: 676 additions & 24 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ViennaFit

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)

A Python package for parameter optimization and calibration of ViennaPS process simulation models. ViennaFit automates the fitting of simulation parameters to match experimental data through various optimization algorithms and distance metrics.
Expand Down Expand Up @@ -138,7 +138,7 @@ If you use ViennaFit in your research, please cite:

## License

ViennaFit is released under the MIT License. See [LICENSE](LICENSE) for details.
ViennaFit is released under the GNU General Public License v3. See [LICENSE](LICENSE) for details.

## Support

Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Execute the optimization:
print("Starting optimization...")
opt.apply(
numEvaluations=50, # Try 50 parameter combinations
saveVisualization=True # Save domain visualizations
saveComparison=True # Save domain visualizations
)
print("Optimization complete!")
```
Expand Down Expand Up @@ -261,7 +261,7 @@ for param, value in results['bestParameters'].items():

### Visualize Convergence

If `saveVisualization=True`, convergence plots are in the `plots/` directory:
If `saveComparison=True`, convergence plots are in the `plots/` directory:

- `convergence_plot.png` - Objective value vs evaluation number
- `parameter_evolution.png` - How parameters changed during optimization
Expand Down Expand Up @@ -334,7 +334,7 @@ opt.setVariableParameters({
})
opt.setDistanceMetrics(primaryMetric="CA")
opt.setName("run1")
opt.apply(numEvaluations=50, saveVisualization=True)
opt.apply(numEvaluations=50, saveComparison=True)

# View results
results_dir = os.path.join(project.projectPath, "optimizationRuns", "run1")
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/tutorial-1-basic-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ print("="*60)

opt.apply(
numEvaluations=100, # Try 100 parameter combinations
saveVisualization=True # Save intermediate results
saveComparison=True # Save intermediate results
)

print("\n" + "="*60)
Expand Down Expand Up @@ -551,7 +551,7 @@ opt2 = fit.Optimization(project)
# ... configure same as before ...
opt.setName("run2_continued")
# Use run1 results as starting point
opt.apply(numEvaluations=50, saveVisualization=True)
opt.apply(numEvaluations=50, saveComparison=True)
```

**Option 2: Narrow Bounds**
Expand Down Expand Up @@ -619,7 +619,7 @@ opt.setDistanceMetrics(primaryMetric="CCH", additionalMetrics=["CA"])
opt.setName("run1_initialCalibration")

# Run
opt.apply(numEvaluations=100, saveVisualization=True)
opt.apply(numEvaluations=100, saveComparison=True)

# Analyze
results_dir = os.path.join(project.projectPath, "optimizationRuns", "run1_initialCalibration")
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/tutorial-2-custom-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ print(f"\nGrid defined: 5 × 5 = 25 evaluations")
# Execute grid evaluation
results = evaluator.apply(
evaluationName="parameterGrid_ionAndEtchant",
saveVisualization=False # Don't save all 25 VTP files
saveComparison=False # Don't save all 25 VTP files
)

print(f"\nGrid evaluation complete!")
Expand Down Expand Up @@ -223,7 +223,7 @@ evaluator.setDistanceMetric("CCH")
# Run evaluation
specific_results = evaluator.apply(
evaluationName="specificCombinations",
saveVisualization=True # Save these for detailed analysis
saveComparison=True # Save these for detailed analysis
)

# Analyze
Expand Down Expand Up @@ -264,7 +264,7 @@ evaluator.setDistanceMetric("CCH")
# Execute
repeat_results = evaluator.apply(
evaluationName="repeatabilityTest",
saveVisualization=False
saveComparison=False
)

print(f"\nRepeatability test complete: {len(repeat_results)} runs")
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/tutorial-4-multi-domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ print("Note: Twice as many simulations per evaluation!")

opt.apply(
numEvaluations=100,
saveVisualization=True
saveComparison=True
)

print("\n" + "="*60)
Expand Down Expand Up @@ -591,7 +591,7 @@ opt.setDistanceMetrics(primaryMetric="CCH")
opt.setName("run1_multiDomain")

# Run
opt.apply(numEvaluations=100, saveVisualization=True)
opt.apply(numEvaluations=100, saveComparison=True)
```

## Key Takeaways
Expand Down
2 changes: 1 addition & 1 deletion examples/2-optimization/basicOptimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ def rateFunction(fluxes, material):

opt1.setNotes("Basic optimization of the multiparticle process for deposition.")

opt1.apply(numEvaluations=100, saveVisualization=True)
opt1.apply(numEvaluations=100, saveComparison=True)
2 changes: 1 addition & 1 deletion examples/2-optimization/customEvaluatorExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Run the grid evaluation
# This will evaluate all combinations of the variable parameters
# while keeping other parameters at their optimal values
results = evaluator.apply(evaluationName="parameterSweep1", saveVisualization=True)
results = evaluator.apply(evaluationName="parameterSweep1", saveComparison=True)

# Get and display the best result from the grid
bestResult = evaluator.getBestResult()
Expand Down
2 changes: 1 addition & 1 deletion examples/3-custom-evaluations/grid-customEvaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Run the grid evaluation
# This will evaluate all combinations of the variable parameters
# while keeping other parameters at their optimal values
results = evaluator.apply(evaluationName="parameterSweep1", saveVisualization=True)
results = evaluator.apply(evaluationName="parameterSweep1", saveComparison=True)

# Get and display the best result from the grid
bestResult = evaluator.getBestResult()
Expand Down
2 changes: 1 addition & 1 deletion examples/3-custom-evaluations/repeated-customEvaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@

# Run the repeated evaluation
# Uses the same process sequence as the loaded optimization run
results = evaluator.apply(evaluationName="repeatedEvaluation", saveVisualization=True)
results = evaluator.apply(evaluationName="repeatedEvaluation", saveComparison=True)
2 changes: 1 addition & 1 deletion examples/sensitivityAnalysis/globalSensitivityStudy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
gss.setSamplingOptions(numSamples=1000, secondOrder=True)

# Run the sensitivity analysis
gss.apply(saveVisualization=False)
gss.apply(saveComparison=False)
6 changes: 2 additions & 4 deletions examples/sensitivityAnalysis/parameterStudies.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
}

evaluator.setVariableValues(singleParamValues)
results = evaluator.apply(
evaluationName="singleParameterSweep", saveVisualization=False
)
results = evaluator.apply(evaluationName="singleParameterSweep", saveComparison=False)

print(f"Evaluated {len(results)} parameter combinations")
bestResult = evaluator.getBestResult()
Expand All @@ -47,7 +45,7 @@
}

evaluator2.setVariableValues(twoParamValues)
results2 = evaluator2.apply(evaluationName="twoParameterStudy", saveVisualization=False)
results2 = evaluator2.apply(evaluationName="twoParameterStudy", saveComparison=False)

print(f"Evaluated {len(results2)} parameter combinations")
bestResult2 = evaluator2.getBestResult()
Expand Down
6 changes: 3 additions & 3 deletions src/viennafit/fitDistanceMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,15 @@ def _compareChamfer(
the RMS Chamfer distance which provides a robust measure of shape similarity.

Args:
domain1: Target domain (reference)
domain2: Sample domain (to compare)
domain1: Sample domain (result to compare)
domain2: Target domain (reference)
saveComparison: Whether to save visualization files
writePath: Path for saving visualization files

Returns:
RMS Chamfer distance between the two surfaces
"""
cch = vls.CompareChamfer(domain1, domain2)
cch = vls.CompareChamfer(domain2, domain1)

if saveComparison:
targetMesh = vls.Mesh()
Expand Down