Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

norm() cannot be run on the output of tran() #9

Open
parejkoj opened this issue Mar 22, 2016 · 3 comments
Open

norm() cannot be run on the output of tran() #9

parejkoj opened this issue Mar 22, 2016 · 3 comments

Comments

@parejkoj
Copy link
Contributor

It would be very good to be able to run norm() (or equivalent) on the output of tran(). For example, either:

frameset.tran(pixels).norm()

or

frameset.norm(frameset.tran(pixels))
@timj
Copy link
Member

timj commented Mar 22, 2016

If any of the package was in python it would have been easier to have a norm=True keyword argument for tran(). Since it's all in C that would probably be tricky. It's a bit silly to add that to Atl. It is a problem that the arrangement of the numpy arrays returned from tran() are different to the numpy arrangement accepted by norm().

The reason tran() doesn't do that by default is that AST doesn't want to waste time normalising the coordinates when those coordinates may well be transformed again anyhow.

@parejkoj
Copy link
Contributor Author

It's fine that tran() doesn't default to that: no disagreement there. But it is very awkward to actually normalize the output of tran. Having some method that can be directly applied to the tran() output is the idea here.

@dsberry
Copy link
Member

dsberry commented Mar 23, 2016

I suppose we could provided an overloaded implementation of the norm method within pyast that check the type of its arguments to see if it is provided with a single array of floating point values, or an array of arrays and does the appropriate thing. But in addition you can also use the existing NormMap class to normalise the output from tran:

(a,b) = wcsinfo.tran( [[100.0,150.0],[200.0,250.0]] )
(c,d) = Ast.NormMap( wcsinfo ).tran( [a,b] )

The reason for not performing normalisation by default within tran is partly, as Tim says, to avoid unnecessary work. But it is also because there are some occasions when you do not want to perform the normalisation - e.g. when dealing with cylindrical projections such as CAR when you need to know if a transformed point has gone out of the domain of the projection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants