Skip to content

Commit bfb0b77

Browse files
committed
Update to various arguments names to ensure consistency is maintainted:
- Updated `waterEntropy` to `water_entropy` - Updated `mout` to `matrix_out` - Updated `outfile` to `output_file` - Ensured that any instance of any of these arguments have been changed throughout the codebase to match - Updated some of the test cases so that they match the new arguments names and made sure they have the correct file format to maintain consistency
1 parent 5f45aed commit bfb0b77

File tree

6 files changed

+31
-32
lines changed

6 files changed

+31
-32
lines changed

CodeEntropy/config/arg_config_manager.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,22 @@
4848
"help": "Enable verbose output",
4949
},
5050
"thread": {"type": int, "help": "How many multiprocess to use", "default": 1},
51-
"outfile": {
51+
"output_file": {
5252
"type": str,
5353
"help": "Name of the file where the output will be written",
54-
"default": "outfile.json",
54+
"default": "output_file.json",
5555
},
56-
"mout": {
56+
"matrix_out": {
5757
"type": str,
5858
"help": "Name of the file where certain matrices will be written",
5959
"default": None,
6060
},
6161
"force_partitioning": {"type": float, "help": "Force partitioning", "default": 0.5},
62-
"waterEntropy": {"type": bool, "help": "Calculate water entropy", "default": False},
62+
"water_entropy": {
63+
"type": bool,
64+
"help": "Calculate water entropy",
65+
"default": False,
66+
},
6367
}
6468

6569

CodeEntropy/config/data_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ def __init__(self):
1212
self.molecule_data = []
1313
self.residue_data = []
1414

15-
def save_dataframes_as_json(self, molecule_df, residue_df, outfile):
15+
def save_dataframes_as_json(self, molecule_df, residue_df, output_file):
1616
"""Save multiple DataFrames into a single JSON file with separate keys"""
1717
data = {
1818
"molecule_data": molecule_df.to_dict(orient="records"),
1919
"residue_data": residue_df.to_dict(orient="records"),
2020
}
2121

2222
# Write JSON data to file
23-
with open(outfile, "w") as out:
23+
with open(output_file, "w") as out:
2424
json.dump(data, out, indent=4)
2525

2626
def add_results_data(self, molecule, level, type, S_molecule):

CodeEntropy/main_mcc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main():
6565

6666
parser = arg_config.setup_argparse()
6767
args, unknown = parser.parse_known_args()
68-
args.outfile = os.path.join(folder, args.outfile)
68+
args.output_file = os.path.join(folder, args.output_file)
6969

7070
try:
7171
# Initialize the logging system once
@@ -432,7 +432,7 @@ def main():
432432
# 'Type':['Orientational (J/mol/K)'],
433433
# 'Result': [S_orient],})
434434
# results_df = pd.concat([results_df, new_row], ignore_index=True)
435-
# with open(args.outfile, "a") as out:
435+
# with open(args.output_file, "a") as out:
436436
# print(molecule,
437437
# "\t",
438438
# level,
@@ -457,7 +457,7 @@ def main():
457457
molecule, level, "Molecule Total Entropy", S_molecule
458458
)
459459
data_logger.save_dataframes_as_json(
460-
results_df, residue_results_df, args.outfile
460+
results_df, residue_results_df, args.output_file
461461
)
462462

463463
logger.info("Molecules:")

config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ run1:
1010
temperature:
1111
verbose:
1212
thread:
13-
outfile:
14-
mout:
13+
output_file:
14+
matrix_output:
1515
force_partitioning:
16-
waterEntropy:
16+
water_entropy:

tests/test_EntropyFunctions/test_arg_config_manager.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ def setup_file(self, mock_file):
6262
"tempra: 298.0\n "
6363
"verbose: False\n "
6464
"thread: 1\n "
65-
"outfile: 'outfile.out'\n "
66-
"resfile: 'res_outfile.out'\n "
67-
"mout: null\n "
65+
"output_file: 'output_file.json'\n "
66+
"matrix_out: null\n "
6867
"force_partitioning: 0.5\n "
69-
"waterEntropy: False"
68+
"water_entropy: False"
7069
).return_value
7170

7271
@patch("builtins.open", new_callable=mock_open)
@@ -126,11 +125,10 @@ def test_invalid_run_config_type(self):
126125
tempra=298.0,
127126
verbose=False,
128127
thread=1,
129-
outfile="outfile.out",
130-
resfile="res_outfile.out",
131-
mout=None,
128+
output_file="output_file.json",
129+
matrix_out=None,
132130
force_partitioning=0.5,
133-
waterEntropy=False,
131+
water_entropy=False,
134132
),
135133
)
136134
def test_setup_argparse(self, mock_args):
@@ -271,11 +269,10 @@ def test_merge_configs(self):
271269
tempra=None,
272270
verbose=None,
273271
thread=None,
274-
outfile=None,
275-
resfile=None,
276-
mout=None,
272+
output_file=None,
273+
matrix_out=None,
277274
force_partitioning=None,
278-
waterEntropy=None,
275+
water_entropy=None,
279276
)
280277
run_config = {
281278
"top_traj_file": ["/path/to/tpr", "/path/to/trr"],
@@ -287,11 +284,10 @@ def test_merge_configs(self):
287284
"tempra": 298.0,
288285
"verbose": False,
289286
"thread": 1,
290-
"outfile": "outfile.out",
291-
"resfile": "res_outfile.out",
292-
"mout": None,
287+
"output_file": "output_file.json",
288+
"matrix_out": None,
293289
"force_partitioning": 0.5,
294-
"waterEntropy": False,
290+
"water_entropy": False,
295291
}
296292
merged_args = arg_config.merge_configs(args, run_config)
297293
self.assertEqual(merged_args.top_traj_file, ["/path/to/tpr", "/path/to/trr"])

tests/test_EntropyFunctions/test_main_mcc.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ def setup_file(self, mock_file):
5454
"tempra: 298.0\n "
5555
"verbose: False\n "
5656
"thread: 1\n "
57-
"outfile: 'outfile.out'\n "
58-
"resfile: 'res_outfile.out'\n "
59-
"mout: null\n "
57+
"output_file: 'output_file.json'\n "
58+
"matrix_out: null\n "
6059
"force_partitioning: 0.5\n "
61-
"waterEntropy: False"
60+
"water_entropy: False"
6261
).return_value
6362

6463
def test_CodeEntropy_imported(self):

0 commit comments

Comments
 (0)