www.gusucode.com > 图像噪声分析源码程序 > 图像噪声分析源码程序/nps_package/cross_talk_noise.m

    function nps = cross_talk_noise(P, varargin)

% nps = cross_talk_noise(P(chi, sigma2, px), f)
% 
% Returns the noise-power spectrum (NPS) for a fraction chi cross talk
% between detector pixels in a rectangular matrix. Cross talk is along
% the first dimension and the noise is uncorrelated in the perpendicular
% direction. The desired pixel variance can be specified.
%
% f is an n-dimensional cartesian array of spatial frequencies as if
% generated by meshgrid. Hence, f is constant in all directions except for
% the cross-talk direction. sigma2 specifies the pixel variance (related to
% the integral of thee NPS). The pixel size (px) is determined by the range 
% of frequencies if px is not sepcified. The output nps is in Cartesian
% coordinates and in units of sigma2.
%
% Erik Fredenberg, Royal Institute of Technology (KTH) (2010).
% Please reference this package if you find it useful.
% Feedback is welcome: fberg@kth.se.

f = varargin{1};
chi = P(1);
sigma2 = P(2);
px = P(3);

% pixel size
if isempty(px), px = 1/abs(f(end) - f(1)); end

% NPS function from:
% E. Fredenberg et al, Nucl. Instr. and Meth. A 613, 156-162 (2010).
nps = sigma2*(1 + chi*(1 + 2*cos(2*pi*px*f)))/(1 + chi)/(px^(-ndim(f)));

end

function [n] = ndim(A)

% [n] = ndim(A)
% 
% Returns the number of dimensions of 'A'.

S = size(A);
n = length(S) - (S(1)==1) - (S(end)==1);

end