sipp11
11 years ago
2 changed files with 58 additions and 1 deletions
@ -0,0 +1,57 @@
|
||||
# -*- coding:utf-8 -*- |
||||
#!/usr/bin/env python |
||||
from __future__ import print_function |
||||
from base import Lo, create_csv |
||||
import os |
||||
import csv |
||||
import sys |
||||
|
||||
los = Lo() |
||||
|
||||
xmodels = { |
||||
'IMSf': {}, 'IMSD': {}, 'IMHf': {}, 'IMHD': {}, 'IFSf': {}, 'IFSD': {}, |
||||
'IFHf': {}, 'IFHD': {}, 'CMSf': {}, 'CMSD': {}, 'CMHf': {}, 'CMHD': {}, |
||||
'CFSf': {}, 'CFSD': {}, 'CFHf': {}, 'CFHD': {}, 'PMSf': {}, 'PMSD': {}, |
||||
'PMHf': {}, 'PMHD': {}, 'PFSf': {}, 'PFSD': {}, 'PFHf': {}, 'PFHD': {}, |
||||
} |
||||
fs = ('Case1_LS.csv', 'Case1_Gender.csv', 'Case1_Level.csv', 'Case1_SciF.csv') |
||||
|
||||
|
||||
def process_s2_data(): |
||||
xm_data = {} |
||||
for ii in xmodels.keys(): |
||||
fname = '%s-2.csv' % ii |
||||
fpath = os.path.join(os.getcwd(), 'build', 'part2', fname) |
||||
with open(fpath, 'rb') as f: |
||||
rows = csv.reader(f) |
||||
rank = 0 |
||||
for r in rows: |
||||
if r[1] == "rank": |
||||
rank = r[2] |
||||
continue |
||||
if ii not in xm_data: |
||||
xm_data[ii] = {} |
||||
if rank not in xm_data[ii]: |
||||
xm_data[ii][rank] = {} |
||||
xm_data[ii][rank] = r[1].split(',') |
||||
return xm_data |
||||
|
||||
|
||||
def produce_match_all(xdata): |
||||
for ii in xmodels.keys(): |
||||
los = set() |
||||
for _rank in xdata[ii]: |
||||
print(_rank) |
||||
|
||||
|
||||
def main(*argv): |
||||
xm = process_s2_data() |
||||
print(xm['CMHf'].keys()) |
||||
produce_match_all(xm) |
||||
pass |
||||
|
||||
if __name__ == '__main__': |
||||
if len(sys.argv) > 1: |
||||
main(sys.argv[1:]) |
||||
else: |
||||
main() |
Loading…
Reference in new issue