def load_hdf5data(self):
        self.h5filepath = toolbox.measurement_filename(self.folder)
        self.f = h5py.File(self.h5filepath, "r")
        self.name = self.f.keys()[5]  # nr 5 has adwin data
        self.g = self.f[self.name]

        self.measurementstring = os.path.split(self.folder)[1]
        self.timestamp = os.path.split(os.path.split(self.folder)[0])[1] + "/" + self.measurementstring[:6]
        self.measurementstring = self.measurementstring[7:]
        self.default_plot_title = self.timestamp + "\n" + self.measurementstring
Ejemplo n.º 2
0
import os, sys
import numpy as np
import h5py
import logging

from matplotlib import pyplot as plt
from measurement.lib.tools import toolbox

FOLDER = toolbox.latest_data('out-003')
FN = toolbox.measurement_filename(FOLDER)
BINEDGES = np.arange(3001) - 0.5


def get_photon_times_ns(FN):
    f = h5py.File(FN, 'r')
    channel = f['/HH_channel-1'].value
    special = f['/HH_special-1'].value
    sync_time = f['/HH_sync_time-1'].value
    f.close()

    # TODO this could maybe be done more efficient with cython
    is_not_special = special == 0
    is_channel_0 = channel == 0
    is_channel_1 = channel == 1

    is_photon_0 = np.logical_and(is_not_special, is_channel_0)
    is_photon_1 = np.logical_and(is_not_special, is_channel_1)

    return sync_time[is_photon_0] * 1e-3, sync_time[is_photon_1] * 1e-3

Ejemplo n.º 3
0
import os, sys
import numpy as np
import h5py
import logging

from matplotlib import pyplot as plt
from measurement.lib.tools import toolbox

FOLDER = toolbox.latest_data('out-003')
FN = toolbox.measurement_filename(FOLDER)
BINEDGES = np.arange(3001)-0.5

def get_photon_times_ns(FN):
    f = h5py.File(FN, 'r')
    channel = f['/HH_channel-1'].value
    special = f['/HH_special-1'].value
    sync_time = f['/HH_sync_time-1'].value
    f.close()

    # TODO this could maybe be done more efficient with cython
    is_not_special = special==0
    is_channel_0 = channel==0
    is_channel_1 = channel==1

    is_photon_0 = np.logical_and(is_not_special, is_channel_0)
    is_photon_1 = np.logical_and(is_not_special, is_channel_1)

    return sync_time[is_photon_0]*1e-3, sync_time[is_photon_1]*1e-3

def make_hist(photons):
    h, b = np.histogram(photons, bins=BINEDGES)