; docformat = 'rst' ; ; NAME: ; dataBox ; PURPOSE: ; Compute whiskers, quartiles, and median of a array of values. ; ;+ ; :Description: ; Compute whiskers, quartiles, and median of a array of values. ; ; :Categories: ; Maths, Statistics ; ; :Params: ; X: in, required, type=float ; Array (any dimension) of x values. ; ; :Returns: The Tukey's whiskers, quartiles, and median. ; ; :Examples: ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Original Version written in September 2014, B. Carry (IMCCE) ; 2016 Nov. - B. Carry (OCA) - Added hidden/idl2 compilation options ;- function dataBox, x compile_opt hidden, idl2 ;--I-- Initialization And Input Verification ----------------------------------- if not keyword_set(X) then begin message, /IoError, 'Syntax - tukey = dataBox(X)' return, -1 endif ;--II-- Type of Input ---------------------------------------------------------- xtype = size(x,/type) ex = make_array(5,type=xtype) ;--III-- Minimum, Maximum, and Median ------------------------------------------ ex[0] = min(x,/Nan) ex[2] = median(x) ex[4] = max(x,/Nan) ;--IV-- Quartiles -------------------------------------------------------------- ex[1] = median(x[ where( x ge ex[0] and x le ex[2] ) ]) ex[3] = median(x[ where( x ge ex[2] and x le ex[4] ) ]) return,ex end