Find2DGlitch $SSW_SMEI_UCSD/sat/idl/toolbox/find2dglitch.pro
[Previous] [Next]
 NAME:
	Find2DGlitch
 PURPOSE:
	Find 'cosmic rays' in a set of 2D frames
 CATEGORY:
 CALLING SEQUENCE:
	Result = Find2DGlitch(Frames [,sumwidth=SumWidth, /exclude, $
		    sigmathreshold=SigmaThreshold, loc=Loc])
 INPUTS:
	Frames		array[n,l,m]; type: any (float or double needed to use NaN option)
			    stack of 2D frames combined in 3D array; the last dimension counts
			    the number of frames (if it is absent then a dummy dimension of 1
			    is added).
			    Frame elements set to the value !VALUES.F_NAN or D_NAN are ignored
 OPTIONAL INPUT PARAMETERS:
	SumWidth	scalar, type integer, no default
			    defines a box of SumWidth by SumWidth pixels used by procedure FrameMoments
	SpotWidth	scalar, type integer, no default
			    defines a box of SpotWidth by SpotWidth pixels used by procedure CleanGlitchBox
	sigmathreshold	scalar, any type, default: 4.
			    see PROCEDURE
	minthreshold	scalar, any type, default: 0
			    see PROCEDURE
	/exclude	if set, then each pixel in the Frames array is tested based on statistical
			    moments calculated omitting the pixel itself
	/remove 	if set the glitches are replaced by average values calculated
			    after removal of the glitches
	/group		activates grouping of pixels that are close together.
 OUTPUTS:
	Result		scalar, type long integer
			    number of glitches found
 OPTIONAL OUTPUT PARAMETERS:
	loc=Loc 	1-dim array [*], type long integer
			    location of the glitches
			    glitch positions are identified by a one-dimensional array index
	/quiet		if set, the list of glitches found is not printed to the screen

	ngroup=ngroup
	pgroup=pgroup
	lgroup=lgroup	unmodified return arguments from a call to the GroupPixels procedure
	fgroup=fgroup	contains total # adus in each group (after subtraction of underlying average)
 INCLUDE:
	@compile_opt.pro    ; On error, return to caller
 CALLS: ***
	ArrayLocation, BadValue, CleanGlitchBox, FrameMoments, GroupPixels, InitVar
 CALLED BY:
	qGlitch_Run
 PROCEDURE:
	If there are nT frames of dimension nX by nY then Frames has dimensions nX,nY,nT

	For each of the nX*nY pixels an average and standard deviation is calculated by averaging
	all nT boxes of SumWidth^2 pixels (total of SumWidth^2*nT pixels).

	A 'cosmic ray' is defined as a pixel where the frame value is more than SigmaThreshold
	standard deviations above the average.
	If MinThreshold is set than the frame value must be at least MinThreshold above the
	average to count as a glitch. This second test can be used to avoid that lots of points
	are flagged when the standard deviation becomes real small.
 MODIFICATION HISTORY:
	OCT-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)


FishEye $SSW_SMEI_UCSD/sat/idl/toolbox/math/fisheye.pro
[Previous] [Next]
 NAME:
	FishEye
 PURPOSE:
	Converts spherical angles to coordinates for a 'fish-eye' plot
 CATEGORY:
	Math: projections
 CALLING SEQUENCE:
	FUNCTION FishEye, Pos	    , $
	    degrees	= degrees   , $
	    maxelo	= maxelo    , $
	    polar	= polar     , $
	    dabg	= dabg	    , $
	    zero_phase	= zero_phase, $
	    inverse	= inverse
 INPUTS:
	Pos		array[2,*]; type: float
			    pos[0,*]: phase angle, longitudes
			    pos[1,*]: latitude
 OPTIONAL INPUT PARAMETERS:
	/degrees	if set, all angles are in degrees (default: radians)
	maxelo=maxelo	scalar; type: float; default: !pi
			    elongation 'maxelo' is scaled to 2*sqrt(2)
	dabg=dabg	array[3]; type: float; default: [0,0,0]
			    Euler angles to be added to the rotation
			    discussed in PROCEDURE.
	zero_phase	scalar; type: float; default: none
			    Additional offset applied to phase angle
			    i.e. adds Euler triplet [zero_phase,0,0] to
			    the rotation discussed in PROCEDURE.
	/inverse	if set, the inverse transformation (from (x,y) in the
			fisheye to phase angle/lat) is done.
 OUTPUTS:
	Result		array[2,*]; type: float
			    x and y coordinates in fish-eye plot
 OPTIONAL OUTPUT PARAMETERS:
	polar=polar	array[2,*]; type: float
			    polar coordinates in fish-eye plot
 INCLUDE:
	@compile_opt.pro	    ; On error, return to caller
 CALLS: ***
	AngleRange, EulerRotate, InitVar, IsType, REVERSE, SyncDims, ToRadians
 CALLED BY:
	ColorSkybox, PlotCoronagraph, PlotEarthSkymap, PlotEloTimeMap, PlotPolarSkymap
	nagoya_plotg2d
 PROCEDURE:
 >	The input angles are usually celestial spherical coordinates,
	e.g. ecliptic longitude and latitude, or right ascension and
	declination.
 >	The fish-eye plot uses phase and polar angles relative to a
	coordinate system with the z-axis along longitude=0,latitude=0,
	and the x-axis along longitude=90, latitude=0. The transformation
	to this coordinate system takes Euler angles E=[0,90,90] degrees.
 >	The Euler angle triplet specified in keyword dabg will be
	added to E, i.e. the total rotation applied to the input
	coordinates is E+dabg.
	dabg is used to change the direction for the center of the
	fish-eye plot. E.g. if the input angles are ecliptic coordinates
	and the ecliptic coordinates of the Sun are [lng,dec], then
	dabg = [lng,-dec,0] would put the Sun in the center of the
	fish-eye (the total rotation would be [lng,90-dec,90]).
	Note that in this example the 3rd angle in dabg (set to zero)
	rotates the plot around the center of the fisheye.
 >	In the fish-eye coordinate system the following transformation is used:
	    x = polar*cos( phase )*(2*sqrt(2)/maxelo)
	    y = polar*sin( phase )*(2*sqrt(2)/maxelo)
	i.e. the maximum polar angle 'maxelo' is scaled to 2*sqrt(2)
 >	 scale -sqrt(2),sqrt(2)
	    X-axis: east (left)
	    Y-axis: north (up)
 MODIFICATION HISTORY:
	SEP-1999, Paul Hick (UCSD/CASS)
	JUL-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Added keyword /inverse


FrameMoments $SSW_SMEI_UCSD/sat/idl/toolbox/math/framemoments.pro
[Previous] [Next]
 NAME:
	FrameMoments
 PURPOSE:
	Calculate average and standard deviations sigma
 CATEGORY:
	Statistics
 CALLING SEQUENCE:
	PRO FrameMoments, Frames, Average, Sigma, sumwidth=SumWidth, exclude=Exclude, pixels=Pixels
 INPUTS:
	Frames	    3D-array, any type, but should be float to use !VALUES.F_NAN
			to indicate missing pixels.
			stack of 2D frames combined in 3D array; the last dimension counts
			the number of frames
			Frame elements set to the value !VALUES.F_NAN are ignored
 OPTIONAL INPUT PARAMETERS:
	sumWidth    scalar, type integer, default: 3. (single frame) or 1. (multiple frames)
			defines a box of sumwidth by sumwidth pixels
			(should be ODD; argument is passed to the IDL 'smooth' function).
	/exclude    if set, the statistical moment for each pixel in the Frames
			array is calculating, excluding the pixel itself
 OUTPUTS:
	Average, Sigma
		    arrays of same structure as Frames, type float
			mean, standard deviation
			If /exclude is not set all frames in the Average and Sigma
			arrays will be identical
 INCLUDE:
	@compile_opt.pro	; On error, return to caller
 CALLS: ***
	ArrayLocation, SuperArray
 CALLED BY:
	Find2DGlitch
 PROCEDURE:
	For each pixel the statistical moments are calculated by summing over
	sumwidth^2 x (# frames) pixels.
	The summing needed to calculate the statistical moments is done using
	'total' (to sum over frames) and 'smooth' (to sum over sumwidth^2 pixels in each frame)
 MODIFICATION HISTORY:
	OCT-1998, Paul Hick (UCSD/CASS; pphick@ucsd.edu)