def test_correct_pairing(self): left = self.tmp.write(self.dir + 'P01_E2_left.txt', b'') right = self.tmp.write(self.dir + 'P01_E2_right.txt', b'') crawler = Crawler() crawler.crawl(self.dir) crawler.pair() self.assertEquals(crawler.pairedFiles[0][0].filename, 'P01_E2_left.txt') self.assertEquals(crawler.pairedFiles[0][1].filename, 'P01_E2_right.txt')
def dummyFile(self, filename, expected): f = self.tmp.write(filename, b'EOF') crawler = Crawler() ref = Sourcefile._make( ['', '', expected[0], expected[1], expected[2]]) res = crawler._parseFileName(f) self.assertEquals(ref[2], res[2]) self.assertEquals(ref[3], res[3]) self.assertEquals(ref[4], res[4])
def test_one_partner_missing_pairing(self): left = self.tmp.write(self.dir + 'P01_E2_left.txt', b'') crawler = Crawler() crawler.crawl(self.dir) try: crawler.pair() except ValueError: pass self.assertEquals(crawler.pairedFiles[0][0].filename, crawler.pairedFiles[0][1].filename)
from sedater.filesystem import Crawler from sedater.rawvalidation import RawConverter from sedater.txtvalidation import TxtConverter from sedater.export import CSVExporter from sedater.export import XMLExporter from sedater.lib.shared import UninitializedSensor from sedater.lib.shared import Orientation if __name__ == "__main__": cli = CLIParser() if not cli.parseForSedater(sys.argv[1:]): sys.exit(2) importer = Crawler() for source in cli.args.inputSource: # Data Export preparations if cli.args.output_dir: outputDir = cli.args.output_dir + '/' else: outputDir = os.path.dirname(source) + '/' # Data Import importer.crawl(source) # All input sources are crawled # now pair all files together importer.pair() # Raw Data Conversion and Normalization