def _read_variablepoint(line, dstart, dlen): sub = line[dstart:dstart + dlen + 2].split() data = None error = None if len(sub) == 2: data = ensdf._getvalue(sub[0]) error = ensdf._getvalue(sub[1]) return data, error
def parse_atomic_data(build_dir=""): i = 0 j = 0 medfile = os.path.join(build_dir, "mednew.dat") dat = np.zeros((103, ), atomic_dtype) with open(medfile, "r") as f: lines = f.readlines() for line in lines: if (-1)**i == 1: Z = int(line[0:3]) k_shell_fluor, k_shell_fluor_error = _readpoint(line, 9, 6) l_shell_fluor, l_shell_fluor_error = _readpoint(line, 18, 6) # Probability of creating L-shell vacancy by filling K-shell prob, prob_error = _readpoint(line, 27, 6) k_shell_be, k_shell_be_err = _readpoint(line, 36, 8) li_shell_be, li_shell_be_err = _readpoint(line, 47, 8) mi_shell_be, mi_shell_be_err = _readpoint(line, 58, 8) ni_shell_be, ni_shell_be_err = _readpoint(line, 69, 8) else: Kb_to_Ka, Kb_to_Ka_err = _read_variablepoint(line, 9, 7) Ka2_to_Ka1, Ka2_to_Ka1_err = _read_variablepoint(line, 19, 7) L_auger = ensdf._getvalue(line[29:36]) K_auger = ensdf._getvalue(line[36:42]) Ka1_X_ray_en, Ka1_X_ray_en_err = _readpoint(line, 43, 8) Ka2_X_ray_en, Ka2_X_ray_en_err = _readpoint(line, 54, 7) Kb_X_ray_en = ensdf._getvalue(line[65:69]) L_X_ray_en = ensdf._getvalue(line[70:76]) dat[j] = ( Z, k_shell_fluor, k_shell_fluor_error, l_shell_fluor, l_shell_fluor_error, prob, k_shell_be, k_shell_be_err, li_shell_be, li_shell_be_err, mi_shell_be, mi_shell_be_err, ni_shell_be, ni_shell_be_err, Kb_to_Ka, Kb_to_Ka_err, Ka2_to_Ka1, Ka2_to_Ka1_err, L_auger, K_auger, Ka1_X_ray_en, Ka1_X_ray_en_err, Ka2_X_ray_en, Ka2_X_ray_en_err, Kb_X_ray_en, L_X_ray_en, ) j += 1 i += 1 return dat
def parse_atomic_data(build_dir=""): i = 0 j = 0 medfile = os.path.join(build_dir, 'mednew.dat') dat = np.zeros((103,), atomic_dtype) with open(medfile, 'r') as f: lines = f.readlines() for line in lines: if (-1) ** i == 1: Z = int(line[0:3]) k_shell_fluor, k_shell_fluor_error = _readpoint(line, 9, 6) l_shell_fluor, l_shell_fluor_error = _readpoint(line, 18, 6) #Probability of creating L-shell vacancy by filling K-shell vacancy prob, prob_error = _readpoint(line, 27, 6) k_shell_be, k_shell_be_err = _readpoint(line, 36, 8) li_shell_be, li_shell_be_err = _readpoint(line, 47, 8) mi_shell_be, mi_shell_be_err = _readpoint(line, 58, 8) ni_shell_be, ni_shell_be_err = _readpoint(line, 69, 8) else: Kb_to_Ka, Kb_to_Ka_err = _read_variablepoint(line, 9, 7) Ka2_to_Ka1, Ka2_to_Ka1_err = _read_variablepoint(line, 19, 7) L_auger = ensdf._getvalue(line[29:36]) K_auger = ensdf._getvalue(line[36:42]) Ka1_X_ray_en, Ka1_X_ray_en_err = _readpoint(line, 43, 8) Ka2_X_ray_en, Ka2_X_ray_en_err = _readpoint(line, 54, 7) Kb_X_ray_en = ensdf._getvalue(line[65:69]) L_X_ray_en = ensdf._getvalue(line[70:76]) dat[j] = Z, k_shell_fluor, k_shell_fluor_error, l_shell_fluor, \ l_shell_fluor_error, prob, k_shell_be, k_shell_be_err, \ li_shell_be, li_shell_be_err, mi_shell_be, \ mi_shell_be_err, ni_shell_be, ni_shell_be_err, \ Kb_to_Ka, Kb_to_Ka_err, Ka2_to_Ka1, Ka2_to_Ka1_err, \ L_auger, K_auger, Ka1_X_ray_en, Ka1_X_ray_en_err, \ Ka2_X_ray_en, Ka2_X_ray_en_err, Kb_X_ray_en, L_X_ray_en j += 1 i += 1 return dat
def _readpoint(line, dstart, dlen): data = ensdf._getvalue(line[dstart:dstart + dlen]) error = ensdf._getvalue(line[dstart + dlen:dstart + dlen + 2]) return data, error