## examples/pca/pca_aucyano.lar # note that this is similar to examples/fitting/doc_example3 auproject = read_athena('cyanobacteria.prj', do_fft=False, do_bkg=False) d_720 = extract_athenagroup(auproject.d_720) au_foil = extract_athenagroup(auproject.Au_foil) au_cl3aq = extract_athenagroup(auproject.Au3_Cl_aq) au_hydrox = extract_athenagroup(auproject.Au_hydroxide) au_sulfide = extract_athenagroup(auproject.Au_sulphide) au_thiocyan = extract_athenagroup(auproject.Au_thiocyanide) au_thiosulf = extract_athenagroup(auproject.Au_thiosulphate_aq) # make sure pre_edge() is run with the same params for all groups for g in (d_720, au_foil, au_cl3aq, au_hydrox, au_sulfide, au_thiocyan, au_thiosulf): pre_edge(g, pre1=-150, pre2=-30, nnorm=1, norm1=150, norm2=850) #endfor standards = (au_foil, au_cl3aq, au_hydrox, au_sulfide, au_thiocyan, au_thiosulf) # train model with standards au_pcamodel = pca_train(standards, arrayname='norm', xmin=11870, xmax=12030) # plot components and weights plot_pca_components(au_pcamodel, min_weight=0.005) plot_pca_weights(au_pcamodel, win=2, min_weight=0.005, ylog_scale=True) # print out weights total = 0 print(" Comp # | Weight | Cumulative Total") for i, weight in enumerate(au_pcamodel.variances): total = total + weight print(" %3i | %8.5f | %8.5f " % (i+1, weight, total)) #endfor # fit unknown data to model pca_fit(d_720, au_pcamodel, ncomps=4) # plot plot_pca_fit(d_720, win=3) ## end of examples/pca/pca_aucyano.lar