This is a flask application that generates thumbnails from data stored on the LCOGT Science Archive.
This script uses amazon S3 to temporarily store images. You'll need a bucket and the correct environmental variables set.
This script also relies on fits2image. Make sure it is installed in your virtualenv.
All other dependencies are listed in the requirements.txt file and can be installed with pip.
Run the tests with
The api passes through the
Authorization header to the archive API. You only need to provide
this header if the data you are attempting to get a thumbnail for is proprietary. See the archive
documentation for more details.
There are only 2 endpoints:
frame_id is the ID of the frame
in the archive, and
basename is the base part of the filename (no file extension) you wish to make
a thumbnail of. Using the frame_id is faster to return if you happen to know it
ahead of time.
Both endpoints take the following query parameters:
Width and height are in pixels, label will appear as white text in the lower left had corner of the image.
They both return a url to the thumbnail file that will be good for 1 week unless the
is supplied which will return an image directly.
- Fix hash used in s3 key to be stable given the same inputs
- Add hook to gunicorn configuration files to clear out the temp directory on startup
- Clean up gunicorn config file as most configuration has been moved to the helm chart
- Migrate to AWS V4 signatures
- Modernize docker image
- Enable gunicorn error and access logs
- Use gunicorn configuration file with
child_exitserver hook implemented for additional temp file cleanup actions on certain abrupt worker death #846
- Update boto3, requests, and flask
- Temporary file cleanup improvements
- Validate frame before attempting thumbnail generation
- Update error handling
- Update numpy version
- Add DejaVu True Type Fonts
- Add freetype dependency for text overlay support
- Use standard LCO Jenkins automated docker container build pipeline
- Migrate Docker container to Alpine Linux base
- Upgrade requests
- Initialize a variable that could have been referenced before assignment
- Upgrade Dockerfile to be more sensible, upgrade to python 3.6
- Add better exception handling to clean up temporary files even if generation fails.
- Add quality paramter and reduce default quality. Improves speed without a noticeable change in image quality.
- Improve filename key so that any differnt combination of parameters will reuslt in a new image.
- Added median filtering support
- Fixed bug where images of different reduction levels were used to compose color images
- Added color image support! Use ?color=True for frames which belong to a request that have other exposures using red, visual and blue filters.
imageurl parameter to return image directly instead of json. Useful for using as the src attribute in img tags.