Skip to content

WIP: Coupled / compound parameters

finesse importer requested to merge feature/coupled_param_scans into master

Fixes #133 (closed)

This merge request makes adjustments to the xNaxis functions and StepParamND action to allow scanning of iterables of parameters. It also changes Surface.Rc to always return a tuple of the Rcx, Rcy model parameters so that these can be scanned simultaneously (without needing manual reference setting) due to the xaxis changes mentioned above.

If the parameter specified for an xaxis scan (for example) is an iterable of params (e.g. from Surface.Rc) then each parameter after the first in the iterable will be set to the ref of the first - thereby setting up temporary references such that these parameters will get set to the value of the first for each data point during the scan. All parameters will get reset to their initial values at the end of the xaxis analysis.

Currently this works when using the xNaxis functions, however it does not yet parse correctly due to the change made to Surface.Rc. The following error will occur:

Traceback (most recent call last):
  File "playground/homs/roc_scan_nomatrix.py", line 28, in <module>
    """
  File "/home/sam/Documents/phd/finesse_development/src/finesse/model.py", line 1270, in parse
    parse(text, model=self)
  File "/home/sam/Documents/phd/finesse_development/src/finesse/script/__init__.py", line 25, in parse
    return parser.parse(text, model=model)
  File "/home/sam/Documents/phd/finesse_development/src/finesse/script/base.py", line 44, in parse
    return self._do_parse(text, model, **kwargs)
  File "/home/sam/Documents/phd/finesse_development/src/finesse/script/parser.py", line 128, in _do_parse
    return self._build(parser, model)
  File "/home/sam/Documents/phd/finesse_development/src/finesse/script/parser.py", line 184, in _build
    _resolve_analysis_args(model, statement.args, statement.kwargs)
  File "/home/sam/Documents/phd/finesse_development/src/finesse/script/parser.py", line 27, in _resolve_analysis_args
    _resolve_analysis_args(model, *value[1])
TypeError: _resolve_analysis_args() argument after * must be an iterable, not finesse.element.Parameter

as Rc now returns a tuple rather than a single parameter even if the surface is non-astigmatic.

These changes also mean that a Parameter (or iterable of) must be passed to XNaxis for now rather than allowing a string too as before.

Merge request reports