[GRASS-user] Spectral Unmixing

Hi All,

Does anybody know the inputs to i.spec.unmix?

it asks for a matrix file.

where to get it?

Regards,
Rashad

On Tue, Nov 27, 2012 at 11:50 AM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi All,

Does anybody know the inputs to i.spec.unmix?

it asks for a matrix file.

where to get it?

You find samples in
grass-addons/grass6/imagery/i.spec.unmix/sample/

Best,
Markus

yes i had those files already

i.spec.unmix gr=96corr

where can i find the imagery group 96corr?

If its newly created which are the raster images needed in it?
and in which dataset its available?

I had spearfish and nc_spm_08

···

On Tue, Nov 27, 2012 at 4:40 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Nov 27, 2012 at 11:50 AM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi All,

Does anybody know the inputs to i.spec.unmix?

it asks for a matrix file.

where to get it?

You find samples in
grass-addons/grass6/imagery/i.spec.unmix/sample/

Best,
Markus

Regards,
Rashad

On Tue, Nov 27, 2012 at 12:16 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

yes i had those files already

i.spec.unmix gr=96corr

where can i find the imagery group 96corr?

If its newly created which are the raster images needed in it?
and in which dataset its available?

I had spearfish and nc_spm_08

You may use the data from the landsat mapset therein.

Markus

Hi Rashad,

On Tue, Nov 27, 2012 at 9:11 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi Markus,

These is the error i got from spectral unmixing module

maybe I was not clear: the module is currently non functional
and needs to be updated and modernized. I write it in 1998/99
as part of my master thesis for GRASS 5.

GRASS 6.3.1svn (nc_spm_08):~ > i.spec.unmix

...

The 6.3 version which I sent to use was partially updated by
Brad Douglas (if I recall correctly) to GRASS 6 but not in a
complete stage. So the order would be

- get it running in 6.3 as you try;
- while keeping GRASS 7 in mind (jump over 6.4) which may
  simplify some code structures.

The update "train" was:
* GRASS 5: i.spec.unmix: working with MESHACH numerical libs
  (http://www.netlib.org/c/meschach/readme)
* GRASS 6.3: attempt to rewrite the MESHACH support to LAPACK
  support since the MESHACH library wasn't clear.
  This remained unfinished by me.
* Someone (Brad?) took over to complete this but didn't fully finish.
  This version you are trying right now.

Now we are at GRASS 7 and it is time to get i.spec.unmix up and
running :slight_smile:

Best,
Markus

fine.

If i give input map and the corresponding output map from i.spec.unmix. can you evaluate?

Also do you see any problem in my selection of input maps?

which are available in grass sample dataset (nc_spm_08) landat (mapset)

···

On Wed, Nov 28, 2012 at 2:26 AM, Markus Neteler <neteler@osgeo.org> wrote:

Hi Rashad,

On Tue, Nov 27, 2012 at 9:11 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi Markus,

These is the error i got from spectral unmixing module

maybe I was not clear: the module is currently non functional
and needs to be updated and modernized. I write it in 1998/99
as part of my master thesis for GRASS 5.

GRASS 6.3.1svn (nc_spm_08):~ > i.spec.unmix

The 6.3 version which I sent to use was partially updated by
Brad Douglas (if I recall correctly) to GRASS 6 but not in a
complete stage. So the order would be

  • get it running in 6.3 as you try;
  • while keeping GRASS 7 in mind (jump over 6.4) which may
    simplify some code structures.

The update “train” was:

  • GRASS 5: i.spec.unmix: working with MESHACH numerical libs
    (http://www.netlib.org/c/meschach/readme)
  • GRASS 6.3: attempt to rewrite the MESHACH support to LAPACK
    support since the MESHACH library wasn’t clear.
    This remained unfinished by me.
  • Someone (Brad?) took over to complete this but didn’t fully finish.
    This version you are trying right now.

Now we are at GRASS 7 and it is time to get i.spec.unmix up and
running :slight_smile:

Best,
Markus

Regards,
Rashad

I had compiled and run i.spec.unmix for grass 6.3 but output is not correct

So could you tell me which version of GRASS5 works with i.spec.unmix?

···

On Wed, Nov 28, 2012 at 8:07 AM, Mohammed Rashad <mohammedrashadkm@gmail.com> wrote:

fine.

If i give input map and the corresponding output map from i.spec.unmix. can you evaluate?

Also do you see any problem in my selection of input maps?

which are available in grass sample dataset (nc_spm_08) landat (mapset)

Regards,
Rashad

On Wed, Nov 28, 2012 at 2:26 AM, Markus Neteler <neteler@osgeo.org> wrote:

Hi Rashad,

On Tue, Nov 27, 2012 at 9:11 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi Markus,

These is the error i got from spectral unmixing module

maybe I was not clear: the module is currently non functional
and needs to be updated and modernized. I write it in 1998/99
as part of my master thesis for GRASS 5.

GRASS 6.3.1svn (nc_spm_08):~ > i.spec.unmix

The 6.3 version which I sent to use was partially updated by
Brad Douglas (if I recall correctly) to GRASS 6 but not in a
complete stage. So the order would be

  • get it running in 6.3 as you try;
  • while keeping GRASS 7 in mind (jump over 6.4) which may
    simplify some code structures.

The update “train” was:

  • GRASS 5: i.spec.unmix: working with MESHACH numerical libs
    (http://www.netlib.org/c/meschach/readme)
  • GRASS 6.3: attempt to rewrite the MESHACH support to LAPACK
    support since the MESHACH library wasn’t clear.
    This remained unfinished by me.
  • Someone (Brad?) took over to complete this but didn’t fully finish.
    This version you are trying right now.

Now we are at GRASS 7 and it is time to get i.spec.unmix up and
running :slight_smile:

Best,
Markus

Regards,
Rashad

It will be nice if i get a working version of source and GRASS rather than partial updates of addon.

Partial updates had some errors and cannot be rectified unless until the entire algorithm is known.

If by any chance you can give me the old version with “meschach” i could find the bug and port it to latest grass

BTW, in GRASS5 v_get(1) returns what?

eg found in source

startvector = **v_get(*A->cols); / length: no. of spectra */

A_tilde = m_get(A->rows+1, A->cols); /* memory allocation */

**mv_mlt(*A_tilde, startvector, A_times_startvector);
v_sub(A_times_startvector, b_gamma, errorvector);
sm_mlt(mu, A_tilde_trans, A_tilde_trans_mu);
mv_mlt(A_tilde_trans_mu, errorvector, temp);
v_sub(startvector,temp,startvector); /
update startvector */

Could you recall what these functions and a brief of what it does will help atleast

mv_mlt() v_sub() sm_mlt()

···

On Thu, Nov 29, 2012 at 1:16 AM, Mohammed Rashad <mohammedrashadkm@gmail.com> wrote:

I had compiled and run i.spec.unmix for grass 6.3 but output is not correct

So could you tell me which version of GRASS5 works with i.spec.unmix?

Regards,
Rashad

On Wed, Nov 28, 2012 at 8:07 AM, Mohammed Rashad <mohammedrashadkm@gmail.com> wrote:

fine.

If i give input map and the corresponding output map from i.spec.unmix. can you evaluate?

Also do you see any problem in my selection of input maps?

which are available in grass sample dataset (nc_spm_08) landat (mapset)

Regards,
Rashad

On Wed, Nov 28, 2012 at 2:26 AM, Markus Neteler <neteler@osgeo.org> wrote:

Hi Rashad,

On Tue, Nov 27, 2012 at 9:11 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Hi Markus,

These is the error i got from spectral unmixing module

maybe I was not clear: the module is currently non functional
and needs to be updated and modernized. I write it in 1998/99
as part of my master thesis for GRASS 5.

GRASS 6.3.1svn (nc_spm_08):~ > i.spec.unmix

The 6.3 version which I sent to use was partially updated by
Brad Douglas (if I recall correctly) to GRASS 6 but not in a
complete stage. So the order would be

  • get it running in 6.3 as you try;
  • while keeping GRASS 7 in mind (jump over 6.4) which may
    simplify some code structures.

The update “train” was:

  • GRASS 5: i.spec.unmix: working with MESHACH numerical libs
    (http://www.netlib.org/c/meschach/readme)
  • GRASS 6.3: attempt to rewrite the MESHACH support to LAPACK
    support since the MESHACH library wasn’t clear.
    This remained unfinished by me.
  • Someone (Brad?) took over to complete this but didn’t fully finish.
    This version you are trying right now.

Now we are at GRASS 7 and it is time to get i.spec.unmix up and
running :slight_smile:

Best,
Markus

Regards,
Rashad

On Wed, Nov 28, 2012 at 9:11 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

It will be nice if i get a working version of source and GRASS rather than
partial updates of addon.

I agree.
I'll send my old GRASS 5 version code to you offlist.

Markus

hi Rashad,

On Thu, Nov 29, 2012 at 7:52 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

I am getting some output from i.spec.unmix which uses gmath and some data
structures from meschach

Please find below screenshot and notes of the spectral unmixing output.

Could you please verify it and let me know.

this looks really very promising!

Of course the results depend a lot on the input spectra which are
sometimes not easy to obtain. You need to identify pure pixels
which one can find the the corners of the PCA featurespace. When
time, I can translate my German instructions to English.

Code works in grass 6.4(release), grass 6.5(grass6_devel), grass
6.3(release)

Wonderful.
For the GRASS 6 version, could you please update or patch against
grass-addons/grass6/imagery/i.spec.unmix/
?

If outputs are fine I will port to grass7

Great!

Thanks for your hard work,
Markus

Thanks. I am glad that results looks fine. BTW, I have write access to grass addons svn. So Can I commit the code by myself ?

If so I will do it by monday evening. I had sent another mail to you

i.spec.unmix [new output]

And for the record it has been ported to grass7 today.

see more info below.

i.spec.unmix group=group2@landsat result=res error=err iter=iter matrix=/home/rashad/dev/sample/spectrum.dat

Dataset: nc_spm_08
Mapset: landsat

group2@landsat

(attachments)

res.1.png

···

On Fri, Nov 30, 2012 at 7:42 PM, Markus Neteler <neteler@osgeo.org> wrote:

hi Rashad,

On Thu, Nov 29, 2012 at 7:52 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

I am getting some output from i.spec.unmix which uses gmath and some data
structures from meschach

Please find below screenshot and notes of the spectral unmixing output.

Could you please verify it and let me know.

this looks really very promising!

Of course the results depend a lot on the input spectra which are
sometimes not easy to obtain. You need to identify pure pixels
which one can find the the corners of the PCA featurespace. When
time, I can translate my German instructions to English.

Code works in grass 6.4(release), grass 6.5(grass6_devel), grass
6.3(release)

Wonderful.
For the GRASS 6 version, could you please update or patch against
grass-addons/grass6/imagery/i.spec.unmix/
?

If outputs are fine I will port to grass7

Great!

Thanks for your hard work,
Markus

Regards,
Rashad

On Fri, Nov 30, 2012 at 4:52 PM, Mohammed Rashad
<mohammedrashadkm@gmail.com> wrote:

Thanks. I am glad that results looks fine. BTW, I have write access to grass
addons svn. So Can I commit the code by myself ?

Yes, of course!

If so I will do it by monday evening. I had sent another mail to you

i.spec.unmix [new output]

And for the record it has been ported to grass7 today.

Great news.

I'll check asap (travelling)

Markus