-
Notifications
You must be signed in to change notification settings - Fork 0
/
detect.py
35 lines (25 loc) · 973 Bytes
/
detect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import numpy as np
import data
import optparse
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
program = "detect.py"
version = "0.1"
usage = "Usage: %prog [OPTION]... [REST]"
description = "Instrument detection using scikit-learn"
parser = optparse.OptionParser(usage=usage, version=version, description=description, prog=program)
parser.add_option("-d", "--directory", dest="directory", action="store",
help="download data to this directory" )
(options, args) = parser.parse_args()
if not options.directory:
print "set -d <directory> to save data to"
sys.exit(1)
logger.info('loading dataset from directory: %s' % options.directory)
DIRECTORY = options.directory
dataset = data.load_dataset(DIRECTORY)
target_names = [item['target'] for item in dataset]
unique_tarets = np.unique(target_names)
logger.info('%d targets found: %s' % (len(unique_tarets), unique_tarets))