• Running on 4 cores with 30 gb RAM

In [1]:
import analysis3 as a3
reload(a3)
import time

In [2]:
def time_function(fun, *args):
    start = time.time();
    result = fun(*args);
    run_time = time.time() - start;
    minutes = run_time / 60;
    print('RUN TIME: %f s (%f m)' % (run_time, minutes));
    return result;

Timing individual functions


In [3]:
token = 's275_to_ara3'
cert_path = '../userToken.pem'

In [4]:
time_function(a3.get_registered, token, cert_path);


Getting registered brain from server...
Saving local copy of registered brain...
RUN TIME: 198.523012 s (3.308717 m)

In [5]:
path = "img/" + token + "_regis.nii"
im = time_function(a3.apply_clahe, path);


Completed CLAHE!
RUN TIME: 61.669982 s (1.027833 m)

In [6]:
output_ds = time_function(a3.downsample, im, 10000);


620.892
(This will take couple minutes)
Above threshold=175577389
total points: 175577389
v.shape:
(175577389,)
v.size before downsample: 175577389
v.size after downsample: 9972
Output num points: 9972
Finished
RUN TIME: 21.718240 s (0.361971 m)

In [7]:
time_function(a3.save_points, output_ds, "points/" + token + ".csv");


RUN TIME: 0.049225 s (0.000820 m)

In [8]:
points_path = "points/" + token + ".csv";

In [9]:
time_function(a3.generate_pointcloud, points_path, "output/" + token + "_pointcloud.html");


RUN TIME: 0.095765 s (0.001596 m)

In [10]:
time_function(a3.get_atlas_annotate, cert_path, True, None);


RUN TIME: 174.797593 s (2.913293 m)

In [11]:
time_function(a3.get_regions, points_path, "atlas/ara3_annotation.nii", "points/" + token + "_regions.csv");


9972
num unique regions: 397
[0, 2, 4, 6, 7, 9, 10, 15, 17, 19, 23, 26, 33, 35, 36, 38, 42, 50, 56, 59, 62, 63, 64, 67, 68, 72, 73, 74, 78, 81, 84, 88, 100, 105, 113, 117, 118, 120, 122, 125, 126, 127, 128, 129, 131, 132, 133, 140, 146, 148, 149, 155, 156, 158, 159, 163, 170, 171, 173, 178, 180, 181, 186, 187, 188, 189, 190, 194, 201, 204, 211, 214, 215, 218, 226, 233, 243, 246, 250, 252, 255, 257, 258, 260, 262, 263, 266, 271, 272, 274, 278, 279, 286, 288, 292, 296, 298, 301, 303, 304, 305, 310, 311, 313, 314, 319, 320, 325, 328, 330, 333, 335, 338, 342, 344, 347, 351, 356, 362, 363, 364, 366, 374, 377, 381, 382, 397, 403, 412, 414, 422, 423, 430, 433, 436, 440, 441, 443, 448, 449, 450, 451, 452, 461, 463, 10704, 466, 470, 475, 477, 478, 482, 483, 484, 491, 494, 502, 503, 507, 510, 511, 515, 520, 523, 525, 530, 531, 536, 542, 549, 556, 558, 564, 565, 566, 573, 574, 575, 577, 580, 581, 582, 583, 587, 588, 589, 590, 591, 593, 595, 596, 599, 600, 601, 603, 608, 609, 611, 612, 613, 614, 616, 620, 622, 625, 628, 629, 630, 632, 634, 638, 639, 647, 648, 654, 656, 657, 658, 662, 665, 667, 672, 673, 675, 678, 679, 681, 685, 687, 689, 690, 692, 693, 694, 697, 698, 702, 703, 704, 706, 707, 718, 721, 725, 729, 10703, 733, 741, 749, 754, 763, 767, 771, 772, 776, 778, 780, 783, 784, 786, 788, 795, 797, 800, 802, 803, 804, 806, 810, 814, 819, 821, 827, 830, 838, 841, 842, 843, 844, 849, 851, 854, 857, 862, 863, 867, 872, 873, 874, 877, 878, 882, 889, 893, 900, 902, 905, 907, 908, 910, 918, 919, 924, 182305693, 926, 182305697, 930, 931, 182305701, 934, 935, 182305705, 940, 182305709, 943, 945, 946, 950, 952, 954, 961, 962, 966, 969, 973, 974, 975, 977, 980, 981, 982, 985, 988, 996, 998, 1004, 1005, 1009, 1015, 1016, 1020, 1021, 1022, 1026, 1029, 1030, 1031, 1035, 1037, 1038, 1044, 1046, 1047, 1052, 1054, 1058, 1060, 1061, 1062, 1070, 1081, 1084, 1085, 1086, 1089, 1090, 1092, 1094, 1097, 1101, 1102, 1105, 1106, 1109, 1111, 1113, 1114, 1120, 1125, 1128, 1139, 929, 182305713, 312782562, 312782570, 312782582, 312782586, 312782590, 312782594, 312782604, 312782608, 312782612, 312782616, 312782620, 312782636, 312782644, 312782648]
RUN TIME: 0.192527 s (0.003209 m)
analysis3.py:461: VisibleDeprecationWarning:

using a non-integer number instead of an integer will result in an error in the future


In [12]:
points_region_path = "points/" + token + "_regions.csv";
g = time_function(a3.create_graph, points_region_path, 20, "graphml/" + token + "_graph.graphml");


finished creating graph, now about to save to graphml.
RUN TIME: 747.332735 s (12.455546 m)

In [13]:
time_function(a3.plot_graphml3d, g, False, "output/" + token + "_edgegraph.html");


RUN TIME: 6.409992 s (0.106833 m)

In [14]:
time_function(a3.generate_region_graph, token, points_region_path, "output/" + token + "_regions.html");


Total number of unique ID's:
332
Done counting!
RUN TIME: 37.245818 s (0.620764 m)

In [15]:
time_function(a3.generate_density_graph, "graphml/" + token + "_graph.graphml", 
              "output/" + token + "_density.html", "False-Color Density of " + token);


RUN TIME: 1.092894 s (0.018215 m)

In [16]:
print("Completed pipeline...!")


Completed pipeline...!

Testing pipeline as a whole


In [17]:
token = 's275_to_ara3'
cert_path = '../userToken.pem'

In [18]:
time_function(a3.run_pipeline, token, cert_path, 5);


Getting registered brain from server...
Saving local copy of registered brain...
Completed CLAHE!
620.892
(This will take couple minutes)
Above threshold=175577389
total points: 175577389
v.shape:
(175577389,)
v.size before downsample: 175577389
v.size after downsample: 10050
Output num points: 10050
Finished
10050
num unique regions: 409
[0, 2, 4, 6, 9, 10, 15, 17, 19, 23, 26, 27, 33, 35, 36, 38, 42, 50, 56, 59, 62, 63, 64, 67, 68, 72, 73, 74, 81, 84, 88, 100, 113, 117, 118, 120, 122, 125, 126, 127, 128, 129, 131, 132, 133, 140, 146, 148, 149, 155, 156, 158, 159, 163, 170, 171, 173, 178, 180, 181, 186, 187, 188, 189, 190, 194, 196, 197, 201, 204, 210, 211, 214, 215, 218, 223, 226, 233, 243, 246, 250, 252, 255, 257, 258, 260, 262, 263, 266, 271, 272, 274, 278, 286, 287, 288, 289, 296, 298, 301, 303, 304, 305, 310, 311, 313, 314, 319, 320, 321, 326, 328, 333, 335, 338, 342, 344, 347, 351, 362, 363, 364, 366, 368, 374, 377, 381, 382, 397, 403, 412, 414, 421, 422, 423, 430, 434, 436, 440, 442, 443, 448, 449, 450, 451, 452, 463, 10704, 466, 469, 470, 475, 477, 478, 482, 483, 484, 491, 494, 502, 503, 507, 510, 511, 515, 520, 523, 525, 530, 531, 536, 542, 549, 556, 558, 564, 565, 566, 573, 574, 575, 577, 580, 581, 582, 583, 587, 588, 589, 590, 591, 593, 595, 596, 598, 599, 600, 601, 603, 608, 609, 610, 611, 612, 613, 614, 616, 620, 621, 622, 625, 628, 629, 630, 632, 634, 638, 639, 642, 647, 648, 654, 656, 657, 658, 665, 667, 670, 672, 673, 675, 678, 679, 681, 685, 687, 689, 690, 692, 693, 694, 697, 698, 702, 703, 704, 706, 707, 718, 721, 725, 729, 10703, 733, 741, 749, 754, 767, 771, 772, 776, 778, 780, 783, 784, 786, 788, 795, 797, 800, 802, 803, 804, 806, 810, 814, 819, 821, 827, 830, 838, 842, 843, 844, 847, 848, 851, 854, 857, 862, 863, 872, 874, 877, 878, 882, 884, 888, 889, 893, 897, 900, 902, 905, 906, 907, 908, 910, 914, 918, 919, 924, 182305693, 926, 927, 182305697, 930, 931, 182305701, 934, 935, 182305705, 940, 182305709, 943, 182305713, 946, 950, 952, 954, 961, 962, 966, 969, 973, 974, 975, 977, 980, 981, 982, 985, 988, 996, 998, 1004, 1005, 1009, 1010, 1015, 1016, 1020, 1021, 1022, 1026, 1029, 1031, 1035, 1037, 1038, 1044, 1045, 1046, 1047, 1052, 1054, 1058, 1060, 1061, 1062, 1070, 1074, 1077, 1081, 1084, 1085, 1089, 1090, 1092, 1094, 1097, 1101, 1102, 1105, 1106, 1109, 1111, 1113, 1114, 1120, 1125, 1128, 1139, 929, 945, 312782562, 312782566, 312782582, 312782586, 312782590, 312782594, 312782604, 312782608, 312782612, 312782616, 312782620, 312782624, 312782644, 312782648]
finished creating graph, now about to save to graphml.
Total number of unique ID's:
343
Done counting!
Completed pipeline...!
RUN TIME: 1351.091940 s (22.518199 m)

Conclusions

  • The create_graph function takes about 50% of the entire pipelines run time
    • This is probably because it consists of two for loops, each iterating through all the points, making the function $n^2$

In [ ]: