from scipy import misc import numpy as np import time import yaml import itertools as it from pyfpm import web from pyfpm.reconstruct import fpm_reconstruct from pyfpm.fpmmath import set_iterator from pyfpm.data import save_yaml_metadata import pyfpm.data as dt from pyfpm.coordinates import PlatformCoordinates # Simulation parameters cfg = dt.load_config() samples, comp_cfg = dt.open_sampled('2017-05-26_152307.npy') background, comp_cfg = dt.open_sampled('2017-05-26_145449_blank.npy') # Connect to a web client running serve_microscope.py pc = PlatformCoordinates(theta=0, phi=0, height=cfg.sample_height, cfg=cfg) pc.generate_model(cfg.plat_model) iterator = set_iterator(cfg) # reconstruction dx = cfg.patch_size[0] x_range = range(0, cfg.video_size[1], dx)[:-1] y_range = range(0, cfg.video_size[0], dx)[:-1] # for i, point in enumerate(it.product(x_range, y_range)): # init_point = [point[0], point[1]] # rec, phase = fpm_reconstruct(samples, background, iterator, init_point, # cfg=cfg, debug=False)
from numpy import abs, angle import pyfpm.local as local from pyfpm.reconstruct import fpm_reconstruct_epry, fpm_reconstruct import pyfpm.coordtrans as ct import pyfpm.data as dt import pyfpm.inspector as ins # Simulation parameters cfg = dt.load_config() mode = cfg.task itertype = cfg.sweep server_ip = cfg.server_ip client = local.SimClient(cfg=cfg) # samples, sample_cfg = dt.open_sampled('20181107_183532.npy', mode='sampling') samples, sample_cfg = dt.open_sampled('simtest.npy', mode='simulation') iterator = ct.set_iterator(cfg) # total_time = 0 # for it in iterator: # nx, ny = it['nx'], it['ny'] # iso, ss, power = it['acqpars'] # total_time += ss/1E6 # print(nx, ny, ss, total_time) # First inspection # iterator = ins.inspect_iterator(iterator, sample_cfg) # iterator = ins.inspect_samples(iterator, samples, sample_cfg) # ins.inspect_pupil(sample_cfg) # Reconstruction
Last update: 28/10/2016 Use to locally simulate FPM. Usage: """ import time import matplotlib.pyplot as plt import numpy as np import pyfpm.local as local from pyfpm.reconstruct import fpm_reconstruct_wrapper import pyfpm.coordtrans as ct import pyfpm.data as dt import pyfpm.inspector as ins # Simulation parameters cfg = dt.load_config() mode = cfg.task itertype = cfg.sweep server_ip = cfg.server_ip client = local.SimClient(cfg=cfg) samples, sample_cfg = dt.open_sampled('20180628_175813.npy', mode='sampling') iterator = ct.set_iterator(cfg) # Reconstruction fpm_reconstruct_wrapper(samples=samples, it=iterator, cfg=sample_cfg, debug=cfg.debug) plt.show()
import itertools as it import pygame import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy import misc from skimage import measure import h5py import pyfpm.fpmmath as fpm from pyfpm import web from pyfpm.fpmmath import set_iterator import pyfpm.data as dt from pyfpm.coordinates import PlatformCoordinates # Simulation parameters comp_images, comp_cfg = dt.open_sampled('2017-05-22_172249.npy') cfg = dt.load_config() out_file = dt.generate_out_file(cfg.output_sample) # Connect to a web client running serve_microscope.py client = web.Client(cfg.server_ip) pc = PlatformCoordinates(cfg=cfg) pc.generate_model(cfg.plat_model) iterator = set_iterator(cfg) def acquire_image(pc, client, theta, phi, shift, power): pc.set_coordinates(theta=theta, phi=phi, shift=shift, units='deg_shift') [theta_plat, phi_plat, shift_plat, power_plat] = pc.parameters_to_platform() # ss = fpm.adjust_shutter_speed(tpsp[0], tpsp[1]) img = client.acquire(theta_plat,
import pyfpm.data as dt # Simulation parameters cfg = dt.load_config() mode = cfg.task itertype = cfg.sweep server_ip = cfg.server_ip iterator = ct.set_iterator(cfg) client = local.SimClient(cfg=cfg) #20180615_190312 #20180615_190312 # 20180618_163559 # 20180618_142136 # 20180622_141301 samples, sim_cfg = dt.open_sampled('20180622_175208.npy', mode='sampling') # Reconstruction start_time = time.time() hr = int(client.lhscale) * int(cfg.patch_size[0]) rec, phase = fpm_reconstruct_epry(samples=samples, hrshape=[hr, hr], it=iterator, cfg=sim_cfg, debug=cfg.debug, pupil_radius=client.pupil_radius, kdsc=client.kdsc) print('--- %s seconds ---' % (time.time() - start_time)) plt.show() if not cfg.debug: import matplotlib.pylab as plt
import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy import misc from skimage import measure # import h5py import pyfpm.fpmmath as fpm from pyfpm import web import pyfpm.coordtrans as ct import pyfpm.data as dt # from pyfpm.coordinates import PlatformCoordinates # Simulation parameters # samples, comp_cfg = dt.open_sampled('2017-05-26_145449.npy') # background, comp_cfg = dt.open_sampled('2017-05-26_145449_blank.npy') samples, comp_cfg = dt.open_sampled('outest.npy', mode='simulation') # 150543 cfg = dt.load_config() out_file = dt.generate_out_file(cfg.output_sample) # Connect to a web client running serve_microscope.py client = web.Client(cfg.server_ip) iterator = ct.set_iterator(cfg) # Start analysis fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(25, 15)) plt.grid(False) fig.show() image_dict = dict() iterator = ct.set_iterator(cfg) corr_ims = list()