def __init__(self, xlfile=EXPERIMENT_DB(), sheet='DSC', prompt=None, debug=0): # self._raw_columns = { # 'Curve', [column, 'label'] # } Experiment.__init__(self, xlfile = xlfile, sheet = sheet, prompt = prompt, delim = '\t', txt_col = 6, debug = debug) self._raw_columns = { 'time:min' : [0, 'Time (min)'], 'heat:flow' : [1, 'Heat Flow (mW)'], 'temp:set' : [3, 'Set Point Temperature ($\degree$C)'], 'temp:act' : [4, 'Temperature ($\degree$C)'], 'heat:cal' : [6, 'Heat Flow Calibration'] } self._ascii_file = self._path + os.sep + 'data' + os.sep + self.p.get('txt:file') self._baseline_file = self._path + os.sep + 'data' + os.sep + self.p.get('baseline:file') self._data_array = remove_with_blanks( io.parse_ascii(self._ascii_file , '\t')[1:] ) self._baseline_array = remove_with_blanks( io.parse_ascii(self._baseline_file, '\t')[1:] ) # if we have defined _raw_columns then add all of those curves (defined for each exp type) if hasattr(self, '_raw_columns'): self._curves = Curve(self._data_array,self._raw_columns) self._baseline = Curve(self._baseline_array,self._raw_columns) else: self._curves = Curve(self._data_array) self._baseline = Curve(self._baseline_array) if hasattr(self, '_curves'): self._curves.add('time:sec', self._curves['time:min']*60., 'Time (sec)') self._curves.add('time:hr', self._curves['time:sec']/3600., 'Time (hr)') self.subtract_baseline() self.c = self._curves self.pl = self._curves.ex_plot self.twin = self._curves.ex_twinplot self.sub = self._curves.ex_subplot
def __init__(self, xlfile='', sheet='', text='', prompt=None, delim='\t', txt_col = 6, autoload=False, debug = 0): # Debug values from 0 -> 2 self._debug=debug self._xl = xlfile self._sh = sheet # Figure out which experiment to process and prompt if not specified # at startup if prompt is None: prompt = io.prompted(xlfile, sheet) # Get row, header, and key values self._get_row_data(prompt) # define filenames associated with experiment # TODO find way to get txt_col information from SS directly self._path = DATA_DIR() + os.sep + self._sh.lower() self._ascii_file = self._path + os.sep + 'data' + os.sep + self._row[txt_col] self._fig_dir = self._path + os.sep + 'figures' + os.sep self._pick_file = self._path + os.sep + 'data' + os.sep + ('%02d-' % prompt) + os.path.splitext(self._row[txt_col])[0] + '.p' self.__check__('File name: ',self._ascii_file) # Import saved data (self._param and self._curves) or parse ASCII file if os.path.isfile(self._pick_file) and autoload is True: self._load() elif os.path.isfile(self._ascii_file): self._data_array = io.parse_ascii(self._ascii_file , delim) # if we have defined _raw_columns then add all of those curves (defined for each exp type) if hasattr(self, '_raw_columns'): self._curves = Curve(self._data_array,self._raw_columns) else: self._curves = Curve(self._data_array) self.c = self._curves self.pl = self._curves.ex_plot self.twin = self._curves.ex_twinplot self.sub = self._curves.ex_subplot if hasattr(self, '_row_params'): self._params = Param(self._row,row_data=self._row_params, xl_keys=self._keys) else: self._params = Param(self._row,xl_keys=self._keys) # Ease of use abbr self.p = self._params self.pg = self._params.get else: print '%s is not accessible.' % (self._ascii_file)