def run_sims(args, iterations, talent, covenant): # pylint: disable=import-outside-toplevel """run sims with the given config""" if args.local: from internal.simc import raidbots else: from internal.api import raidbots print("Running sims on {0} in {1}".format(config["simcBuild"], args.dir)) existing = listdir(args.dir + utils.get_simc_dir(talent, covenant, 'output')) profiles = listdir(args.dir + utils.get_simc_dir(talent, covenant, 'profiles')) count = 0 for profile in profiles: profile_name = re.search('((hm|lm|pw).+?(?=.simc)|dungeons.simc)', profile).group() count = count + 1 if not args.dungeons: weight = find_weights(config["compositeWeights"]).get(profile_name) else: weight = 1 print("Simming {0} out of {1}.".format(count, len(profiles))) output_name = profile.replace('simc', 'json') if output_name not in existing and weight > 0: output_location = args.dir + \ utils.get_simc_dir(talent, covenant, 'output') + output_name profile_location = args.dir + \ utils.get_simc_dir(talent, covenant, 'profiles') + profile # prefix the profile name with the base file name profile_name_with_dir = "{0}{1}".format(args.dir, profile_name) raidbots(get_api_key(args, config["simcBuild"]), profile_location, config["simcBuild"], output_location, profile_name_with_dir, iterations) elif weight == 0: print( "-- {0} has a weight of 0. Skipping file.".format(output_name)) else: print("-- {0} already exists. Skipping file.".format(output_name))
def analyze(talents, directory, dungeons, weights, timestamp, covenant): # pylint: disable=too-many-arguments, too-many-locals """main analyze function""" foldername = os.path.basename(os.getcwd()) # Move to correct outer folder while foldername != directory[:-1]: os.chdir("..") foldername = os.path.basename(os.getcwd()) csv = "{0}statweights.csv".format( utils.get_simc_dir(talents, covenant, 'output')) if weights: data = pandas.read_csv(csv, usecols=[ 'profile', 'actor', 'DD', 'DPS', 'int', 'haste', 'crit', 'mastery', 'vers' ]) else: data = pandas.read_csv(csv, usecols=['profile', 'actor', 'DD', 'DPS']) talent_string = "_{0}".format(talents) if talents else "" covenant_string = "_{0}".format(covenant) if covenant else "" sim_types = ["Dungeons"] if dungeons else ["Composite", "Single"] covenant_range = config["sims"][directory[:-1] ]["steps"][0] == "CovenantRange" for sim_type in sim_types: results = build_results(data, weights, sim_type, directory) base_dps = results.get('Base') if config["analyze"]["markdown"]: build_markdown(sim_type, talent_string, results, weights, base_dps, covenant_string) if config["analyze"]["csv"]: build_csv(sim_type, talent_string, results, weights, base_dps, covenant_string) # If covenant_range is true we skip building the json here to do it later if config["analyze"]["json"] and not covenant_range and not weights: build_json(sim_type, talent_string, results, directory, timestamp, covenant_string) # Check if we need to build extra JSON files if covenant_range: build_talented_covenant_json(talents) build_covenant_json() os.chdir("..")
def convert_to_csv(args, weights, talent, covenant): """creates results/statweights.txt""" results_dir = args.dir + utils.get_simc_dir(talent, covenant, 'output') parse_json(results_dir, weights)