Add support for generating HiPS and reprojecting RGB images with AVM metadata#509
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #509 +/- ##
==========================================
- Coverage 91.45% 88.86% -2.59%
==========================================
Files 25 28 +3
Lines 1088 1374 +286
==========================================
+ Hits 995 1221 +226
- Misses 93 153 +60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| reproject_function, | ||
| output_directory, | ||
| tile_size, | ||
| progress_bar=None, |
There was a problem hiding this comment.
can't be None, gives TypeError: 'NoneType' object is not callable
|
The current approach doesn't produce the index.html file: reproject_to_hips('/Users/adam/work/gc/ACES/ACES_tour_Aladin/12m_continuum_commonbeam_circular_reimaged_mosaic_MUSTANGfeathered_zerod.fits', coord_system_out='galactic', level=4, reproject_function=reproject_interp, output_directory='REPROJECT_TO_HIPS_MUSTANG_EXPERIMENT', progress_bar=tqdm)$ ls REPROJECT_TO_HIPS_MUSTANG_EXPERIMENT
Norder0/ Norder1/ Norder2/ Norder3/ Norder4/ properties |
|
@keflavich - I've pushed some new changes. This now supports reprojecting from PNG/JPG with AVM. Here is an example: import os
import shutil
from tqdm.notebook import tqdm
from reproject.hips import reproject_to_hips
from reproject import reproject_interp
filename = "MUSTANG_12m_feather_noaxes.png"
output_directory = filename.replace('.png', '_hips')
if os.path.exists(output_directory):
shutil.rmtree(output_directory)
reproject_to_hips(filename,
coord_system_out='galactic',
level=6,
reproject_function=reproject_interp,
output_directory=output_directory,
progress_bar=tqdm)This now also outputs an index.html file, so if I serve the output directory and open it in the browser, I get: |
|
Ok I've now added a new Currently if there is overlap, the last image is shown on top. We could have some more fancy blending in future. |
| level : int | ||
| The number of levels of FITS tiles. |
There was a problem hiding this comment.
would be helpful to auto-detemine the level from the input WCS by default
|
I'm not sure the |
|
I have an example RGBA file. Can we handle those? They have a 4th layer. Does Aladin support transparency? |
|
coadd didn't work: from reproject.hips import coadd_hips
coadd_hips(['rgb_final_uncropped_hips', 'MUSTANG_12m_feather_noaxes_hips'], 'AshFigureWithACES')
Traceback (most recent call last):
File ~/repos/avm_images/python_reproject_to_hips.py:58
coadd_hips(['rgb_final_uncropped_hips', 'MUSTANG_12m_feather_noaxes_hips'], 'AshFigureWithACES')
File ~/repos/python-reprojection/reproject/hips/core.py:360 in coadd_hips
raise NotImplementedError()
NotImplementedErrormost likely because one of these is jpeg and the other png |
|
with pngs: ...I think there's a formatting error there that I'll fix... |
| hips_order = [p["hips_order"] for p in all_properties] | ||
|
|
||
| if len(set(tile_formats)) > 1: | ||
| raise ValueError("tile_format values do not match: {tile_formats}") |
There was a problem hiding this comment.
| raise ValueError("tile_format values do not match: {tile_formats}") | |
| raise ValueError(f"tile_format values do not match: {tile_formats}") |
|
ok yeah, this error message is more useful, but strangely incorrect now... |
|
ok, forced both things into |
No, the first image is shown on top. 🤷 |
|
the |
|
we have some successes, e.g.: https://keflavich.github.io/avm_images/AshFigureWithACES_MUSTANGfirst/index.html |
|
looking at some of the index.html's generated by aladin.jar, getting the image to be oriented in galactic (not just projected into galactic, but also shown that way) requires non-negligible javascript in the index |
user error; I copied the code snippet above but I wasn't in a notebook |


This adds initial support for HiPS. Main TODOs:
reproject_to_hipsfor 2D celestial imagesBeyond this PR:
reproject_to_hipsfor 3D cubes -> Add support for generating HiPS3D #518reproject_from_hipsfor 2D celestial images -> Add support for reprojecting from HiPS and HiPS3D to standard projections #519reproject_from_hipsfor 3D cubes -> Add support for reprojecting from HiPS and HiPS3D to standard projections #519return_type='pil_image'and add tests #523