Example #1
0
    def load_h5py(cls, f, prepend=None):
        """Load object contents from an opened HDF5 file object."""
        sc = cls()
        prefix = 'Config/'

        if prepend is not None:
            prefix = prepend + prefix

        sc.wavelength = float(f[prefix + 'wavelength'].value[0])
        sc.aperture_radius = float(f[prefix + 'aperture_radius'].value[0])
        sc.focal_length = float(f[prefix + 'focal_length'].value[0])
        sc.image_width = int(f[prefix + 'image_width'].value[0])
        sc.image_height = int(f[prefix + 'image_height'].value[0])
        sc.pixel_size = float(f[prefix + 'pixel_size'].value[0])
        sc.n_alpha = int(f[prefix + 'n_alpha'].value[0])
        sc.n_beta = int(f[prefix + 'n_beta'].value[0])
        sc.fit_L = int(f[prefix + 'fit_L'].value[0])
        sc.fit_K = int(f[prefix + 'fit_K'].value[0])

        sc.focus_positions = f[prefix + 'focus_positions'].value
        sc.xspace = f[prefix + 'xspace'].value
        sc.yspace = f[prefix + 'yspace'].value

        sc.phase_fit = FitZern.load_h5py(f, prepend=prefix+'phase_fit/')
        sc.phase_grid = sc.phase_fit.z

        sc.cpsf = CPsf.load_h5py(f, prepend=prefix+'cpsf/')

        sc.gpf_fit = FitZern.load_h5py(f, prepend=prefix+'gpf_fit/')
        sc.gpf_fit.z = sc.cpsf.czern

        print('phase: n_alpha = {}, N_alpha = {}'.format(
            sc.n_alpha, sc.phase_grid.nk))
        print('cpsf:  n_beta  = {}, N_beta  = {},  N_f = {}'.format(
            sc.n_beta, sc.cpsf.czern.nk, sc.focus_positions.size))

        return sc
Example #2
0
    def load_h5py(cls, f, prepend=None):
        """Load object contents from an opened HDF5 file object."""
        sc = cls()
        prefix = 'Config/'

        if prepend is not None:
            prefix = prepend + prefix

        sc.wavelength = float(f[prefix + 'wavelength'].value[0])
        sc.aperture_radius = float(f[prefix + 'aperture_radius'].value[0])
        sc.focal_length = float(f[prefix + 'focal_length'].value[0])
        sc.image_width = int(f[prefix + 'image_width'].value[0])
        sc.image_height = int(f[prefix + 'image_height'].value[0])
        sc.pixel_size = float(f[prefix + 'pixel_size'].value[0])
        sc.n_alpha = int(f[prefix + 'n_alpha'].value[0])
        sc.n_beta = int(f[prefix + 'n_beta'].value[0])
        sc.fit_L = int(f[prefix + 'fit_L'].value[0])
        sc.fit_K = int(f[prefix + 'fit_K'].value[0])

        sc.focus_positions = f[prefix + 'focus_positions'].value
        sc.xspace = f[prefix + 'xspace'].value
        sc.yspace = f[prefix + 'yspace'].value

        sc.phase_fit = FitZern.load_h5py(f, prepend=prefix + 'phase_fit/')
        sc.phase_grid = sc.phase_fit.z

        sc.cpsf = CPsf.load_h5py(f, prepend=prefix + 'cpsf/')

        sc.gpf_fit = FitZern.load_h5py(f, prepend=prefix + 'gpf_fit/')
        sc.gpf_fit.z = sc.cpsf.czern

        print('phase: n_alpha = {}, N_alpha = {}'.format(
            sc.n_alpha, sc.phase_grid.nk))
        print('cpsf:  n_beta  = {}, N_beta  = {},  N_f = {}'.format(
            sc.n_beta, sc.cpsf.czern.nk, sc.focus_positions.size))

        return sc