Skip to content

Download selection as FITS leads to astropy error #34

@msyriac

Description

@msyriac

Attempting "Download FITS" from the region selection menu leads to an astropy error. The full traceback is below:

$ tilemaker open act_map.fits lensing_mask_70_float.fits --port=9182
2025-09-28 22:28:02 [info     ] discriminator.passed           discriminator=iqu filename=act_map.fits
2025-09-28 22:28:02 [info     ] layer.success                  discriminator=iqu filename=act_map.fits layer_id=0-0-a4b8ad
2025-09-28 22:28:02 [info     ] layer.success                  discriminator=iqu filename=act_map.fits layer_id=0-1-a4b8ad
2025-09-28 22:28:02 [info     ] layer.success                  discriminator=iqu filename=act_map.fits layer_id=0-2-a4b8ad
2025-09-28 22:28:02 [info     ] discriminator.passed           discriminator=mask filename=lensing_mask_70_float.fits
2025-09-28 22:28:02 [info     ] layer.success                  discriminator=mask filename=lensing_mask_70_float.fits layer_id=0-0-b8933b
INFO:     Started server process [48808]
INFO:     Waiting for application startup.
2025-09-28 22:28:02 [debug    ] analysis.inmemory.miss         analysis_id=hist-0-0-a4b8ad
2025-09-28 22:28:02 [debug    ] provider.inmemory.miss         tile_hash=0-0-a4b8ad-0-0-0
2025-09-28 22:28:02 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.009179946002404904 pos_yx=(array(7560.), array(32400.)) ra_center=<Quantity -90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-0-a4b8ad-0-0-0
2025-09-28 22:28:02 [debug    ] provider.inmemory.pushed       tile_hash=0-0-a4b8ad-0-0-0
2025-09-28 22:28:02 [debug    ] provider.inmemory.miss         tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:02 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.008022551999602001 pos_yx=(array(7560.), array(10800.)) ra_center=<Quantity 90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:02 [debug    ] provider.inmemory.pushed       tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:03 [info     ] histogram.built                bins=128 dt=0.09530399899813347 end=2000.0 layer_id=0-0-a4b8ad start=-2000.0
2025-09-28 22:28:03 [debug    ] analysis.inmemory.pushed       analysis_id=hist-0-0-a4b8ad
2025-09-28 22:28:03 [debug    ] analysis.inmemory.miss         analysis_id=hist-0-1-a4b8ad
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-1-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.008086934001767077 pos_yx=(array(7560.), array(32400.)) ra_center=<Quantity -90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-1-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-1-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-1-a4b8ad-1-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.007990174999576993 pos_yx=(array(7560.), array(10800.)) ra_center=<Quantity 90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-1-a4b8ad-1-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-1-a4b8ad-1-0-0
2025-09-28 22:28:03 [info     ] histogram.built                bins=128 dt=0.09268903100019088 end=200.0 layer_id=0-1-a4b8ad start=-200.0
2025-09-28 22:28:03 [debug    ] analysis.inmemory.pushed       analysis_id=hist-0-1-a4b8ad
2025-09-28 22:28:03 [debug    ] analysis.inmemory.miss         analysis_id=hist-0-2-a4b8ad
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-2-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.009619266998925013 pos_yx=(array(7560.), array(32400.)) ra_center=<Quantity -90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-2-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-2-a4b8ad-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-2-a4b8ad-1-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.008291396003187401 pos_yx=(array(7560.), array(10800.)) ra_center=<Quantity 90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-2-a4b8ad-1-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-2-a4b8ad-1-0-0
2025-09-28 22:28:03 [info     ] histogram.built                bins=128 dt=0.10052320899922051 end=200.0 layer_id=0-2-a4b8ad start=-200.0
2025-09-28 22:28:03 [debug    ] analysis.inmemory.pushed       analysis_id=hist-0-2-a4b8ad
2025-09-28 22:28:03 [debug    ] analysis.inmemory.miss         analysis_id=hist-0-0-b8933b
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-0-b8933b-0-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.017036189001373714 pos_yx=(array(7559.5), array(32400.)) ra_center=<Quantity -90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-0-b8933b-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-0-b8933b-0-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.miss         tile_hash=0-0-b8933b-1-0-0
2025-09-28 22:28:03 [debug    ] fits.pulled                    dec_center=<Quantity 0. deg> dt=0.013311817001522286 pos_yx=(array(7559.5), array(10800.)) ra_center=<Quantity 90. deg> radius=<Quantity 180. deg> shape=(21600, 21600) subsample_every=32 tile_hash=0-0-b8933b-1-0-0
2025-09-28 22:28:03 [debug    ] provider.inmemory.pushed       tile_hash=0-0-b8933b-1-0-0
2025-09-28 22:28:03 [info     ] histogram.built                bins=128 dt=0.09087495199855766 end=4.0 layer_id=0-0-b8933b start=0.0
2025-09-28 22:28:03 [debug    ] analysis.inmemory.pushed       analysis_id=hist-0-0-b8933b
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:9182 (Press CTRL+C to quit)
INFO:     127.0.0.1:55774 - "GET / HTTP/1.1" 200 OK
INFO:     127.0.0.1:55774 - "GET /maps HTTP/1.1" 200 OK
INFO:     127.0.0.1:47950 - "GET /sources HTTP/1.1" 200 OK
INFO:     127.0.0.1:47956 - "GET /highlights/boxes HTTP/1.1" 200 OK
INFO:     127.0.0.1:47956 - "GET /highlights/boxes HTTP/1.1" 200 OK
INFO:     127.0.0.1:55774 - "GET /maps HTTP/1.1" 200 OK
INFO:     127.0.0.1:47950 - "GET /sources HTTP/1.1" 200 OK
2025-09-28 22:28:08 [debug    ] analysis.inmemory.pulled       analysis_id=hist-0-0-a4b8ad
2025-09-28 22:28:08 [debug    ] provider.inmemory.pulled       tile_hash=0-0-a4b8ad-0-0-0
2025-09-28 22:28:08 [debug    ] provider.inmemory.present      tile_hash=0-0-a4b8ad-0-0-0
INFO:     127.0.0.1:55774 - "GET /histograms/RdBu_r.png HTTP/1.1" 200 OK
2025-09-28 22:28:08 [debug    ] provider.inmemory.pulled       tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:08 [debug    ] provider.inmemory.present      tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:08 [debug    ] provider.inmemory.pulled       tile_hash=0-0-a4b8ad-1-0-0
2025-09-28 22:28:08 [debug    ] provider.inmemory.pulled       tile_hash=0-0-a4b8ad-0-0-0
2025-09-28 22:28:08 [info     ] histogram.built                bins=128 dt=0.12342780100152595 end=2000.0 layer_id=0-0-a4b8ad start=-2000.0
2025-09-28 22:28:08 [debug    ] analysis.inmemory.pushed       analysis_id=hist-0-0-a4b8ad
INFO:     127.0.0.1:47956 - "GET /histograms/data/0-0-a4b8ad HTTP/1.1" 200 OK
INFO:     127.0.0.1:47956 - "GET /histograms/RdBu_r.png HTTP/1.1" 200 OK
INFO:     127.0.0.1:47950 - "GET /maps/0-0-a4b8ad/0/0/0/tile.png?cmap=RdBu_r&vmin=-500&vmax=500&flip=true&log_norm=false&abs=false HTTP/1.1" 200 OK
2025-09-28 22:28:08 [debug    ] provider.inmemory.present      tile_hash=0-0-a4b8ad-0-0-0
INFO:     127.0.0.1:55774 - "GET /maps/0-0-a4b8ad/0/0/1/tile.png?cmap=RdBu_r&vmin=-500&vmax=500&flip=true&log_norm=false&abs=false HTTP/1.1" 200 OK
2025-09-28 22:28:08 [debug    ] provider.inmemory.present      tile_hash=0-0-a4b8ad-1-0-0
INFO:     127.0.0.1:47964 - "GET /maps/0-0-a4b8ad/submap/-43.41796875/-20.7421875/-10.418452710176979/-20.705026272123888/image.fits?cmap=RdBu_r&vmin=-500&vmax=500 HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/fastapi/applications.py", line 1082, in __call__
    await super().__call__(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/middleware/authentication.py", line 48, in __call__
    await self.app(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/routing.py", line 716, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/routing.py", line 736, in app
    await route.handle(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/routing.py", line 290, in handle
    await self.app(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/routing.py", line 78, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/routing.py", line 75, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/fastapi/routing.py", line 308, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/fastapi/routing.py", line 221, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/starlette/concurrency.py", line 38, in run_in_threadpool
    return await anyio.to_thread.run_sync(func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/repos/tilemaker/tilemaker/server/maps.py", line 60, in get_submap
    submap, pushables = extract(
                        ^^^^^^^^
  File "/home/msyriac/repos/tilemaker/tilemaker/processing/extractor.py", line 82, in extract
    right_pix, top_pix, _ = wcs.world_to_pixel(
                            ^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/astropy/wcs/wcsapi/high_level_api.py", line 352, in world_to_pixel
    world_values = high_level_objects_to_values(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/msyriac/.uv/mcmc/lib/python3.11/site-packages/astropy/wcs/wcsapi/high_level_api.py", line 233, in high_level_objects_to_values
    raise ValueError(
ValueError: Expected the following order of world arguments: SkyCoord, Quantity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions