def run(self, data, results=None, mask=None, positions=None):
model_image = results.last.unmasked_model_image<EOL>galaxy_tuples = results.last.constant.name_instance_tuples_for_class(g.Galaxy)<EOL>results_copy = copy.copy(results.last)<EOL>for name, galaxy in galaxy_tuples:<EOL><INDENT>optimizer = self.optimizer.copy_with_name_extension(name)<EOL>optimizer.variable.hyper_galaxy = g.HyperGalaxy<EOL>galaxy_image = results.last.unmasked_image_for_galaxy(galaxy)<EOL>optimizer.fit(self.__class__.Analysis(data, model_image, galaxy_image))<EOL>getattr(results_copy.variable, name).hyper_galaxy = optimizer.variable.hyper_galaxy<EOL>getattr(results_copy.constant, name).hyper_galaxy = optimizer.constant.hyper_galaxy<EOL><DEDENT>return results_copy<EOL>
Run a fit for each galaxy from the previous phase.

Parameters
----------
data: LensData
results: ResultsCollection
    Results from all previous phases
mask: Mask
    The mask
positions

Returns
-------
results: HyperGalaxyResults
    A collection of results, with one item per a galaxy