thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
253 stars 151 forks source link

ROPE error #315

Open ShuaiGe57 opened 7 months ago

ShuaiGe57 commented 7 months ago

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() will occur if there are same likes. key parameter of sorted should be set in line #74 of rope.py

    def get_best_runs(self, likes, pars, runs, percentage):
        """
        Returns the best xx% of the runs"""
        return [
            new_pars
            for (new_likes, new_pars) in sorted(zip(likes, pars), key=lambda x: x[0])[
                int(len(likes) * (1 - percentage)) :
            ]
        ]