[70b6b3]: / sandbox / test_idx.py

Download this file

52 lines (38 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import numpy as np
x = np.arange(21)
part_out_of = (1, 3)
this_part = part_out_of[0]
all_parts = part_out_of[1]
part_lenght = int(len(x) / all_parts)
if this_part == all_parts:
x1 = x[part_lenght * (this_part - 1):]
else:
x1 = x[part_lenght * (this_part - 1): part_lenght * this_part]
print x1
part_out_of = (2, 3)
this_part = part_out_of[0]
all_parts = part_out_of[1]
part_lenght = int(len(x) / all_parts)
if this_part == all_parts:
x1 = x[part_lenght * (this_part - 1):]
else:
x1 = x[part_lenght * (this_part - 1): part_lenght * this_part]
print x1
part_out_of = (3, 3)
this_part = part_out_of[0]
all_parts = part_out_of[1]
part_lenght = int(len(x) / all_parts)
if this_part == all_parts:
x1 = x[part_lenght * (this_part - 1):]
else:
x1 = x[part_lenght * (this_part - 1): part_lenght * this_part]
print x1
part_out_of = (4, 3)
this_part = part_out_of[0]
all_parts = part_out_of[1]
part_lenght = int(len(x) / all_parts)
if this_part == all_parts:
x1 = x[part_lenght * (this_part - 1):]
else:
x1 = x[part_lenght * (this_part - 1): part_lenght * this_part]
print x1