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

tran() should support ND array input/output #11

Open
parejkoj opened this issue Mar 23, 2016 · 1 comment
Open

tran() should support ND array input/output #11

parejkoj opened this issue Mar 23, 2016 · 1 comment

Comments

@parejkoj
Copy link
Contributor

If I want to output the transformed locations of e.g. a whole CCD, something like this is the obvious approach:

xx = np.arange(0,nx)
yy = np.arange(0,ny)
xv,yv = np.meshgrid(xx,yy)
result = frameset.tran((xv,yv))

but this doesn't work, as tran wants flattened arrays, but then the output has to be reshaped:

result = frameset.tran((xv.flatten(),yv.flatten())
result_ast = (result_ast[0].reshape(ny,nx),result_ast[1].reshape(ny,nx))

It would be useful if tran supported generic NDarrays, outputting the result in the same shape.

@dsberry
Copy link
Member

dsberry commented Mar 24, 2016

The python interface is certainly something that could be smarted up. Demitri Muna had a plan for creating a more Pythonesque interface, but I'm not sure he ever got very far with it. ANy change would need to go through the whole of pyast, not just the tran function. However, for that particular example, you could do:

result = frameset.trangrid( [0,0], [nx,ny] )

see http://www.starlink.ac.uk/docs/sun211.htx/sun211ss219.html

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

2 participants