def plot_trace(self): ''' performs a measurement and plots the data. ''' freqs, reply = self.get_trace() qt.plot(freqs, reply, name='netan', xlabel='freq [Hz]', ylabel='S_ij [dB]', clear=True)
def save_spectrum(self, ret=False): spec = andor.get_spectrum() specd = qt.Data(name='spectrum') specd.add_value('Counts') specd.create_file() specd.add_data_point(spec) specd.close_file() qt.plot(specd, name='saved_spectrum', clear=True) if ret: return spec
def save_spectrum(self, ret=False): spec = winspec.get_spectrum() specd = qt.Data(name='spectrum') specd.add_coordinate('Wavelength', units='nm') specd.add_value('Counts') specd.create_file() specd.add_data_point(spec) specd.close_file() qt.plot(specd, name='saved_spectrum', clear=True) if ret: return spec
def save_trace(self, filepath=None, plot=True): ''' runs 'get_trace()' and saves the output to a file. Input: filepath (string): Path to where the file should be saved.(optional) Output: filepath (string): The filepath where the file has been created. ''' #TODO: change value label 'S_ij' to represent actual measurement freqs, reply = self.get_trace() d = qt.Data(name='netan') d.add_coordinate('freq [Hz]') d.add_value('S_ij [dB]') d.create_file(filepath=filepath) d.add_data_point(zip(freqs, reply)) d.close_file() if plot: p = qt.plot(d, name='netan', clear=True) p.save_png() p.save_gp() return d.get_filepath()
import numpy as np from qtlab.source import qt x = np.arange(-10, 10, 0.2) y = np.sinc(x) yerr = 0.1 * np.random.rand(len(x)) d = qt.Data() d.add_coordinate('x') d.add_coordinate('y') d.add_coordinate('yerr') d.create_file() d.add_data_point(x, y, yerr) p = qt.Plot2D() p.add_data(d, coorddim=0, valdim=1, yerrdim=2) # or: ('ok' is style for black circles) qt.plot(x, y, 'ok', yerr=yerr, name='test2')
def take_spectrum(self, ret=False, newdoc=False): spec = winspec.get_spectrum(newdoc=newdoc) qt.plot(spec, name='winspec_spectrum', clear=True) if ret: return spec
import numpy as np from qtlab.source import qt x = np.arange(-10, 10, 0.2) y = np.sinc(x) yerr = 0.1*np.random.rand(len(x)) d = qt.Data() d.add_coordinate('x') d.add_coordinate('y') d.add_coordinate('yerr') d.create_file() d.add_data_point(x,y,yerr) p = qt.Plot2D() p.add_data(d, coorddim=0, valdim=1, yerrdim=2) # or: ('ok' is style for black circles) qt.plot(x, y, 'ok', yerr=yerr, name='test2')
def plot(self): if not self._dev: return from qtlab.source import qt x, trace = self._dev.get_block() qt.plot(trace, name='picoharp', clear=True)
def take_spectrum(self, ret=False): spec = andor.get_spectrum() qt.plot(spec, name='andor_spectrum', clear=True) if ret: return spec