Ejemplo n.º 1
0
    def _build_hyperspectral_map(self, ):
        """Build a hyperspectral map. Hyperspectral maps are single-object
        files with datapoints of _14_W_Size length"""

        #Check that the object contained only one object.
        #Probably overkill at this point but better safe than sorry
        if len(self._list_sur_file_content) != 1:
            raise MountainsMapFileError(
                "Input {:s} File is not of Hyperspectral type".format(
                    self._Object_type))

        #We get the dictionary with all the data
        hypdic = self._list_sur_file_content[0]

        #Add all the axes to the signal dict
        self.signal_dict['axes'].append(\
            self._build_Yax(hypdic,ind=0,nav=True))
        self.signal_dict['axes'].append(\
            self._build_Xax(hypdic,ind=1,nav=True))
        #Wavelength axis in hyperspectral surface files are stored as T Axis
        #with length set as _14_W_Size
        self.signal_dict['axes'].append(\
            self._build_Tax(hypdic,'_14_W_Size',ind=2,nav=False))

        #We reshape the data in the correct format
        self.signal_dict['data'] = hypdic['_62_points'].reshape(\
            hypdic['_19_Number_of_Lines'],
            hypdic['_18_Number_of_Points'],
            hypdic['_14_W_Size'],
            )

        self.signal_dict['metadata'] = self._build_metadata(hypdic)

        self.signal_dict['original_metadata'] = self._build_original_metadata()
Ejemplo n.º 2
0
    def _build_sur_dict(self):
        """Create a signal dict with an unpacked object"""

        #If the signal is of the type spectrum or hypercard
        if self._Object_type in [
                "_HYPCARD",
        ]:
            self._build_hyperspectral_map()
        elif self._Object_type in ["_SPECTRUM"]:
            self._build_spectrum()
        elif self._Object_type in ["_PROFILE"]:
            self._build_general_1D_data()
        elif self._Object_type in ["_PROFILESERIE"]:
            self._build_1D_series()
        elif self._Object_type in ["_SURFACE"]:
            self._build_surface()
        elif self._Object_type in ["_SURFACESERIE"]:
            self._build_surface_series()
        elif self._Object_type in ["_MULTILAYERSURFACE"]:
            self._build_surface_series()
        elif self._Object_type in ["_RGBSURFACE"]:
            self._build_RGB_surface()
        elif self._Object_type in ["_RGBIMAGE"]:
            self._build_RGB_image()
        elif self._Object_type in ["_RGBINTENSITYSURFACE"]:
            self._build_RGB_surface()
        elif self._Object_type in ["_BINARYIMAGE"]:
            self._build_surface()
        else:
            raise MountainsMapFileError(self._Object_type \
                + "is not a supported mountain object.")

        return self.signal_dict
Ejemplo n.º 3
0
    def _build_general_1D_data(self, ):
        """Build general 1D Data objects. Currently work with spectra"""

        #Check that the object contained only one object.
        #Probably overkill at this point but better safe than sorry
        if len(self._list_sur_file_content) != 1:
            raise MountainsMapFileError("Corrupt file")

        #We get the dictionary with all the data
        hypdic = self._list_sur_file_content[0]

        #Add the axe to the signal dict
        self.signal_dict['axes'].append(\
            self._build_Xax(hypdic,ind=0,nav=False))

        #We reshape the data in the correct format
        self.signal_dict['data'] = hypdic['_62_points']

        #Build the metadata
        self._set_metadata_and_original_metadata(hypdic)
Ejemplo n.º 4
0
    def _build_surface(self, ):
        """Build a surface"""

        #Check that the object contained only one object.
        #Probably overkill at this point but better safe than sorry
        if len(self._list_sur_file_content) != 1:
            raise MountainsMapFileError("CORRUPT {:s} FILE".format(
                self._Object_type))

        #We get the dictionary with all the data
        hypdic = self._list_sur_file_content[0]

        #Add all the axes to the signal dict
        self.signal_dict['axes'].append(\
            self._build_Yax(hypdic,ind=0,nav=False))
        self.signal_dict['axes'].append(\
            self._build_Xax(hypdic,ind=1,nav=False))

        #We reshape the data in the correct format
        shape = (hypdic['_19_Number_of_Lines'], hypdic['_18_Number_of_Points'])
        self.signal_dict['data'] = hypdic['_62_points'].reshape(shape)

        self._set_metadata_and_original_metadata(hypdic)