how can I use this grammar ?

Moderators: cyao, michael_borland

michael_borland
Posts: 2008
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how can I use this grammar ?

Post by michael_borland » 30 Apr 2012, 08:54

Joytop wrote:Dear Michael,

I almost cannot beleive there is no way to know the variable(mm/pixel) of the PNG file produced by elegant because when the elegant use sddsplot to plot a x-y image, elegant should know how many pixels will be used inside the axis of coordinates. I did not meant that I should know pixel/mm only by the picture itself. Anyway , I just want to know the mm/pixel or pixel/mm that have been determined by elegant when the picture was produced by sddsplot. So, I have also tried the sddsplot to set the number of grids of the region inside the axis of coordinates which only include the particles. But I am still failed. Please help me to reach the goal, which I have tooken more than 15 days to resolve the problem and I really have no ideas about this! Please help me! Please!

Regards!
Joy
elegant only provides a data file that is then plotted by sddsplot. sddsplot produces PNGs, EPS, and various other formats. For some of these, like EPS, the concept of pixel/mm doesn't even exist because they are vector formats. Others, like PNG, are general purpose graphics formats that do no include the ability to encode pixels/mm. (For example, if you took a picture of a cat and stored that in PNG, would you expect to be able to determine pixels/mm from the PNG?)

It is hard for me to understand exactly why you want to do this. What are you trying to accomplish using the PNG files and why not just use the *data* produced by elegant to perform the necessary computations?

--Michael

michael_borland
Posts: 2008
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how can I use this grammar ?

Post by michael_borland » 30 Apr 2012, 08:56

Joytop wrote:Dear Michael,

Elegant caculates he variables "s1 (units=m, description="sqrt(<x*x>)", )" in output file(*.sig) . During the process, Now I want to caculate "s1" from the image "x-y" produced by sddsplot, so I should know the pixel/mm of the image, am I rignt ?
I think it is sure. So one way is to set pixel/mm when I use sddsplot, can I ? and how ? I shave done lot of tries as manual but I am still fail.

Regards!
Joy
If you want to do that calculation, use the output of sddshist2d, which includes the mm/bin information in the *Interval parameters. Using an image display format like PNG is the wrong approach.

--Michael

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 30 Apr 2012, 10:52

Dear Michael,

Your are so patient! Many thanks!

When you give me the example, I have tried the sddshist2d. But I found I should set the xparam and yparam, which is to say, I give the number of bins and the size by myself (the example you showed me : -xparam=100,-0.01,0.01 -yparam=100,-0.01,0.01 ). Therefore the interval of a bin is determined by myself. However, when Elegant caculate the sigma matrix, Elegant should also use interval of a bin, who and where set it ? That's one of what exactly I want.

Another what I want is the density function of x-y distribution, so I supposed to get it from the PNG image since I can readin the corresponding image matrix in which the values can represent gray level between 0-255 (also can be seen as the density function) . So, now you means I can also get the denstiy function from the output from sddshist2d(the Columns) ?

Best Regards!
Joy

michael_borland
Posts: 2008
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how can I use this grammar ?

Post by michael_borland » 30 Apr 2012, 12:25

Joy,

Elegant doesn't use binning when it computes the sigma matrix. Since it has the particle coordinates, it just computes the sigma matrix elements directly. E.g.,
S11 = 1/N Sum{i=0, n-1} x^2

Yes, the density function can be obtained from sddshist2d output. The data is organized as a single column, so you'll need to pre-process it somewhat.

--Michael

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 01 May 2012, 08:16

Dear Michael,

S11 = sqrt((Sum{i=0, n-1} x^2)/N), not S11 = 1/N Sum{i=0, n-1} x^2, am I right ?

Today I have tried to pre-process the result from sddshit2d all day, but I have not figure it out ! I used two ways to finished it but no one can work effectively.

Firstly, I found there was a seem mistake in the output of sddshist2d about the xInterval and yInterval. For instance, I used :

sddshist2d xyValues.sdds -pipe=out -column=x,y -xparam=15,-0.01,0.01 -yparam=6,-0.01,0.01 \
| sddsprocess -pipe "-redefine=column,frequency,frequency 2 2 grndl * abs +" \
| tee xyValues.h2d \
| sddsbreak -pipe=in break.sdds -rowlimit=6

the results in xyValues.sdds is as following :

&description contents="sddshist2d output", &end
&parameter name=Variable1Name, type=string, &end
&parameter name=xDimension, type=long, &end
&parameter name=xInterval, units=m, type=double, &end
&parameter name=xMinimum, units=m, type=double, &end
&parameter name=Variable2Name, type=string, &end
&parameter name=yDimension, type=long, &end
&parameter name=yInterval, units=m, type=double, &end
&parameter name=yMinimum, units=m, type=double, &end
&column name=frequency, type=double, &end
&data mode=ascii, &end
! page number 1
x
15
1.428571428571429e-03
-1.000000000000000e-02
y
6
4.000000000000000e-03
-1.000000000000000e-02

How did xInterval= 1.428571428571429e-03 and yInterval= 4.000000000000000e-03 come out ? Both of them should be 0.02/15=1.3e-3/bin and 0.02/6=3.3e-3/bin

Joy

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 01 May 2012, 08:27

Dear Michael,
I used the following two methods to get the projections of a x-y distribution, like project on x axis, by -method=integrated in sddsimageprofiles.

The first way : sddshist2d——sddsimageconvert——sddsimageprofiles
The second way : sddshist2d——sddsbreak—— sddstranspose——sddscombine——sddsimageprofiles

There are both many mistakes in the processes. I am really a little tired about it so that I even don not know how to write down the mistakes ! Can you give a example to get projections like spotanalysisExample you give me last time ?

The most confused me is that : the corresponding relationship between row,column and image matrix ! I am more and more confused with it ! :cry: :cry: :cry: :cry: :cry:

Joy

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 01 May 2012, 09:26

:cry:
Last edited by Joytop on 02 Jun 2012, 19:33, edited 1 time in total.

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 01 May 2012, 09:52

:P
Last edited by Joytop on 02 Jun 2012, 19:32, edited 1 time in total.

Joytop
Posts: 36
Joined: 02 Mar 2012, 09:50

Re: how can I use this grammar ?

Post by Joytop » 02 May 2012, 03:03

Hi, dear Michael :

I am very happy to tell you that I finally make everything clear after this all morning's tries! I should use the first way(sddshist2d——sddsimageconvert——sddsimageprofiles) to get projections by sddsimageprofile(-method=integrated). But it seems still two small questions that need you help.

NO.1
The "column name = profix..." in output of sddsimageconvert can not be recognized by "-columnPrefix" in sddsimageprofiles. For instance, when I use "-profix = UUU" in sddsimageconvert, the output will automatically produce "column name = UUU-0.005 ; column name = UUU-0.003 ...." . The value after UUU is the values on y-axis , which cannot be read by sddsimageprofile except format like UUU1;UUU3...
How can I solve this problem ? I think it would be very time-cumsueing for me to change the number after UUU by hand when the number of "UUU..." is large.

NO.2
When I used "-profileType=y" in sddsimageprofiles, the output will more one row than number of bins om y-axis . For instance:
1.329648419259314e+04 1
2.574724701212067e+03 2
4.977848238095215e+03 3
2.514490379532914e+03 4
1.536373595729444e+01 5
2.988299916022121e+03 6
4.163336342344337e-17 0 ??? what's this ? The number of bins along y axis i set is 6.

Best Regards!
Joy

michael_borland
Posts: 2008
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how can I use this grammar ?

Post by michael_borland » 03 May 2012, 08:18

Joytop wrote:Dear Michael,

S11 = sqrt((Sum{i=0, n-1} x^2)/N), not S11 = 1/N Sum{i=0, n-1} x^2, am I right ?
Joy


No, that's not right. S11 = <x*x>. The equation you gave is for Sx=sqrt(S11).

Post Reply