# Warm hematite drill core¶

A new version of the hematite example is introduced for the 0.12.0 version. The main improvement is to use FCLS instead of NNLS. With the introduction of FCLS a higher precision is obtained and only four endmembers is needed to map the quartz and, this is new, to define the mask. You can consult the version 0.11.0 for the previous analysis.

Quartz and feldspar have absorbtion feature in the LWIR range. Hematite (Fe2O3) has no absorption feature in the sensor spectral range. The dark regions correspond to a quartz (SiO2) impurity in the sample (next figure). The broad spectral feature between 1050 and 1275 cm-1 is associated with the Si-O asymmetric stretching mode of quartz. The cube is acquired in the VLW range of infrared, between 867 to 1288 wavenumber (cm-1) (7.76 to 11.54 micrometer) and it have 165 bands. The instrument used to acquire the data come from the Telops compagny.

In [1]:

    # Image displayed by the Reveal Viewer software at 1113.15 [cm-1].
    from IPython.core.display import Image
    Image(filename=r'C:\dev\pysptools\doc\hem\hem_pic1.png')

Out[1]:

First, we load the cube.

In [2]:

    %matplotlib inline
    import os.path as osp
    import numpy as np
    import pysptools.util as util
    import pysptools.eea as eea
    import pysptools.abundance_maps as amp

    # Load the cube
    data_path = '../data1'
    sample = 'hematite.hdr'

    data_file = osp.join(data_path, sample)
    data, info = util.load_ENVI_file(data_file)
    # Telops cubes are flipped left-right
    # Flipping them again restore the orientation
    data = np.fliplr(data)

In [3]:

    def display(image, colormap):
        import matplotlib.pyplot as plt
        img = plt.imshow(image)
        img.set_cmap(colormap)
        plt.colorbar()
        plt.show()
        plt.clf()

The analysis is made in tree steps. First, we extract four endmembers.

In [4]:

    ee = eea.NFINDR()
    U = ee.extract(data, 4, maxit=5, normalize=True, ATGP_init=True)
    ee.display(info, suffix='Hematite example')

    <matplotlib.figure.Figure at 0xb459f98>

Next, the related abundance maps are generated with FCLS.

In [5]:

    fcls = amp.FCLS()
    amaps = fcls.map(data, U, normalize=True)
    fcls.display(colorMap='jet', suffix='Hematite example')

    <matplotlib.figure.Figure at 0x14e2cac8>

For the last step, we use the EM1 and EM3 spectra to create the mask and the quartz images respectively. Creation of the quartz image is straightforward. The EM1 spectra is a background spectra. Inverting it give a mask for the drill core.

In [6]:

    # Print the quartz image
    # EM3 == quartz
    quartz = amaps[:,:,2]
    display(quartz, 'spectral')

    <matplotlib.figure.Figure at 0xb237358>

In [7]:

    # Print the mask
    # EM1 == background, we use the backgroud to isolate the drill core
    # and define the mask
    mask = (amaps[:,:,0] < 0.2)
    display(mask, 'gray')

    <matplotlib.figure.Figure at 0x14d34ac8>

Finally, we extract some statistics.

In [8]:

    # pixels sum
    rock_surface = np.sum(mask)
    quartz_surface = np.sum(quartz > 0.16)
    print 'Some statistics'
    print '  Drill core surface (mask) in pixels:', rock_surface
    print '  Quartz surface in pixels:', quartz_surface
    print '  Hematite surface in pixels:', rock_surface - quartz_surface

    Some statistics
      Drill core surface (mask) in pixels: 1718
      Quartz surface in pixels: 1163
      Hematite surface in pixels: 555