def __init__(self, datapath=None): super(_Data, self).__init__() # default to the files in this directory if datapath is None: datapath = os.path.split(__file__)[0] d = {} self.__dict__ = d # find all data files in `datapath` data_files = [f for f in os.listdir(datapath) if f.endswith('.dat')] for data_file in data_files: full_path = os.path.join(datapath, data_file) # pick the correct io reader if data_file.endswith('normalized_spot.dat'): data = read_normalized_file(full_path) elif data_file.endswith('QandPhiandI.dat'): data = read_spot_summary_file(full_path) self.__dict__[os.path.splitext(data_file)[0]] = data
def test_normalized_spot_io(): path = os.path.join(os.path.split(io.__file__)[0], 'data', 'spots90FQ2_normalized_spot.txt') spots = io.read_normalized_file(path) assert len(spots) > 0