Skip to content

discretize_model should work or throw an error for non-model callable input #2274

Description

@cdeil

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions