mocpy icon indicating copy to clipboard operation
mocpy copied to clipboard

from astroquery.cds import cds failing in example and notebooks

Open richardgmcmahon opened this issue 9 months ago • 1 comments

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()

richardgmcmahon avatar May 17 '24 14:05 richardgmcmahon