In OpticStudio Sequential mode, one can use the Spot Diagram to view the RMS spot radius. And you can use operand such as RSCE, RSCH, RSRE, and RSRH to report this radial RMS spot size into the Merit Function Editor for optimization. However, if your system provides a non-circular spot, you might want to know the spot size along the X or Y direction separately and might want to optimize the X or Y spot size individually. When you go to the Text tab of the Spot Diagram window, you can view the RMS spot size in X or Y direction, but the RSCE/RSRE operands only report the radial spot size and cannot report the size along the X or Y direction separately.
One thing you can do is to create a ZPL macro to pull data from the Spot Diagram Text tab and then use the ZPLM operand to return these X/Y spot size into the Merit Function Editor for optimization. However, this takes some programming effort and also having the ZPLM operand in the MFE might slow down the optimization process.
Another approach is to use the IMAE operand instead. The Geometric Image Analysis (GIA) is a powerful tool. And the IMAE operand returns useful information including fractional efficiency, centroid, or RMS data as computed by the GIA analysis. However, one thing to keep in mind is that similar to the POPD operand where user needs to first set up the POP analysis, the IMAE operand also requires user to first enter all desired settings in the GIA analysis and press Save. This is to make sure that the IMAE operand data will be computed using the Saved settings in the GIA analysis. You can find a detailed description on how to use IMAE operand in the Help system at The Optimize Tab (sequential ui mode) > Automatic Optimization Group > Merit Function Editor (automatic optimization group) > Optimization Operands (Alphabetically)
In this file if I set up the GIA analysis as shown below, and click the Save button to save its settings, I can then use the IMAE operand Data 3, 4, 5 to return the X, Y or Radial direction RMS spot size.
Now if I have a specific X or Y spot size target, I can enter those into the MFE as Target for the IMAE operand, assign a weight and start optimization.