def save_plots(self, pdf_dir, png_dir): #create spectrum list spectrums = [] for i in range(self._refls.shape[0]): dm = np.vstack((self._waves, self._refls[i, :])).transpose() spectrums.append(Spectrum(data = dm)) #plot spectrums and save fig1_title = self._name fig1 = plot_spectrums(spectrums, spectrums_color = 'cyan', title = fig1_title) fig1.savefig(os.path.join(pdf_dir, fig1_title + ".pdf")) fig1.savefig(os.path.join(png_dir, fig1_title + ".png")) #plot spectrums + mean and save fig2_title = self._name + "_with_mean" fig2 = plot_spectrums(spectrums, spectrums_color = 'cyan', title = fig2_title, stat_spectrum = self.mean, stat_spectrum_color = 'black') fig2.savefig(os.path.join(pdf_dir, fig2_title + ".pdf")) fig2.savefig(os.path.join(png_dir, fig2_title + ".png")) #plot spectrums + median and save fig3_title = self._name + "_with_median" fig3 = plot_spectrums(spectrums, spectrums_color = 'cyan', title = fig3_title, stat_spectrum = self.median, stat_spectrum_color = 'black') fig3.savefig(os.path.join(pdf_dir, fig3_title + ".pdf")) fig3.savefig(os.path.join(png_dir, fig3_title + ".png"))
def save_plots(self, pdf_dir, png_dir): #create spectrum list spectrums = [] for i in range(self._refls.shape[0]): dm = np.vstack((self._waves, self._refls[i, :])).transpose() spectrums.append(Spectrum(data=dm)) #plot spectrums and save fig1_title = self._name fig1 = plot_spectrums(spectrums, spectrums_color='cyan', title=fig1_title) fig1.savefig(os.path.join(pdf_dir, fig1_title + ".pdf")) fig1.savefig(os.path.join(png_dir, fig1_title + ".png")) #plot spectrums + mean and save fig2_title = self._name + "_with_mean" fig2 = plot_spectrums(spectrums, spectrums_color='cyan', title=fig2_title, stat_spectrum=self.mean, stat_spectrum_color='black') fig2.savefig(os.path.join(pdf_dir, fig2_title + ".pdf")) fig2.savefig(os.path.join(png_dir, fig2_title + ".png")) #plot spectrums + median and save fig3_title = self._name + "_with_median" fig3 = plot_spectrums(spectrums, spectrums_color='cyan', title=fig3_title, stat_spectrum=self.median, stat_spectrum_color='black') fig3.savefig(os.path.join(pdf_dir, fig3_title + ".pdf")) fig3.savefig(os.path.join(png_dir, fig3_title + ".png"))
# -*- coding: utf-8 -*- """ Created on Mon Aug 3 13:18:15 2015 @author: pravindran """ from __future__ import print_function import os, os.path from SdalReader import SdalReader from sdal_plot_spectrums import plot_spectrums from helpers import get_extension if __name__ == "__main__": print("asd_trek.py") data_dir = "/home/pravindran/mycode/sdal_data/tests_data/asd_mixed_test/" files = [os.path.join(data_dir, f) for f in os.listdir(data_dir)] print("\n".join(files)) specs = [SdalReader().read_spectrum(f) for f in files if get_extension(f).lower() == "asd"] fig = plot_spectrums(specs, spectrums_color="cyan", title="Spectra from ASD Trek + FieldSpec") fig.savefig(os.path.join(data_dir, "plots.pdf"))
# -*- coding: utf-8 -*- """ Created on Mon Aug 3 13:18:15 2015 @author: pravindran """ from __future__ import print_function import os, os.path from SdalReader import SdalReader from sdal_plot_spectrums import plot_spectrums from helpers import get_extension if __name__ == "__main__": print("asd_trek.py") data_dir = '/home/pravindran/mycode/sdal_data/tests_data/asd_mixed_test/' files = [os.path.join(data_dir, f) for f in os.listdir(data_dir)] print("\n".join(files)) specs = [ SdalReader().read_spectrum(f) for f in files if get_extension(f).lower() == 'asd' ] fig = plot_spectrums(specs, spectrums_color='cyan', title="Spectra from ASD Trek + FieldSpec") fig.savefig(os.path.join(data_dir, "plots.pdf"))