Example #1
0
parser = OptionParser()
parser.add_option('-a', '--append', dest='inxml', action='store',
                  help='existing filename (e.g. Sources.xml) to append elements to')
parser.add_option('-d', '--debug', dest='debug', action='store_true', 
                  default=False, 
                  help='debug (useful for broken .bib entries)')
parser.add_option('-i', '--input', dest='bibtexfile', type='string', 
                  help='input bibtex filename', action='store')
parser.add_option('-o', '--output', dest='xmlfile', type='string',
                  default=sys.stdout,
                  help='output filename', action='store')
(options, args) = parser.parse_args()

parser = bibtex.Parser()

try: bibdata = parser.parse_file(options.bibtexfile)
except NameError:
    prLong >> sys.stderr, 'Need an input filename. See --help'
    sys.exit(1)

if len(args) > 0:
    prLong >> sys.stderr, 'Warning: extra arguments ignored: ' % ' '.join(args)

try:
    ET.register_namespace('', "http://schemas.microsoft.com/office/word/2004/10/bibliography")
    ET.register_namespace('b', "http://schemas.microsoft.com/office/word/2004/10/bibliography")
    root = ET.parse(options.inxml).getroot()
except TypeError:
    root = ET.Element('b:Sources', {'xmlns:b': "http://schemas.microsoft.com/office/word/2004/10/bibliography"""})

for key, entry in bibdata.entries.iteritems():
Example #2
0
                if abs(col - row) > band:
                    print(" 0.0          ", file=file, end="")
                    continue
                if col < row:
                    print(" ", file=file, end="")
                    print(ll[col][row - col], file=file, end="")
                else:
                    print(" ", file=file, end="")
                    print(ll[row][col - row], file=file, end="")
                # print((row, col), file=sys.stderr)
            print("", file=file)


if __name__ == "__main__":

    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option("", "--covmat", dest="covmatFile", help="Covariance matrix output to a FILE")
    (options, args) = parser.parse_args()
    parser = gamaXMLParser()
    parser.parse_file(sys.stdin)
    if options.covmatFile is not None:
        try:
            cfile = open(options.covmatFile, "wt")
            # print("Opening file %s" % options.covmatFile)
        except Exception:
            sys.exit("Cant open file %s for writing" % options.covmatFile)
        parser.write_cov_mat(cfile)
        cfile.close()
Example #3
0
parser = OptionParser()
parser.add_option('-a', '--append', dest='inxml', action='store',
                  help='existing filename (e.g. Sources.xml) to append elements to')
parser.add_option('-d', '--debug', dest='debug', action='store_true', 
                  default=False, 
                  help='debug (useful for broken .bib entries)')
parser.add_option('-i', '--input', dest='bibtexfile', type='string', 
                  help='input bibtex filename', action='store')
parser.add_option('-o', '--output', dest='xmlfile', type='string',
                  default=sys.stdout,
                  help='output filename', action='store')
(options, args) = parser.parse_args()

parser = bibtex.Parser()

try: bibdata = parser.parse_file(options.bibtexfile)
except NameError:
    prLong >> sys.stderr, 'Need an input filename. See --help'
    sys.exit(1)

if len(args) > 0:
    prLong >> sys.stderr, 'Warning: extra arguments ignored: ' % ' '.join(args)

try:
    ET.register_namespace('', "http://schemas.microsoft.com/office/word/2004/10/bibliography")
    ET.register_namespace('b', "http://schemas.microsoft.com/office/word/2004/10/bibliography")
    root = ET.parse(options.inxml).getroot()
except TypeError:
    root = ET.Element('b:Sources', {'xmlns:b': "http://schemas.microsoft.com/office/word/2004/10/bibliography"""})

for key, entry in bibdata.entries.iteritems():
Example #4
0
                if col < row:
                    print(' ', file=file, end='')
                    print(ll[col][row - col], file=file, end='')
                else:
                    print(' ', file=file, end='')
                    print(ll[row][col - row], file=file, end='')
                #print((row, col), file=sys.stderr)
            print('', file=file)


if __name__ == "__main__":

    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option("",
                      "--covmat",
                      dest="covmatFile",
                      help="Covariance matrix output to a FILE")
    (options, args) = parser.parse_args()
    parser = gamaXMLParser()
    parser.parse_file(sys.stdin)
    if options.covmatFile is not None:
        try:
            cfile = open(options.covmatFile, 'wt')
            #print("Opening file %s" % options.covmatFile)
        except Exception:
            sys.exit('Cant open file %s for writing' % options.covmatFile)
        parser.write_cov_mat(cfile)
        cfile.close()