-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (48 loc) · 1.24 KB
/
main.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
#
# Author: Kenny Peluso
# Elevator Description: Create Python class objects to hold all necessary info and methods.
#
import numpy as np
from ind2mass import *
class Institution:
'''
DESCRIPTION:
metastate of the entire system
INPUT:
MC_dict :: dict< String : Tuple< Integer, NPArray<NPArray<Float>> > >
# String is from np.tostring(NPArray), Integer is the number of times that MC occurs
'''
def __init__(self, MCdict):
self.MCdict = MCdict
def addMC(MC):
'''
INPUT:
MC :: NPArray<NPArray<Float>>
'''
theStr = np.tostring(MC)
if theStr in self.MCdict:
self.MCdict[theStr] += 1
else:
self.MCdict[theStr] = 1
def delMC_once(MC):
'''
INPUT:
MC :: NPArray<NPArray<Float>>
'''
theStr = np.tostring(MC)
if theStr in self.MCdict and self.MCdict[theStr] > 1:
self.MCdict[theStr] -= 1
elif theStr in self.MCdict and self.MCdict[theStr] <= 1:
del self.MCdict[theStr]
else:
print "\nError! ~~ delMC_once() ~~ Your input MC is not in the class dictionary!\n"
def delMC_all(MC):
'''
INPUT:
MC :: NPArray<NPArray<Float>>
'''
theStr = np.tostring(MC)
if theStr in self.MCdict:
del self.MCdict[theStr]
else:
print "\nError! ~~ delMC_once() ~~ Your input MC is not in the class dictionary!\n"