-
Notifications
You must be signed in to change notification settings - Fork 49
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
Link pretty image from FITS file #538
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #538 +/- ##
===========================================
- Coverage 70.55% 70.35% -0.21%
===========================================
Files 64 64
Lines 5475 5484 +9
Branches 761 762 +1
===========================================
- Hits 3863 3858 -5
- Misses 1405 1417 +12
- Partials 207 209 +2
Continue to review full report at Codecov.
|
pocs/utils/images/__init__.py
Outdated
pretty_path = _make_pretty_from_fits(fname, **kwargs) | ||
|
||
# Symlink latest.jpg to the image; first remove the symlink if it already exists. | ||
latest_path = '{}/images/latest.jpg'.format(os.getenv('PANDIR')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about moving the linking for CR2 files from the cr2_to_jpg.sh script into this file?
Then we don't have two different approaches. And we don't have the primary==False check in just the CR2 case, and not the FITS case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would almost prefer to go the other way and bury the details of the linking inside _make_pretty_from_fits
, which is almost what I did in the first place.
For the CR2 we use the convert
shell command. We could split this out of the existing bash script but then would just be calling another bash script. Not a huge deal either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see it making sense to complicate the two conversion to jpeg routines and bash scripts with linking to latest. It seems wrong to me.
So, let me be more definite and say that we should put the linking code into this routine, and share it between FITS and CR2.
Changed it so there is a common linking. Note that this now saves over the original JPG so it is a reduced size and has a timestamp, which means that the timelapse that are created will be the same thing. Not necessarily a bad thing but FYI. |
I'm not sure I understand the problem with overwriting that you're
mentioning. Could you clarify?
…On Mon, Jul 16, 2018, 4:27 PM Wilfred Tyler Gee ***@***.***> wrote:
Changed it so there is a common linking. Note that this now saves over the
original JPG so it is a reduced size and has a timestamp, which means that
the timelapse that are created will be the same thing. Not necessarily a
bad thing but FYI.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#538 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABYmU-G5Wg4z3-adTv7l8PW4mDFewpXRks5uHUuggaJpZM4VKYwx>
.
|
The JPG is extracted directly from the CR2 (it's an embedded thumbnail, i.e. not a conversion we perform). Originally we were keeping that copy alongside the FITS file but also resizing the JPG and adding the caption to the bottom and saving that as a different file. So for the CR2 it was not actually doing a symlink to the original file but instead generating a new JPG. The timelapse movies have been generated from the original JPGs, which means they are not resized and don't have a caption. So with the above change we no longer have two JPGs but instead resize and caption the original and then do a symlink. As such the timelapse will start to appear with a caption (which will have an unreadable time since it's 3 fps) and will be slightly different size. Not a big deal either way and probably for the better to have only one JPG anyway. |
Note also that on PAN008 here in Sydney running a Raspberry Pi B 3 (not the +) it was taking too long for me to run the I do miss the time stamp as it's handy to know when the image changed. Luckily (:confused: ?) my tracking isn't very good right now so it's easy to tell when the image updated. |
@@ -88,9 +88,25 @@ def make_pretty_image(fname, timeout=15, **kwargs): # pragma: no cover | |||
warn("File doesn't exist, can't make pretty: {}".format(fname)) | |||
|
|||
if fname.endswith('.cr2'): | |||
return _make_pretty_from_cr2(fname, timeout=timeout, **kwargs) | |||
pretty_path = _make_pretty_from_cr2(fname, timeout=timeout, **kwargs) | |||
elif fname.endswith('.fits'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to include an else clause to handle the case of an unsupported extension?
pocs/utils/images/__init__.py
Outdated
pretty_path = _make_pretty_from_fits(fname, **kwargs) | ||
|
||
# Symlink latest.jpg to the image; first remove the symlink if it already exists. | ||
if os.path.exists(pretty_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add: and fname.endswith('.jpg')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested a couple of changes, but I'll leave it to you to decide whether to make them. They can come later if appropriate.
I've updated to this version of software. I find that the pretty image is no longer being produced. |
Is it not produced at all or just not linking? Any errors? |
The CR2 files are linked as part of the download process. This links those generated directly from FITS files (e.g. SBIG, FLI).
Replacing parts of #511.