def load_file(self, filepath, numhdu=None, naxispath=None,
                  allow_numhdu_override=True):
        self.logger.debug("Loading file '%s' ..." % (filepath))
        self.clear_metadata()

        ahdr = self.get_header()

        info = iohelper.get_fileinfo(filepath)
        if numhdu is None:
            numhdu = info.numhdu

        _data, numhdu_, naxispath = self.io.load_file(info.filepath, ahdr,
                                                      numhdu=numhdu,
                                                      naxispath=naxispath,
                                                      phdr=self._primary_hdr)
        # this is a handle to the full data array
        self._md_data = _data

        if naxispath is None:
            naxispath = []

        # Drill down to 2D data slice
        if len(naxispath) == 0:
            naxispath = ([0] * (len(_data.shape)-2))

        # Set the image name if no name currently exists for this image
        # TODO: should this *change* the existing name, if any?
        if not (self.name is None):
            self.set(name=self.name)
        else:
            name = self.get('name', None)
            if name is None:
                name = info.name
                if ('[' not in name):
                    if (numhdu is None) or allow_numhdu_override:
                        numhdu = numhdu_
                    name += iohelper.get_hdu_suffix(numhdu)
                self.set(name=name)

        self.set(path=filepath, idx=numhdu)

        self.set_naxispath(naxispath)

        # Try to make a wcs object on the header
        # TODO: in order to do more sophisticated WCS (e.g. distortion
        #   correction) that requires info in additional headers we need
        #   to pass additional information to the wcs class
        #self.wcs.load_header(hdu.header, fobj=fobj)
        self.wcs.load_header(ahdr)
dataset/ETHPy150Open ejeschke/ginga/ginga/AstroImage.py/AstroImage.load_file/original