def action(self):
        """
        Replaces the values in the specified range of wavelengths with NaNs

        :return: (Spectronon DataCube) new datacube with bands replaced with NaNs
        """

        # Make a new cube, which will contain the processed spectral bands
        newcube = util.makeEmptyCube(mode="memory",
                                     typechar='f',
                                     rotationString=self.datacube.getRotationString())

        bands = self.datacube.getBandCount()
        samples = self.datacube.getSampleCount()
        lines = self.datacube.getLineCount()
        wavelengths = self.datacube.getWavelengthList()

        minBand = self.minBand.value
        maxBand = self.maxBand.value

        for wavelength in wavelengths:

            currentBand = self.datacube.getBandAtWavelength(wavelength)
            currentBand = currentBand.astype(np.float32)
            if (minBand <= wavelength <= maxBand):
                currentBand[:,:] = np.NaN

            newcube.appendBandWithWavelength(currentBand, wavelength)

        return newcube
示例#2
0
    def action(self):
        """
        Replaces the values in the specified range of wavelengths with NaNs

        :return: (Spectronon DataCube) new datacube with bands replaced with NaNs
        """

        # Make a new cube, which will contain the processed spectral bands
        newcube = util.makeEmptyCube(
            mode="memory",
            typechar='f',
            rotationString=self.datacube.getRotationString())

        bands = self.datacube.getBandCount()
        samples = self.datacube.getSampleCount()
        lines = self.datacube.getLineCount()
        wavelengths = self.datacube.getWavelengthList()

        minBand = self.minBand.value
        maxBand = self.maxBand.value

        for wavelength in wavelengths:

            currentBand = self.datacube.getBandAtWavelength(wavelength)
            currentBand = currentBand.astype(np.float32)
            if (minBand <= wavelength <= maxBand):
                currentBand[:, :] = np.NaN

            newcube.appendBandWithWavelength(currentBand, wavelength)

        return newcube
def createNewDatacube(workbench, data, wavelengths, rotationString):
    """
    Creates a Spectronon DataCube object from the supplied data matrix. 

    :param workbench: (Spectronon workbench) Reference to useful stuff in Spectronon
    :param data: (matrix of floats) Data which should be put into a cube
    :param wavelengths: (list of floats) Wavelengths of the datacube
    :param rotationString: (string) Rotation format for the datacube

    :return: (Spectronon DataCube) New datacube containing provided data
    """

    newcube = util.makeEmptyCube(mode="memory",
                                 typechar='f',
                                 rotationString=rotationString)

    for i, wavelength in enumerate(wavelengths):

        band = data[:,:, i]
        newcube.appendBandWithWavelength(band, wave=wavelength)

    return newcube