<commit_before>

"""
ScipyFitting module contains FitArrange , ScipyFit,
Parameter classes.All listed classes work together to perform a 
simple fit with scipy optimizer.
"""

import numpy 
from scipy import optimize

from sans.fit.AbstractFitEngine import FitEngine
from sans.fit.AbstractFitEngine import SansAssembly
#from sans.fit.AbstractFitEngine import FitAbort

class fitresult(object):
    """
    Storing fit result
    """
    def __init__(self, model=None, param_list=None):
        self.calls = None
        self.fitness = None
        self.chisqr = None
        self.pvec = None
        self.cov = None
        self.info = None
        self.mesg = None
        self.success = None
        self.stderr = None
        self.parameters = None
        self.model = model
        self.param_list = param_list
     
    def set_model(self, model):
        """
        """
        self.model = model
        
    def set_fitness(self, fitness):
        """
        """
        self.fitness = fitness
        
    def __str__(self):
        """
        """
        if self.pvec == None and self.model is None and self.param_list is None:
            return "No results"
        n = len(self.model.parameterset)

        result_param = zip(xrange(n), self.model.parameterset)
        msg = ["P%-3d  %s......|.....%s" % (p[0], p[1], p[1].value)\<commit_msg>Added iteration # in __str__ on Scipy_fitting<commit_after>

"""
ScipyFitting module contains FitArrange , ScipyFit,
Parameter classes.All listed classes work together to perform a 
simple fit with scipy optimizer.
"""

import numpy 
from scipy import optimize

from sans.fit.AbstractFitEngine import FitEngine
from sans.fit.AbstractFitEngine import SansAssembly
#from sans.fit.AbstractFitEngine import FitAbort

class fitresult(object):
    """
    Storing fit result
    """
    def __init__(self, model=None, param_list=None):
        self.calls = None
        self.fitness = None
        self.chisqr = None
        self.pvec = None
        self.cov = None
        self.info = None
        self.mesg = None
        self.success = None
        self.stderr = None
        self.parameters = None
        self.model = model
        self.param_list = param_list
        self.iterations = 0
     
    def set_model(self, model):
        """
        """
        self.model = model
        
    def set_fitness(self, fitness):
        """
        """
        self.fitness = fitness
        
    def __str__(self):
        """
        """
        if self.pvec == None and self.model is None and self.param_list is None:
            return "No results"
        n = len(self.model.parameterset)
        self.iterations += 1
        result_param = zip(xrange(n), self.model.parameterset)
        msg = [" [Iteration #: %s] | P%-3d  %s......|.....%s" % \
               (self.iterations, p[0], p[1], p[1].value)\
{'fraction_non_alphanumeric': 0.10800419433764417, 'fraction_numerical': 0.003495281370150297, 'mean_word_length': 2.038216560509554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2954270', 'n_tokens_mistral': 880, 'n_tokens_neox': 852, 'n_words': 227}