-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.py
26 lines (25 loc) · 1.04 KB
/
save.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""This module is used for saving and loading data"""
import tkinter as tk
import tkinter.filedialog
import pandas as pd
from icecream import ic
#================================================================
# EXPORT PEAK TABLE TO CSV
#================================================================
def export_peaks(params):
try:
filepath = tk.filedialog.asksaveasfilename(
defaultextension="csv",
filetypes=[
("Comma-Separated Values", "*.csv"),
("All Files", "*.*")],
)
#open a filedialog to pick output file name and destination
peak_tables = [gram.peak_table for gram in params["chromatograms"]]
table_temp = pd.concat(peak_tables,
keys=[gram.name for gram in params["chromatograms"]])
#concatenate all peak summary tables into one data frame indexed by
#chromatogram names
table_temp.to_csv(str(filepath), index = False, header=True)
except ValueError:
print("Peak summary export operation aborted!")