Interpreting results from CMS

140 views
Skip to first unread message
Assigned to bexe...@gmail.com by me

jdldeauna

unread,
Jul 10, 2017, 9:16:36 AM7/10/17
to connectivity-modeling-system-club
Good day,

We are currently using Infomap to process the results from CMS. I'd like to ask if anybody uses the same code, and if so, do you use the undirected or directed mode? What are the advantages of one over the other?
On the other hand, what other post-processing software can be used for CMS results?
Thank you very much for your consideration.

Sally Wood

unread,
Jul 10, 2017, 9:37:49 AM7/10/17
to jdldeauna, connectivity-modeling-system-club

I have never used Infomap, but there are some example Matlab scripts for processing CMS output at https://github.com/beatrixparis/connectivity-modeling-system/tree/master/cms-master/postproc

I also have a range of Matlab scripts for doing various further analysis which I am happy to share, if you let me know what you are trying to do (and please kindly acknowledge these scripts in any publications).

Kind regards,

Sally


From: connectivity-mod...@googlegroups.com <connectivity-mod...@googlegroups.com> on behalf of jdldeauna <jdld...@gmail.com>
Sent: 10 July 2017 14:16:36
To: connectivity-modeling-system-club
Subject: Connectivity Modeling System (CMS) User's discussion Interpreting results from CMS
 
--
You received this message because you are subscribed to the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-...@googlegroups.com.
To post to this group, send email to connectivity-mod...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

salwood82

unread,
Nov 23, 2017, 6:07:48 AM11/23/17
to connectivity-modeling-system-club
Hi,
in case anyone else is interested, I have attached a script which takes the raw connectivity matrix and groups individual cells into larger, user-defined regions (such as individual reefs or management areas). Say your original matrix is n x n, and you have m number of 'sum regions', you input a file (excel or text) listing all the settlement cells (n, column 1) and which sum region (m, column 2) they belong to. The resulting matrix is an m x m matrix with the values for all cells n in each region m summed. 

I have simplified the script to make it as generic as possible.

Dianne, I hope that is what you meant. Let me know if not, I have a range of other Matlab scripts for manipulating and analysing the output of CMS in different ways.

Sally
group_matrix.m

Dianne Deauna

unread,
Nov 23, 2017, 6:36:21 AM11/23/17
to salwood82, connectivity-modeling-system-club
Hello Dr Wood,

Thank you very much for sharing your script. Would you also happen to have one which can automatically group individual cells from a high-resolution grid into relatively low-resolution groups? In case you don't have a predefined set of user-defined regions? Thank you for your help.

Regards,
Dianne

--
You received this message because you are subscribed to a topic in the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/connectivity-modeling-system-club/OJZqroDfqjA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to connectivity-modeling-system-club+unsubscribe@googlegroups.com.
To post to this group, send email to connectivity-modeling-system-cl...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Josephine Dianne L. Deauna
Research Assistant
Physical Oceanography Laboratory
Marine Science Institute, UP Diliman
(632) 9223957

Sally Wood

unread,
Nov 23, 2017, 7:09:39 AM11/23/17
to Dianne Deauna, salwood82, connectivity-modeling-system-club

Hi Dianne,

I do do that, but unfortunately I do the re-gridding in GIS before reading the resulting groupings into Matlab. If you use ArcGIS I would be happy to tell you how I do this? In fact, it is almost identical to the instructions for creating reef polygons on page 37 of the user guide: https://github.com/beatrixparis/connectivity-modeling-system/blob/master/User-Guide-v2.pdf


Kind regards,

Sally


Dr Sally Wood  
School of Earth Sciences, University of Bristol
Wills Memorial Building, Queens Road, BRISTOL BS8 1RJ
+44 (0)117 954 5429 | w: salwood.weebly.com | t: @SalWood82

-- Please note I do not work on Mondays at present --

From: connectivity-mod...@googlegroups.com <connectivity-mod...@googlegroups.com> on behalf of Dianne Deauna <jdld...@gmail.com>
Sent: 23 November 2017 11:36:20
To: salwood82
Cc: connectivity-modeling-system-club
Subject: Re: Connectivity Modeling System (CMS) User's discussion Re: Interpreting results from CMS
 
You received this message because you are subscribed to the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-...@googlegroups.com.
To post to this group, send email to connectivity-mod...@googlegroups.com.

Dianne Deauna

unread,
Nov 23, 2017, 10:42:48 AM11/23/17
to Sally Wood, salwood82, connectivity-modeling-system-club
Hello Dr Wood,

Oh I see, alright I will try to adapt the methodology prescribed in the manual first. If I am not mistaken it's a matter of defining larger-sized polygons right? Thank you very much for your help!!

Regards,
Dianne

On Thu, Nov 23, 2017 at 8:09 PM, Sally Wood <Sally...@bristol.ac.uk> wrote:

Hi Dianne,

I do do that, but unfortunately I do the re-gridding in GIS before reading the resulting groupings into Matlab. If you use ArcGIS I would be happy to tell you how I do this? In fact, it is almost identical to the instructions for creating reef polygons on page 37 of the user guide: https://github.com/beatrixparis/connectivity-modeling-system/blob/master/User-Guide-v2.pdf


Kind regards,

Sally


Dr Sally Wood  
School of Earth Sciences, University of Bristol
Wills Memorial Building, Queens Road, BRISTOL BS8 1RJ
+44 (0)117 954 5429 | w: salwood.weebly.com | t: @SalWood82

-- Please note I do not work on Mondays at present --

To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-system-club+unsubscribe@googlegroups.com.

To post to this group, send email to connectivity-modeling-system-cl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sally Wood

unread,
Nov 23, 2017, 10:49:19 AM11/23/17
to Dianne Deauna, salwood82, connectivity-modeling-system-club

Yes you can use ArcMap to define a vector grid which creates larger polygons. You can then use Spatial Join to find out which larger 'sum polygon' each original polygon falls within, and export that information to Matlab. Issues will arise if your original polygons intersect 2 or more of the new polygons (for example if your grids don't match) - in that case you need to decide how to assign the problem polygons to just 1 of the larger sum polygons (e.g. by using the centroid of the original polygon). I find the ETGeowizards add-in tool for ArcGIS very helpful for some of these tasks. Although I am afraid we may be getting a little off-topic for this forum here...

Feel free to email me if you need any more help. 

Kind regards,

Sally


Dr Sally Wood  
School of Earth Sciences, University of Bristol
Wills Memorial Building, Queens Road, BRISTOL BS8 1RJ
+44 (0)117 954 5429 | w: salwood.weebly.com | t: @SalWood82

-- Please note I do not work on Mondays at present --

From: Dianne Deauna <jdld...@gmail.com>
Sent: 23 November 2017 15:42:46
To: Sally Wood
Cc: salwood82; connectivity-modeling-system-club

Dianne Deauna

unread,
Nov 23, 2017, 10:57:25 AM11/23/17
to Sally Wood, salwood82, connectivity-modeling-system-club
Hello Dr Wood,

Thank you for the comprehensive explanation! I think I am getting the gist of how to do it. I'd like to try it first for myself and will email you for any further guidance. Again, thank you very much for your help.

Regards,
Dianne

Felipe Torquato

unread,
May 3, 2018, 7:58:25 AM5/3/18
to connectivity-modeling-system-club
Hi Sally,

I am trying to use your script to plot my matrix but I am getting a error.

"Undefined function 'fieldnames' for input arguments of type 'double'.

Error in group_matrix (line 29)
f = fieldnames(S);"

As input I am using the con_file_1 provided by the CMS and an excel file with no header (example below).

1 1 Red Sea
2 1 Red Sea
3 1 Red Sea
4 1 Red Sea
5 2 Gulf
6 2 Gulf
7 2 Gulf
8 2 Gulf
9 2 Gulf
10 2 Gulf
. . .
. . .
181 5 Arabian Sea

 
Can you see the potential error?

Thanks in advance,
Felipe

salwood82

unread,
May 3, 2018, 9:29:18 AM5/3/18
to connectivity-modeling-system-club
Hi Felipe,
Matlab is expecting S to be a structure array which it gets from opening the connectivity file in the line:

> S = load(filepath);

With 'filepath' being the path to the connectivity file (e.g. filepath = 'user/connectivity_files/con_file_1'). Instead, S seems to be of type 'double', such as a numerical array.

This has nothing to do with your excel file.

Also, where are you getting the example connectivity file from? As far as I know none is provided in the CMS package?

Cheers,
Sally

Felipe Torquato

unread,
May 3, 2018, 10:44:59 AM5/3/18
to connectivity-modeling-system-club
Hi Sally,

thanks for the quick reply.

The connectivity file that I am using is the con_file_1, the output of CMS.

Sally Wood

unread,
May 3, 2018, 11:04:40 AM5/3/18
to Felipe Torquato, connectivity-modeling-system-club

Ah I see. So there should be no problem, if you are using the script correctly. Run the script up to the line S = load(filepath); What does S come out as?

Sally


Dr Sally Wood  
School of Earth Sciences, University of Bristol
Wills Memorial Building, Queens Road, BRISTOL BS8 1RJ
+44 (0)117 954 5429 | w: salwood.weebly.com | t: @SalWood82
----------------------------------------------------------------
Note: My working days are Tuesday to Thursday
----------------------------------------------------------------

From: connectivity-mod...@googlegroups.com <connectivity-mod...@googlegroups.com> on behalf of Felipe Torquato <torqua...@gmail.com>
Sent: 03 May 2018 15:44:59
To: connectivity-modeling-system-club
Subject: Connectivity Modeling System (CMS) User's discussion Re: Interpreting results from CMS
 
--
You received this message because you are subscribed to the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-...@googlegroups.com.
To post to this group, send email to connectivity-mod...@googlegroups.com.

Majambo Gamoyo

unread,
Jul 22, 2018, 11:04:12 AM7/22/18
to connectivity-modeling-system-club
Hi Felipe,

Hope you are doing ok.
Was wondering if you managed to use Sally's script.
I am getting the same error. "Undefined function 'fieldnames' for input arguments of type 'double'!!

Any idea on how to go about this will be appreciated

Thanks

Majambo Gamoyo

unread,
Jul 22, 2018, 11:09:09 AM7/22/18
to connectivity-modeling-system-club
Hi Sally,

So when I rain the script up to the line S = load(filepath), S come out as 6688x10 double matrix. But I run the next line f = fieldnames(S), I get the error "Undefined function 'fieldnames' for input arguments of type 'double'!!

Any idea??

Thanks

On Thursday, 3 May 2018 18:04:40 UTC+3, sally.wood wrote:

Ah I see. So there should be no problem, if you are using the script correctly. Run the script up to the line S = load(filepath); What does S come out as?

Sally


Dr Sally Wood  
School of Earth Sciences, University of Bristol
Wills Memorial Building, Queens Road, BRISTOL BS8 1RJ
+44 (0)117 954 5429 | w: salwood.weebly.com | t: @SalWood82
----------------------------------------------------------------
Note: My working days are Tuesday to Thursday
----------------------------------------------------------------

To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-system-club+unsubscribe@googlegroups.com.
To post to this group, send email to connectivity-modeling-system-cl...@googlegroups.com.

salwood82

unread,
Aug 9, 2018, 7:36:12 AM8/9/18
to connectivity-modeling-system-club
Ah I see the problem, sorry...

you are running the script on the raw connectivity output (con_file_1) from CMS. Instead, this script uses a connectivity matrix - which made from the raw CMS output using the file make_mtx.m provided in the CMS package (see https://github.com/beatrixparis/connectivity-modeling-system/tree/master/cms-master/postproc).

S = load(filepath) should give you a 1x1 structure array, whereas you are getting a numerical matrix. You need to specify the link to the connectivity matrix in the first input line: 

filepath='path-to-file\name-of-file.mat';

Hope that helps,
Sally
Reply all
Reply to author
Forward
0 new messages