Author |
Topic |
|
RenoudLCAR
3 Posts |
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.
|
|
AmandaLu
439 Posts |
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
|
|
|
Hideo Fujii
USA
1582 Posts |
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 |
|
|
|
Topic |
|
|
|