Skip to content

Commit

Permalink
fixed sorted in create_files_info
Browse files Browse the repository at this point in the history
  • Loading branch information
mpecchi committed Feb 28, 2024
1 parent 8d6a650 commit c7fa8af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions gcms_data_analysis/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1400,8 +1400,8 @@ def create_files_info(self):
input path if an existing 'files_info' file is not found. It autogenerates filenames,
samples, and replicates based on the GCMS file names, saves the DataFrame to
'files_info.xlsx', and sets it as the current 'files_info' attribute."""
filename = [a.parts[-1].split('.')[0]
for a in list(Project.in_path.glob('**/*.txt'))]
filename = sorted([a.parts[-1].split('.')[0]
for a in list(Project.in_path.glob('**/*.txt'))])
samplename = [f.split('_')[0] for f in filename]
replicate_number = [f.split('_')[1] for f in filename]
files_info_no_defaults = pd.DataFrame({'filename':filename,
Expand Down
5 changes: 3 additions & 2 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import numpy as np
from pandas.testing import assert_frame_equal

example_data_path = plib.Path(plib.Path(__file__).parent.parent,
'example/data/')
# example_data_path = plib.Path(plib.Path(__file__).parent.parent,
# 'example/data/')
example_data_path = r"C:\Users\mp933\OneDrive - Cornell University\Python\gcms_data_analysis\example\data"
Project.set_folder_path(example_data_path)
gcms = Project()
#%%
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def checked_files_info():
'total_sample_conc_in_vial_mg_L': [560.0000000000001, 560.0000000000001, 112.0, 112.0, 2800.0, 2800.0],
'sample_yield_on_feedstock_basis_fr': [0.45, 0.46, 0.47, 0.48, 0.49, 0.5],
'calibration_file': ['calibration', 'calibration', 'deriv_calibration', 'deriv_calibration', 'calibration', 'calibration'],
}
}
)
return files_info

Expand Down
5 changes: 3 additions & 2 deletions tests/test_gcms_data_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def test_load_files_info(gcms, checked_files_info):

def test_create_files_info(gcms, checked_created_files_info):
to_check = gcms.create_files_info()
to_check_sorted = to_check.sort_index()
assert_frame_equal(to_check_sorted, checked_created_files_info,
# to_check_sorted = to_check.sort_index()
assert_frame_equal(to_check, checked_created_files_info,
check_exact=False, atol=1e-5, rtol=1e-5)


Expand Down Expand Up @@ -173,6 +173,7 @@ def test_create_samples_info(gcms, checked_samples_info):

def test_add_stats_to_samples_info_no_calibrations(gcms, checked_samples_info_no_calibrations):
_ = gcms.create_files_info()

gcms.files_info['calibration_file'] = False
gcms.load_calibrations()
_ = gcms.add_stats_to_files_info()
Expand Down

0 comments on commit c7fa8af

Please sign in to comment.