<s> """<STR_LIT>""" <EOL> import unittest <EOL> import numpy <EOL> from pyRMSD . condensedMatrix import CondensedMatrix <EOL> import scipy . spatial . distance <EOL> from pyproct . postprocess . actions . confSpaceComparison . tools import calculate_mean_center_differences , calculate_distance_stats <EOL> class Test ( unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> cls . decomposed_cluster = { <EOL> "<STR_LIT>" : [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> ] , <EOL> "<STR_LIT>" : [ <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> ] <EOL> } <EOL> square_points = numpy . array ( [ [ <NUM_LIT:0> , <NUM_LIT:0> ] , [ <NUM_LIT:0> , <NUM_LIT:2> ] , [ <NUM_LIT:2> , <NUM_LIT:0> ] , [ <NUM_LIT:2> , <NUM_LIT:2> ] , [ <NUM_LIT:1> , <NUM_LIT:1> ] ] ) <EOL> square_points_2 = square_points + numpy . array ( [ <NUM_LIT:0> , <NUM_LIT:5> ] ) <EOL> square_points_3 = square_points + numpy . array ( [ <NUM_LIT:5> , <NUM_LIT:0> ] ) <EOL> cls . square_points = square_points . tolist ( ) <EOL> cls . square_points . extend ( square_points_2 . tolist ( ) ) <EOL> cls . square_points . extend ( square_points_3 . tolist ( ) ) <EOL> cls . matrix = CondensedMatrix ( scipy . spatial . distance . pdist ( cls . square_points ) ) <EOL> def test_calculate_mean_centers_difference ( self ) : <EOL> expected_medoids = [ [ <NUM_LIT:1> , <NUM_LIT:1> ] , [ <NUM_LIT:1> , <NUM_LIT:6> ] , [ <NUM_LIT:6> , <NUM_LIT:1> ] ] <EOL> expected_mean = numpy . mean ( scipy . spatial . distance . pdist ( expected_medoids ) ) <EOL> self . assertAlmostEqual ( expected_mean , calculate_mean_center_differences ( self . decomposed_cluster , self . matrix ) , <NUM_LIT:8> ) <EOL> def test_calculate_distance_stats ( self ) : <EOL> calc_mean , calc_std , calc_radius = calculate_distance_stats ( self . decomposed_cluster [ "<STR_LIT>" ] , self . matrix ) <EOL> distances = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0.0> ] <EOL> expected_mean = numpy . mean ( distances ) <EOL> expected_std = numpy . std ( distances ) <EOL> expected_radius = numpy . max ( distances ) <EOL> self . assertItemsEqual ( ( expected_mean , expected_std , expected_radius ) , ( calc_mean , calc_std , calc_radius ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
