def __init__(self, match_conf, dir_path): self.series1 = [] for s1 in match_conf.series1.series: fn1 = os.path.join(dir_path, s1.name + '.new') if os.path.isfile(fn1): self.series1.append( Series.read(fn1, name=s1.name + '-tuned', col1=1, col2=2)) match_file = os.path.join(dir_path, match_conf.matchfile) if os.path.isfile(match_file): self.match = Series.read(match_file, name=os.path.basename(dir_path) + '-rel', col1=1, col2=3)
def read_data(self, role, parameter, filename, base_dir=None): """Read a data series. Read a data series (record or target curve) into Scoter. Args: role: 0 for record, 1 for target parameter: 0 for d18O, 1 for RPI filename: path to data file If a filename of "" is supplied, read_data will ignore it and return with no error. base_dir: base directory used to resolve filename if it is a relative path """ assert (0 <= role <= 1) assert (0 <= parameter <= 1) param_name = ("d18o", "rpi")[parameter] if os.path.isabs(filename): full_path = filename else: if base_dir is None: return full_path = os.path.join(base_dir, filename) if full_path != "" and os.path.isfile(full_path): logger.debug("Reading file: %d %d %s" % (role, parameter, full_path)) self.filenames[role][parameter] = full_path self.series[role][parameter] = Series.read(full_path, parameter=param_name)