-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCommunity.py
29 lines (23 loc) · 1.06 KB
/
Community.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
import numpy as np
class Community:
def __init__(self, populations):
self.populations = populations
def get_derivatives(self, C, T, tracker):
return np.vstack([population.get_derivatives(C, T, tracker) for population in self.populations])
def get_population_specific_variables_indexes(self):
'''Asks all populations for their specific variables' indexes.
Returns it as a list'''
indexes = list()
for population in self.populations:
for chem_info in population.specific_chems.values():
indexes.append(population.chems_list.index(chem_info["name"]))
return indexes
def get_index_of_chems_unaffected_by_dilution(self):
indexes = list()
for population in self.populations:
indexes.extend(population.get_index_of_specific_chems_unaffected_by_dilution())
return indexes
def pretty_str(self):
return "\n".join(population.pretty_str() for population in self.populations)
if __name__== "__main__":
pass