def ant_select_callback():
    """JS callback for the selection and de-selection of antennas

    Returns
    -------
    code : :obj:`str`
    """
    code = """
            /*ax: list containing glyph renderers
              bsel: batch selection group button
              nbatches: Number of batches available
              fsel: field_selector widget,
              csel: corr_select widget,
              ssel: spw_select widget,
              nfields: Number of available fields,
              ncorrs: Number of avaiblable corrs,
              nspws: Number of spectral windows,
            */
            let nplots = ax.length;
            if (cb_obj.active.includes(0))
                {
                    for(let i=0; i<nplots; i++){
                        ax[i].visible = true;
                    }
                    //activate all the checkboxes whose antennas are active
                    bsel.active = [...Array(nbatches).keys()]
                    csel.active = [...Array(ncorrs).keys()]
                    fsel.active = [...Array(nfields).keys()]
                    ssel.active = [...Array(nspws).keys()]

                }
            else{
                    for(let i=0; i<nplots; i++){
                       ax[i].visible = false;
                    }

                    bsel.active = []
                    csel.active = []
                    fsel.active = []
                    ssel.active = []
                }
            """
    return code
