-
Notifications
You must be signed in to change notification settings - Fork 5
creating more stats plots #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| """ | ||
| Run script for computing statistics of results including the runout derived from aimec | ||
| """ | ||
|
|
||
| # Load modules | ||
| import os | ||
| import time | ||
| import glob | ||
| import configparser | ||
| import shutil | ||
| import pathlib | ||
| import pandas as pd | ||
| import numpy as np | ||
|
|
||
| # Local imports | ||
| from avaframe.out3Plot import statsPlots as sPlot | ||
| from avaframe.com1DFA import com1DFA | ||
| import avaframe.ana4Stats.probAna as probAna | ||
| from avaframe.ana4Stats import getStats | ||
| from avaframe.ana3AIMEC import ana3AIMEC, dfa2Aimec, aimecTools | ||
| from avaframe.in3Utils import initializeProject as initProj | ||
| from avaframe.in3Utils import fileHandlerUtils as fU | ||
| from avaframe.log2Report import generateReport as gR | ||
| from avaframe.out1Peak import outPlotAllPeak as oP | ||
| from avaframe.out3Plot import plotUtils | ||
| from avaframe.in3Utils import cfgUtils | ||
| from avaframe.in3Utils import logUtils | ||
| from avaframe.runScripts import runAna3AIMEC as rAimec | ||
|
|
||
|
|
||
| # log file name; leave empty to use default runLog.log | ||
| logName = 'runStatsPlots' | ||
| modName = 'com1DFA' | ||
|
|
||
| # Load general configuration filee | ||
| cfgMain = cfgUtils.getGeneralConfig() | ||
| flagShow = cfgMain['FLAGS'].getboolean('showPlot') | ||
|
|
||
| avaDir = cfgMain['MAIN']['avalancheDir'] | ||
| cfgStats = cfgUtils.getModuleConfig(getStats) | ||
| cfg = cfgStats['GENERAL'] | ||
|
|
||
| # set output directory, first ava in list | ||
| outDir = os.path.join(avaDir, 'Outputs', 'ana4Stats') | ||
| cfgStats['GENERAL']['outDir'] = outDir | ||
| cfgStats['GENERAL']['avalancheDir'] = avaDir | ||
|
|
||
| # Specify where you want the results to be stored | ||
| fU.makeADir(outDir) | ||
|
|
||
| # Start logging | ||
| log = logUtils.initiateLogger(outDir, logName) | ||
|
|
||
| # requires aimec output resAnalysisDF files if not already create set aimec flag to True | ||
| if cfgStats['GENERAL'].getboolean('aimec'): | ||
| # clean all existing aimec files first | ||
| initProj.cleanModuleFiles(avaDir, ana3AIMEC) | ||
| # fetch config for aimec | ||
| cfgAIMEC = cfgUtils.getModuleConfig(ana3AIMEC) | ||
| # run aimec | ||
| pathDict, rasterTransfo, resAnalysisDF, plotDict = rAimec.runAna3AIMEC(avaDir, cfgAIMEC) | ||
|
|
||
| # load results from aimec | ||
| pathToCsv = pathlib.Path(avaDir, 'Outputs', 'ana3AIMEC', modName) | ||
| resAnalysisDFFiles = list(pathToCsv.glob('*resAnalysisDF.csv')) | ||
| if len(resAnalysisDFFiles) > 1: | ||
| log.warning('Multiple resAnalysisDF files found, taking only first one: %s' % resAnalysisDFFiles[0]) | ||
| elif len(resAnalysisDFFiles) == 0: | ||
| message = 'No resAnalysisDF file found' | ||
| log.error(message) | ||
| raise FileNotFoundError | ||
|
|
||
| # load dataframe | ||
| resAnalysisDF = pd.read_csv(resAnalysisDFFiles[0]) | ||
|
|
||
| # filter simulations | ||
| parametersDict = fU.getFilterDict(cfgStats, 'FILTER') | ||
|
|
||
| # ------- runout histogram plot | ||
| sPlot.resultHistPlot(cfgStats['GENERAL'], resAnalysisDF, xName='sRunout', scenario='scenario', | ||
| stat='probability', parametersDict=parametersDict) | ||
|
|
||
| # -------- max result values scatter plot | ||
| sPlot.plotDistFromDF(cfgStats['GENERAL'], resAnalysisDF, name1='pftFieldMax', | ||
| name2='pfvFieldMax', scenario='scenario', parametersDict=parametersDict, type='') |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.