@@ -47,15 +47,14 @@ def test_calibration_workflow(
4747 """Test complete calibration workflow without prediction."""
4848 calibration = LinearCCSCalibration (per_charge = True )
4949
50- target_df = pd .DataFrame ({
51- 'peptidoform' : sample_peptidoforms ,
52- 'metadata' : [{'CCS' : ccs } for ccs in sample_ccs_values ]
53- })
54-
55- source_df = pd .DataFrame ({
56- 'peptidoform' : sample_peptidoforms ,
57- 'CCS' : sample_predicted_ccs
58- })
50+ target_df = pd .DataFrame (
51+ {
52+ "peptidoform" : sample_peptidoforms ,
53+ "metadata" : [{"CCS" : ccs } for ccs in sample_ccs_values ],
54+ }
55+ )
56+
57+ source_df = pd .DataFrame ({"peptidoform" : sample_peptidoforms , "CCS" : sample_predicted_ccs })
5958
6059 # Fit calibration
6160 calibration .fit (
@@ -66,11 +65,15 @@ def test_calibration_workflow(
6665 assert calibration .is_fitted
6766
6867 # Transform predictions
69- transform_df = pd .DataFrame ({
70- 'peptidoform' : sample_peptidoforms ,
71- 'metadata' : [{'predicted_CCS_uncalibrated' : pred } for pred in sample_predicted_ccs ]
72- })
73-
68+ transform_df = pd .DataFrame (
69+ {
70+ "peptidoform" : sample_peptidoforms ,
71+ "metadata" : [
72+ {"predicted_CCS_uncalibrated" : pred } for pred in sample_predicted_ccs
73+ ],
74+ }
75+ )
76+
7477 calibrated = calibration .transform (transform_df )
7578
7679 assert len (calibrated ) == len (sample_predicted_ccs )
@@ -82,7 +85,9 @@ def test_calibration_workflow(
8285 assert val > 0
8386
8487 # Calibrated values should be closer to targets (compare scalars)
85- calibrated_scalars = np .array ([v if not isinstance (v , np .ndarray ) else v [0 ] for v in calibrated ])
88+ calibrated_scalars = np .array (
89+ [v if not isinstance (v , np .ndarray ) else v [0 ] for v in calibrated ]
90+ )
8691 original_error = np .mean (np .abs (sample_predicted_ccs - sample_ccs_values ))
8792 calibrated_error = np .mean (np .abs (calibrated_scalars - sample_ccs_values ))
8893 assert calibrated_error <= original_error
@@ -93,15 +98,16 @@ def test_multi_output_calibration_workflow(
9398 """Test calibration workflow with multi-output predictions."""
9499 calibration = LinearCCSCalibration (per_charge = True )
95100
96- target_df = pd .DataFrame ({
97- 'peptidoform' : sample_peptidoforms ,
98- 'metadata' : [{'CCS' : ccs } for ccs in sample_ccs_values ]
99- })
100-
101- source_df = pd .DataFrame ({
102- 'peptidoform' : sample_peptidoforms ,
103- 'CCS' : sample_ccs_values - 2.0
104- })
101+ target_df = pd .DataFrame (
102+ {
103+ "peptidoform" : sample_peptidoforms ,
104+ "metadata" : [{"CCS" : ccs } for ccs in sample_ccs_values ],
105+ }
106+ )
107+
108+ source_df = pd .DataFrame (
109+ {"peptidoform" : sample_peptidoforms , "CCS" : sample_ccs_values - 2.0 }
110+ )
105111
106112 # Fit with single output targets
107113 calibration .fit (
@@ -110,11 +116,15 @@ def test_multi_output_calibration_workflow(
110116 )
111117
112118 # Transform multi-output predictions
113- transform_df = pd .DataFrame ({
114- 'peptidoform' : sample_peptidoforms ,
115- 'metadata' : [{'predicted_CCS_uncalibrated' : pred } for pred in sample_predicted_ccs_multi ]
116- })
117-
119+ transform_df = pd .DataFrame (
120+ {
121+ "peptidoform" : sample_peptidoforms ,
122+ "metadata" : [
123+ {"predicted_CCS_uncalibrated" : pred } for pred in sample_predicted_ccs_multi
124+ ],
125+ }
126+ )
127+
118128 calibrated = calibration .transform (transform_df )
119129
120130 assert len (calibrated ) == len (sample_predicted_ccs_multi )
@@ -155,15 +165,11 @@ def test_charge_state_coverage(self):
155165 ccs_target = np .array ([300.0 , 400.0 , 500.0 , 600.0 , 700.0 ])
156166 ccs_source = ccs_target - 5.0
157167
158- target_df = pd .DataFrame ({
159- 'peptidoform' : peptidoforms ,
160- 'metadata' : [{'CCS' : ccs } for ccs in ccs_target ]
161- })
162-
163- source_df = pd .DataFrame ({
164- 'peptidoform' : peptidoforms ,
165- 'CCS' : ccs_source
166- })
168+ target_df = pd .DataFrame (
169+ {"peptidoform" : peptidoforms , "metadata" : [{"CCS" : ccs } for ccs in ccs_target ]}
170+ )
171+
172+ source_df = pd .DataFrame ({"peptidoform" : peptidoforms , "CCS" : ccs_source })
167173
168174 calibration = LinearCCSCalibration (per_charge = True )
169175 calibration .fit (
@@ -219,11 +225,15 @@ def test_array_shape_consistency(self, sample_peptidoforms, sample_predicted_ccs
219225 calibration .general_shift = 4.0
220226 calibration .fitted = True
221227
222- transform_df = pd .DataFrame ({
223- 'peptidoform' : sample_peptidoforms ,
224- 'metadata' : [{'predicted_CCS_uncalibrated' : pred } for pred in sample_predicted_ccs ]
225- })
226-
228+ transform_df = pd .DataFrame (
229+ {
230+ "peptidoform" : sample_peptidoforms ,
231+ "metadata" : [
232+ {"predicted_CCS_uncalibrated" : pred } for pred in sample_predicted_ccs
233+ ],
234+ }
235+ )
236+
227237 result = calibration .transform (transform_df )
228238
229239 assert len (result ) == len (sample_predicted_ccs )
0 commit comments