def update_z_edge(frame):
    '''Frame updater for FuncAnimation.
    '''
    im_xy.set_data(imgs_rna[chan][:,:,frame])
    colors = []
    for spot in spots_masked:
        alpha = su.gauss_1d(frame, 1., spot[2], spot[3])
        colors.append([1., 0., 0., alpha])
    spots_xy.set_edgecolor(colors)
    return im_xy, spots_xy  # this return structure is a requirement for the FuncAnimation() callable
def update_z_compartments(frame):
    '''Frame updater for FuncAnimation.
    '''
    im_xy.set_data(imgs_rna[chan][:,:,frame])
    colors_nuc = []
    colors_cyt = []
    colors_peri = []
    for spot in spots_by_region['nuc']:
        alpha = su.gauss_1d(frame, 1., spot[2], spot[3])
        colors_nuc.append([0.3, 0.3, 1., alpha])
    for spot in spots_by_region['cyt']:
        alpha = su.gauss_1d(frame, 1., spot[2], spot[3])
        colors_cyt.append([1., 0.3, 0.3, alpha])
    for spot in spots_by_region['peri']:
        alpha = su.gauss_1d(frame, 1., spot[2], spot[3])
        colors_peri.append([0.3, 1., 0.3, alpha])
    spots_nuc_xy.set_facecolor(colors_nuc)
    spots_cyt_xy.set_facecolor(colors_cyt)
    spots_peri_xy.set_facecolor(colors_peri)
    return im_xy, spots_nuc_xy, spots_cyt_xy, spots_peri_xy  # this return structure is a requirement for the FuncAnimation() callable
def update_z_grassfire(frame):
    '''Frame updater for FuncAnimation.
    '''
    dapi_xy.set_data(img_dapi[:,:,frame])
    im_xy.set_data(imgs_rna[chan][:,:,frame])
    colors = spots_xy.get_facecolor()
    for i, spot in enumerate(spots_xyz):
        alpha = su.gauss_1d(frame, 1., spot[2]/dims['Z'], 1.)
        colors[i,3] = alpha
    spots_xy.set_facecolor(colors)
    return dapi_xy, im_xy, spots_xy  # this return structure is a requirement for the FuncAnimation() callable