Skip to content

In-place list operations on Simulate.params cause run failure #33

@lesslogic

Description

@lesslogic

Using in-place list operations (append(), extend()) to modify the Simulate.params property leads to an AttributeError when run() is called. My suspicion is this happens because the operations bypass the parameter extraction/validation.

Result of calling run() after using params.append() or params.extend():

File ~/git-repos/raypyng/src/raypyng/simulate.py:611, in Simulate._save_parameters_to_file(self, dir)
    603 def _save_parameters_to_file(self, dir):
    604     """Save user input parameters to file.
    605     
    606     It takes the values from the SimulationParams class
   (...)
    609         dir (str): the folder where to save the parameters
    610     """        
--> 611     for i, p in enumerate(self.sp.ind_par):
    612         filename = str(p.get_full_path().lstrip("lab.beamline."))
    613         filename = "input_param_"+filename.replace(".", "_")

AttributeError: 'NoneType' object has no attribute 'ind_par'

Note: This issue probably existed prior to merge of pull request #31, but it was masked by the error being thrown by the params getter (#29).

Also note: Simulate.exports does not suffer from this problem.

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