[ana6, com8]: Add ana6Optimisation Module, apply changes in com8MoTPSA#1245
[ana6, com8]: Add ana6Optimisation Module, apply changes in com8MoTPSA#1245RolandFischbacher wants to merge 37 commits into
Conversation
Analysis for project
|
| Tool | Category | Rule | Count | |
|---|---|---|---|---|
| ruff | Lint | Local variable e is assigned to but never used |
3 | ❌ |
| black | Style | Incorrect formatting, autoformat by running qlty fmt. |
3 | ❌ |
| ripgrep | Lint | # TODO: make layer information more prominent - handle differently? | 3 | ❌ |
| ruff | Lint | avaframe\.runScripts\.runPlotAreaRefDiffs\.createArealIndicatorPickle imported but unused |
1 | ❌ |
| qlty | Structure | Function with many parameters (count = 12): plotAreaDiff | 2 |
@qltysh one-click actions:
- Auto-fix formatting (
qlty fmt && git push)
f66f702 to
38e42ca
Compare
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
|
Coverage Impact ⬇️ Merging this pull request will decrease total coverage on Modified Components (1)
Modified Files with Diff Coverage (2)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
- Add bounds to paramValuesD in createSamplesWithVariation (StandardParameters) - Add writing of visualisation scenario and sampling method to com8MoTPSACfg.ini
…IMECcfg.ini settings and not pass AIMEC module for calcArealIndicatorsAndAIMEC
…st runoutLineDiff comparison and only for one simulation not all always
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| # inDir = pathlib.Path(avalancheDir, ("Outputs/%s/configurationFiles" % modName)) | ||
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| # inDir = pathlib.Path(avalancheDir, ("Outputs/%s/configurationFiles" % modName)) | ||
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| # inDir = pathlib.Path(avalancheDir, ("Outputs/%s/configurationFiles" % modName)) | ||
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| # inDir = pathlib.Path(avalancheDir, ("Outputs/%s/configurationFiles" % modName)) | ||
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| # inDir = pathlib.Path(avalancheDir, ("Outputs/%s/configurationFiles" % modName)) | ||
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| ) | ||
| configFound = True | ||
| except (NotADirectoryError, FileNotFoundError) as e: | ||
| configFound = False |
| from avaframe.com1DFA import com1DFA | ||
| from avaframe.ana3AIMEC import ana3AIMEC | ||
| from avaframe.ana4Stats import probAna | ||
| from avaframe.runScripts.runPlotAreaRefDiffs import runPlotAreaRefDiffs, createArealIndicatorPickle |
There was a problem hiding this comment.
| """ | ||
|
|
||
| # Areal indicators | ||
| # TODO: make layer information more prominent - handle differently? |
| # Read parameterSetDF | ||
| # paramSetDF = readParamSetDF(inDir, varParList) | ||
| # ------------------------- | ||
| # TODO: consider using cfgHandling/createInfoDF instead |
| inputsDF = ( | ||
| inputsDF.reset_index().merge(configurationDF, on=["simName", "modelType"]).set_index("index") | ||
| ) | ||
| except (NotADirectoryError, FileNotFoundError) as e: |
| keepColumnsCleaned = [kC for kC in keepColumns if kC in inputsDF.columns] | ||
| infoDF = inputsDF[keepColumnsCleaned + ["parameterSet"]] | ||
|
|
||
| # TODO: this is required in ana6Optimisation |
| indicatorDict, | ||
| simName, | ||
| cropFile=None, | ||
| Tversky="", |
| alpha, | ||
| beta, | ||
| allResults, | ||
| resType, |

This PR introduces a new optimisation module
ana6Optimisationforcom8MoTPSAand updates the simulation workflow.The module ana6Optimisation includes:
New files in ana6Opitmisaton:
runMorrisSA.py(configuration:runMorrisSACfg.ini)runPlotMorrisConvergence.py(usesrunMorrisSACfg.ini)runOptimisation.py(configuration:runOptimisationCfg.ini)optimisationUtils.pyREADME_ana6.md(contains usage instructions)New file in out3Plot:
outAna6Plots.pyChanged workflow of runing com8MoTPSA: