Coverage for test/test_cli.py: 100%
85 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-09-14 14:49 -0400
« prev ^ index » next coverage.py v7.4.4, created at 2024-09-14 14:49 -0400
1import os
2from pathlib import Path
4import pytest
6import peakipy.cli.main
7from peakipy.cli.main import PeaklistFormat, Lineshape
8from peakipy.io import StrucEl
11@pytest.fixture
12def protein_L():
13 path = Path("test/test_protein_L")
14 return path
17def test_read_main_with_default_pipe(protein_L):
18 args = dict(
19 peaklist_path=protein_L / Path("test.tab"),
20 data_path=protein_L / Path("test1.ft2"),
21 peaklist_format=PeaklistFormat.pipe,
22 )
23 peakipy.cli.main.read(**args)
26def test_read_main_with_default_analysis(protein_L):
27 args = dict(
28 peaklist_path=protein_L / Path("peaks.a2"),
29 data_path=protein_L / Path("test1.ft2"),
30 peaklist_format=PeaklistFormat.a2,
31 )
32 peakipy.cli.main.read(**args)
35def test_read_main_with_default_sparky(protein_L):
36 args = dict(
37 peaklist_path=protein_L / Path("peaks.sparky"),
38 data_path=protein_L / Path("test1.ft2"),
39 peaklist_format=PeaklistFormat.sparky,
40 )
41 peakipy.cli.main.read(**args)
44def test_read_main_with_strucel_square(protein_L):
45 args = dict(
46 peaklist_path=protein_L / Path("peaks.sparky"),
47 data_path=protein_L / Path("test1.ft2"),
48 peaklist_format=PeaklistFormat.sparky,
49 struc_el=StrucEl.square,
50 )
51 peakipy.cli.main.read(**args)
54def test_read_main_with_strucel_rectangle(protein_L):
55 args = dict(
56 peaklist_path=protein_L / Path("peaks.sparky"),
57 data_path=protein_L / Path("test1.ft2"),
58 peaklist_format=PeaklistFormat.sparky,
59 struc_el=StrucEl.rectangle,
60 struc_size=(3, 3),
61 )
62 peakipy.cli.main.read(**args)
65def test_read_main_with_mask_method(protein_L):
66 args = dict(
67 peaklist_path=protein_L / Path("peaks.sparky"),
68 data_path=protein_L / Path("test1.ft2"),
69 peaklist_format=PeaklistFormat.sparky,
70 struc_el=StrucEl.mask_method,
71 struc_size=(1, 1),
72 )
73 peakipy.cli.main.read(**args)
76def test_read_main_with_mask_method_fuda(protein_L):
77 args = dict(
78 peaklist_path=protein_L / Path("peaks.sparky"),
79 data_path=protein_L / Path("test1.ft2"),
80 peaklist_format=PeaklistFormat.sparky,
81 struc_el=StrucEl.mask_method,
82 struc_size=(1, 1),
83 fuda=True,
84 )
85 peakipy.cli.main.read(**args)
88def test_fit_main_with_default(protein_L):
89 args = dict(
90 peaklist_path=protein_L / Path("test.csv"),
91 data_path=protein_L / Path("test1.ft2"),
92 output_path=protein_L / Path("fits_PV.csv"),
93 )
94 peakipy.cli.main.fit(**args)
97def test_fit_main_with_centers_floated(protein_L):
98 args = dict(
99 peaklist_path=protein_L / Path("test.csv"),
100 data_path=protein_L / Path("test1.ft2"),
101 output_path=protein_L / Path("fits_PV_centers_floated.csv"),
102 fix=["fraction", "sigma"],
103 )
104 peakipy.cli.main.fit(**args)
107def test_fit_main_with_centers_bounded(protein_L):
108 args = dict(
109 peaklist_path=protein_L / Path("test.csv"),
110 data_path=protein_L / Path("test1.ft2"),
111 output_path=protein_L / Path("fits_PV_centers_bounded.csv"),
112 fix=["fraction", "sigma"],
113 xy_bounds=[0.01, 0.1],
114 )
115 peakipy.cli.main.fit(**args)
118def test_fit_main_with_sigmas_floated(protein_L):
119 args = dict(
120 peaklist_path=protein_L / Path("test.csv"),
121 data_path=protein_L / Path("test1.ft2"),
122 output_path=protein_L / Path("fits_PV_sigmas_floated.csv"),
123 fix=["fraction", "center"],
124 )
125 peakipy.cli.main.fit(**args)
128def test_fit_main_with_vclist(protein_L):
129 args = dict(
130 peaklist_path=protein_L / Path("test.csv"),
131 data_path=protein_L / Path("test1.ft2"),
132 output_path=protein_L / Path("fits_PV.csv"),
133 vclist=protein_L / Path("vclist"),
134 )
135 peakipy.cli.main.fit(**args)
138def test_fit_main_with_gaussian(protein_L):
139 args = dict(
140 peaklist_path=protein_L / Path("test.csv"),
141 data_path=protein_L / Path("test1.ft2"),
142 output_path=protein_L / Path("fits_G.csv"),
143 lineshape=Lineshape.G,
144 )
145 peakipy.cli.main.fit(**args)
148def test_fit_main_with_lorentzian(protein_L):
149 args = dict(
150 peaklist_path=protein_L / Path("test.csv"),
151 data_path=protein_L / Path("test1.ft2"),
152 output_path=protein_L / Path("fits_L.csv"),
153 lineshape=Lineshape.L,
154 )
155 peakipy.cli.main.fit(**args)
158def test_fit_main_with_voigt(protein_L):
159 args = dict(
160 peaklist_path=protein_L / Path("test.csv"),
161 data_path=protein_L / Path("test1.ft2"),
162 output_path=protein_L / Path("fits_V.csv"),
163 lineshape=Lineshape.V,
164 )
165 peakipy.cli.main.fit(**args)
168def test_fit_main_with_pv_pv(protein_L):
169 args = dict(
170 peaklist_path=protein_L / Path("test.csv"),
171 data_path=protein_L / Path("test1.ft2"),
172 output_path=protein_L / Path("fits_PV_PV.csv"),
173 lineshape=Lineshape.PV_PV,
174 )
175 peakipy.cli.main.fit(**args)
178def test_check_main_with_default(protein_L):
179 args = dict(
180 fits_path=protein_L / Path("fits_PV.csv"),
181 data_path=protein_L / Path("test1.ft2"),
182 clusters=[1],
183 first=True,
184 label=True,
185 show=True,
186 test=True,
187 individual=True,
188 )
189 peakipy.cli.main.check(**args)
192def test_check_main_with_gaussian(protein_L):
193 args = dict(
194 fits_path=protein_L / Path("fits_G.csv"),
195 data_path=protein_L / Path("test1.ft2"),
196 clusters=[1],
197 first=True,
198 label=True,
199 show=True,
200 test=True,
201 individual=True,
202 )
203 peakipy.cli.main.check(**args)
206def test_check_main_with_lorentzian(protein_L):
207 args = dict(
208 fits_path=protein_L / Path("fits_L.csv"),
209 data_path=protein_L / Path("test1.ft2"),
210 clusters=[1],
211 first=True,
212 label=True,
213 show=True,
214 test=True,
215 individual=True,
216 )
217 peakipy.cli.main.check(**args)
220def test_check_main_with_voigt(protein_L):
221 args = dict(
222 fits_path=protein_L / Path("fits_V.csv"),
223 data_path=protein_L / Path("test1.ft2"),
224 clusters=[1],
225 first=True,
226 label=True,
227 show=True,
228 test=True,
229 individual=True,
230 )
231 peakipy.cli.main.check(**args)
234def test_check_main_with_pv_pv(protein_L):
235 args = dict(
236 fits_path=protein_L / Path("fits_PV_PV.csv"),
237 data_path=protein_L / Path("test1.ft2"),
238 clusters=[1],
239 first=True,
240 label=True,
241 show=True,
242 test=True,
243 individual=True,
244 )
245 peakipy.cli.main.check(**args)
248def test_check_panel_PVPV(protein_L):
249 args = dict(
250 fits_path=protein_L / Path("fits_PV_PV.csv"),
251 data_path=protein_L / Path("test1.ft2"),
252 test=True,
253 panel=True,
254 )
255 peakipy.cli.main.check(**args)
258def test_check_panel_PV(protein_L):
259 args = dict(
260 fits_path=protein_L / Path("fits_PV.csv"),
261 data_path=protein_L / Path("test1.ft2"),
262 test=True,
263 panel=True,
264 )
265 peakipy.cli.main.check(**args)
268def test_check_panel_V(protein_L):
269 args = dict(
270 fits_path=protein_L / Path("fits_V.csv"),
271 data_path=protein_L / Path("test1.ft2"),
272 test=True,
273 panel=True,
274 )
275 peakipy.cli.main.check(**args)
278def test_edit_panel(protein_L):
279 args = dict(
280 peaklist_path=protein_L / Path("test.csv"),
281 data_path=protein_L / Path("test1.ft2"),
282 test=True,
283 )
284 peakipy.cli.main.edit(**args)