Skip to content

Commit

Permalink
hplc added modifiable output folder name
Browse files Browse the repository at this point in the history
  • Loading branch information
mpecchi committed Jul 2, 2024
1 parent d98c0e5 commit 66a4a72
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hplc_data_analysis/hplc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ def __init__(
param_to_axis_label: dict[str, str] | None = None,
plot_font: Literal["Dejavu Sans", "Times New Roman"] = "Dejavu Sans",
plot_grid: bool = False,
output_folder_name: str = "output",
):
self.folder_path = plib.Path(folder_path)
self.out_path = plib.Path(folder_path, "output")
self.out_path = plib.Path(self.folder_path, output_folder_name)
if projectname is None:
self.projectname = self.folder_path.parts[-1]
else:
Expand Down Expand Up @@ -747,6 +748,11 @@ def load_single_file(self, filename: str) -> pd.DataFrame:
skiprows=self.file_load_skiprows,
)
file.rename(self.columns_to_rename_in_files, inplace=True, axis="columns")
# check if all values in columns_to_rename_in_files are in the columns
# if not, raise an exception that prints the name of the filename
if not all([col in file.columns for col in self.columns_to_rename_in_files.values()]):
raise ValueError(f"columns_to_rename_in_files not in {filename = }")

file = file.loc[file["comp_name"].notna(), self.columns_to_keep_in_files]
file.set_index("comp_name", inplace=True)
file.rename(self.compounds_to_rename_in_files, inplace=True)
Expand Down

0 comments on commit 66a4a72

Please sign in to comment.