@@ -101,6 +101,52 @@ def test_remember_initial_params(qtbot):
101
101
assert float (itab .item (1 , 1 ).text ()) == 5
102
102
103
103
104
+ def test_update_ancillary_init (qtbot ):
105
+ with MockModel (
106
+ compute_ancillaries = lambda x : {
107
+ # take initial fit parameter of E
108
+ "E" : x .get_initial_fit_parameters (
109
+ model_ancillaries = False )["E" ].value },
110
+ parameter_anc_keys = ["E" ],
111
+ parameter_anc_names = ["ancillary E guess" ],
112
+ parameter_anc_units = ["Pa" ],
113
+ model_key = "test1" ):
114
+
115
+ main_window = pyjibe .head .PyJibe ()
116
+ main_window .load_data (files = [jpkfile , jpkfile ])
117
+ war = main_window .subwindows [0 ].widget ()
118
+ # clear data
119
+ war .tab_preprocess .list_preproc_applied .clear ()
120
+ war .cb_autosave .setChecked (0 )
121
+ # perform simple filter
122
+ item = QtWidgets .QListWidgetItem ()
123
+ item .setText ("compute_tip_position" )
124
+ war .tab_preprocess .list_preproc_applied .addItem (item )
125
+ # disable weighting
126
+ war .tab_fit .cb_weight_cp .setCheckState (0 )
127
+ # set mock model
128
+ idx = war .tab_fit .cb_model .findData ("test1" )
129
+ war .tab_fit .cb_model .setCurrentIndex (idx )
130
+ # perform fitting with standard parameters
131
+ # set initial parameters in user interface
132
+ itab = war .tab_fit .table_parameters_initial
133
+ atab = war .tab_fit .table_parameters_anc
134
+ war .on_tab_changed (1 )
135
+ assert len (war .data_set [0 ].preprocessing ) == 1
136
+ assert war .tab_preprocess .list_preproc_applied .count () == 1
137
+ # The ancillary parameter gets its value from the default parameters
138
+ assert atab .item (0 , 1 ).text () == "3000"
139
+ assert itab .item (0 , 1 ).text () == "3000"
140
+ # Now we change the initial parameter "E" and move on to the next
141
+ # curve. Ancillary parameter "F" should also change.
142
+ itab .item (0 , 1 ).setText ("2000" )
143
+ assert atab .item (0 , 1 ).text () == "2000"
144
+ it = war .list_curves .topLevelItem (1 )
145
+ war .list_curves .setCurrentItem (it )
146
+ assert itab .item (0 , 1 ).text () == "2000"
147
+ assert atab .item (0 , 1 ).text () == "2000"
148
+
149
+
104
150
def test_update_ancillary_nan (qtbot ):
105
151
with MockModel (
106
152
compute_ancillaries = lambda x : {"E" : np .nan },
0 commit comments