Beispiel #1
0
def main():
    parser = OptionParser(usage="usage: %prog [options] data")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file for outputs",)

    parser.add_option("-o", "--output",
            action="store",
            dest="output",
            default="filtered.csv",
            help="Output file of outputs",)

    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.error("wrong number of arguments")

    try:
        with open(options.config, 'r') as configFile:
            config = yaml.load(configFile)
    except IOError:
        sys.exit("Unable to find configuration file " + options.config)

    data = gyrodata.readMetadata(args[0])
    metadata = extractMetadata(data, config)
    output = [extractOutput(entry, metadata, config) for entry in data]
    gyrodata.writeCsvData(output, options.output)
Beispiel #2
0
def main():
    parser = OptionParser(usage="usage: %prog [options] data")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file for features",)

    parser.add_option("-o", "--output",
            action="store",
            dest="output",
            default="filtered.csv",
            help="Output file of features",)

    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.error("wrong number of arguments")

    config = GyroConfig.load(options.config)

    data = gyrodata.readMetadata(args[0])
    features = [extractFeatures(entry, config) for entry in data]
    gyrodata.writeCsvData(features, options.output)
Beispiel #3
0
def getMetadata():
    if metadataPath is None:
        return None
    global cachedData
    if not cachedData:
        data = gyrodata.readMetadata(metadataPath)
        cachedData = dict(zip([e['id'] for e in data], data))
    return cachedData
Beispiel #4
0
def main():
    metapath = "../data/gyroscoper.csv"
    meta = gyrodata.readMetadata(metapath)

    plt.ion()

    filteredMeta = meta
    # filteredMeta = [entry for entry in meta if 'walk' in entry['activityFolder'] and 'waist' in entry['position'] and entry['gyrofile']]
    for entry in filteredMeta:
        plt.close()
        plt.clf()
        plotEntry(entry)
        plt.show()
        text = raw_input("Press enter for next one...")
        if text == "q":
            break

    while True:
        plt.close()
        entry = promptForEntry(meta)
        plt.clf()
        plotEntry(entry)
        plt.show()
Beispiel #5
0
def main():
    parser = OptionParser(usage="usage: %prog [options] source")

    parser.add_option("-c", "--config-file",
            action="store",
            dest="config",
            default="gold.yml",
            help="Configuration file for filter",)

    parser.add_option("-o", "--output",
            action="store",
            dest="output",
            default="filtered.csv",
            help="Output file",)

    (options, args) = parser.parse_args()

    if len(args) != 1:
        parser.error("wrong number of arguments")

    try:
        with open(options.config, 'r') as configFile:
            config = yaml.load(configFile)
    except IOError:
        sys.exit("Unable to find configuration file " + options.config)

    data = gyrodata.readMetadata(args[0])

    filteredData = [entry for entry in data if isValidEntry(entry, config)]

    # filter by person
    if config['data-filters']['unique']:
        filteredData = [group.next() for key, group in groupby(filteredData, key=itemgetter('person'))]

    print("Loaded %d entries!" % (len(filteredData)))

    gyrodata.writeMetadata(filteredData, options.output)