@@ -247,6 +247,7 @@ def make_problem(project: RATapi.Project, checks: Checks) -> ProblemDefinition:
247247 background = project .backgrounds [contrast .background ]
248248 contrast_background_types .append (background .type )
249249 contrast_background_param = []
250+
250251 if background .type == TypeOptions .Data :
251252 contrast_background_param .append (project .data .index (background .source , True ))
252253 if background .value_1 != "" :
@@ -275,17 +276,37 @@ def make_problem(project: RATapi.Project, checks: Checks) -> ProblemDefinition:
275276
276277 contrast_background_params .append (contrast_background_param )
277278
278- # contrast data has exactly six columns to include background data if relevant
279- all_data .append (np .column_stack ((data , np .zeros ((data .shape [0 ], 6 - data .shape [1 ])))))
280-
281- # Set resolution parameters, with -1 used to indicate a data resolution
282- contrast_resolution_param = []
279+ # set resolution parameters
283280 resolution = project .resolutions [contrast .resolution ]
284281 contrast_resolution_types .append (resolution .type )
285- if resolution .source :
282+ contrast_resolution_param = []
283+ if resolution .type == TypeOptions .Data :
284+ # The source field is empty for a data resolution
285+ pass
286+ elif resolution .type == TypeOptions .Function :
287+ contrast_resolution_param .append (project .custom_files .index (resolution .source , True ))
288+ contrast_resolution_param .extend (
289+ [
290+ project .resolution_parameters .index (value , True )
291+ for value in [
292+ resolution .value_1 ,
293+ resolution .value_2 ,
294+ resolution .value_3 ,
295+ resolution .value_4 ,
296+ resolution .value_5 ,
297+ ]
298+ if value != ""
299+ ]
300+ )
301+
302+ else :
286303 contrast_resolution_param .append (project .resolution_parameters .index (resolution .source , True ))
304+
287305 contrast_resolution_params .append (contrast_resolution_param )
288306
307+ # contrast data has exactly six columns to include background data if relevant
308+ all_data .append (np .column_stack ((data , np .zeros ((data .shape [0 ], 6 - data .shape [1 ])))))
309+
289310 problem = ProblemDefinition ()
290311
291312 problem .TF = project .calculation
0 commit comments