• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CCPBioSim / CodeEntropy / 14334168434

08 Apr 2025 12:59PM UTC coverage: 40.491% (+1.4%) from 39.089%
14334168434

push

github

web-flow
Merge pull request #84 from CCPBioSim/81-verbose-YAML-bug

Ensure verbose flag in YAML sets logging to DEBUG mode correctly

23 of 24 new or added lines in 3 files covered. (95.83%)

264 of 652 relevant lines covered (40.49%)

1.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

56.0
/CodeEntropy/config/data_logger.py
1
import json
3✔
2
import logging
3✔
3

4
from tabulate import tabulate
3✔
5

6
# Set up logger
7
logger = logging.getLogger(__name__)
3✔
8

9

10
class DataLogger:
3✔
11
    def __init__(self):
3✔
12
        self.molecule_data = []
3✔
13
        self.residue_data = []
3✔
14

15
    def save_dataframes_as_json(self, molecule_df, residue_df, output_file):
3✔
16
        """Save multiple DataFrames into a single JSON file with separate keys"""
17
        data = {
×
18
            "molecule_data": molecule_df.to_dict(orient="records"),
19
            "residue_data": residue_df.to_dict(orient="records"),
20
        }
21

22
        # Write JSON data to file
NEW
23
        with open(output_file, "w") as out:
×
24
            json.dump(data, out, indent=4)
×
25

26
    def add_results_data(self, molecule, level, type, S_molecule):
3✔
27
        """Add data for molecule-level entries"""
28
        self.molecule_data.append([molecule, level, type, f"{S_molecule}"])
×
29

30
    def add_residue_data(self, molecule, residue, type, S_trans_residue):
3✔
31
        """Add data for residue-level entries"""
32
        self.residue_data.append([molecule, residue, type, f"{S_trans_residue}"])
×
33

34
    def log_tables(self):
3✔
35
        """Log both tables at once"""
36
        # Log molecule data
37
        if self.molecule_data:
3✔
38
            logger.info("Molecule Data Table:")
×
39
            table_str = tabulate(
×
40
                self.molecule_data,
41
                headers=["Molecule ID", "Level", "Type", "Result (J/mol/K)"],
42
                tablefmt="grid",
43
            )
44
            logger.info(f"\n{table_str}")
×
45

46
        # Log residue data
47
        if self.residue_data:
3✔
48
            logger.info("Residue Data Table:")
×
49
            table_str = tabulate(
×
50
                self.residue_data,
51
                headers=["Molecule ID", "Residue", "Type", "Result (J/mol/K)"],
52
                tablefmt="grid",
53
            )
54
            logger.info(f"\n{table_str}")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc