#!/usr/bin/env python3
# -*- coding: utf-8 -*-


# ***************************************************************************
#                                                                           *
# Copyright (C) 2019  <NAME>                          *
#                                                                           *
# Licensed under the Apache License, Version 2.0 (the "License");           *
# you may not use this file except in compliance with the License.          *
# You may obtain a copy of the License at                                   *
#                                                                           *
#    http://www.apache.org/licenses/LICENSE-2.0                             *
#                                                                           *
# Unless required by applicable law or agreed to in writing, software       *
# distributed under the License is distributed on an "AS IS" BASIS,         *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
# See the License for the specific language governing permissions and       *
# limitations under the License.                                            *
# ***************************************************************************

# 2019-07-04

import numpy as np
from numpy import sqrt, sin, cos

def clarkeTransformation(a, b, c):
    alpha = (2/3) * (a      + (-1*b/2)               + (-1*c/2))
    beta =  (2/3) * (0      + (np.sqrt(3) * b/2)     + (-1 * np.sqrt(3) * c/2))
    gamma = (2/3) * (a/2    + b/2                    + c/2)

    amplitude   = np.sqrt(np.power(alpha, 2) + np.power(beta, 2))
    angle       = 180/np.pi*(np.arctan2(alpha, beta))

    return alpha, beta, gamma, amplitude, angle

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


# ***************************************************************************
#                                                                           *
# Copyright (C) 2019  <NAME>                          *
#                                                                           *
# Licensed under the Apache License, Version 2.0 (the "License");           *
# you may not use this file except in compliance with the License.          *
# You may obtain a copy of the License at                                   *
#                                                                           *
#    http://www.apache.org/licenses/LICENSE-2.0                             *
#                                                                           *
# Unless required by applicable law or agreed to in writing, software       *
# distributed under the License is distributed on an "AS IS" BASIS,         *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
# See the License for the specific language governing permissions and       *
# limitations under the License.                                            *
# ***************************************************************************

# 2019-07-04

import numpy as np
from numpy import sqrt, sin, cos

def clarkeTransformation(a, b, c):
    alpha = (2/3) * (a      + (-1*b/2)               + (-1*c/2))
    beta =  (2/3) * (0      + (np.sqrt(3) * b/2)     + (-1 * np.sqrt(3) * c/2))
    gamma = (2/3) * (a/2    + b/2                    + c/2)

    amplitude   = np.sqrt(np.power(alpha, 2) + np.power(beta, 2))
    angle       = 180/np.pi*(np.arctan2(alpha, beta))

    return alpha, beta, gamma, amplitude, angle

#!/usr/bin/env python3 # -*- coding: utf-8 -*- # *************************************************************************** #                                                                           * # Copyright (C) 2019  <NAME>                          * #                                                                           * # Licensed under the Apache License, Version 2.0 (the "License");           * # you may not use this file except in compliance with the License.          * # You may obtain a copy of the License at                                   * #                                                                           * #    http://www.apache.org/licenses/LICENSE-2.0                             * #                                                                           * # Unless required by applicable law or agreed to in writing, software       * # distributed under the License is distributed on an "AS IS" BASIS,         * # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  * # See the License for the specific language governing permissions and       * # limitations under the License.                                            * # *************************************************************************** # 2019-07-04