def getdata_(self): """ Executes qrange to extract data from reports. """ data, errmsg, rawdat = qrange(self.datadir, self.range, self.X + " " + self.Y) display(errmsg) self.raw_data = rawdat return data
def get_data(self): directory = self.get_dir() shots = self.setup_dict['shots'] if type(shots) == type([]): shots = ",".join(shots) keys = " ".join([self.setup_dict['X'], self.setup_dict['Y']]) self.data, self.errmsg, self.raw_data = qrange.qrange(directory, shots, keys) s = '' for i in range(self.data.shape[1]): col = self.data[:,i] s00 = numpy.mean(col) s01 = stats.sem(col) s02 = numpy.std(col) s03 = numpy.max(col) - numpy.min(col) s = s + "Mean = %10.6f\n" % s00 s = s + "Std. deviation = %10.6f\n" % s02 s = s + "Std. Error of the mean = %10.6f\n" % s01 s = s + "Pk-Pk = %10.6f\n" % s03 s = s+ '\n' self.raw_data = s + self.raw_data self.sdata = None if self.setup_dict['X'] == "SEQ:shot": s = [ numpy.mean(self.data[:,1]), numpy.std(self.data[:,1]), stats.sem(self.data[:,1]),numpy.max(self.data[:,1]) - numpy.min(self.data[:,1]) ] a = [] for val in s: a.append( [val for i in range(self.data[:,1].size)]) self.sdata = numpy.c_[self.data[:,0], numpy.transpose(numpy.array(a))] else: self.sdata = statdat.statdat(self.data, 0, 1)
import qrange #import getopt, sys #sys.path.append('L:/software/apparatus3/bin') #import parse_range qrange.qrange('L:/data/app3/2011/1107/110725/','8888:8890','SEQ:shot CPP:nfit')
# --------------------- MAIN CODE --------------------# if __name__ == "__main__": parser = argparse.ArgumentParser('plotevap.py') parser.add_argument('RANGE', action="store", type=str, help='range of shots to be considered for plotevap') args = parser.parse_args() #print os.getcwd() #print args.RANGE # # EXTRACT DATA FROM REPORTS # evapdat, errmsg, raw = qrange.qrange( os.getcwd() +'/' , args.RANGE, ' '.join(keys)) extracted = extract_same_field( evapdat ) lowestdepth = sorted(extracted.keys())[0] lowestdepth_report = configobj.ConfigObj ( "report%04d.INI" % extracted[lowestdepth][0][k['SEQ:shot']] ) lowestdepth_rampfile = re.sub('L:', '/lab', lowestdepth_report['EVAP']['ramp'] ) if '_phys' != lowestdepth_rampfile[-5:]: print "Appending _phys to the ramp file obtained from the report" lowestdepth_rampfile = lowestdepth_rampfile + '_phys' evapramp = numpy.fromfile( lowestdepth_rampfile , sep='\n') stepsize = float( lowestdepth_report['EVAP']['evapss'] ) maxdepth = float( lowestdepth_report['ODTCALIB']['maxdepth'] ) evapramp = evapramp / 10. * maxdepth / 5. # Trap depth divided by 5 evaptime = numpy.linspace( 0.0, evapramp.shape[0]*stepsize/1000., evapramp.shape[0] ) # # SETUP MATPLOTLIB