From 7d5dc4fc95e4e7ac2fa55c43233e9aafd51a044f Mon Sep 17 00:00:00 2001 From: hvasbath Date: Sun, 21 Aug 2022 23:34:31 +0200 Subject: [PATCH] beat: create proj_dir only on init and clone, cleanup --- beat/apps/beat.py | 15 ++++++++++----- data/examples/MTQT_polarity/config_geometry.yaml | 4 ++-- docs/examples/MTQT_polarity.rst | 14 +++++++------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/beat/apps/beat.py b/beat/apps/beat.py index 9a1c970f..125ef65c 100644 --- a/beat/apps/beat.py +++ b/beat/apps/beat.py @@ -163,7 +163,6 @@ def get_project_directory(args, options, nargs=1, popflag=False): def process_common_options(options, project_dir): - util.ensuredir(project_dir) utility.setup_logging(project_dir, options.loglevel, logfilename="BEAT_log.txt") @@ -195,7 +194,9 @@ def cl_parse(command, args, setup=None, details=None): add_common_options(parser) (options, args) = parser.parse_args(args) project_dir = get_project_directory(args, options, nargs_dict[command]) - process_common_options(options, project_dir) + + if command != "init": + process_common_options(options, project_dir) return parser, options, args @@ -215,6 +216,9 @@ def get_sampled_slip_variables(config): def command_init(args): + + command_str = "init" + def setup(parser): parser.add_option( @@ -331,6 +335,10 @@ def setup(parser): name = args[0] date = None + project_dir = pjoin(os.path.abspath(options.main_path), name) + + util.ensuredir(project_dir) + process_common_options(options, project_dir) return bconfig.init_config( name, date, @@ -1477,9 +1485,6 @@ def setup(parser): "To start calculations set --execute!" % datatype ) - if options.execute: - logger.info("%s GF calculations successful!" % datatype) - elif options.mode == ffi_mode_str: from beat import ffi diff --git a/data/examples/MTQT_polarity/config_geometry.yaml b/data/examples/MTQT_polarity/config_geometry.yaml index e481ed49..9ae36d50 100644 --- a/data/examples/MTQT_polarity/config_geometry.yaml +++ b/data/examples/MTQT_polarity/config_geometry.yaml @@ -124,12 +124,12 @@ polarity_config: !beat.PolarityConfig - !beat.PolarityFitConfig name: any_P include: true - polarities_marker_path: ./Polarity_tutorial/polarity_markers_P.pf + polarities_marker_path: ./MTQT_polarity/polarity_markers_P.pf blacklist: - EO.KSM02 - PQ.NBC7 gf_config: !beat.PolarityGFConfig - store_superdir: /home/vasyurhm/BEATS/GF + store_superdir: ./MTQT_polarity reference_model_idx: 0 n_variations: - 0 diff --git a/docs/examples/MTQT_polarity.rst b/docs/examples/MTQT_polarity.rst index 9e851022..7394a4c5 100644 --- a/docs/examples/MTQT_polarity.rst +++ b/docs/examples/MTQT_polarity.rst @@ -198,13 +198,13 @@ Optimization setup For this setup we use the moment tensor parameterisation of the MTQTSource after [TapeTape2015]_. This is defined in the *problem_config* (source specification):: -problem_config: !beat.ProblemConfig - mode: geometry - source_type: MTQTSource - stf_type: Triangular - n_sources: 1 - datatypes: - - polarity + problem_config: !beat.ProblemConfig + mode: geometry + source_type: MTQTSource + stf_type: Triangular + n_sources: 1 + datatypes: + - polarity Finally, we need to configure *priors* and *hyperparameters*::