Skip to content

Models should support Quantity #1464

@eteq

Description

@eteq

I just noticed the following behavior:

In [1]: from astropy.modeling import models
In [2]: m = models.Linear1DModel(slope=1,intercept=0)
In [3]: m([1,2.] * u.m)
Out[3]: array([ 1.,  2.])

even though you give a Quantity in, a regular array comes out.

Also,

In [28]: m = models.Linear1DModel(slope=1,intercept=2 * u.m)
InputParameterError: Don't know how to convert parameter of <class 'astropy.units.quantity.Quantity'> to float

So even if I wanted to use quantities as the variable in the model, I can't do it because the parameters are forced to be a float.

So it would be much more valuable if parameters could be a quantity where q.isscalar == True, and the varaible in the model can be any sort of quantity.

cc @nden @adrn @astrofrog

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions