Exemple #1
0
    def PlotCalSpecRadiance(self, savePath=None, saveExt='png'):
        """Plot spectral radiance data for the calibration temperatures.

        The filename is constructed from the given object name, save path, and
        the word 'CalRadiance'.

        Args:
            | savePath (string): Path to where the plots must be saved (optional).
            | saveExt (string) : Extension to save the plot as, default of 'png' (optional).

        Returns:
            | None, the images are saved to a specified location or in the location
            | from which the script is running.

        Raises:
            | No exception is raised.
        """

        if self.calTablesCalculated:

            numsubplots = len(self.dicCaldata.keys())

            p = ryplot.Plotter(1,numsubplots,1, figsize=(10,10))
            for j,tmprInstr in enumerate(self.dicCaldata):
                #print(tmprInstr,j)

                # build temperature labels
                labels = []
                for temp in self.dicCaldata[tmprInstr][:,0]:
                    labels.append('{:.0f} $^\circ$C, {:.0f} K'.format(temp-273.15, temp))

                p.plot(1+j,self.wl,self.dicSpecRadiance[tmprInstr],label=labels)
                currentP = p.getSubPlot(1+j)
                currentP.set_xlabel('Wavelength {}m'.format(ryutils.upMu(False)), fontsize=12)
                currentP.set_ylabel('Radiance W/(m$^2$.sr.cm$^{-1}$)', fontsize=12)
                title = '{} at Tinstr={} $^\circ$C'.format(self.specName, tmprInstr)
                currentP.set_title(title, fontsize=12)

            if savePath==None:
                savePath=self.specName
            else:
                savePath = os.path.join(savePath,self.specName)

            p.saveFig('{}-CalRadiance.{}'.format(savePath, saveExt))

            plt.close(p.getPlot())
Exemple #2
0
    def PlotSpectrals(self, savePath=None, saveExt='png'):
        """Plot all spectral curve data to a single graph.

        The filename is constructed from the given object name, save path, and
        the word 'spectrals'.

        Args:
            | savePath (string): Path to where the plots must be saved (optional).
            | saveExt (string) : Extension to save the plot as, default of 'png' (optional).

        Returns:
            | None, the images are saved to a specified location or in the location
            | from which the script is running.

        Raises:
            | No exception is raised.
        """

        if  self.spectralsLoaded == True:

            p = ryplot.Plotter(1, figsize=(10,5))
            p.semilogY(1,self.wl,self.specEmis,label=['Emissivity'])
            p.semilogY(1,self.wl,self.specAtmo,label=['Atmosphere'])
            p.semilogY(1,self.wl,self.specFilter,label=['Filter'])
            p.semilogY(1,self.wl,self.specSensor,label=['Sensor'])
            p.semilogY(1,self.wl,self.specOptics,label=['Optics'])
            p.semilogY(1,self.wl,self.specEffWiFil,label=['Effective'])
            currentP = p.getSubPlot(1)
            currentP.set_xlabel('Wavelength {}m'.format(ryutils.upMu(False)))
            currentP.set_ylabel('Response')
            currentP.set_title('{} Spectral Response'.format(self.specName))

            if savePath==None:
                savePath=self.specName
            else:
                savePath = os.path.join(savePath,self.specName)

            p.saveFig('{}-spectrals.{}'.format(savePath, saveExt))

            plt.close(p.getPlot())