Created
June 3, 2020 16:42
-
-
Save wkerzendorf/ba0cf14fa2b78490e822d243403370cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### implementation 1 #### | |
class GenericModel(object): | |
def __init__(self, *args): | |
for property in args: | |
self.cells_property = {some dictionary containing each cell property} | |
# example | |
self.cells_property = {'velocity':Velocity(asdasd)} | |
self.__dict__[property.name] = property | |
def evolve(self, time): | |
for cell_property in self.cell_properties: | |
#def load_from_csvy(self, csy_fpath): | |
# pass | |
def __getattr__(self, name): | |
class BaseCellProperty(units.Quantity): | |
def __init__(self, name, quantity, time): | |
self.name = name | |
self.quanity = quantity | |
self.time = time | |
def evolve(self, time): | |
self.time = time | |
pass | |
class Velocity(units.Quantity): | |
def __init__(self, quanity, time): | |
self.name = 'velocity' | |
self.quantity = quantity | |
self.time = time | |
vel = Velocity(np.arange(5000), u.km/u.s, 0 * u.day) | |
GenericModel(Velocity(lkjdsflkdjsf), Density(sdfjsdfl), ...) | |
#### implementation 2 #### | |
class GenericModel(object): | |
def __init__(self, **kwargs): | |
self.__dict__.update(kwargs) | |
def load_from_csvy(self, csy_fpath): | |
pass | |
GenericModel(velocity=Velocity(lkjdsflkdjsf)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment