<commit_before>import yt
import numpy as np
from matplotlib import pyplot as plt
import os

num_problems = 2

ncell = 64

vel_arr = [0, 1, 3, 10, 30, 100]

for p in range(num_problems):

    problem = p + 1

    for v in vel_arr:

        # First we load in the numerical data. We want to use the last plotfile
        # since that is at the time of interest.

        dir = "results/problem" + str(problem) + "/velocity" + str(v) + "/" + str(ncell)

        dir_contents = os.listdir(dir)

        # Strip out non-plotfiles, then select the last one in the list.

        plotfiles = sorted(filter(lambda s: s[0:3] == 'plt', dir_contents))

        pf_name = dir + "/" + plotfiles[len(plotfiles)-1]

        pf = yt.load(pf_name)

        plot = yt.SlicePlot(pf, 'z', "density", width=(1.0, 'cm'))
<commit_msg>Add ability of KH test analysis script to deal with plotfiles that reach six digits.<commit_after>import yt
import numpy as np
from matplotlib import pyplot as plt
import os

num_problems = 2

ncell = 512

vel_arr = [0, 1, 3, 10, 30, 100]

for p in range(num_problems):

    problem = p + 1

    for v in vel_arr:

        # First we load in the numerical data. We want to use the last plotfile
        # since that is at the time of interest.

        dir = "results/problem" + str(problem) + "/velocity" + str(v) + "/" + str(ncell)

        dir_contents = os.listdir(dir)

        # Strip out non-plotfiles, then select the first and last one in the list.

        plotfiles = sorted(filter(lambda s: s[0:3] == 'plt', dir_contents))

        # This step strips out 'plt' from each plotfile, sorts them numerically,
        # then recasts them as strings. This is necessary because we may have some
        # plotfiles with six digits and some with five, and the default sort will
        # not sort them properly numerically.

        plotfiles = ['plt' + str(y).zfill(5) for y in sorted([int(x[3:]) for x in plotfiles])]

        pf_name = dir + "/" + plotfiles[0]

        print pf_name

        pf = yt.load(pf_name)

        plot = yt.SlicePlot(pf, 'z', "density", width=(1.0, 'cm'))

        file_name = 'density_t0_p_' + str(problem) + '_v_' + str(v) + '_n_' + str(ncell) + '.eps'

        plot.save(file_name)

        pf_name = dir + "/" + plotfiles[len(plotfiles)-1]

        print pf_name

        pf = yt.load(pf_name)

        plot = yt.SlicePlot(pf, 'z', "density", width=(1.0, 'cm'))

{'fraction_non_alphanumeric': 0.11820821236001659, 'fraction_numerical': 0.018664454583160513, 'mean_word_length': 2.5575221238938055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6812133', 'n_tokens_mistral': 878, 'n_tokens_neox': 792, 'n_words': 281}