def makePlots(arr): clips = [] clipi = [] smooths = [] smoothi = [] for t in list(set(arr)): subset = stars[arr == t] clispec, clivar = sigclip_coadd(subset, sigLim=3.0) clips.append(clispec) clipi.append(clivar) for s, i in zip(clips, clipi): flux = Spectrum(lbin, s, ivar=i) flux.smooth(width=5, filtertype="gaussian", replace=True) smooths.append(flux.flux) smoothi.append(flux.ivar) uniqarr = list(set(arr)) sortInd = np.argsort(uniqarr) n = len(uniqarr) fig = py.figure(1, (9, 14)) ax = fig.add_subplot(111) offset = 0 weight = np.ones(len(lbin)) weight[(7550 < lbin) & (lbin < 7700)] = np.nan for i in sortInd[1:]: color = cmp.autumn(i / np.float(n)) ax.plot(lbin, weight * smooths[i] + offset, lw=2.0, color=color) offset += 1 ax.set_xlim(5500, 9500) ax.set_ylim(0, 21) ax.set_xlabel("$\lambda$") ax.axes.get_yaxis().set_visible(False) fig = py.figure(1, (15, 5)) ax = fig.add_subplot(111) for i in sortInd: color = cmp.cool(i / float(n)) ax.plot(lbin, weight * smooths[i], color=color) ax.set_xlim(5500, 9500)
lbin = data.LBIN[0] nlbin = len(lbin) ftype = data.FIELDTYPE types = list(set(ftype)) cid = data.CID fig = py.figure(1,(12,8)) ax = fig.add_subplot(111) clips = [] clipi = [] offset = 0 for t in types: stars = data[(ftype == t) & (cid == 'c')] cospec,coivar,clispec,clivar = sigclip_coadd(stars, sigLim = 1.5, verbose = True) clips.append(clispec) clipi.append(clivar) #ax.plot(lbin, clispec+offset, label = t) #offset += 2 smooths = [] smoothi = [] for s,i in zip(clips, clipi): flux = Spectrum(lbin,s,ivar = i) flux.smooth(width = 5, filtertype = 'gaussian', replace = True) smooths.append(flux.flux) smoothi.append(flux.ivar) arrayfmt = '9230E' ntypes = len(types)