Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 4, 2024
1 parent 02c8643 commit 7a7aff5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cubehandler/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

def remove_trailing_zeros(number):
# Format the number using fixed-point notation with high precision
number_str = "{:.11f}".format(number)
number_str = f"{number:.11f}"

# Remove trailing zeros and a possible trailing decimal point
number_str = number_str.rstrip("0").rstrip(".")
Expand Down Expand Up @@ -189,7 +189,7 @@ def write_cube_file(self, filename, low_precision=False):

if low_precision:
string_io = io.StringIO()
format_string = "%.{}f".format(self.low_precision_decimals)
format_string = f"%.{self.low_precision_decimals}f"
np.savetxt(string_io, self.data.flatten(), fmt=format_string)
result_string = remove_useless_zeros(string_io.getvalue())
f.write(result_string)
Expand Down

0 comments on commit 7a7aff5

Please sign in to comment.