diff --git a/wetb/prepost/Simulations.py b/wetb/prepost/Simulations.py index e46312e5cca7cc17b679c4a0b840ee909aa5d2ad..4081a76e60ccbde79045beabc3169664b3613e31 100755 --- a/wetb/prepost/Simulations.py +++ b/wetb/prepost/Simulations.py @@ -559,7 +559,8 @@ def prepare_launch(iter_dict, opt_tags, master, variable_tag_func, update_cases=False, ignore_non_unique=False, wine_appendix='', run_only_new=False, windows_nr_cpus=2, wine_64bit=False, pbs_fname_appendix=True, short_job_names=True, qsub='', - update_model_data=True, maxcpu=1, pyenv='wetb_py3'): + update_model_data=True, maxcpu=1, pyenv='wetb_py3', + m=[3,4,6,8,9,10,12]): """ Create the htc files, pbs scripts and replace the tags in master file ===================================================================== @@ -799,7 +800,7 @@ def prepare_launch(iter_dict, opt_tags, master, variable_tag_func, copyback_turb=copyback_turb, qsub=qsub, wine_appendix=wine_appendix, windows_nr_cpus=windows_nr_cpus, short_job_names=short_job_names, pbs_fname_appendix=pbs_fname_appendix, silent=silent, maxcpu=maxcpu, - pyenv=pyenv, wine_64bit=wine_64bit) + pyenv=pyenv, wine_64bit=wine_64bit, m=[3,4,6,8,9,10,12]) return cases @@ -1000,7 +1001,7 @@ def prepare_launch_cases(cases, runmethod='gorm', verbose=False,write_htc=True, def launch(cases, runmethod='none', verbose=False, copyback_turb=True, silent=False, check_log=True, windows_nr_cpus=2, qsub='time', wine_appendix='', pbs_fname_appendix=True, short_job_names=True, - maxcpu=1, pyenv='wetb_py3', wine_64bit=False): + maxcpu=1, pyenv='wetb_py3', wine_64bit=False, m=[3,4,6,8,9,10,12]): """ The actual launching of all cases in the Cases dictionary. Note that here only the PBS files are written and not the actuall htc files. @@ -1041,7 +1042,8 @@ def launch(cases, runmethod='none', verbose=False, copyback_turb=True, # create the pbs object pbs = PBS(cases, short_job_names=short_job_names, pyenv=pyenv, pbs_fname_appendix=pbs_fname_appendix, qsub=qsub, - verbose=verbose, silent=silent, wine_64bit=wine_64bit) + verbose=verbose, silent=silent, wine_64bit=wine_64bit, + m=m) pbs.wine_appendix = wine_appendix pbs.copyback_turb = copyback_turb pbs.pbs_out_dir = pbs_out_dir @@ -1931,7 +1933,7 @@ class PBS(object): def __init__(self, cases, qsub='time', silent=False, pyenv='wetb_py3', pbs_fname_appendix=True, short_job_names=True, verbose=False, - wine_64bit=False): + wine_64bit=False, m=[3,4,6,8,9,10,12]): """ Define the settings here. This should be done outside, but how? In a text file, paramters list or first create the object and than set @@ -1965,6 +1967,8 @@ class PBS(object): self.pyenv = pyenv self.pyenv_cmd = 'source /home/python/miniconda3/bin/activate' + self.m = m + # run in 32-bit or 64-bit mode. Note this uses the same assumptions # on how to configure wine in toolbox/pbsutils/config-wine-hawc2.sh wineparam = ('win32', '~/.wine32') @@ -2335,7 +2339,7 @@ class PBS(object): param = (self.winenumactl, hawc2_exe, self.htc_dir+case, self.wine_appendix) self.pbs += ' echo "execute HAWC2, do not fork and wait"\n' - self.pbs += " %s %s ./%s %s\n" % param + self.pbs += " " + ("%s %s ./%s %s" % param).strip() + "\n" self.pbs += ' echo "POST-PROCESSING"\n' self.pbs += " " self.checklogs() @@ -2695,8 +2699,9 @@ class PBS(object): """ self.pbs += 'python -c "from wetb.prepost import statsdel; ' fsrc = os.path.join(self.results_dir, self.case) - rpl = (fsrc, str(self.case_duration), '.csv') - self.pbs += ('statsdel.calc(\'%s\', no_bins=46, m=[3, 4, 6, 8, 10, 12], ' + mstr = ','.join([str(k) for k in self.m]) + rpl = (fsrc, mstr, str(self.case_duration), '.csv') + self.pbs += ('statsdel.calc(\'%s\', no_bins=46, m=[%s], ' 'neq=%s, i0=0, i1=None, ftype=\'%s\')"\n' % rpl) def check_results(self, cases): diff --git a/wetb/prepost/dlctemplate.py b/wetb/prepost/dlctemplate.py index 39afc1c9a23e85fc8c8e24f6e2bf090f06eb6d8c..b4ba1ac25728363cc21718919007e2bd246b64a8 100644 --- a/wetb/prepost/dlctemplate.py +++ b/wetb/prepost/dlctemplate.py @@ -265,8 +265,9 @@ def variable_tag_func_mod1(master, case_id_short=False): def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, runmethod=None, write_htc=True, zipchunks=False, - walltime='04:00:00', postpro_node=False, - dlcs_dir='htc/DLCs', compress=False, wine_64bit=False): + walltime='04:00:00', postpro_node=False, compress=False, + dlcs_dir='htc/DLCs', wine_64bit=False, + m=[3,4,6,8,9,10,12]): """ Launch load cases defined in Excel files """ @@ -329,7 +330,7 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, ignore_non_unique=False, run_only_new=False, pbs_fname_appendix=False, short_job_names=False, silent=silent, verbose=verbose, pyenv=pyenv, - wine_64bit=wine_64bit) + wine_64bit=wine_64bit, m=[3,4,6,8,9,10,12]) if pbs_turb: # to avoid confusing HAWC2 simulations and Mann64 generator PBS files, @@ -360,7 +361,7 @@ def launch_dlcs_excel(sim_id, silent=False, verbose=False, pbs_turb=False, def post_launch(sim_id, statistics=True, rem_failed=True, check_logs=True, force_dir=False, update=False, saveinterval=2000, csv=False, - m=[1, 3, 4, 5, 6, 8, 10, 12, 14], neq=1e7, no_bins=46, + m=[3, 4, 6, 8, 9, 10, 12], neq=1e7, no_bins=46, years=20.0, fatigue=True, A=None, AEP=False, save_new_sigs=False, envelopeturbine=False, envelopeblade=False, save_iter=False, pbs_failed_path=False): @@ -468,7 +469,7 @@ def post_launch(sim_id, statistics=True, rem_failed=True, check_logs=True, return df_stats, df_AEP, df_Leq -def postpro_node_merge(tqdm=False, zipchunks=False): +def postpro_node_merge(tqdm=False, zipchunks=False, m=[3,4,6,8,9,10,12]): """With postpro_node each individual case has a .csv file for the log file analysis and a .csv file for the statistics tables. Merge all these single files into one table/DataFrame. @@ -521,8 +522,8 @@ def postpro_node_merge(tqdm=False, zipchunks=False): store = pd.HDFStore(fdf, mode='w', format='table', complevel=9, complib='zlib') colnames = ['channel', 'max', 'min', 'mean', 'std', 'range', - 'absmax', 'rms', 'int', 'm=3', 'm=4', 'm=6', 'm=8', 'm=10', - 'm=12', 'intabs', '[case_id]'] + 'absmax', 'rms', 'int', 'intabs', '[case_id]'] + colnames.extend(['m=%1.0f' % k for k in m]) dtypes = {col:np.float64 for col in colnames} dtypes['channel'] = str dtypes['[case_id]'] = str @@ -663,6 +664,9 @@ if __name__ == '__main__': 'Only works on Jess.') opt = parser.parse_args() + # Wholer coefficients to be considered for the fatigue analysis + m = [3, 4, 6, 8, 9, 10, 12] + # ------------------------------------------------------------------------- # # manually configure paths, HAWC2 model root path is then constructed as # # p_root_remote/PROJECT/sim_id, and p_root_local/PROJECT/sim_id @@ -717,7 +721,7 @@ if __name__ == '__main__': envelopeturbine=opt.envelopeturbine, envelopeblade=opt.envelopeblade) if opt.postpro_node_merge: - postpro_node_merge(zipchunks=opt.zipchunks) + postpro_node_merge(zipchunks=opt.zipchunks, m=m) if opt.dlcplot: plot_chans = {} plot_chans['$B1_{flap}$'] = ['setbeta-bladenr-1-flapnr-1'] diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p index 5fed071645069f93274c75bea5670a86862c0732..fc26cf63b9534ec14d1a424cce1ebde3fbd6a40d 100644 --- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p +++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p @@ -68,10 +68,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then # find+xargs mode: 1 PBS job, multiple cases else echo "execute HAWC2, do not fork and wait" - time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp10_s100.htc + time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp10_s100.htc echo "POST-PROCESSING" python -c "from wetb.prepost import statsdel; statsdel.logcheck('logfiles/dlc01_demos/dlc01_steady_wsp10_s100.log')" - python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp10_s100', no_bins=46, m=[3, 4, 6, 8, 10, 12], neq=20.0, i0=0, i1=None, ftype='.csv')" + python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp10_s100', no_bins=46, m=[3,4,6,8,9,10,12], neq=20.0, i0=0, i1=None, ftype='.csv')" fi # ------------------------------------------------------------------------------ diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p index b2db53ba4f4a4b07fe83d39dec0f3b9b8b695c86..d464f905ac1232f363356dc828f4a436781f36a9 100644 --- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p +++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p @@ -68,10 +68,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then # find+xargs mode: 1 PBS job, multiple cases else echo "execute HAWC2, do not fork and wait" - time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp11_s101.htc + time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp11_s101.htc echo "POST-PROCESSING" python -c "from wetb.prepost import statsdel; statsdel.logcheck('logfiles/dlc01_demos/dlc01_steady_wsp11_s101.log')" - python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp11_s101', no_bins=46, m=[3, 4, 6, 8, 10, 12], neq=20.0, i0=0, i1=None, ftype='.csv')" + python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp11_s101', no_bins=46, m=[3,4,6,8,9,10,12], neq=20.0, i0=0, i1=None, ftype='.csv')" fi # ------------------------------------------------------------------------------ diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p index 4fe00308ffdf95d83e3b21a96f3e6072be7d9831..3ad903f889cb7e54c7ee89cfc162d1311a02d6a3 100644 --- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p +++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p @@ -68,10 +68,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then # find+xargs mode: 1 PBS job, multiple cases else echo "execute HAWC2, do not fork and wait" - time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp8_noturb.htc + time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp8_noturb.htc echo "POST-PROCESSING" python -c "from wetb.prepost import statsdel; statsdel.logcheck('logfiles/dlc01_demos/dlc01_steady_wsp8_noturb.log')" - python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp8_noturb', no_bins=46, m=[3, 4, 6, 8, 10, 12], neq=20.0, i0=0, i1=None, ftype='.csv')" + python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp8_noturb', no_bins=46, m=[3,4,6,8,9,10,12], neq=20.0, i0=0, i1=None, ftype='.csv')" fi # ------------------------------------------------------------------------------ diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p index 237970bb3702b5fb37eeeae9cf553fe2930e3c68..7afc37a7f7b65a544ab78b97208257546fb32759 100644 --- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p +++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p @@ -68,10 +68,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then # find+xargs mode: 1 PBS job, multiple cases else echo "execute HAWC2, do not fork and wait" - time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp9_noturb.htc + time WINEARCH=win32 WINEPREFIX=~/.wine32 numactl --physcpubind=$CPU_NR wine hawc2-latest ./htc/dlc01_demos/dlc01_steady_wsp9_noturb.htc echo "POST-PROCESSING" python -c "from wetb.prepost import statsdel; statsdel.logcheck('logfiles/dlc01_demos/dlc01_steady_wsp9_noturb.log')" - python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp9_noturb', no_bins=46, m=[3, 4, 6, 8, 10, 12], neq=20.0, i0=0, i1=None, ftype='.csv')" + python -c "from wetb.prepost import statsdel; statsdel.calc('res/dlc01_demos/dlc01_steady_wsp9_noturb', no_bins=46, m=[3,4,6,8,9,10,12], neq=20.0, i0=0, i1=None, ftype='.csv')" fi # ------------------------------------------------------------------------------