The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Slope of a 2D island

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
RenoudLCAR Posted - 10/23/2018 : 11:24:13 AM
Origin Ver. and Service Release (Select Help-->About Origin):Origin Pro 2018 64 bit b950193
Operating System:Windows 10

Hi all ,

I have a correlation map, composed of x = time1, y=time2, z=number of counts for each (t1;t2) couple. This form kinds of island and I would like to determine the slope of the islands, weighed by the number of counts. Any ideas ?
You can see an exemple attached.
2   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 10/31/2018 : 11:34:51 AM
RenoudLCAR,

How about simply picking up the slope at the steepest cell around? The following snippet does such task (slope not scaled).
The sample below is input and output matrices:



///////////////////////////
if(exist(%H)!=5) {
  type -b Current window is not a Matrix;
  Return;
}
range mi=[%H]1!1;  //Input matrix
window -d;  //Duplicate matrix for output
range mo=[%H]1!1;  //Output matrix
nc=mi.ncols;  //# of cols
nr=mi.nrows;  //# of rows
for(jj=1; jj<=nc; jj++) {  //looping on columns
  for(ii=1; ii<=nr; ii++) {  //looping on rows
    if(ii==1)  cUU=0; else cUU=abs(mi[ii,jj]-mi[ii-1,jj]); //Up cell
    if(ii>=nr) cDD=0; else cDD=abs(mi[ii,jj]-mi[ii+1,jj]); //Down cell
    if(jj>=1)  cLL=0; else cLL=abs(mi[ii,jj]-mi[ii,jj-1]); //Left cell
    if(jj>=nc) cRR=0; else cRR=abs(mi[ii,jj]-mi[ii,jj+1]); //Right cell
    //////////////////////////////////////
    if(ii==1  || jj==1 ) cUL=0; else cUL=abs(mi[ii,jj]-mi[ii-1,jj-1])/sqrt(2);  //Upper left
    if(ii==1  || jj>=nc) cUR=0; else cUR=abs(mi[ii,jj]-mi[ii-1,jj+1])/sqrt(2);  //Upper right
    if(ii>=nr || jj==1 ) cDL=0; else cDL=abs(mi[ii,jj]-mi[ii+1,jj-1])/sqrt(2);  //Lower left
    if(ii>=nr || jj>=nc) cDR=0; else cDR=abs(mi[ii,jj]-mi[ii+1,jj+1])/sqrt(2);  //Lower right
    mo[ii,jj]=max(cUU,cDD,cLL,cRR,cUL,cUR,cDL,cDR); //Get steepest
  }
}
///////////////////////////

Of course, ideally the best is to measure whole angles to get the steepest. Also, you
may want to smooth the surface before applying this routine (by 3D Smoother
https://www.originlab.com/fileExchange/details.aspx?fid=415 , or by 2D Kernel Density
https://www.originlab.com/doc/Origin-Help/Create-2D-Kernel-Density).

I hope this helps you to consider how you approach the problem?

--Hideo Fujii
OriginLab
AmandaLu Posted - 10/26/2018 : 04:27:57 AM
Hi,

I’m not sure what do you mean by “the slope of the islands”. Could you please explain how to calculate the slope?

Thanks,
Amanda
OriginLab Technical Service

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000