comparison Marea/marea.py @ 61:69dfed656e0b draft

Uploaded
author bimib
date Sun, 15 Mar 2020 12:26:26 -0400
parents 68375ead0ee4
children 53b4fca5bdf9
comparison
equal deleted inserted replaced
60:ecc24ecafa11 61:69dfed656e0b
634 sys.exit('Execution aborted: classes provided for comparisons are ' + 634 sys.exit('Execution aborted: classes provided for comparisons are ' +
635 'less than two\n') 635 'less than two\n')
636 636
637 if comparison == "manyvsmany": 637 if comparison == "manyvsmany":
638 for i, j in it.combinations(class_pat.keys(), 2): 638 for i, j in it.combinations(class_pat.keys(), 2):
639
640 tmp = {} 639 tmp = {}
641 count = 0 640 count = 0
642 max_F_C = 0 641 max_F_C = 0
643 for l1, l2 in zip(class_pat.get(i), class_pat.get(j)): 642 for l1, l2 in zip(class_pat.get(i), class_pat.get(j)):
644 try: 643 try:
670 if create_pdf: 669 if create_pdf:
671 file_pdf = 'result/' + i + '_vs_' + j + ' (PDF Map).pdf' 670 file_pdf = 'result/' + i + '_vs_' + j + ' (PDF Map).pdf'
672 renderPDF.drawToFile(svg2rlg(file_svg), file_pdf) 671 renderPDF.drawToFile(svg2rlg(file_svg), file_pdf)
673 672
674 if not create_svg: 673 if not create_svg:
675 #Ho utilizzato il file svg per generare il pdf,
676 #ma l'utente non ne ha richiesto il ritorno, quindi
677 #lo elimino
678
679 os.remove('result/' + i + '_vs_' + j + ' (SVG Map).svg') 674 os.remove('result/' + i + '_vs_' + j + ' (SVG Map).svg')
680 elif comparison == "onevsrest": 675 elif comparison == "onevsrest":
681 for single_cluster in class_pat.keys(): 676 for single_cluster in class_pat.keys():
682 t = [] 677 t = []
683 for k in class_pat.keys(): 678 for k in class_pat.keys():
724 if not create_svg: 719 if not create_svg:
725 os.remove('result/' + single_cluster + '_vs_ rest (SVG Map).svg') 720 os.remove('result/' + single_cluster + '_vs_ rest (SVG Map).svg')
726 721
727 elif comparison == "onevsmany": 722 elif comparison == "onevsmany":
728 for i, j in it.combinations(class_pat.keys(), 2): 723 for i, j in it.combinations(class_pat.keys(), 2):
724 if i != control and j != control:
725 continue
726 if i == control and j == control:
727 continue
729 tmp = {} 728 tmp = {}
730 count = 0 729 count = 0
731 max_F_C = 0 730 max_F_C = 0
732 for l1, l2 in zip(class_pat.get(i), class_pat.get(j)): 731 for l1, l2 in zip(class_pat.get(i), class_pat.get(j)):
733 try: 732 try:
759 if create_pdf: 758 if create_pdf:
760 file_pdf = 'result/' + i + '_vs_' + j + ' (PDF Map).pdf' 759 file_pdf = 'result/' + i + '_vs_' + j + ' (PDF Map).pdf'
761 renderPDF.drawToFile(svg2rlg(file_svg), file_pdf) 760 renderPDF.drawToFile(svg2rlg(file_svg), file_pdf)
762 761
763 if not create_svg: 762 if not create_svg:
764 #Ho utilizzato il file svg per generare il pdf,
765 #ma l'utente non ne ha richiesto il ritorno, quindi
766 #lo elimino
767
768 os.remove('result/' + i + '_vs_' + j + ' (SVG Map).svg') 763 os.remove('result/' + i + '_vs_' + j + ' (SVG Map).svg')
769 764
770 765
771 766
772 767