From 146fb2f8eb4eb1e7622d8b1949411aa1d8d45e62 Mon Sep 17 00:00:00 2001 From: 97gamjak <97gamjak@gmail.com> Date: Fri, 31 May 2024 15:48:32 +0200 Subject: [PATCH] fixed dangling output prints --- PQAnalysis/atomic_system/_decorators.py | 18 ++++--------- PQAnalysis/core/cell/cell.py | 3 --- PQAnalysis/io/formats.py | 2 -- .../pq/pq_input_file_reader.py | 26 ++++++++----------- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/PQAnalysis/atomic_system/_decorators.py b/PQAnalysis/atomic_system/_decorators.py index 1f25a4d3..31fbe9c7 100644 --- a/PQAnalysis/atomic_system/_decorators.py +++ b/PQAnalysis/atomic_system/_decorators.py @@ -24,9 +24,7 @@ from decorator import decorator from .exceptions import ( - AtomicSystemPositionsError, - AtomicSystemMassError, - AtomicSystemError + AtomicSystemPositionsError, AtomicSystemMassError, AtomicSystemError ) @@ -54,17 +52,12 @@ def check_atom_number_setters(func, self, arg_to_set: Any) -> None: AtomicSystemError If the number of atoms is not equal the number of positions. """ - print("test") - print(func.__name__, file=sys.stderr) - print(self.logger) - print(arg_to_set) if self.n_atoms != np.shape(arg_to_set)[0]: - print("test") self.logger.error( ( - "The number of atoms in the AtomicSystem object have " - "to be equal to the number of atoms in the new array " - "in order to set the property." + "The number of atoms in the AtomicSystem object have " + "to be equal to the number of atoms in the new array " + "in order to set the property." ), exception=AtomicSystemError ) @@ -129,8 +122,7 @@ def check_atoms_has_mass(func, *args, **kwargs): if not all(atom.mass is not None for atom in self.atoms): self.logger.error( - AtomicSystemMassError.message, - exception=AtomicSystemMassError + AtomicSystemMassError.message, exception=AtomicSystemMassError ) return func(*args, **kwargs) diff --git a/PQAnalysis/core/cell/cell.py b/PQAnalysis/core/cell/cell.py index a8ba9e74..c982fec7 100644 --- a/PQAnalysis/core/cell/cell.py +++ b/PQAnalysis/core/cell/cell.py @@ -277,9 +277,6 @@ def init_from_box_matrix(cls, box_matrix: Np3x3NumberArray) -> "Cell": ) / (y * z) ) - print(alpha, beta, gamma) - print(np.rad2deg(alpha), np.rad2deg(beta), np.rad2deg(gamma)) - return cls( x, y, z, np.rad2deg(alpha), np.rad2deg(beta), np.rad2deg(gamma) ) diff --git a/PQAnalysis/io/formats.py b/PQAnalysis/io/formats.py index c787171c..bde23902 100644 --- a/PQAnalysis/io/formats.py +++ b/PQAnalysis/io/formats.py @@ -140,8 +140,6 @@ def infer_format_from_extension(cls, file_path: str) -> "OutputFileFormat": file_extension = "." + file_path.split(".")[-1] - print(file_extension) - if file_extension in cls.file_extensions()[cls.XYZ.value]: return cls.XYZ diff --git a/PQAnalysis/io/input_file_reader/pq/pq_input_file_reader.py b/PQAnalysis/io/input_file_reader/pq/pq_input_file_reader.py index 7ed68006..f7bd92ec 100644 --- a/PQAnalysis/io/input_file_reader/pq/pq_input_file_reader.py +++ b/PQAnalysis/io/input_file_reader/pq/pq_input_file_reader.py @@ -132,13 +132,11 @@ def continue_input_file(self, n: PositiveInt): if key in self.dictionary.keys(): new_filename = self.dictionary[key][0].replace( - self.actual_n, - new_actual_n + self.actual_n, new_actual_n ) new_raw_input_file = new_raw_input_file.replace( - self.dictionary[key][0], - new_filename + self.dictionary[key][0], new_filename ) # replace digit strings in output files @@ -146,19 +144,16 @@ def continue_input_file(self, n: PositiveInt): if key in self.dictionary.keys(): new_filename = self.dictionary[key][0].replace( - self.start_n, - new_start_n + self.start_n, new_start_n ) new_raw_input_file = new_raw_input_file.replace( - self.dictionary[key][0], - new_filename + self.dictionary[key][0], new_filename ) # create new input file and write new_raw_input_file to it new_filename = self.filename.replace( - self.input_file_n, - new_input_file_n + self.input_file_n, new_input_file_n ) with open(new_filename, "w", encoding="utf-8") as file: @@ -191,8 +186,10 @@ def _parse_start_n(self) -> str: if self.is_rpmd_start_file_defined: # add "." to match also files without extension - if (_n := _get_digit_string_from_filename(self.rpmd_start_file + - '.')) != n: + if ( + _n := + _get_digit_string_from_filename(self.rpmd_start_file + '.') + ) != n: self.logger.error( f"N from start_file ({n}) and rpmd_start_file ({_n}) do not match.", exception=PQValueError @@ -226,7 +223,6 @@ def _parse_actual_n(self) -> str: ) if _n != n and n is not None: - print(_n, n, key) self.logger.error( "Actual n in output files is not consistent.", exception=PQValueError @@ -324,8 +320,8 @@ def _get_digit_string_from_filename(filename: str) -> str: if (regex := re.search(r"\d+.", filename)) is None: PQInputFileReader.logger.error( ( - f"Filename {filename} does not contain a number to be " - "continued from. It has to be of the form \"....\"." + f"Filename {filename} does not contain a number to be " + "continued from. It has to be of the form \"....\"." ), exception=PQValueError )