Skip to main content

Hello again,





today I have a question about the NSDD operand, Pix#-10.


According to the documentation this should calculate x² which should be the 2nd order moment of the intensity distribution on the detector.



May I ask if the x-coordinate of the centroid is considered for the calculation of this parameter?


I also would like to know, if Pix#-10 provides the variance (which is from my point of view the 2nd order moment) or the standard deviation (which is from my understanding Sqrt(Var)).


It looks like Optic studio calculates the standard deviation instead of the variance.


And is variance / standard deviation calculated by integrating over the whole detector area (2-dimensional integral)?



Unfortunately I cannot find any formulas about this in the Optic Studio documentation.


Thus I would be very lucky if you can help bringing some light into the darkness…





Thanks for your help and best regards



Dirk  

Hi Dirk,



At Zemax Support, we love to bring light into the darkness. With that in mind, it would help if you could clarify some of your questions. For the first question, I think the answer has to be yes, the x-coordinate is considered because Pix -10 (and others) are specifically calculated with respect to the centroid, which is an X,Y coordinate. I feel like this seems trivial, so if I am misreading it please let me know.



My understanding is also that variance and 2nd order are describing the same thing, and that the square root is the standard deviation. You should be getting back x^2 from Pix -10. Can you tell us what you are seeing that leads you to observe that the SD might be the output? If you have a system set up that you don't wish to share with the world, you can always make a portal case with us so that only Customer Support at Zemax will see it.



The integration one is tricky to answer. It is performing a numerical integral, but is doing so using data in the pixels, not in the rays. Analysis done on detector data is done pixel-by-pixel, so it is summing the appropriate values for each pixel over the whole detector, and in this sense is an integral over the detector area. But it is pixelated. The value at each pixel is constant over the entire pixel area, and there is no attempt to interpolate smoothly or anything like that. So I think your answer is yes, it is integrated over the whole detector as well as the numerical resolution allows.



If you'd like to clarify or re-state any of your questions or share further information with us, please don't hesitate.



Best,



Kevin


Hi Kevin,



thanks for your answer.



I made the following comparison: NSDD Pix#-10 calculation of a spatial intensity profile. Result: 0.311.


Then I made 2d Data export and imported the data in octave (= Matlab clone). 


Then I made numerical calculation of total power, x_centroid and x_var:



%Import 2d data from text file


%------------------------------------


Data = dlmread ('C:\Users\broemmed\Desktop\Intensitaetsprofile_2d\z53mm_dickeLinse.txt');


[ny,nx]=size(Data);





%Detector: 4mm x 4mm, 800 px x 800 px


%Merit Function Result NSDD Pix# -10: 0.311



Data_1=Data(2:ny,2:nx);


ywerte=linspace(-2,2,800); %mm


xwerte=linspace(-2,2,800); %mm



%x² Variance calculation, numerical, 2d


%--------------------------------------------------


%Scaling because [i] = W/cm² and [xwerte] = [ywerte] = mm


Data_1=Data_1/100;



%Calculation of total power


%Integration along x


p=ones(1,800);


for i=1:800


  p(1,i)=trapz(xwerte,Data_1(i,:));


end



%Integration along y


Pges=trapz(ywerte,p(1,:)) %W



%Calculation of centroid coordinate xs


%Integration along x


q=ones(1,800);


for i=1:800


  q(1,i)=trapz(xwerte,Data_1(i,:).*xwerte);


end



%Integration along y


xs=trapz(ywerte,q(1,:))  %mm



%Calculation of x2 Variance


%Integration along x


m=ones(1,800);


for i=1:800


  m(1,i)=trapz(xwerte,Data_1(i,:).*(xwerte-xs).^2);


end



%Integration along y


x2=trapz(ywerte,m(1,:))  %mm²



Numerical result for total power is the same like Zemax calculated. 


x2 result is 0,097288 which differs a lot from Zemax NSDD value (0.311).



When I take the square root of 0.097288 I get 0.31191.


So for me it looks like NSDD does not calculate the variance but the standard deviation


and that the Zemax documentation is not accurate here.



Can you check if NSDD Pix# -10really provides x-Variance?


And I would also be very interested in what Zemax exactly calculates for Pix# -9. Maybe you can provide a formula...





Thanks in advance and best regards



Dirk



 


Hi Dirk,



Mea Culpa, I read too quickly and too carelessly on that question. RMS is, of course, the ROOT of the mean of the sum of squares. Now, after looking up the definitions properly, the second moment is the variance, but the square root, which is the RMS value, is the standard deviation. So your calculations are correct. The help page line that identifies the terms as the RMS of the various factors is correct, but the line that they are the second moments appears to be off. The RMS for radius should be defined the same as for any other value, by summing the weighted squares (with an offset if needed) of the radius for each point and then taking the square root.



Kevin


Hi Kevin,



okay, thanks a lot. I think the NSDD despriction in the pdf manual is misleading because of the wording 'These are the second moments' on page 1554. Actually the values NSDD Pix#-9...-13 provide the standard deviation (=RMS value), which is the square root of the second moments.





Best regards and have a happy weekend



Dirk


Hi Dirk



Thank you for your reply. Following your conversation with Kevin, I will submit a change to our help file for clarification.



Thank you! Happy weekend to you too!



Sandrine


Reply