<commit_before>import os
import shutil

import numpy as np
from random import random, choice

from htsohm import binning as bng
from htsohm import simulate as sim
from htsohm.runDB_declarative import session, RunData

def first_s(run_id, strength_0):       # Creates `strength` array

    bins = bng.check_number_of_bins(run_id)

    s_array = np.zeros([bins, bins, bins])

    for i in range(bins):
        for j in range(bins):
            for k in range(bins):
                s_array[i, j, k] = strength_0

    wd = os.environ['HTSOHM_DIR']
    np.save(wd + '/' + run_id, s_array)


def calculate_s(run_id, generation):

    wd = os.environ['HTSOHM_DIR']

    with open(wd + '/' + run_id + '.txt') as origin:
        for line in origin:
            if "Children per generation:" in line:
                children_per_generation = int(line.split()[3])
    first = generation * children_per_generation
    last = (generation + 1) * children_per_generation
    child_ids = np.arange(first, last)
    seed_ids = np.arange(0, children_per_generation)

    strength_0 = np.load(wd + '/' + run_id + '.npy')       # Load strength-parameter array

    parent_list = []
    for i in child_ids:
        child = session.query(RunData).filter(RunData.run_id == run_id,
                                              RunData.material_id == str(i))<commit_msg>moved .npy from . to ./output<commit_after>import os
import shutil

import numpy as np
from random import random, choice

from htsohm import binning as bng
from htsohm import simulate as sim
from htsohm.runDB_declarative import session, RunData

def first_s(run_id, strength_0):       # Creates `strength` array

    bins = bng.check_number_of_bins(run_id)

    s_array = np.zeros([bins, bins, bins])

    for i in range(bins):
        for j in range(bins):
            for k in range(bins):
                s_array[i, j, k] = strength_0

    wd = os.environ['HTSOHM_DIR']
    np.save(wd + '/output' + run_id, s_array)


def calculate_s(run_id, generation):

    wd = os.environ['HTSOHM_DIR']

    with open(wd + '/' + run_id + '.txt') as origin:
        for line in origin:
            if "Children per generation:" in line:
                children_per_generation = int(line.split()[3])
    first = generation * children_per_generation
    last = (generation + 1) * children_per_generation
    child_ids = np.arange(first, last)
    seed_ids = np.arange(0, children_per_generation)

    strength_0 = np.load(wd + '/' + run_id + '.npy')       # Load strength-parameter array

    parent_list = []
    for i in child_ids:
        child = session.query(RunData).filter(RunData.run_id == run_id,
                                              RunData.material_id == str(i))
{'fraction_non_alphanumeric': 0.10522442972774099, 'fraction_numerical': 0.004415011037527594, 'mean_word_length': 2.5870712401055407, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1305519', 'n_tokens_mistral': 923, 'n_tokens_neox': 868, 'n_words': 236}