Skip to content

Instantly share code, notes, and snippets.

@nden
Last active December 25, 2015 19:29
Show Gist options
  • Save nden/7028218 to your computer and use it in GitHub Desktop.
Save nden/7028218 to your computer and use it in GitHub Desktop.
subclass_model
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