This file is indexed.

/usr/share/expeyes/eyes-junior/induction.py is in expeyes 3.2.0-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
'''
expEYES program
Author  : Ajith Kumar B.P, bpajith@gmail.com
License : GNU GPL version 3
'''
import gettext
gettext.bindtextdomain("expeyes")
gettext.textdomain('expeyes')
_ = gettext.gettext

from Tkinter import *
import expeyes.eyesj as eyes, expeyes.eyeplot as eyeplot, expeyes.eyemath as eyemath, time, math, sys

TIMER = 100
WIDTH  = 500   # width of drawing canvas
HEIGHT = 350   # height 
VPERDIV = 1.0		# Volts per division, vertical scale
delay = 500			# Time interval between samples
NP = 400			# Number of samples
data = [ [], [] ]
history = []		# Data store
trial = 0			# trial number
data = [ [], [] ]	# Current & Voltage


def find_peaks(ta,va):   # returns the index of the peaks found
	vmin = 5.0
	vmax = -5.0
	p1 = 0		# index of the peaks
	p2 = 0
	t1 = t2 = 0
	size = len(ta)
	for i in range(size):
		if va[i] < vmin:
			vmin = va[i]
			p1 = i
		if va[i] > vmax:
			vmax = va[i]
			p2 = i
	#print p1,p2,vmin, vmax
	if p1 < p2:			# return left side peak first
		return p1,p2
	else:
		return p2,p1

def base_scan():
	global data, history, trial, NP, delay, noise
	t, v = p.capture_hr(1,NP,delay)
	g.delete_lines()
	g.line(t,v,trial)
	running = True
	data = [ [], [] ]
	p1,p2 = find_peaks(t,v)
	noise = abs(v[p1])
	msgwin.config(text = _('Voltage Scan on Coil Done. Noise Voltage = %5.3f V')%noise)
	root.after(TIMER, update)

def update():
	global data, history, trial, NP, delay, noise
	t, v= p.capture_hr(1,NP,delay)		# Scan for 5 times more
	p1,p2 = find_peaks(t,v)
	print v[p1], v[p2]
	if abs(v[p1] - noise) > 0.5 and p1 < .9*NP:  # Signal at least 0.5 volts above noise
		index = p1-50
		tbeg = t[index]
		'''
		tn = []
		vn = []
		while index < p1 + 150:
			#print index
			tn.append(t[index]-tbeg)
			vn.append(v[index])
			index += 1
		'''
		g.delete_lines()
		g.line(t,v,trial)
		data = [t,v]
		s = _('Peak voltages %5.2f and %5.3f separated by %5.3f msec') %(v[p1], v[p2], t[p2]-t[p1])
		msgwin.config(text = s)
		#print len(tn), len(vn), v[p1], v[p2]
		history.append(data)
		trial += 1
		return				
	root.after(TIMER, update)

def clear():
	global history, trial
	g.delete_lines()
	history = []
	trial = 0

def save():
	global history
	s = fn.get()
	if s == '':
		return
	p.save(history, s)
	msgwin.config(text = _('Data saved to file ')+s)

def viewall():		# Send the data to Xmgrace
	global history
	g.delete_lines()	
	i = 0
	for t,v in history:
		g.line(t,v,i)
		i += 1

p = eyes.open()
root = Tk()
Canvas(root, width = WIDTH, height = 5).pack(side=TOP)  # Some space at the top
g = eyeplot.graph(root, width=WIDTH, height=HEIGHT)	# make plot objects using draw.disp
g.setWorld(0,-5*VPERDIV, NP * delay * 0.001, 5*VPERDIV,_('mS'),_('V'))

cf = Frame(root, width = WIDTH, height = 10)
cf.pack(side=TOP,  fill = BOTH, expand = 1)
b = Button(cf,text =_('Start Scanning'), command= base_scan)
b.pack(side=LEFT, anchor = SW)

b = Button(cf,text =_('Save to'), command=save)
b.pack(side=LEFT, anchor = SW)
fn = Entry(cf,width = 10, bg = 'white')
fn.pack(side=LEFT, anchor = SW)
fn.insert(END,'ind.dat')
b = Button(cf,text =_('QUIT'), command=sys.exit)
b.pack(side=RIGHT, anchor = SW)
b = Button(cf,text =_('VIEW'), command=viewall)
b.pack(side=RIGHT, anchor = SW)
b4 = Button(cf, text = _('CLEAR'), command = clear)
b4.pack(side = RIGHT, anchor = N)

mf = Frame(root)				# Message Frame below command frame.
mf.pack(side=TOP, anchor = SW)
msgwin = Label(mf,text = _('Messages'), fg = 'blue')
msgwin.pack(side=LEFT, anchor = SW)

eyeplot.pop_image('pics/induction.png', _('Electromagnetic Induction'))
root.title(_('EYESJUN: Electromagnetic Induction'))
root.mainloop()