====== hscmap ====== * `Code repository `_ With this module, you can create hscMap windows in Jupyter Lab and control them from Python. Jupyter Lab process remembers status of hscMap windows, so you don't loose your work on hscMap on reloading or closing the browser window. .. raw:: html ======= Example ======= Zoom in on M31 -------------- :: import hscmap w = hscmap.Window(title='My Window') w.jump_to(10.651, 41.242, 0.5) See Also: - :class:`~hscmap.window.Window` - :meth:`~hscmap.window.Window.jump_to` Plot catalog objects obtained by ``hscdata.sql`` ------------------------------------------------ :: import hscdata.sql res = hscdata.sql.query(''' SELECT object_id ,ra ,dec ,i_cmodel_mag ,i_cmodel_magsigma ,y_cmodel_mag ,y_cmodel_magsigma FROM pdr2_wide.forced WHERE boxSearch(coord, 151.38831350334513, 151.40458586556656, 0.06900732437557724, 0.0825390607736913) AND isprimary ''', isNullColumn=False) w = hscmap.Window() w.jump_to(151.396, 0.076, 0.02) catalog = w.catalogs.from_query_result(res) See Also: - :attr:`~hscmap.window.Window.catalogs` - :meth:`~hscmap.catalog.CatalogManager.from_query_result` Selectable catalog ------------------ .. raw:: html :: def selectableCatalog(res): indices = [] def on_click(index): if index in indices: indices.remove(index) else: indices.append(index) refresh() def refresh(): ra_selected = res.ra[indices] dec_selected = res.dec[indices] marker.set_coords(ra_selected, dec_selected) base = w.catalogs.from_query_result(res, color=[0, 1, 0, 0.25]) base.on_click = on_click marker = w.catalogs.new([], [], name='marker', color=[0, 1, 1, 1]) def clear(): marker.remove() base.remove() refresh() return indices, clear indices, clear = selectableCatalog(res) :: # Click some of the objects to select and deselect print(indices) See Also: - :meth:`~hscmap.catalog.CatalogManager.new` - :meth:`~hscmap.catalog.CatalogManager.from_query_result` Loag a FITS image onto an hscMap window --------------------------------------- :: import hscdata.imagecutout as imagecutout w.jump_to(216.20416023106773, -0.8893594325061295, 0.01) hdul = imagecutout.getImage(216.20416023106773, -0.8893594325061295, sw='1arcmin', sh='1arcmin', filter='HSC-I') fits_image = w.fits_images.from_hdu(hdul[1]) See Also: - :meth:`~hscmap.fitsimage.FitsImageManager.from_hdu` Save snapshot to file --------------------- :: w.snapshot.save('a.png') ! open a.png See Also: - :meth:`~hscmap.snapshot.Snapshot.save` Save snapshot to notebook ------------------------- :: fut = w.snapshot('a.png') :: # wait few seconds fut.result() See Also: - :meth:`~hscmap.snapshot.Snapshot.__call__` ========= Reference ========= Window ------ .. automodule:: hscmap.window :members: :undoc-members: :show-inheritance: Catalog ------- .. automodule:: hscmap.catalog :members: :undoc-members: :show-inheritance: FitsImage --------- .. automodule:: hscmap.fitsimage :members: :show-inheritance: Snapshot -------- .. autoclass:: hscmap.snapshot.Snapshot :members: :show-inheritance: :special-members: __call__ .. toctree:: :maxdepth: 4 :caption: Contents: