Skip to content

[ana6, com8]: Add ana6Optimisation Module, apply changes in com8MoTPSA#1245

Open
RolandFischbacher wants to merge 3 commits into
masterfrom
RF_com8MoTPSA
Open

[ana6, com8]: Add ana6Optimisation Module, apply changes in com8MoTPSA#1245
RolandFischbacher wants to merge 3 commits into
masterfrom
RF_com8MoTPSA

Conversation

@RolandFischbacher

Copy link
Copy Markdown
Contributor

This PR introduces a new optimisation module ana6Optimisation for com8MoTPSA and updates the simulation workflow.


The module ana6Optimisation includes:

  • Calculation of combined loss function (runout + tversky)
  • Morris sensitivity analysis for parameter ranking
  • Sequential and non-sequential surrogate based optimisation routines

New files in ana6Opitmisaton:

  • runMorrisSA.py (configuration: runMorrisSACfg.ini)
  • runPlotMorrisConvergence.py (uses runMorrisSACfg.ini)
  • runOptimisation.py (configuration: runOptimisationCfg.ini)
  • optimisationUtils.py
  • README_ana6.md (contains usage instructions)

New file in out3Plot:

  • outAna6Plots.py

Changed workflow of runing com8MoTPSA:

  • Check prior if simulation is run already
  • Process in chunks not all simulations at once

@RolandFischbacher RolandFischbacher self-assigned this Feb 23, 2026
@RolandFischbacher RolandFischbacher added the enhancement New feature or request label Feb 23, 2026
@qltysh

qltysh Bot commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

Analysis for project AvaFrame

❌ 3 blocking issues (3 total)

Tool Category Rule Count
black Style Incorrect formatting, autoformat by running qlty fmt. 3

@qltysh one-click actions:

  • Auto-fix formatting (qlty fmt && git push)

Comment thread avaframe/ana3AIMEC/aimecTools.py Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/out3Plot/outAna6Plots.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/ana3AIMEC/aimecTools.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/out3Plot/outQuickPlot.py Outdated
Comment thread avaframe/out3Plot/outQuickPlot.py Outdated
Comment thread avaframe/out3Plot/outQuickPlot.py Outdated
Comment thread avaframe/out3Plot/outQuickPlot.py Outdated
Comment thread avaframe/out3Plot/outQuickPlot.py Outdated
@fso42 fso42 added this to the Version 2.0 milestone Feb 23, 2026
@fso42 fso42 changed the title [ana6Opitmisation], [com8MoTPSA]: Add ana6Optimisation Module, apply changes in com8MoTPSA [ana6, com8]: Add ana6Optimisation Module, apply changes in com8MoTPSA Feb 24, 2026
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana3AIMEC/aimecTools.py Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/com8MoTPSA/com8MoTPSA.py Outdated
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py Outdated
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py Outdated
Comment thread avaframe/out3Plot/outAIMEC.py Outdated
Comment thread avaframe/out3Plot/outAIMEC.py
@fso42 fso42 assigned fso42 and unassigned RolandFischbacher Feb 24, 2026
Squash of 20 commits from RF_com8MoTPSA branch including:
- com8MoTPSA workflow improvements (chunked multiprocessing, path handling)
- Bayesian optimisation integration (ana6Optimisation module)
- Morris sensitivity analysis scripts
- AIMEC runout reference implementation
- probAna pickle saving and bounds
- Plotting and config improvements
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/com8MoTPSA/com8MoTPSA.py Outdated
Comment thread avaframe/com8MoTPSA/com8MoTPSA.py
@qltysh

qltysh Bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Qlty

Coverage Impact

⬇️ Merging this pull request will decrease total coverage on master by 0.19%.

Modified Components (1)

RatingComponent% Diff
Coverage rating: C Coverage rating: C
com1DFA

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: F Coverage rating: F
avaframe/com8MoTPSA/com8MoTPSA.py0.0%21-182
Coverage rating: A Coverage rating: A
avaframe/in3Utils/cfgUtils.py71.4%995, 1016
Total10.0%
🤖 Increase coverage with AI coding...

In the `RF_com8MoTPSA` branch, add test coverage for this new code:

- `avaframe/com8MoTPSA/com8MoTPSA.py` -- Line 21-182
- `avaframe/in3Utils/cfgUtils.py` -- Lines 995 and 1016

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@fso42 fso42 assigned RolandFischbacher and unassigned fso42 Feb 24, 2026
Comment thread avaframe/runScripts/runPlotAreaRefDiffs.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/out3Plot/outAna6Plots.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana4Stats/probAna.py Outdated
Comment thread avaframe/ana6Optimisation/runOptimisation.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
@OpenNHM OpenNHM deleted a comment from qltysh Bot Feb 27, 2026
@OpenNHM OpenNHM deleted a comment from qltysh Bot Feb 27, 2026
Comment thread avaframe/ana4Stats/probAna.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/com8MoTPSA/com8MoTPSA.py
Comment thread avaframe/out3Plot/outAna6Plots.py

@awirb awirb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first comments, more to come

Comment thread avaframe/in3Utils/cfgUtils.py
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini Outdated
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/runMorrisSACfg.ini
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini

@awirb awirb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments for the optimisation part and plotting still missing

Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/runMorrisSA.py
Comment thread avaframe/ana6Optimisation/runMorrisSA.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/runMorrisSACfg.ini Outdated
Comment thread avaframe/ana6Optimisation/runOptimisation.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/optimisationUtils.py Outdated
Comment thread avaframe/ana6Optimisation/runOptimisationCfg.ini Outdated
Comment thread avaframe/ana6Optimisation/runOptimisation.py Outdated
Comment thread avaframe/ana6Optimisation/runOptimisation.py
Comment thread avaframe/out3Plot/outAna6Plots.py Outdated
Comment thread avaframe/out3Plot/outAna6Plots.py
Comment thread avaframe/out3Plot/outAna6Plots.py
@fso42 fso42 modified the milestones: Version 2.0, Version 2.1 Apr 7, 2026
@awirb awirb self-assigned this May 5, 2026
@fso42 fso42 modified the milestones: Version 2.1, Version 2.2 May 19, 2026
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana3AIMEC/ana3AIMEC.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/in3Utils/cfgHandling.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
Comment thread avaframe/out1Peak/outPlotAllPeakDiffs.py
RolandFischbacher and others added 2 commits July 8, 2026 10:41
- fix(probAna): restore missing bounds and config writing after merge
  - Add bounds to paramValuesD in createSamplesWithVariation (StandardParameters)
  - Add writing of visualisation scenario and sampling method to com8MoTPSACfg.ini

- refactor(runScripts): `runPlotAreaRefDiffs`,removing unused conditions and checks

- fix: handle new _L1/_L2 naming in merging logic and rename some variables

- change function name, move parameter to ini file, change values of ini file, delete redundant code

- Add: if __name__ == '__main__'

- Fix: remove duplicate in com8MoTPSAMain and read chunkSize from avaframeCfg.ini nCPU

- Implement a direct call of com8MoTPSAMain with updated cfgs (writeCfgFiles in optimisationUtils.py), add possibility to RUN writeCfgFiles with counter

- Use logging instead of print in optimisationUtils.py

- Add sklearn (scikit-learn) to the requirements in pyproject.toml and clean header
- Implement modName to make code general and remove adjustText package

- Initialize index and sampleMethod with np.nan to avoid UnboundLocalError and stale values and remove copy paste error.

- Add a check if 'VISUALISATION' exists in cfgStart, if not, it will be added to cfgStart.
- And read sample method with fallback; meaning if 'PROBANA' or 'sampleMethod' is missing sample_method contains an empty string

- Make optimisationType case-insensitive, add raise ValueErrors, update docstring, tidy up code, add if __name__='__main__': in runPlotMorrisConvergence.py and improve BOConvergencePlot.

- Add description of Loss function to README_ana6.md and add parameter names from paper to com8MoTPSACfg.ini.

- Add description of Loss function to README_ana6.md.

- Add more info and layer handling in Cfg.ini files,swap scenario 1 and 2 (1 more important),

- Revise README_ana6.md

- Use cfg.getint(...) instead of int(cfg(...)), swap scenario 1 and 2 (consistent with runOptimisationCfg.ini) and add comments.

- Improve documentation, construct the filename of AIMEC results from AIMECcfg.ini settings and not pass AIMEC module for calcArealIndicatorsAndAIMEC

- Add definition of chunkSize to probAnaCfg.ini, if left empty 10 is used as default

- Fix typo in com8MoTPSACfg.ini and Fix cfg handling in runPlotMorrisConvergence.py

- Add y scaled boxplot and boxplot of simulations with no PSC

- Add information about sample size

- Add function: plotComparisonBoxplots
- adjust to work for com1DFA too

- simplify workflow so that not full aimec analysis is performed but just runoutLineDiff comparison and only for one simulation not all always

- move to separate functions, fix bugs

- add override settings required for aimec in optimisation

- move to config

- update README, adjust ini file, runscript, loop over sims, choose result layer

- adjust runscript

- adjust ini file

- loop over sims

- chose also result layer

- RF added: Move GP surrogate variables to ini file and update README_ana6.md
Comment thread avaframe/ana6Optimisation/README_ana6.md Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana4Stats/probAnaCfg.ini
Comment thread avaframe/ana6Optimisation/README_ana6.md
Comment thread avaframe/ana6Optimisation/README_ana6.md Outdated
Comment thread avaframe/ana6Optimisation/README_ana6.md Outdated
# Read scenario flag
scenario = cfgOpt.getint('PARAM_BOUNDS', 'scenario')

avaName = avaDir.split('/')[-1]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
avaName = avaDir.split('/')[-1]
avaName = pathlib.Path(avaDir).name

Comment thread avaframe/ana6Optimisation/optimisationUtils.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants