Ejemplo n.º 1
0
def test_normalisation():
    """Tests for normalisation."""

    datin = Data()
    datin.data = np.ma.array([[1., 2.], [1., 2.]])

    tmp = normalisation.Normalisation(None)
    tmp.indata = {'Raster': [datin, datin]}
    tmp.radiobutton_interval.setChecked(True)
    tmp.settings(True)
    datout = np.ma.array([[0., 1.], [0., 1.]])

    np.testing.assert_array_equal(tmp.outdata['Raster'][0].data, datout)

    tmp.radiobutton_mean.setChecked(True)
    tmp.settings(True)
    datout = np.ma.array([[-1., 1.], [-1., 1.]])

    np.testing.assert_array_equal(tmp.outdata['Raster'][0].data, datout)

    tmp.radiobutton_median.setChecked(True)
    tmp.settings(True)
    datout = np.ma.array([[-1., 1.], [-1., 1.]])

    np.testing.assert_array_equal(tmp.outdata['Raster'][0].data, datout)

    tmp.radiobutton_8bit.setChecked(True)
    tmp.settings(True)

    datout = np.ma.array([[0., 255.], [0., 255.]])

    np.testing.assert_array_equal(tmp.outdata['Raster'][0].data, datout)
Ejemplo n.º 2
0
 def norm_data(self):
     """ Normalisation of data"""
     fnc = normalisation.Normalisation(self.parent)
     self.parent.item_insert("Step", "Normalisation", fnc)
Ejemplo n.º 3
0
 def norm_data(self):
     """Normalisation of data."""
     fnc = normalisation.Normalisation(self.parent)
     self.parent.item_insert('Step', 'Normalisation', fnc)