Beispiel #1
0
 def plot_peak_intensities(self, title=None):
     plot = iPlot.Plot()
     plot.line(self.delays / PRE.p, self.peak_intensities)
     plot.show(xlabel='Delay (ps)',
               ylabel='Peak Intensity (a.u.)',
               title=title,
               grid=True)
     return self
Beispiel #2
0
def plotRaw(wavelengths, rawIntensities, title=None, name=None):
    plot = iPlot.Plot()
    plot.line(wavelengths, rawIntensities, format_='k')
    plot.show(xlabel='Wavelength (nm)',
              ylabel='Intensity (a.u.)',
              grid=True,
              title=title,
              name=name)
def plotPopulation(js, populations, title=None, name=None):
    plot = iPlot.Plot()
    plot.bar(js, populations, width=0.8)
    plot.show(xlabel='J State',
              ylabel='Population (a.u.)',
              grid=True,
              title=title,
              name=name)
Beispiel #4
0
 def plot_peak_wavelengths(self, title=None):
     plot = iPlot.Plot()
     plot.line(self.delays / PRE.p,
               self.peak_wavelengths / PRE.n,
               format_='o-')
     plot.show(xlabel='Delay (ps)',
               ylabel='Peak Wavelength (nm)',
               title=title)
     return self
Beispiel #5
0
def fwhmVsVerticalPosition(data):
    x, y = [], []
    for info in data.values():
        if info.fiberConfig == '1' and info.fpDistance == 0:
            x.append(info.verticalPosition)
            y.append(info.fwhm)
            print(info)

    p2 = iPlot.Plot()
    p2.line(x[::-1], y, format_='.', markerSize=8)
    p2.show(xlabel='Vertical Position', ylabel='FWHM (THz)', grid=True)
Beispiel #6
0
def depthVsVerticalPosition(data):
    x, y = [], []
    for info in data.values():
        if info.fiberConfig == '1' and info.fpDistance == 0:
            x.append(info.verticalPosition)
            y.append(info.depth)
            print(info)

    plot = iPlot.Plot()
    plot.line(x[::-1], y, format_='.', markerSize=8)
    plot.show(xlabel='Vertical Position', ylabel='Depth (0-1)', grid=True)
Beispiel #7
0
 def cmap_raw(self, title=None):
     plot = iPlot.Plot()
     extent = [
         self.delays[0] / PRE.p, self.delays[-1] / PRE.p,
         self.wavelengths[0] / PRE.n, self.wavelengths[-1] / PRE.n
     ]
     plot.cmap(self.intensities,
               label='Intensity (a.u.)',
               extent=extent,
               flip=True)
     plot.show(xlabel='Delay (ps)', ylabel='Wavelength (nm)', title=title)
     return self
Beispiel #8
0
 def cmap_raw(self):
     plot = iPlot.Plot()
     extent = [
         self.delays[0] / PRE.p, self.delays[-1] / PRE.p,
         self.wavelengths[0] / PRE.n, self.wavelengths[-1] / PRE.n
     ]
     plot.cmap(self.intensities_rel,
               label='Intensity Difference (a.u.)',
               extent=extent,
               flip=True)
     plot.show(xlabel='Delay (ps)', ylabel='Wavelength (nm)')
     return self
Beispiel #9
0
def plotArms(frequencies,
             intensities,
             blueSlice,
             redSlice,
             title=None,
             name=None):
    plot = iPlot.Plot()
    plot.line(frequencies[redSlice], intensities[redSlice], format_='tab:red')
    plot.line(frequencies[blueSlice],
              intensities[blueSlice],
              format_='tab:blue')
    plot.show(xlabel='Centrifuge Frequency (THz)',
              ylabel='Intensity (a.u.)',
              grid=True,
              title=title,
              name=name)
def plotRaman(frequencies, intensities, bounds, js, title=None, name=None):
    labelPositions = [(a + b) / 2 for a, b in zip(bounds, bounds[1:])]
    plot = iPlot.Plot()
    plot.line(frequencies, intensities, format_='k')
    plot.line(bounds, np.full_like(bounds, 0), format_='|g', markerSize=10)
    plot.annotate(js,
                  labelPositions,
                  np.zeros_like(js),
                  offset=(0.6, -9),
                  rotation=90,
                  fontSize=6)
    plot.show(xlabel='Centrifuge Frequency (THz)',
              ylabel='Intensity (a.u.)',
              grid=True,
              title=title,
              name=name)
Beispiel #11
0
def fwhmVsFiberCount(data, doFit=True):
    x, y = [], []
    for info in data.values():
        if all([info.fiberConfig.isdigit(), info.fpDistance == 0, info.verticalPosition == 0]):
            x.append(int(info.fiberConfig))
            y.append(info.fwhm)
            print(info)

    p = iPlot.Plot()
    p.line(x, y, format_='.', markerSize=8)
    if doFit:
        parameters, errors, chi2 = iProcess.fit(iProcess.Function.line, x, y, np.full((len(x)), 0.01))
        print(f'\nχ²: {chi2:.1E}\n'
              f'slope: {parameters[0]:.3f} ± {errors[0]:.0E} THz\n'
              f'y-intercept: {parameters[1]:.3f} ± {errors[1]:.0E} THz')
        xFit = np.array([min(x), max(x)])
        p.line(xFit, iProcess.Function.line(xFit, *parameters), format_='--')
    p.show(xlabel='Fiber Count', ylabel='FWHM (THz)', legend=['Data', 'Fit'] if doFit else None, grid=True)
Beispiel #12
0
def plotCfg(wavelengths,
            intensities,
            blueSlice,
            redSlice,
            cfgMetrics,
            title=None,
            name=None):
    plot = iPlot.Plot()
    plot.line(wavelengths[redSlice], intensities[redSlice], format_='tab:red')
    plot.line(wavelengths[blueSlice],
              intensities[blueSlice],
              format_='tab:blue')
    parameters = cfgMetrics.centerWavelength, 0, 1, cfgMetrics.blueFwhm, 1, cfgMetrics.redFwhm
    plot.line(wavelengths,
              halfGaussians(wavelengths, *parameters),
              format_='--k')
    plot.show(xlabel='Wavelength (nm)',
              ylabel='Intensity (a.u.)',
              grid=True,
              title=title,
              name=name)
Beispiel #13
0
def transitionHwhmVsFpDistance(data, doFit=True):
    x, y = [], []
    for info in data.values():
        if info.fiberConfig.isdigit() and info.verticalPosition == 0:
            x.append(info.fpDistance)
            y.append(info.transitionHwhm)
            print(info)

    plot = iPlot.Plot()
    plot.line(x, y, format_='.')
    if doFit:
        def gaussBeam(z, A, zR):
            return A * np.sqrt(1 + (z / zR) ** 2)

        parameters, errors, chi2 = iProcess.fit(gaussBeam, x, y, np.full((len(x)), 0.01), guess=[0.065, 1])
        print(f'\nχ²: {chi2:.1E}\n'
              f'A: {parameters[0]:.3f} ± {errors[0]:.0E} THz\n'
              f'zR: {parameters[1]:.2f} ± {errors[1]:.0E} mm')
        xFit = np.linspace(min(x), max(x), 100)
        plot.line(xFit, gaussBeam(xFit, *parameters), format_='--')
    plot.show(xlabel='FP Distance (mm)', ylabel='Transition HWHM (THz)', legend=['Data', 'Fit'] if doFit else None, grid=True)
Beispiel #14
0
        content = file.read()
    wavelengths, intensities = [], []
    delays = np.arange(0, 201, 2)
    for line in content.splitlines():
        values = [float(v) for v in line.split('\t')]
        wavelengths.append(values.pop(0))
        intensities.append(values)
    return np.array(intensities), np.array(wavelengths), delays


if __name__ == '__main__':
    folder = ASSETS_DIR / '2021-03-20 OCS'
    controlNotch = CfgControl(folder / '0.xls')

    probeIntensities, wavelengths, delays = extractScan(folder / 'probe.dat')
    frequencies = PHYS.c * (1 / PROBE_WAVELENGTH - 1 / wavelengths) / (PRE.n * PRE.T) / 2
    extent = [np.min(delays), np.max(delays), np.min(frequencies), np.max(frequencies)]
    # controlIntensities = extractScan(folder / f'0.dat')[0] - probeIntensities

    for i in range(1, 4):
        notch = CfgNotch(folder / f'{i}.xls', control=controlNotch, rescale=True)
        print(notch.notchMetrics)

    for i in range(4):
        intensities, *_ = extractScan(folder / f'{i}.dat')
        intensities -= probeIntensities

        plot = iPlot.Plot()
        plot.cmap(np.log2(np.clip(intensities, 1, 10000)), extent=extent, label='log$_{2}$ (Intensity)', flip=True)
        plot.show(xlabel='Delay (ps)', ylabel='Frequency (THz)')