Skip to content

Commit 38a6847

Browse files
committed
attempt to fix unit tests
1 parent ae47e2f commit 38a6847

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

utilities/reduce_output_size.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import pandas as pd
2+
import os
23

3-
df = pd.read_csv('test_output.csv')
4+
file_path = 'test_output.csv'
45

5-
# Columns to be rounded to four decimal places
6-
columns_to_round = ['f', 'Dp', 'D', 'f_fitted', 'Dp_fitted', 'D_fitted']
7-
for column in columns_to_round:
8-
df[column] = df[column].round(4)
6+
# Check if the file exists
7+
if os.path.exists(file_path):
8+
df = pd.read_csv(file_path)
99

10-
#drop b_values columns.
11-
df = df.loc[:, ~df.columns.str.startswith('bval')]
10+
# Columns to be rounded to four decimal places
11+
columns_to_round = ['f', 'Dp', 'D', 'f_fitted', 'Dp_fitted', 'D_fitted']
12+
for column in columns_to_round:
13+
df[column] = df[column].round(4)
1214

13-
#compress and save the file.
14-
df.to_csv('test_output.csv.gz', compression='gzip', index=False)
15+
#drop b_values columns.
16+
df = df.loc[:, ~df.columns.str.startswith('bval')]
17+
18+
#compress and save the file.
19+
df.to_csv('test_output.csv.gz', compression='gzip', index=False)

0 commit comments

Comments
 (0)