This file is indexed.

/usr/share/gnudatalanguage/astrolib/histogauss.pro is in gdl-astrolib 2018.02.16+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
PRO HISTOGAUSS,SAMPLE,A,XX,YY,GX,GY,NOPLOT=noplot,NOFIT=SIMPL, $
               CHARSIZE=CSIZE, FONT=font, _EXTRA = _extra,Window=window
;
;+
;NAME:
;       HISTOGAUSS
;
; PURPOSE:
;       Histograms data and overlays it with a Gaussian. Draws the mean, sigma,
;       and number of points on the plot.
;
; CALLING SEQUENCE:
;       HISTOGAUSS, Sample, A, [XX, YY, GX, GY, /NOPLOT, /NOFIT, FONT=, 
;                               CHARSIZE = ]
;
; INPUT:
;       SAMPLE = Vector to be histogrammed
;
; OUTPUT ARGUMENTS:
;       A = coefficients of the Gaussian fit: Height, mean, sigma
;               A[0]= the height of the Gaussian
;               A[1]= the mean
;               A[2]= the standard deviation
;               A[3]= the half-width of the 95% conf. interval of the standard
;                     mean
;               A[4]= 1/(N-1)*total( (y-mean)/sigma)^2 ) = a measure of 
;                       normality
;
;       Below: superceded. The formula is not entirely reliable.
;       A[4]= measure of the normality of the distribution. =1.0, perfectly
;       normal. If no more than a few hundred points are input, there are
;       formulae for the 90 and 95% confidence intervals of this quantity:
;       M=ALOG10(N-1) ; N = number of points
;       T90=ABS(.6376-1.1535*M+.1266*M^2)  ; = 90% confidence interval
;       IF N LT 50 THEN T95=ABS(-1.9065-2.5465*M+.5652*M^2) $
;                  ELSE T95=ABS( 0.7824-1.1021*M+.1021*M^2)   ;95% conf.
;       (From Martinez, J. and Iglewicz, I., 1981, Biometrika, 68, 331-333.)
;
;       XX = the X coordinates of the histogram bins (CENTER)
;       YY = the Y coordinates of the histogram bins
;       GX = the X coordinates of the Gaussian fit
;       GY = the Y coordinates of the Gaussian fit
;
; OPTIONAL INPUT KEYWORDS:
;       /NOPLOT - If set, nothing is drawn
;       /FITIT   If set, a Gaussian is actually fitted to the distribution.
;               By default, a Gaussian with the same mean and sigma is drawn; 
;               the height is the only free parameter.
;       CHARSIZE Size of the characters in the annotation. Default = 0.82.
;       FONT - scalar font graphics keyword (-1,0 or 1) for text
;       /WINDOW - set to plot to a resizeable graphics window
;       _EXTRA - Any value keywords to the cgPLOT command (e.g. XTITLE) may also
;               be passed to HISTOGAUSS
; SUBROUTINE CALLS:
;       BIWEIGHT_MEAN, which determines the mean and std. dev.
;       AUTOHIST, which draws the histogram
;       GAUSSFIT() (IDL Library) which does just that
;
; REVISION HISTORY:
;       Written, H. Freudenreich, STX, 12/89
;       More quantities returned in A, 2/94, HF
;       Added NOPLOT keyword and print if Gaussian, 3/94
;       Stopped printing confidence limits on normality 3/31/94 HF
;       Added CHARSIZE keyword, changed annotation format, 8/94 HF
;       Simplified calculation of Gaussian height, 5/95 HF
;       Convert to V5.0, use T_CVF instead of STUDENT_T, GAUSSFIT instead of
;           FITAGAUSS  W. Landsman April 2002 
;       Correct call to T_CVF for calculation of A[3], 95% confidence interval
;                P. Broos/W. Landsman   July 2003
;       Allow FONT keyword to be passed.  T. Robishaw Apr. 2006
;       Use Coyote Graphics for plotting W.L. Mar 2011
;       Better formatting of text output W.L. May 2012
;-

 On_error,2
 compile_opt idl2

 if N_params() LT 2 then begin
    print,'Syntax - HISTOGAUSS, Sample, A, [XX, YY, GX, GY,  '
    print,'                   /NOPLOT, /NOFIT, CHARSIZE=, Plotting keywords...]'
    return
 endif

 if (N_elements(FONT) eq 0) then font = !p.font
 DATA = SAMPLE
 N = N_ELEMENTS(DATA)

; First make sure that not everything is in the same bin. If most
; data = 0, reject zeroes. If they = some other value, complain and
; give up.
 A = 0.
 DATA = DATA[SORT(DATA)]  
 N3 = 0.75*N & N1 = 0.25*N
IF DATA[N3] EQ DATA[N1] THEN BEGIN
   IF DATA[N/2] EQ 0. THEN BEGIN
      Q = WHERE(DATA NE 0.,NON0)
      IF (N-NON0) GT 15 THEN BEGIN
         message,/INF,'Suppressing Zeroes!'
         DATA=DATA[Q]
         N=NON0
      ENDIF ELSE BEGIN 
         message,' Too Few Non-0 Values!',/CON
         RETURN
      ENDELSE
      Q=0
   ENDIF ELSE BEGIN
      message,/CON,' Too Many Identical Values: ' + strtrim(DATA[N/2],2)
      RETURN
   ENDELSE
ENDIF

A = FLTARR(5) 

; The "mean":
A[1] = BIWEIGHT_MEAN(DATA,S)
; The "standard deviation":
A[2] = S  
; The 95% confidence interval:
M=.7*(N-1)  ;appropriate for a biweighted mean
CL = 0.95
two_tail_area = 1 - CL
A[3]=ABS( T_CVF(1 - (two_tail_area)/2.0,M) )*S/sqrt(n)

; A measure of the Gaussianness:
A[4]=TOTAL((DATA-A[1])^2)/((N-1)*A[2]^2)
;Q=WHERE( ABS(DATA-A(1)) LT (5.*S), COUNT )   ; "robust I" unreliable
;ROB_I=TOTAL((DATA(Q)-A(1))^2)/((COUNT-1)*A(2)^2)
;PRINT,A(4),ROB_I

; Set bounds on the data:
 U1 = A[1] - 5.*A[2]
 U2 = A[1] + 5.*A[2]
 Q = WHERE(DATA LT U1, NQ)
 IF NQ GT 0 THEN DATA[Q] = U1
 Q = WHERE(DATA GT U2, NQ)
 IF NQ GT 0 THEN DATA[Q] = U2

; Draw the histogram
 font_in = !P.FONT & !P.FONT=font
 AUTOHIST,DATA,X,Y,XX,YY,NOPLOT = noplot, _EXTRA = _extra,Window=window
 !P.FONT=font_in
 
; Check for error in AUTOHIST:

M = N_ELEMENTS(X)
MM = N_ELEMENTS(XX)
IF M LT 2 THEN BEGIN
   XX=0. & YY=0. & A=0.
   RETURN ; (AUTOHIST has already screamed)
ENDIF

; Calculate the height of the Gaussian:
Z = EXP(-.5*(X-A[1])^2/A[2]^2 )
XQ1 = A[1] - 1.3*A[2]
XQ2 = A[1] + 1.3*A[2]
QQ = WHERE((X GT XQ1) AND (X LT XQ2),COUNT)
IF COUNT GT 0 THEN HYTE = MEDIAN(Y[QQ]/Z[QQ],/EVEN) ELSE BEGIN
   print,'HISTOGAUSS: Distribution too Weird!'
   HYTE = MAX(SMOOTH(Y,5))
ENDELSE
A[0]=HYTE

; Fit a Gaussian, unless the /NOFIT qualifier is present
IF ~KEYWORD_SET(SIMPL) THEN BEGIN
   PARM=A[0:2]
   YFIT = GAUSSFIT(XX,YY,PARM,NTERMS=3)
   A[0:2]=PARM
ENDIF

; It the /NOPLOT qualifier is present, we're done.
IF KEYWORD_SET(NOPLOT) THEN RETURN

; Overplot the Gaussian, 
 DU = (U2-U1)/199.
 GX = U1 + FINDGEN(200)*DU

 Z = (GX-A[1])/A[2]
 GY = A[0]*EXP(-Z^2/2. )
 cgplot,/over,GX,GY,window=window

; Annotate. 
MEANST = STRING(A[1],'(G12.5)')
SIGST = STRING(A[2],'(G12.5)')
NUM = N_ELEMENTS(DATA)
NUMST =STRING(N,'(I6)')

IF KEYWORD_SET(CSIZE) THEN ANNOT=CSIZE ELSE ANNOT=.82
 if FONT EQ 0 then LABL = '#, !Mm!X, !Ms!X=' else  LABL='#, !7l!6, !7r!3='
 LABL = LABL +numst+','+meanst+','+sigst 
X1 = !x.crange[0] + annot*(!x.crange[1]-!x.crange[0])/20./0.82 
y1 = !y.crange[1] - annot*(!y.crange[1]-!y.crange[0])/23./0.82 
cgtext, X1, Y1, LABL, CHARSIZE=ANNOT, FONT=font,window=window

RETURN
END