Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- class Parser():
- """ Base class for parsers specific to a table format. Explicitly defines methods and attributes the
- subclasses must implement """
- def __init__(self):
- self.defines = {}
- self.labels = []
- self.header = ''
- self.matrix = None
- class ArchicadParser(Parser):
- """ Class that parses the archicad table with areas by story for each unit """
- def __init__(self, table_fp):
- clean = lambda name : name.replace(' ', '_').lower()
- with open(table_fp, 'r') as f:
- self.texble = [line[:-2].split('\t') for line in f.readlines()]
- self.header = self.texble[0]
- self.body = self.texble[1:]
- self.header = [clean(name) for name in self.header]
- self.matrix = np.array(self.body)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement