Mercurial > hg > audio-features-catalogue
annotate fca/writeFCA.py @ 18:d5012016bf64 tip
added rdfpy and rdfonto directories
author | nothing@tehis.net |
---|---|
date | Tue, 23 Apr 2013 11:49:20 +0100 |
parents | 62d2c72e4223 |
children |
rev | line source |
---|---|
nothing@0 | 1 def writeCTX( path, matrix, cols, rows ): |
nothing@0 | 2 ctx = "B\n\n" + len(rows) + "\n" + len(cols) + "\n\n" |
nothing@0 | 3 |
nothing@0 | 4 for it in columns: |
nothing@0 | 5 ctx += it + "\n" |
nothing@0 | 6 |
nothing@0 | 7 for it in columns: |
nothing@0 | 8 ctx += it + "\n" |
nothing@0 | 9 |
nothing@0 | 10 ctx += "\n" |
nothing@0 | 11 |
nothing@0 | 12 for i in range(len(rows)): |
nothing@0 | 13 for j in range(len(columns)): |
nothing@0 | 14 if matrix[i][j] == 1: |
nothing@0 | 15 ctx += "X" |
nothing@0 | 16 else: |
nothing@0 | 17 html += "." |
nothing@0 | 18 html += "\n" |
nothing@0 | 19 |
nothing@0 | 20 if path != '': |
nothing@0 | 21 file = open(path, 'w') |
nothing@0 | 22 file.write(ctx) |
nothing@0 | 23 file.close() |
nothing@0 | 24 |
nothing@0 | 25 return ctx |