def read_lecroy(self, path, scope_data): lecroy = lc.lecroy_data("%s/%s" % (path, scope_data['file'])) lecroy.get_seg_time() lecroy.get_segment(scope_data['trace'], scope_data['cal_factor']) offset = np.average(lecroy.data[0:int(len(lecroy.data)/5)]) lecroy.data -= offset return lecroy
def read_lecroy(self, wantOffset=False): lecroy = lc.lecroy_data(self.file_name) lecroy.get_seg_time() lecroy.get_segment(self.trace_number, self.cal_factor) if wantOffset: offset = np.average(lecroy.data[0:int(len(lecroy.data)/5)]) lecroy.data -= offset self.data = lecroy.data self.dataTime = lecroy.dataTime
def scope_open_file_dialog(self): fname = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '/home/jaime/Documents/ResearchTopics/Publications/Current Reflections/Raw Data/') index = fname.find('.') extension = fname[index+1:] if extension.lower() == 'hdr' or extension.lower() == 'wvf': f = yoko.Yoko850File(fname[:index]) header = f.get_header() traces = [] for i in range(header.numTraces): traces.append(f.get_trace_data(header, i+1, 0, 2, wantOffset='y')) for trace in traces: fig = Figure(dpi=300) ax = fig.add_subplot(111) ax.plot(trace.dataTime, trace.data) self.plots.append((fig, ax)) self.draw() else: f = lecroy.lecroy_data(fname) traces = [] for i in range(f.subarray_count): traces.append(f.get_segment(i+1)) for trace in traces: # fig = Figure(dpi=300) # ax = fig.add_subplot(111) # ax.plot(trace.dataTime, trace.data) fig, ax = trace.plot() self.plots.append((fig, ax)) self.draw()
# Import other modules import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import iclrt_tools.plotting.dfplots as df import iclrt_tools.oscilloscopes.lecroy as lc import iclrt_tools.oscilloscopes.yoko750 as yk750 import iclrt_tools.oscilloscopes.yoko850 as yk850 import iclrt_tools.differentiators.differentiate_waveform as diff dataFile = "/home/jaime/Documents/My Papers/Ongoing/Current Reflections/" \ "Raw Data/081713/Scope18/C4AC00001.trc" f = lc.lecroy_data(dataFile) wantOffset = False trace = 1 traceUnit = 'V/m' traceUnitsFactor = 1.0 calFactor = 1 df32_tStart = 9.99993682e-001 df32_tStop = 1.00003088e+000 f.get_seg_time() f.get_segment(trace, calFactor) t, d_dt, wave = diff.differentiate(f.dataTime-df32_tStart, f.data) d_dt *= 1E9
import sys sys.path.append('/home/jaime/Documents/Python Code') # Import other packages import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator import iclrt_tools.plotting.dfplots as df import iclrt_tools.oscilloscopes.lecroy as lc import iclrt_tools.timing.timing as timing file_name = "./C4AC00001.trc" #~ x,y = lc.read_timetrace(file_name) lecroy = lc.lecroy_data(file_name) seg_time = lecroy.get_seg_time() segments = lecroy.get_segments() n_ticks = 1.0 mult, string = timing.fix_time(seg_time, n_ticks) #~ mult = 1 #~ string = '' fig = plt.figure() ax = fig.add_subplot(111) ax.plot(seg_time*mult, segments[0]) ax.set_title('Segment 1') ax.set_xlabel('Time (%s)' % string)