Last active
December 25, 2015 19:29
-
-
Save nden/7028218 to your computer and use it in GitHub Desktop.
subclass_model
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
from astropy.modeling.core import Model | |
from astropy.modeling.parameters import Parameter | |
class MyModel1(Model): | |
param_names = ['a'] | |
def __init__(self, a): | |
self._a = Parameter('a', a, self, 1) | |
super(MyModel1, self).__init__(self.param_names, n_inputs=1, n_outputs=1) | |
def __call__(self): | |
pass | |
''' | |
Generally param_names holds parameters that are used in model evaluation and for which properties are created. | |
If, for some reason this is not needed, the model canbe written in this way: | |
''' | |
class MyModel(Model): | |
def __init__(self, a): | |
super(MyModel, self).__init__(param_names=[], n_inputs=1, n_outputs=1) | |
def __call__(self): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment