EOppi student grading: Difference between revisions
From wikiluntti
(→Part 2) |
(→Part 3) |
||
Line 10: | Line 10: | ||
https://gist.github.com/markkuleino/bea1d81b41b233a8a3dbb2b6659a2222 | https://gist.github.com/markkuleino/bea1d81b41b233a8a3dbb2b6659a2222 | ||
== Part 4 == | == Part 4 == |
Revision as of 19:59, 5 March 2021
Introduction
Set the grades according to the points given to the exercises.
I encountered some problems while trying to add a long file: Internal server error. Thus, there is many parts.
Theory
Save the database as a csv file and read it. Choose the exercises and run the python script. See the script at
https://gist.github.com/markkuleino/bea1d81b41b233a8a3dbb2b6659a2222
Part 4
ka = 0
lkm = 0
print("\n\n")
print('Hei')
print('Biologian tehtäväsi tähän mennessä. Lopussa arvosana seisoo.')
print('Tarkista ainakin, että olet teet ne tehtävä mitkä olen merkinnyt arvosanalla neljä (4). Jos olet tehnyt, mutta arvosanasi on 4, kerro minulle. ')
print('Saat parannella ja lisäillä tehtäviä, jos haluat paremman numeron. Aikaa on viikon verran.')
print('- - - - - - - - - - - - - - - - - - - - -')
ave = 0
for i, tcsv in enumerate( fil ):
lkm = lkm + 1
names = []
with open( tcsv ) as csvfile:
print( kpl[i] )
print( "-"*len( kpl[i] ) )
readCSV = csv.reader(csvfile, delimiter=',')
#Read the column names
eNames = getExeNames(next(readCSV))
eNames.insert(0,'Name')
formats = ['u4']*( len( eNames ) - 1)
formats.insert(0, 'U30')
#print( eNames )
# Create the array
rr = [];
for row in readCSV:
r = getRow( row )
rr.append( tuple(r) )
points = np.array( (rr), dtype={'names': eNames, 'formats':formats})
#print( points )
#Create the grading table.
formatsGrade = ['f4']*( len( eNames ) - 1)
formatsGrade.insert(0, 'U30')
grades = np.array( (rr), dtype={'names': eNames, 'formats':formatsGrade})
#print( grades )
#print( eNames )
#print( len( eNames ) )
for n in eNames[1:]:
#print( grades[n] )
grades[n] = grades[n]/ max( max( grades[n] ), 1 )
grades[n] = np.maximum( np.round( ( 4*( 6/(1-0.1)*(grades[n]-1)+10 ))/4, 2), 4)
#print( grades )
#Get the needed columns (exercises) only
grades = leaveFields(grades, tul[i])
#print( grades.dtype.names[1:] )
#print( grades )
if 1:
names = grades['Name']
nameInd = [j for j,i in enumerate(names) if name.lower() in i.lower()]
average = 4
if nameInd:
nameInd = nameInd[0]
pp = list( grades[nameInd] )
print( pp[0] )
for ni, n in enumerate( grades.dtype.names[1:] ):
print( "Arvosana: " + str(pp[ni+1]) , end="\t" )
print(n)
average = np.round( np.average( pp[1:] ), 1)
else:
print("Et ole tehnyt yhtään tehtävää tästä luvusta! Tee vielä:")
for ni, n in enumerate( grades.dtype.names[1:] ):
print(n)
print( "-> Keskiarvo: " + str( average ) )
ave = ave + average
print("\n")
print('---------------')
print( 'Kaikkien tehtävien keskiarvo: ', np.round( ave/lkm, 1) )
print("\n\n")