@@ -653,18 +653,24 @@ class SCompositeModel(_CompositeModel):
653653
654654 Examples
655655 --------
656- Apply a 2D rotation followed by a shift in x and y
657-
658- >>> from astropy.modeling import *
659- >>> rot = builtin_models.MatrixRotation2D(angle=23.5)
660- >>> offx = builtin_models.ShiftModel(-4.23)
661- >>> offy = builtin_models.ShiftModel(2)
662- >>> linp = LabeledInput([x, y], ["x", "y"]
663- >>> scomptr = SCompositeModel([rot, offx, offy],
664- inmap=[['x', 'y'], ['x'], ['y']],
665- outmap=[['x', 'y'], ['x'], ['y']])
666- >>> result=scomptr(linp)
667-
656+
657+ >>> from astropy.modeling import models, LabeledInput, SCompositeModel
658+ >>> # Set up the serial composite model:
659+ >>> # 2D rotation followed by a shift in x and y
660+ >>> rotation = models.MatrixRotation2D(angle=90)
661+ >>> shift_x = models.ShiftModel(2)
662+ >>> shift_y = models.ShiftModel(5)
663+ >>> model = SCompositeModel([rotation, shift_x, shift_y],
664+ ... inmap=[['x', 'y'], ['x'], ['y']],
665+ ... outmap=[['x', 'y'], ['x'], ['y']])
666+ >>> # Evaluate the model
667+ >>> input_pos = LabeledInput([0, 1], ["x", "y"])
668+ >>> output_pos = model(input_pos)
669+ >>> # 90 deg clockwise rotation: [0, 1] -> [1, 0]
670+ >>> # x shift by 2: [1, 0] -> [3, 0]
671+ >>> # y shift by 5: [3, 0] -> [3, 5]
672+ >>> print(output_pos)
673+ {'y': 5.0, 'x': 3.0}
668674 """
669675 def __init__ (self , transforms , inmap = None , outmap = None ):
670676 super (SCompositeModel , self ).__init__ (transforms , inmap , outmap )
0 commit comments