-
Notifications
You must be signed in to change notification settings - Fork 19
/
fabricate_fcs_file.py
79 lines (71 loc) · 1.83 KB
/
fabricate_fcs_file.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import numpy as np
from flowio.create_fcs import create_fcs
if __name__ == '__main__':
np.random.seed(42)
# these clusters are clearly separated
cluster1 = np.random.multivariate_normal(
[6000.0, 6000.0, 0.0, 3000.0],
[
[600000, 300, 0, 0],
[300, 1000, 0, 0],
[0, 0, 1, 10],
[0, 0, 10, 1000]
],
(2000,)
)
cluster2 = np.random.multivariate_normal(
[-10.0, 0.0, 0.0, 0.0],
[
[10000, 100, 0, 0],
[100, 10000, 0, 0],
[0, 0, 100000, 0],
[0, 0, 0, 1000]
],
(2000,)
)
cluster3a = np.random.multivariate_normal(
[7000.0, 2000.0, -6.0, 1500],
[
[100000, 100, 0, 0],
[100, 100000, 100, 0],
[0, 100, 10000, 0],
[0, 0, 0, 10000]
],
(2000,)
)
cluster3b = np.random.multivariate_normal(
[2000.0, 7000.0, 1500.0, -6.0],
[
[100000, 100, 0, 0],
[100, 100000, 100, 0],
[0, 100, 10000, 0],
[0, 0, 0, 10000]
],
(2000,)
)
data_set1 = np.vstack(
[
cluster1,
cluster2,
cluster3a
]
).flatten().tolist()
data_set2 = np.vstack(
[
cluster1,
cluster2,
cluster3b
]
).flatten().tolist()
channel_names = [
'channel_A',
'channel_B',
'channel_C',
'channel_D'
]
fh = open('data_set1.fcs', 'wb')
create_fcs(fh, data_set1, channel_names)
fh.close()
fh = open('data_set2.fcs', 'wb')
create_fcs(fh, data_set2, channel_names)
fh.close()