laserjet $SMEI/user/pphick/idl/drivers/laserjet.pro
[Previous] [Next]
 NAME:
	laserjet
 CALLING SEQUENCE:
	pro laserjet
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	FILEPATH, MEAN, PlotCurve, TimeOp, TimeSet, TimeUnit, TimeXAxis, flt_read


LocalExtrema $SMEI/ucsd/sat/idl/toolbox/math/localextrema.pro
[Previous] [Next]
 NAME:
	LocalExtrema
 PURPOSE:
	Return location of local maxima and minima in an array
 CATEGORY:
	Math
 CALLING SEQUENCE:
	R = LocalExtrema(Array, [/minima, /float])
 INPUTS:
	Array	    array[*]; type: 1-dim array
			input array to be searched for extrema
 OPTIONAL INPUT PARAMETERS:
	By default the locations of an alternating sequence of
	maxima and minima are returned.

	/maxima     if /maxima is set then the locations of maxima are returned
	/minima     if /minima is set then the locations of minima are returned

	/float	    by default integer indices are returned for the location of the extrema.
		    If /float is set then the location is refined by fitting a quadratic to
		    the minimum element and its two neighbours. The extremum of the
		    quadratic is returned as a floating point number.
 OUTPUTS:
	R	    scalar or array; type: integer or float
			indices of minima or maxima
 OPTIONAL OUTPUT PARAMETERS:
	fnc=fnc     array[*]; same size as R, same type as 'Array'
			function values in locations R. If the /float keyword is set it
			returns the function values in the extremum of the quadratic fit.
	count=count scalar; type: integer
			# extrema
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	BadValue, InitVar
 CALLED BY:
	even_light_pedestal, smei_frm_hbar
 RESTRICTIONS:
 >	Only genuine maxima and minima are detected,
 >	The edges of the array are excluded, i.e. only the locations of
	'internal' extrema (with neighbour on both sides) are returned
 PROCEDURE:
	Let 'array' represent a function f(x) in points x=[0,1,.]
	Let f have an extremum in grid point j, i.e. f(j) > f(j-1) and f(j) > f(j+1)
	Define dx = x-j and g(dx) = f(j+dx)-f(j), i.e. g(0) = 0 is an extremum of g
	The quadratic for g through 0 and its two neighbours -1 and +1 is:
	    y(dx) = 0.5*dx*{ g(-1)*(dx-1)+g(+1)*(dx+1) }
	which has a maximum at
	    dx = 0.5*(g(-1)-g(1))/(g(-1)+g(1))
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS)
	FEB-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Introduced /maxima keyword to return maxima. This used to be the default.
	    The default now is to return an alternating sequence of minima and maxima.


los_weight $SMEI/user/pphick/idl/figures/los_weight.pro
[Previous] [Next]
 NAME:
	los_weight
 CALLING SEQUENCE:
	PRO los_weight, ips=ips, E=E
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	IPS_WeightFnc, IPS_params, InitVar, gridgen, twin


losgeometry $SMEI/user/pphick/idl/figures/losgeometry.pro
[Previous] [Next]
 NAME:
	losgeometry
 CALLING SEQUENCE:
	pro losgeometry, figure
 INCLUDE:
	@compile_opt.pro    ; On error, return to caller
 CALLS: ***
	BadValue, CV_COORD, CvSky, InitVar, LOADCT, PlotCurve, TimeSet, coord3to2, flip_colors
	gridgen, plot3darc, plot3dline, plot3dtext, setup3d, twin, vectorproduct


lospos $SMEI/user/pphick/idl/losprojections.pro
[Previous] [Next]
 NAME:
	lospos
 CALLING SEQUENCE:
	function lospos, c, pp, degrees=degrees
 INCLUDE:
	@compile_opt.pro
 CALLS: ***
	CARRINGTONT, CvPointOnLos, CvSky, LOSPROJECTIONS, NewcombSun, SubArray, SuperArray
	ToRadians


lsqCircleFit $SMEI/ucsd/gen/idl/toolbox/math/lsqcirclefit.pro
[Previous] [Next]
 NAME:
	lsqCircleFit
 PURPOSE:
	Least square fitting a circle to a set of points
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	FUNCTION lsqCircleFit, x, y, chisq=chisq
 INPUTS:
	x	array[n,m] or array[2,n,m]; type: any
		    m sets of n x-coordinates
		    if y is not specified than x must be of the form x[2,n,m]
		    with x[0,*,*] the x-values and x[1,*,*] the y-values.
	y	array[n,m]; type: any
		    m sets of n y-coordinates matching the x-array
 OUTPUTS:
	R	array[3] or array[3,m]; type: float or double
		    x-coordinate and y-coordinate of center, followed by the radius
 OPTIONAL OUTPUT PARAMETERS:
	chisq=chisq
		scalar or array[m]; type: float
		    residual 'chi-square' = sqrt ( sqrt( (1/N)*Sum( ((x-x0)^2+(y-y0)^2-R^2)^2 ) ) )
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	SubArray, SyncArgs
 CALLED BY:
	even_light, even_light_corrections
 PROCEDURE:
 >	If both x and y is specified than it is allowed to specify only one set of x-value
	x[n] with multiple sets of y-values y[n,m]. Each of the sets of y-values is combined
	with the set of x-values.
 >	Standard least square fit.
	Each row in the input arrays x and y is fitted to a circle. A separate center and radius
	is returned for each of the rows.
 MODIFICATION HISTORY:
	MAR-2000, Paul Hick (UCSD/CASS)
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu), added SyncArgs call.


lsqLinearFit $SMEI/ucsd/gen/idl/toolbox/math/lsqlinearfit.pro
[Previous] [Next]
 NAME:
	lsqLinearFit
 PURPOSE:
	Least-squares fit of function of N independent variables
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	FUNCTION lsqLinearFit, f,x,y,z,t,   $
	    yzero   = yzero	, $
	    unit    = unit	, $
	    torigin = torigin	, $
	    weights = weights
 INPUTS:
	f	    array[n]; type: float
			function values
			f can be a time structure (see keywords unit and torigin)
 OPTIONAL PARAMETERS:
	x	    array[n] or array[m,n]; type: float; default: findgen(n)
			array[n  ]: n 1-dimensional position vectors
			array[m,n]; n m-dimensional position vectors

			If x is the only argument specified (i.e. y,z,t
			are NOT present) then x can be a time structure
			(see keywords unit and torigin)

	y,z,t	    array[n] (same as x); type: float
			n position vectors [x,y,z,t].

	weights=weights
		    array[n] (same as x); type: float
			weights for each data points
			(usually proportional to the inverse of the variance)
	/yzero	    fits to a linear function with no leading constant
		    (i.e. it fits to a linear function that goes through
		    the origin x=y=z=t=0)
		    The intercept Result[0] is explicitly set to zero
		    in this case.

	torigin=torigin
		    array[1]; type: time structure; default: none
	unit=unit   scalar; type: integer; default: TimeUnit(/day)
			if f and/or x are time structures then the lsq fit
			is done using the specified time units relative
			to time origin 'torigin'.
			If torigin is not defined then it is defined
			internally (as the earliest time specified in f
			and x, truncated to time units of 'unit')
 OUTPUTS:
	Result	    array[m+1]; type: float
			least-square fit parameters of the linear
			function fitted to the points.
 OPTIONAL PARAMETERS:
	torigin=torigin
		    array[1]; type: time structure
			If f and/or x are time structures and torigin
			is not defined as input then the internally
			defined value is returned here.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLED BY:
	smei_star_lsqfit, stardistance
 SEE ALSO:
	circlefit, normalfit
 CALLS: ***
	InitVar, IsTime, IsType, MEAN, SuperArray, TimeGet, TimeLimits, TimeUnit
 PROCEDURE:
	For 1,2,3 and 4-dim fits the solution is evaluated directly
	from analytic expressions. For higher dimensions a matrix
	inversion is used.
 MODIFICATION HISTORY:
	FEB-2003, Paul Hick (UCSD/CASS)
	SEP-2006, Paul Hick (UCSD/CASS)
	    Added /yzero.
	DEC-2006, Paul Hick (UCSD/CASS)
	    Added keywords unit and torigin
	MAY-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added weights keyword.


lsqNormalFit $SMEI/ucsd/gen/idl/toolbox/math/lsqnormalfit.pro
[Previous] [Next]
 NAME:
	lsqNormalFit
 PURPOSE:
	Find least squares fit to a data series x,y
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	FUNCTION lsqNormalFit, xin, yin , $
	    plotx   = plotx , $
	    oplotx  = oplotx, $
	    worst   = worst , $
	    xfit    = xfit  , $
	    yfit    = yfit  , $
	    _extra  = _extra
 INPUTS:
	x,y arrays to be fitted
 OPTIONAL INPUT PARAMETERS:
	/plot	data points and fit are plotted
	/oplot	the fit is plotted using the current user scale
	/worst	will also plot the worst possible fit
 OUTPUTS:
	A   fltarr(5,2)
	    A[*,0] represents the best fit; A[*,1] represents the worst fit

	The equation for the straight line fit:
	    A[0,i]*(x-A[1,i])+A[2,i]*(y-A[3,i]) = 0

	A[1,i] is the average of the x-array
	A[3,i] is the average of the y-array

	A[4,i] is the residual average distance of the `normalized' data points to the fit.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	InitVar, POLY_FIT
 CALLED BY:
	even_light_info, qLine_FitPlot, vu_correlate, vu_insitucurve
 PROCEDURE:
	The x and y arrays are `normalized' by dividing the arrays by their
	respective standard deviations. The resulting arrays are fitted by
	minimizing the perpendicular distance to a straight line fit.
	The result is symmetric: interchanging x and y arrays will give the same fit.
 MODIFICATION HISTORY:
	JUN-1994, Paul Hick (UCSD/CASS)
	AUG-1999, Paul Hick (UCSD/CASS); added title keyword
	APR-2000, Paul Hick (UCSD/CASS); added _extra keyword
	FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu); changed the main plotting command to
	    use the input arrays directly for plotting.


lsqQuadraticFit $SMEI/ucsd/gen/idl/toolbox/math/lsqquadraticfit.pro
[Previous] [Next]
 NAME:
	lsqQuadraticFit
 PURPOSE:
	Fits points to a quadratic polynomial
 CATEGORY:
	gen/idl/toolbox/math
 CALLING SEQUENCE:
	FUNCTION lsqQuadraticFit, x, y, chisq=chisq
 INPUTS:
	x	array[n,m] or array[2,n,m]; type: any
		    m sequences of n x-coordinates
		    if m=1 then the last dimension may be absent
		    if y not specified then x must be of the form x[2,n,m] with
		    x[0,*,*] the x-values and x[1,*,*] the y-values
	y	array[n,m]; type: any
		    m sequences of n y-coordinates matching the x-array
 OUTPUTS:
	R	array[3] or array[3,m]; type: double
		    the 3 fitted constants in
			y = R[0]+R[1]*x+R[2]*x^2
 OPTIONAL OUTPUT PARAMETERS:
	chisq=chisq
		scalar, or array[m]; type: double
		    residual chisq.
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	IsType, SubArray, SyncArgs
 CALLED BY:
	even_light, even_light_corrections
 PROCEDURE:
 >	If both x and y is called then it is allowed to specify only
	one set of x-values, x[n] and multiple sets of y-values, y[n,m]
	In that case each y-series is combined with x.
 >	The same can be accomplished with the IDL function poly_fit.
	polyfit uses a matrix inversion; here we use the analytic solution.
 MODIFICATION HISTORY:
	JAN-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu)