Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
atomprobe-tc committed Feb 26, 2024
1 parent 499639c commit 384fe89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions ifes_apt_tc_data_modeling/rng/rng_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ def evaluate_rng_range_line(
raise ValueError(f"Line {line} has inconsistent line prefix!")
if is_range_significant(np.float64(tmp[1]), np.float64(tmp[2])) is False:
# raise ValueError(f"Line {line} insignificant range!")
return None
return info
info["range"] = np.asarray([tmp[1], tmp[2]], np.float64)

# line encodes multiplicity of element via array of multiplicity counts
element_multiplicity = np.asarray(tmp[3:len(tmp)], np.uint32)
if np.sum(element_multiplicity) < 0:
# raise ValueError(f"Line {line} no element counts!")
return None
return info
if np.sum(element_multiplicity) > 0:
for jdx in np.arange(0, len(element_multiplicity)):
if element_multiplicity[jdx] < 0:
# raise ValueError(f"Line {line} no negative element counts!")
return None
raise ValueError(f"element_multiplicity[jdx] {element_multiplicity[jdx]} needs to be positive!")
if element_multiplicity[jdx] > 0:
symbol = column_id_to_label[jdx + 1]
if symbol in get_chemical_symbols():
Expand Down
10 changes: 5 additions & 5 deletions ifes_apt_tc_data_modeling/rrng/rrng_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def evaluate_rrng_range_line(i: int, line: str) -> dict:
tmp = re.split(r"[\s=]+", line)
if len(tmp) < 6:
# raise ValueError(f"Line {line} does not contain all required fields {len(tmp)}!")
return None
return info
if tmp[0] != f"Range{i}":
# raise ValueError(f"Line {line} has inconsistent line prefix {tmp[0]}!")
return None
return info
if is_range_significant(np.float64(tmp[1]), np.float64(tmp[2])) is False:
# raise ValueError(f"Line {line} insignificant range!")
return None
return info
info["range"] = np.asarray([tmp[1], tmp[2]], np.float64)

if tmp[3].lower().startswith("vol:"):
Expand Down Expand Up @@ -83,13 +83,13 @@ def evaluate_rrng_range_line(i: int, line: str) -> dict:
symbol = element_multiplicity[0]
if (symbol not in chemical_symbols) or (symbol == "X"):
# raise ValueError(f"WARNING::Line {line} contains an invalid chemical symbol {symbol}!")
return None
return info
# if np.uint32(element_multiplicity[1]) <= 0:
# raise ValueError(f"Line {line} zero or negative multiplicity !")
if np.uint32(element_multiplicity[1]) >= 256:
# raise ValueError(f"Line {line} unsupported high multiplicity "
# f"{np.uint32(element_multiplicity)}!")
return None
return info
info["atoms"] = np.append(info["atoms"],
[symbol] * int(element_multiplicity[1]))
return info
Expand Down
4 changes: 2 additions & 2 deletions ifes_apt_tc_data_modeling/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ def symbol_lst_to_matrix_of_nuclide_vector(method: str = "resolve_all",
if not isinstance(symbol_lst, list) and all(isinstance(lst, list) for lst in symbol_lst):
raise TypeError("Argument symbol_lst must be a list of lists!")
if not all(len(np.shape(lst)) == 1 for lst in symbol_lst):
"One list in argument symbol_lst is not a 1d list or an empty list!"
raise ValueError("One list in argument symbol_lst is not a 1d list or an empty list!")
if not all(np.shape(lst)[0] >= 1 for lst in symbol_lst):
"One list in argument symbol_lst is not a 1d list or an empty list!"
raise ValueError("One list in argument symbol_lst is not a 1d list or an empty list!")
matrix = np.zeros([len(symbol_lst), MAX_NUMBER_OF_ATOMS_PER_ION])
charge = []
if (method == "resolve_ion") and ("charge_lst" in kwargs):
Expand Down

0 comments on commit 384fe89

Please sign in to comment.