Currently discretize_model silently fails (i.e. returns None) for a non-model callable as input:
>>> from astropy.convolution import discretize_model
>>> def my_model(x):
... return 42 * x
>>> array = discretize_model(my_model, x_range=(-3, 3))
>>> print(array)
None
One option would be to remove all the isinstance checks and slightly change the API (add an argument callable_n_dim=1) to be able to process any callable as input.
Another option would be to fix the isinstance checking to throw a TypeError if something other than a Parametric1DModel or a Parametric2DModel is passed.
cc @astrofrog @adonath
Currently discretize_model silently fails (i.e. returns
None) for a non-model callable as input:One option would be to remove all the
isinstancechecks and slightly change the API (add an argumentcallable_n_dim=1) to be able to process any callable as input.Another option would be to fix the
isinstancechecking to throw aTypeErrorif something other than aParametric1DModelor aParametric2DModelis passed.cc @astrofrog @adonath