fluxunit = [label_format(catalog[entry]['spectra'][i]['fluxunit'])]*sl, x = spectrumwave[i], y = [y_offsets[i] + j for j in spectrumscaled[i]], src = [catalog[entry]['spectra'][i]['source']]*sl ) if 'redshift' in catalog[entry]: data['xrest'] = [x/(1.0 + z) for x in spectrumwave[i]] if 'timeunit' in spectrum and 'time' in spectrum: data['epoch'] = [catalog[entry]['spectra'][i]['time'] for j in spectrumscaled[i]] sources.append(ColumnDataSource(data)) p2.line('x', 'y', source=sources[i], color=mycolors[i % len(mycolors)], line_width=2) if 'redshift' in catalog[entry]: minredw = minsw/(1.0 + z) maxredw = maxsw/(1.0 + z) p2.extra_x_ranges = {"other wavelength": Range1d(start=minredw, end=maxredw)} p2.add_layout(LinearAxis(axis_label ="Restframe Wavelength (Å)", x_range_name="other wavelength"), 'above') sdicts = dict(zip(['s'+str(x) for x in range(len(sources))], sources)) callback = CustomJS(args=sdicts, code=""" var yoffs = [""" + ','.join([str(x) for x in y_offsets]) + """]; for (s = 0; s < """ + str(len(sources)) + """; s++) { var data = eval('s'+s).get('data'); var redshift = """ + str(z if 'redshift' in catalog[entry] else 0.) + """; if (!('binsize' in data)) { data['binsize'] = 1.0 } if (!('spacing' in data)) { data['spacing'] = 1.0 } if (cb_obj.get('title') == 'Spacing') {