Skip to content

Remove unnecessary x and y arguments in 1D optimization routines #10

@utkarshp1161

Description

@utkarshp1161

Problem: Remove unnecessary x and y arguments in 1D optimization routines

Description:

Currently, the black-box function zheight_tune in our 1D optimization routine calls:

tf_acquisition.move_stage_translation_absolute(x=x_old, y=y_old, z=z/1e6)

This implies that x_old and y_old must be passed even though the optimization is only being performed over z. This is reflected in [MLlayerBO.py](https://github.com/pycroscopy/pyAutoMic/blob/main/TEM/stemOrchestrator/stemOrchestrator/MLlayer/MLlayerBO.py#L2), specifically in the Tune1d class:

def _acquire_data(self, x):
    result = self.python_command(self.old_x, self.old_y, x.item())
    return result

However, in cases like defocus tuning, where we use:

tf_acquisition.microscope.optics.defocus = z / 1e6

there is no need to pass x and y at all. Still, the Tune1d class requires those parameters, which makes the interface unnecessarily rigid and confusing for use cases that do not involve x or y movements.


Suggested Fix:

  • Refactor Tune1d and similar routines to allow optional x and y arguments.
  • Update python_command calls accordingly, using only relevant parameters for the specific optimization.
  • Ensure backward compatibility where x, y, and z stage control is required.

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