import numpy as np
import miepy
from topics.photonic_clusters.create_lattice import hexagonal_lattice_particles
import matplotlib.pyplot as plt
from numpipe import scheduler, pbar
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
from my_pytools.my_matplotlib.layout import alpha_labels
from scipy import constants
from scipy.integrate import trapz
from my_pytools.my_matplotlib.plots import colorbar

mpl.rc('font', size=12, family='arial')
mpl.rc('mathtext', default='regular')

job = scheduler()
nm = 1e-9
um = 1e-6

Ag = miepy.materials.Ag()
radius = 150 * nm
width = 2500 * nm
wavelengths = np.linspace(470 * nm, 880 * nm, 1000)
energy = constants.h * constants.c / constants.e / wavelengths
separation = 600 * nm

source = miepy.sources.gaussian_beam(width=width,
                                     polarization=[1, 1j],
                                     power=1)
source = miepy.sources.plane_wave(polarization=[0, 1], amplitude=1e7)
lmax = 3
Exemple #2
0
import numpipe
from numpipe import pbar
from time import sleep

### Setup
job = numpipe.scheduler()

import numpy as np
N = 100
T = 5


@job.cache
def progress(i):
    progress = 0
    for j in pbar(range(N)):
        if i in (2, 5, 8) and j == 40:
            raise RuntimeError
        sleep(T / N)
        yield dict()


for i in range(10):
    job.add(progress, i=i)

### execute
if __name__ == '__main__':
    job.run()