コード例 #1
0
ファイル: test_io.py プロジェクト: sid6155330/holopy
 def test_calculate_hologram_noise_sd(self):
     accumulator = Accumulator()
     refimg = _load_raw_example_data()
     paths = get_example_data_path(['bg01.jpg', 'bg02.jpg', 'bg03.jpg'])
     bg = load_average(paths, refimg)
     # This value is from the legacy version of load_average
     self.assertTrue(np.allclose(bg.noise_sd, 0.00709834))
コード例 #2
0
ファイル: mielensfit.py プロジェクト: ralex0/mielens-data
def load_bkg(path, bg_prefix, refimg):
    subdir = os.path.dirname(path)
    bkg_paths = [
        subdir + '/' + pth for pth in os.listdir(subdir) if bg_prefix in pth]

    bkg = load_average(bkg_paths, refimg=refimg, channel=RGB_CHANNEL)
    return bkg
コード例 #3
0
ファイル: mielensfit.py プロジェクト: ralex0/mielens-data
 def _load_darkfield(self):
     if self.darkfield_prefix is not None:
         names = self._get_filenames_which_contain(self.darkfield_prefix)
         darkfield = load_average(
             names, refimg=self._reference_image, channel=RGB_CHANNEL)
     else:
         darkfield = None
     return darkfield
コード例 #4
0
ファイル: test_io.py プロジェクト: sid6155330/holopy
 def test_2_colour_noise_sd(self):
     paths = get_example_data_path([
         '2colourbg0.jpg', '2colourbg1.jpg', '2colourbg2.jpg',
         '2colourbg3.jpg'
     ])
     image = load_average(paths, spacing=1, channel=[0, 1])
     gold_noise = [0.06864433355667054, 0.04913377621162473]
     noise = [
         image.noise_sd.loc[colour].item() for colour in ['green', 'red']
     ]
     self.assertTrue(np.allclose(gold_noise, noise))
コード例 #5
0
import holopy as hp
from holopy.core.io import get_example_data_path, load_average
from holopy.core.process import bg_correct
from scipy.ndimage import measurements
from holopy.scattering import Spheres
from holopy.scattering import calc_holo, Sphere

imagepath = get_example_data_path('image01.jpg')
raw_holo = hp.load_image(
    imagepath,
    spacing=0.0851,
    medium_index=1.33,
    illum_wavelen=0.66,
)
bgpath = get_example_data_path(['bg01.jpg', 'bg02.jpg', 'bg03.jpg'])
bg = load_average(bgpath, refimg=raw_holo)
holo = bg_correct(raw_holo, bg)

z = [17.5, 20, 27]
x = np.linspace(1, 512, 1000)

p1 = np.angle(np.e**(-1j * 2 * np.pi * z[0] / (0.66 / 1.33)))
p2 = np.angle(np.e**(-1j * 2 * np.pi * z[1] / (0.66 / 1.33)))
p3 = np.angle(np.e**(-1j * 2 * np.pi * z[2] / (0.66 / 1.33)))

rec_vol1 = hp.propagate(holo, z[0])
rec_vol2 = hp.propagate(holo, z[1])
rec_vol3 = hp.propagate(holo, z[2])

amp1 = np.abs(rec_vol1[:, 253, :])
amp2 = np.abs(rec_vol2[:, 253, :])
コード例 #6
0
ファイル: inout.py プロジェクト: ralex0/mielens-data
def load_bkg(path, bg_prefix, refimg):
    bkg_paths = get_bkg_paths(path, bg_prefix)
    bkg = load_average(bkg_paths, refimg=refimg, channel=RGB_CHANNEL)
    return bkg
コード例 #7
0
ファイル: basic_recon.py プロジェクト: barkls/holopy
import numpy as np
import holopy as hp
from holopy.core.io import get_example_data_path, load_average
from holopy.core.process import bg_correct

imagepath = get_example_data_path('image01.jpg')
raw_holo = hp.load_image(imagepath, spacing = 0.0851, medium_index = 1.33, illum_wavelen = 0.66, )
bgpath = get_example_data_path(['bg01.jpg','bg02.jpg','bg03.jpg'])
bg = load_average(bgpath, refimg = raw_holo)
holo = bg_correct(raw_holo, bg)

zstack = np.linspace(0, 20, 11)
rec_vol = hp.propagate(holo, zstack)
hp.show(rec_vol)
コード例 #8
0
ファイル: mielensfit.py プロジェクト: ralex0/mielens-data
 def _load_background(self):
     names = self._get_filenames_which_contain(self.background_prefix)
     background = load_average(
         names, refimg=self._reference_image, channel=RGB_CHANNEL)
     return background