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

Various bugfixes with non-square pixel maps. #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Various bugfixes with non-square pixel maps. #1

wants to merge 3 commits into from

Conversation

cyphar
Copy link

@cyphar cyphar commented Jul 27, 2015

If you try to use k2flix to render pixel maps which do not have a square aspect ratio (such as 204367097), the image is the wrong aspect ratio. In addition, after fixing that, I realised that there were no safety checks for the annotations, so they can overlap.

I've fixed both in this PR (because they are both caused by non-square pixel maps).

Signed-off-by: Aleksa Sarai [email protected]

Previously, if you had a FITS file with a non-square array (such as
204367097-c02), the pixels will be squashed to an elongated rectangle.
This patch fixes it by passing in the height and width of the figure in
the right order.

Signed-off-by: Aleksa Sarai <[email protected]>
This patchset ensures that the annotations will not overlap by scaling
up the figure size so that the figure will always be big enough to fit
the annotation (plus some padding).

Signed-off-by: Aleksa Sarai <[email protected]>
Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Author

cyphar commented Jul 28, 2015

Actually, I also just realised that 65c550b fixes another bug where certain FITS files will fail to be rendered as a movie because the default ffmpeg codec requires the height and width to be divisible by 2. You can double check this by trying to use the linked fits file to render an mp4.

@cyphar cyphar changed the title Fix elongated pixel maps Various bugfixes with non-square pixel maps. Jul 28, 2015
@barentsen
Copy link
Member

Hi @cyphar -- many thanks for looking into these issues. I fetched the pull request and tried e.g.

k2flix --start 1 --stop 5 --step 1 https://archive.stsci.edu/pub/k2/target_pixel_files/c3/200000000/04000/ktwo200004716-c03_lpd-targ.fits.gz

but unfortunately this gives me a 337x22894 animated gif, which doesn't look quite right. I'll look more into this tomorrow to understand what's happening!

@cyphar
Copy link
Author

cyphar commented Aug 2, 2015

@barentsen If you look at it with the code on HEAD, you get a wide image with large streaks. I'm fairly sure that this is not correct. My patch fixes a flat out bug in the aspect ratio code, since any non-square pixel map gives you an image with the wrong aspect ratio. You might want to figure out a nicer way of making the image smaller, but the aspect ratio issue (and some other issues) are fixed.

ktwo200004716-c03_lpd-targ fits gz

@cyphar
Copy link
Author

cyphar commented Aug 19, 2015

@barentsen Have you taken another look at it? The current code is flat-out broken for non-square pixel maps, and also the code doesn't handle very thin pixel maps (such that the text would be overlapping) properly either. I've fixed both, and the output of that image is as I would expect (look at the pixel map in fv or DS9, and you'll see a very elongated image).

fv output

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

Successfully merging this pull request may close these issues.

2 participants