Skip to content

Commit

Permalink
Added extra padding for minus sign to export
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtitus committed Nov 12, 2024
1 parent cee94ab commit 6120d44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions export_to_xdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ def generate_format_string(data):
formats = []
for column_data in data:
if np.issubdtype(column_data.dtype, np.integer):
width = len(str(np.max(np.abs(column_data))))
width = len(str(np.max(np.abs(column_data)))) + 1
formats.append(f"%{width}d")
else:
avg_value = np.mean(column_data)
max_value = np.max(np.abs(column_data))
if np.abs(avg_value) < 1:
formats.append("%.4e")
else:
width = len(str(int(max_value))) + 4 # Add 4 for decimal point and 3 decimals
formats.append(f"%{width}.3f")
width = len(str(int(max_value))) + 5 # Add 5 for decimal point, 3 decimals, and sign
formats.append(f"%+{width}.3f")

return " ".join(formats)

0 comments on commit 6120d44

Please sign in to comment.