Fit an analysis with a set of grid priors. The grid priors are priors associated with the model mapper
        of this instance that are replaced by uniform priors for each step of the grid search.

        Parameters
        ----------
        analysis: non_linear.Analysis
            An analysis used to determine the fitness of a given model instance
        grid_priors: [p.Prior]
            A list of priors to be substituted for uniform priors across the grid.

        Returns
        -------
        result: GridSearchResult
            An object that comprises the results from each individual fit

def fit(self, analysis, grid_priors):
        """
        Fit an analysis with a set of grid priors. The grid priors are priors associated with the model mapper
        of this instance that are replaced by uniform priors for each step of the grid search.

        Parameters
        ----------
        analysis: non_linear.Analysis
            An analysis used to determine the fitness of a given model instance
        grid_priors: [p.Prior]
            A list of priors to be substituted for uniform priors across the grid.

        Returns
        -------
        result: GridSearchResult
            An object that comprises the results from each individual fit
        """
        grid_priors = list(set(grid_priors))
        results = []
        lists = self.make_lists(grid_priors)

        results_list = [list(map(self.variable.name_for_prior, grid_priors)) + ["figure_of_merit"]]

        def write_results():
            with open("{}/results".format(self.phase_output_path), "w+") as f:
                f.write("\n".join(map(lambda ls: ", ".join(
                    map(lambda value: "{:.2f}".format(value) if isinstance(value, float) else str(value), ls)),
                                      results_list)))

        for values in lists:
            arguments = self.make_arguments(values, grid_priors)
            model_mapper = self.variable.mapper_from_partial_prior_arguments(arguments)

            labels = []
            for prior in arguments.values():
                labels.append(
                    "{}_{:.2f}_{:.2f}".format(model_mapper.name_for_prior(prior), prior.lower_limit, prior.upper_limit))

            name_path = "{}{}/{}".format(self.phase_name, self.phase_tag, "_".join(labels))
            optimizer_instance = self.optimizer_instance(model_mapper, name_path)
            optimizer_instance.constant = self.constant
            result = optimizer_instance.fit(analysis)
            results.append(result)

            results_list.append([*[prior.lower_limit for prior in arguments.values()], result.figure_of_merit])

            write_results()

        return GridSearchResult(results, lists)