<jupyter_start><jupyter_text>View z-band dropout galaxies (redshift ~ 7) in COSMOS<jupyter_code>import warnings
with warnings.catch_warnings():
    warnings.filterwarnings('ignore', '.*astropy.extern.six will be removed.*')
    from astroquery.ned import Ned
candidates = Ned.query_refcode('2012MNRAS.426.2772B')
from IPython.display import IFrame, display
import ipywidgets as widgets
out = widgets.Output(layout={'border': '1px solid black'})
import firefly_client
import uuid
fc = firefly_client.FireflyClient(url='https://lsst-demo.ncsa.illinois.edu/firefly/',
                                  channel=uuid.uuid4().hex,
                                  html_file='slate.html')
from astropy.table import Table
surveys = Table.read('https://raw.githubusercontent.com/Caltech-IPAC/firefly/dev/src/firefly/' +
                     'java/edu/caltech/ipac/firefly/resources/irsa-image-master-table.csv',
                     format='csv')
cosmos_surveys = surveys[surveys['missionId'] == 'COSMOS']
import numpy as np
from astropy.coordinates import SkyCoord
import astropy.units as u
import time
irsacats = Table.read('https://irsa.ipac.caltech.edu/cgi-bin/Gator/nph-scan?mode=ascii', format='ipac')
projects = np.unique(irsacats['projectshort'].data)
inx = irsacats['catname'] == 'gaia_dr2_source'
def visualize_candidate(candidate_number=1, size_index=2):
    size_in_arcsec = size_index*100
    fc.reinit_viewer()
    tbl_index = candidates['No.'] == candidate_number
    c = SkyCoord(ra=candidates['RA'][tbl_index].data[0]*u.deg,
                 dec=candidates['DEC'][tbl_index].data[0]*u.deg)
    target = '{};{};EQ_J2000'.format(c.ra.deg, c.dec.deg)
    time.sleep(1)
    fc.show_table(tbl_id='gaiaTbl', title='Gaia DR2 catalog',
             target_search_info=dict(catalogProject=irsacats[inx]['projectshort'][0],
                                     catalog=irsacats[inx]['catname'][0],
                                     position=target,
                                     SearchMethod='Box',
                                     size=size_in_arcsec),
             options=dict(removable=True, showUnits=False, showFilters=True),
             meta=dict(DEFAULT_SYMBOL='CIRCLE', DEFAULT_COLOR='#FFDD11'))
    rvstring = fc._create_rangevalues_standard(algorithm='asinh',
                                               asinh_q_value=6,
                                               upper_value=98.0)
    time.sleep(2)
    fc.show_fits(plot_id='z+', Title='z+', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_subaru', SurveyKeyBand='z+',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring, OverlayPosition=False);
    rvstring_Y = fc._create_rangevalues_standard(algorithm='asinh',
                                             asinh_q_value=6,
                                             lower_value=0.5,
                                             upper_value=95.0)
    #time.sleep(1)
    fc.show_fits(plot_id='Y', Title='Y', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_ultravista', SurveyKeyBand='Y',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring_Y, OverlayPosition=False);
    #time.sleep(1)
    fc.show_fits(plot_id='H', Title='H', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_ultravista', SurveyKeyBand='H',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring, OverlayPosition=False);
    #time.sleep(1)
    fc.show_fits(plot_id='K', Title='K', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_ultravista', SurveyKeyBand='K',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring, OverlayPosition=False);
    #time.sleep(1)
    rvstring_irac = fc._create_rangevalues_standard(algorithm='asinh',
                                                asinh_q_value=6,
                                                lower_value=0.2,
                                                upper_value=95.0)
    fc.show_fits(plot_id='IRAC1', Title='3.6um', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_irac', SurveyKeyBand='IRAC1',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,            
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring_irac, OverlayPosition=False);
    #time.sleep(1)
    fc.show_fits(plot_id='IRAC2', Title='4.5um', Type='SERVICE', Service='ATLAS',
            SurveyKey='cosmos.cosmos_irac', SurveyKeyBand='IRAC1',
            WorldPt=target, SizeInDeg=size_in_arcsec/3600,
            ColorTable=1, plotGroupId=1, 
            ZoomType='ARCSEC_PER_SCREEN_PIX', ZoomArcsecPerScreenPix=0.3,
            RangeValues=rvstring_irac, OverlayPosition=False);
    fc.dispatch('ImagePlotCntlr.wcsMatch', payload=dict(#plotId='z+', 
                                                         matchType='Standard', 
                                                         lockMatch=True))
options = []
for i in range(1, len(candidates)):
    row = candidates[i]
    optstring = ('%15s  RA=%9.5f  Dec=%8.5f  Redshift=%4.2f' %
                (row['Object Name'], row['RA'], row['DEC'], row['Redshift']))
    options.append((optstring, i))
w1 = widgets.Dropdown(
         options=options, value=2, description='Candidate:',
         disabled=False,
         layout=widgets.Layout(width='550px'))
w2 = widgets.Dropdown(
         options=[('100 arcsec', 1), ('200 arcsec', 2),
                  ('300 arcsec', 3), ('400 arcsec', 4),
                  ('500 arcsec', 5), ('600 arcsec', 6)],
         value=2, description='Field size:',
         disabled=False)
widgets.interact(visualize_candidate, candidate_number=w1, size_index=w2);

with out:
    display(IFrame(fc.get_firefly_url(), 1000, 700))
out<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12898188632104934, 'fraction_numerical': 0.024828232354778264, 'mean_word_length': 2.488562091503268, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '120363', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2123, 'n_tokens_neox': 2004, 'n_words': 275, 'path': 'ipynb/redshift7-app.ipynb', 'repo_name': 'stargaser/mybinder-demo', 'size': '6404'}