<jupyter_start><jupyter_text>Reading parameters.out<jupyter_code>class ParametersOut:
    def __init__(self, filename):
        self.level_blocks = []
        with open(filename, 'r') as f:
            file = f.read()
            lines = np.array(file.split('\n'))
            blank_line_indices = np.where('' == np.array(lines))[0]
            n = len(blank_line_indices)
            for i in range(n-2):
                block = lines[blank_line_indices[i]+1:blank_line_indices[i+1]]
                self.level_blocks.append(LevelBlock(block))
    
    
class LevelBlock:
    def __init__(self, lines):
        num_lines = len(lines)
        
        first_line = lines[0].split()
        Jpi = first_line[2]
        self.J  = float(Jpi[:-1])
        self.pi = 1 if Jpi[-1] == '+' else -1
        self.E_level = float(first_line[5])
        self.E_level_units = first_line[6]
        
        self.lines = []
        for i in range(1, num_lines):
            self.lines.append(Line(lines[i]))
            
                
                
class Line:
    def __init__(self, line):
        self.values = {}
        self.line = np.array(line.split())
        ii = np.where('=' == self.line)[0] - 1
        n = len(ii)
        for j in range(n-1):
            self.values[self.line[ii[j]]] = ' '.join(self.line[ii[j]+2:ii[j+1]])
        self.values[self.line[ii[n-1]]] = ' '.join(self.line[ii[n-1]+2:])
po = ParametersOut('output/parameters.out')
# for lb in po.level_blocks:
#     for l in lb.lines:
#         for v in l.values:
#             print(v, l.values[v])<jupyter_output><empty_output><jupyter_text>Reading param.errors<jupyter_code>with open('output/param.errors', 'r') as f:
    file = f.read()
for l in list(filter(lambda l: l is not '', file.split('\n'))):
    print(l.split())
class ParamErrors:
    def __init__(self, filename):
        self.params = []
        with open(filename, 'r') as f:
            self.lines = list(filter(lambda l: l is not '', f.read().split('\n')))
            for l in self.lines:
                self.params.append(Param(l))

class Param:
    def __init__(self, line):
        self.line  = line.split()
        self.label = ParamLabel(self.line[0])
        self.value = float(self.line[1])
        self.plus  = float(self.line[2])
        self.minus = float(self.line[3])
        self.varied = (self.plus != 0 or self.minus != 0)
        
        
class ParamLabel:
    def __init__(self, label):
        self.components = label.split('_')
        self.type = self.components[-1]
        s = self.components[0]
        if self.type != 'norm':
            self.j = int(s[2:])
pe = ParamErrors('output/param.errors')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15625, 'fraction_numerical': 0.011160714285714286, 'mean_word_length': 2.101499423298731, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '89497', 'license': 'MIT', 'n_tokens_mistral': 913, 'n_tokens_neox': 912, 'n_words': 175, 'path': '3he4he/Test AZURE2 Fitting.ipynb', 'repo_name': 'odell/r-matrix-emulation', 'size': '2688'}