def main():
    """
    Test the functions from analysis programs
    """
    # Load dataset
    df = pd.read_csv('US_Accidents_Dec19.csv')

    # Question 1: Using pie charts to show the percentage of each range
    # of a given factor.
    wind_speed(df)
    numeric_factors(df)
    cate_factors(df)

    # Question 2: Predict the severity of traffic accident
    # with machine learning model
    result = fit_and_predict_severity(df)
    print('Mean Squared Error:', result[0])
    print('Accuracy Score:', result[1])
    def power_shape(self, config=(0, 0), step=1, average=True):
        """
        Create a generator on farm output layout

        NOTICE:
        x-distance and y-distance should be => self.turbine_diameter

        :param step: step in degrees
        :param config: tuple of type (number of turbines in x-direction,... y-direction)
        :param average: bool whether return integral value or sequence
        :return:
        """
        # assert ((config[0] > self.turbine_diameter) & (config[1] > self.turbine_diameter),
        #         'Distance between turbines x: {a}, y: {b} should be grater than radius r: {c}'
        #         .format(a=config[0], b=config[1], c=self.turbine_diameter / 2))

        self.turbines_list(config[0], config[1])
        theta = []
        output = []

        for angle in range(0, 91, step):
            theta.append(angle)
            self.wind.direction = radians(angle)

            power = 0

            for i in xrange(len(self.turbines)):
                self.turbines[i].w.set_direction(self.wind.direction)
                for j in xrange(i+1, len(self.turbines)):
                    self.turbines[j].set_wind(wind_speed(self.wind, self.turbines[i], self.turbines[j]),
                                              self.wind.direction)

            for turbine in self.turbines:
                power += round(turbine.power, 2)

            output.append(power)

        if average:
            return sum(output) / len(self.turbines)  #__reduce__(lambda x, y: x+y/len(self.turbines))

        return [theta, output]
theta = []
speed = [[], [], [], [], [], [], [], [], []]

output = []

for angle in drange(0, 91, 1):
    theta.append(angle)
    w0.direction = radians(angle)

    power = 0

    for i in xrange(len(turbines)):
        turbines[i].w.set_direction(w0.direction)
        for j in xrange(i+1, len(turbines)):
            turbines[j].set_wind(wind_speed(w0, turbines[i], turbines[j]), w0.direction)

    for turbine in turbines:
        power += turbine.power

    output.append(power)

    for i in xrange(len(turbines)):
        speed[i].append(turbines[i].w.v0)


# for turbine in turbines:
#     print turbine


plt.figure(1)