Skip to content

Commit

Permalink
Update codegreen version and add
Browse files Browse the repository at this point in the history
export_summary_to_csv function
  • Loading branch information
saurabh-singh-rajput committed Dec 11, 2023
1 parent d4ec518 commit 68617bf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Codegreen requires the following hardware:

The Intel processor is needed for accessing the RAPL power sensors. An NVIDIA GPU is required for profiling GPU usage via `nvidia-smi`.

Make sure to add your respective local paths to the following files after installation:

- `codegreen/fecom/patching/patching_config.py`
- `codegreen/fecom/measurement/measurement_config.py`

## Installation

```
Expand Down
2 changes: 1 addition & 1 deletion codegreen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Codegreen package!"""

__version__ = "0.1.30"
__version__ = "0.1.31"
17 changes: 17 additions & 0 deletions codegreen/fecom/experiment/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,23 @@ def export_summary_to_latex(output_dir: Path, summary_dfs: Dict[str, pd.DataFram
for name, df in summary_dfs.items():
df.style.format(precision=2).to_latex(buf = output_dir/f"{name}.tex")

def export_summary_to_csv(output_dir: Path, summary_dfs: Dict[str, pd.DataFrame]):
"""
Write a given set of summary dfs returned by create_summary() to csv files.
"""

for name, df in summary_dfs.items():
csv_path = output_dir / f"{name}.csv"

with open(csv_path, 'w') as csv_file:
writer = csv.writer(csv_file)

# Write column headers
writer.writerow(df.columns)

# Write each row to the csv
for index, row in df.iterrows():
writer.writerow(row)

def create_summary(project_energy_data: ProjectEnergyData) -> Dict[str, pd.DataFrame]:
cpu_summary_mean = build_summary_df_mean(project_energy_data.cpu_data)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "flit_core.buildapi"
name = "codegreen"
authors = [{name = "Saurabhsingh Rajput", email = "[email protected]"}]
license = {file = "LICENSE"}
classifiers = ["License :: OSI Approved :: Apache 2.0"]
classifiers = ["License :: OSI Approved :: Apache Software License"]
dynamic = ["version", "description"]
dependencies = [
"typer>=0.9",
Expand Down

0 comments on commit 68617bf

Please sign in to comment.