<commit_before>import numpy as np
import condor

def compare_two_sets_of_quaternions(q1,q2,full_output=False,n_samples=100,q1_is_extrinsic=False,q2_is_extrinsic=False,sigma=2):
    """
    Compares two sets of quaternions based on a comparison of randomly picked quaternions within each set. 

    Args: 
        :q1(float ndarray):        5d ndarray of intrinsic quaternions
        :q2(float ndarray):        5d ndarray of intrinsic quaternions

    Kwargs:
        :full_output(bool):        returns full output as a dictionary, default = False
        :n_samples(int):           number of randomly picked pairs of quaternions, default = 100
        :q1_is_extrinsic(bool):    q1 quaternions are extrinsic and should be converted to instrinsic, default = False
        :q2_is_extrinsic(bool):    q2 quaternions are extrinsic and should be converted to instrinsic, default = False 
        :sigma(int):               sigma of standart deviation, default = 2
    """

    q1_rel_list = []
    q2_rel_list = []
    theta_rel = []

    # iterate through a number of randomly picked pairs
    for i in range(n_samples):

        m = 0
        n = 0
        
        while m==n:
            # pick random index
            m = np.random.randint(0,q1.shape[0]-1)
            n = np.random.randint(0,q1.shape[0]-1)
                
        # pick random quaternions and make sure they are represented on one half of the hyper sphere
        q1_m = q1[m,:]
        q1_n = q1[n,:]
        q2_m = q2[m,:]
        q2_n = q2[n,:]

        # normalise quaternions
        q1_m = q1_m/np.sqrt(q1_m[0]**2 + q1_m[1]**2 + q1_m[2]**2 + q1_m[3]**2)
        q1_n = q1_n/np.sqrt(q1_n[0]**2 + q1_n[1]**2 + q1_n[2]**2 + q1_n[3]**2)
        q2_m = q2_m/np.sqrt(q2_m[0]**2 + q2_m[1]**2 + q2_m[2]**2 + q2_m[3]**2)
        q2_n = q2_n/np.sqrt(q2_n[0]**2 + q2_n[1]**2 + q2_n[2]**2 + q2_n[3]**2)

        # convert quaternions if necessary
        if q1_is_extrinsic: 
            q1_m = condor.utils.rotation.quat_conj(q1_m)
            q1_n = condor.utils.rotation.quat_conj(q1_n)
        if q2_is_extrinsic: 
            q2_m = condor.utils.rotation.quat_conj(q2_m)
            q2_n = condor.utils.rotation.quat_conj(q2_n)

        # calculating the inverse of q -> q^-1
        q1_n_inv = condor.utils.rotation.quat_conj(q1_n)/(np.sqrt(q1_n[0]**2 + q1_n[1]**2 + q1_n[2]**2 + q1_n[3]**2)**2)
        q2_n_inv = condor.utils.rotation.quat_conj(q2_n)/(np.sqrt(q2_n[0]**2 + q2_n[1]**2 + q2_n[2]**2 + q2_n[3]**2)**2)
    
        # calculating the relative quaternion q_rel = q_m * q_n^-1
        q1_rel = condor.utils.rotation.quat_mult(q1_n_inv, q1_m)
        if q1_is_extrinsic or q2_is_extrisnic:
            q1_rel = condor.utils.rotation.quat_mult(q1_m,q1_n_inv)

        w1 = q1_rel[0]

        # calculating the relative quaternion q_rel = q_m * q_n^-1 
        q2_rel_1 = condor.utils.rotation.quat_mult(q2_n_inv, q2_m)<commit_msg>fixed typo<commit_after>import numpy as np
import condor

def compare_two_sets_of_quaternions(q1,q2,full_output=False,n_samples=100,q1_is_extrinsic=False,q2_is_extrinsic=False,sigma=2):
    """
    Compares two sets of quaternions based on a comparison of randomly picked quaternions within each set. 

    Args: 
        :q1(float ndarray):        5d ndarray of intrinsic quaternions
        :q2(float ndarray):        5d ndarray of intrinsic quaternions

    Kwargs:
        :full_output(bool):        returns full output as a dictionary, default = False
        :n_samples(int):           number of randomly picked pairs of quaternions, default = 100
        :q1_is_extrinsic(bool):    q1 quaternions are extrinsic and should be converted to instrinsic, default = False
        :q2_is_extrinsic(bool):    q2 quaternions are extrinsic and should be converted to instrinsic, default = False 
        :sigma(int):               sigma of standart deviation, default = 2
    """

    q1_rel_list = []
    q2_rel_list = []
    theta_rel = []

    # iterate through a number of randomly picked pairs
    for i in range(n_samples):

        m = 0
        n = 0
        
        while m==n:
            # pick random index
            m = np.random.randint(0,q1.shape[0]-1)
            n = np.random.randint(0,q1.shape[0]-1)
                
        # pick random quaternions and make sure they are represented on one half of the hyper sphere
        q1_m = q1[m,:]
        q1_n = q1[n,:]
        q2_m = q2[m,:]
        q2_n = q2[n,:]

        # normalise quaternions
        q1_m = q1_m/np.sqrt(q1_m[0]**2 + q1_m[1]**2 + q1_m[2]**2 + q1_m[3]**2)
        q1_n = q1_n/np.sqrt(q1_n[0]**2 + q1_n[1]**2 + q1_n[2]**2 + q1_n[3]**2)
        q2_m = q2_m/np.sqrt(q2_m[0]**2 + q2_m[1]**2 + q2_m[2]**2 + q2_m[3]**2)
        q2_n = q2_n/np.sqrt(q2_n[0]**2 + q2_n[1]**2 + q2_n[2]**2 + q2_n[3]**2)

        # convert quaternions if necessary
        if q1_is_extrinsic: 
            q1_m = condor.utils.rotation.quat_conj(q1_m)
            q1_n = condor.utils.rotation.quat_conj(q1_n)
        if q2_is_extrinsic: 
            q2_m = condor.utils.rotation.quat_conj(q2_m)
            q2_n = condor.utils.rotation.quat_conj(q2_n)

        # calculating the inverse of q -> q^-1
        q1_n_inv = condor.utils.rotation.quat_conj(q1_n)/(np.sqrt(q1_n[0]**2 + q1_n[1]**2 + q1_n[2]**2 + q1_n[3]**2)**2)
        q2_n_inv = condor.utils.rotation.quat_conj(q2_n)/(np.sqrt(q2_n[0]**2 + q2_n[1]**2 + q2_n[2]**2 + q2_n[3]**2)**2)
    
        # calculating the relative quaternion q_rel = q_m * q_n^-1
        q1_rel = condor.utils.rotation.quat_mult(q1_n_inv, q1_m)
        if q1_is_extrinsic or q2_is_extrinsic:
            q1_rel = condor.utils.rotation.quat_mult(q1_m,q1_n_inv)

        w1 = q1_rel[0]

        # calculating the relative quaternion q_rel = q_m * q_n^-1 
        q2_rel_1 = condor.utils.rotation.quat_mult(q2_n_inv, q2_m)
{'fraction_non_alphanumeric': 0.12162858615358185, 'fraction_numerical': 0.05291187081257516, 'mean_word_length': 2.4862275449101796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '87735', 'n_tokens_mistral': 2416, 'n_tokens_neox': 2319, 'n_words': 452}