Beispiel #1
0
def fusion():
    options, args = createOptionParser().parse_args()

    # dispatch the positional args into their named equivalents
    try:
        if options.transform:
            if not options.inputFile:
                options.inputFile, args = args[0], args[1:]

            if not options.outputFile:
                options.outputFile, args = args[0], args[1:]

        else:  # no transform, just merge
            if not options.yamllist and not options.directory:
                path, args = args[0], args[1:]
                if isfile(path):
                    options.yamllist = path
                elif isdir(path):
                    options.directory = path
                else:
                    raise IOError('File/dir not found: %s' % path)

            if not options.outputFile:
                options.outputFile, args = args[0], args[1:]

        # if there are any remaining args, then we have a problem...
        if args:
            usage()

    except IndexError:
        usage()

    # TODO: validate parameters

    # dispatch request
    if options.transform:
        transformDataSet(options.inputFile, options.outputFile,
                         options.transfoFile)
    else:
        select, exclude = None, None
        if options.select:
            select = options.select.split(',')
        if options.exclude:
            exclude = options.exclude.split(',')

        if options.yamllist:
            mergeAll(options.yamllist, options.outputFile,
                     int(options.chunkSize), options.transfoFile, select,
                     exclude)
        elif options.directory:
            if not isdir(options.directory):
                print('ERROR: %s is not a valid directory' % options.directory)
                sys.exit(1)

            mergeDirectory(options.directory, options.outputFile,
                           int(options.chunkSize), options.transfoFile, select,
                           exclude)
        else:
            usage()
Beispiel #2
0
def fusion():
    options, args = createOptionParser().parse_args()

    # dispatch the positional args into their named equivalents
    try:
        if options.transform:
            if not options.inputFile:
                options.inputFile, args = args[0], args[1:]

            if not options.outputFile:
                options.outputFile, args = args[0], args[1:]

        else: # no transform, just merge
            if not options.yamllist and not options.directory:
                path, args = args[0], args[1:]
                if isfile(path):
                    options.yamllist = path
                elif isdir(path):
                    options.directory = path
                else:
                    raise IOError('File/dir not found: %s' % path)

            if not options.outputFile:
                options.outputFile, args = args[0], args[1:]

        # if there are any remaining args, then we have a problem...
        if args:
            usage()

    except IndexError:
        usage()

    # TODO: validate parameters

    # dispatch request
    if options.transform:
        transformDataSet(options.inputFile, options.outputFile, options.transfoFile)
    else:
        select, exclude = None, None
        if options.select:
            select = options.select.split(',')
        if options.exclude:
            exclude = options.exclude.split(',')

        if options.yamllist:
            mergeAll(options.yamllist, options.outputFile, int(options.chunkSize), options.transfoFile, select, exclude)
        elif options.directory:
            if not isdir(options.directory):
                print 'ERROR: %s is not a valid directory' % options.directory
                sys.exit(1)

            mergeDirectory(options.directory, options.outputFile, int(options.chunkSize), options.transfoFile, select, exclude)
        else:
            usage()
    def mergeDataSet(self):
        if exists(self.conf['datasetFilename']):
            log.info('Base dataset already exists!')
            return

        log.info('Merging original base dataset...')

        from gaia2.fusion import mergeAll
        mergeAll(self.conf['filelist'], self.conf['datasetFilename'], 5000, transfoFile = None)

        log.info('Original dataset successfully created!')
Beispiel #4
0
    def mergeDataSet(self):
        if exists(self.conf['datasetFilename']):
            log.info('Base dataset already exists!')
            return

        log.info('Merging original base dataset...')

        from gaia2.fusion import mergeAll
        mergeAll(self.conf['filelist'],
                 self.conf['datasetFilename'],
                 5000,
                 transfoFile=None)

        log.info('Original dataset successfully created!')
Beispiel #5
0
    def mergeDataSet(self):
        if exists(self.conf['datasetFilename']):
            log.info('Base dataset already exists!')
            return

        log.info('Merging original base dataset...')

        from gaia2.fusion import mergeAll
        # exclude tags fields as they may not be consistent among tracks
        # and they don't contain relevant information for classification
        mergeAll(self.conf['filelist'],
                 self.conf['datasetFilename'],
                 5000,
                 transfoFile=None,
                 exclude=self.conf['excludedDescriptors'],
                 failOnUnmatched=self.conf['failOnUnmatched'])

        log.info('Original dataset successfully created!')