Skip to content

Passing background/resolution with empty source assigned gives unhelpful error #145

@alexhroom

Description

@alexhroom

If a Project is created and then a background or resolution source is set to "", then the error is

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rec93639/Code/python-RAT/RATapi/run.py", line 112, in run
    problem_definition, limits, cpp_controls = make_input(project, controls)
  File "/home/rec93639/Code/python-RAT/RATapi/inputs.py", line 148, in make_input
    problem = make_problem(project)
  File "/home/rec93639/Code/python-RAT/RATapi/inputs.py", line 283, in make_problem
    contrast_resolution_param.append(project.resolution_parameters.index(resolution.source, True))
  File "/home/rec93639/Code/python-RAT/RATapi/classlist.py", line 287, in index
    return self.data.index(item, *args) + int(offset)
ValueError: '' is not in list

rather than telling the user they need to define source.

MRE:

import RATapi as RAT
p, r = RAT.examples.DSPC_standard_layers()

p.resolutions[0].source = ""

c = RAT.Controls()
RAT.run(p, c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions