cds-astro / mocpy

Python library to easily create and manipulate MOCs (Multi-Order Coverage maps)
https://cds-astro.github.io/mocpy/
BSD 3-Clause "New" or "Revised" License
59 stars 33 forks source link

MOCServer Cancells request on HST coverage (MOC too big) #126

Closed richardgmcmahon closed 3 months ago

richardgmcmahon commented 4 months ago

00-MOCpy_introduction.ipynb is failing probably since astroquery.cds has been renamed as astroquery.mocserver

WARNING: AstropyDeprecationWarning: The cds module has been moved to astroquery.mocserver, and CdsClass has been renamed to MOCServerClass. Please update your imports. [warnings]

This is a warning.

This is needed: from astroquery.mocserver import MOCServer

See: https://github.com/astropy/astroquery/blob/main/CHANGES.rst#mocserver 0.4.7 (2024-03-08)

I then get other errors which I am investigating. I will try to make a working fork.

This fails:

hst_moc = cds.query_region( region=allsky,

We want a MOCpy object instead of an astropy table

return_moc=True,
# The order of the MOC
max_norder=11,
# Expression on the ID meta-data
meta_data="ID=*HST*",

)

Note I split the cell to make it easier to debug.

sdss_moc seems to work

This works where I removed the hst parts

fig = plt.figure(figsize=(20, 10))

with WCS( fig, fov=160 * u.deg, center=SkyCoord(0, 0, unit="deg", frame="icrs"), coordsys="icrs", rotation=Angle(0, u.degree), projection="AIT", ) as wcs:

Create a matplotlib axe and give it a astropy.wcs.WCS-like object

ax = fig.add_subplot(1, 1, 1, projection=wcs, frame_class=EllipticalFrame)

# Fill the SDSS MOC in red with an opacity of 70%
sdss_moc.fill(
    ax=ax,
    wcs=wcs,
    edgecolor="r",
    facecolor="r",
    linewidth=0,
    fill=True,
    alpha=0.7,
    label="sdss9 footprint",
)
# Draw its perimeter in black
sdss_moc.border(ax=ax, wcs=wcs, color="black", alpha=0.5)

Usual matplotlib calls

plt.title("Using matplotlib to vizualize MOCs") plt.xlabel("ra") plt.ylabel("dec") plt.legend() plt.grid(color="black", linestyle="dotted") path_effects = [patheffects.withStroke(linewidth=3, foreground="black")] ax.coords[0].set_ticklabel(color="white", path_effects=path_effects) plt.show() plt.close()

ManonMarchand commented 4 months ago

Thanks. I can reproduce the bug, we'll have a look

ManonMarchand commented 4 months ago

So what happens is that there is a lot of data in HST and the resulting MOC is larger than 500Mo. This is larger than the limit that the server is willing to return. We will change the example and/or see what can be done upstream in the MOCServer, thanks a lot for spotting this.

ManonMarchand commented 3 months ago

This is fixed upstream :slightly_smiling_face: