Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

treams

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treams - npm Package Compare versions

Comparing version
0.3.2
to
0.4.0
+4
-4
docs/examples/grid.py

@@ -15,12 +15,12 @@ import matplotlib.pyplot as plt

spheres = [treams.TMatrix.sphere(lmax, k0, r, materials) for r in radii]
chain = treams.TMatrix.cluster(spheres, positions).latticeinteraction.solve(
array = treams.TMatrix.cluster(spheres, positions).latticeinteraction.solve(
lattice, kpar
)
inc = treams.plane_wave([0, 0, k0], [-1, 0, 0], k0=chain.k0, material=chain.material)
sca = chain @ inc.expand(chain.basis)
inc = treams.plane_wave([0, 0, k0], [-1, 0, 0], k0=array.k0, material=array.material)
sca = array @ inc.expand(array.basis)
grid = np.mgrid[-150:150:31j, 0:1, -150:150:31j].squeeze().transpose((1, 2, 0))
ez = np.zeros_like(grid[..., 0])
valid = chain.valid_points(grid, radii)
valid = array.valid_points(grid, radii)
vals = []

@@ -27,0 +27,0 @@ for i, r in enumerate(grid[valid]):

@@ -1,4 +0,4 @@

============
Introduction
============
========
Examples
========

@@ -5,0 +5,0 @@ *treams* is a program that covers various aspects of T-matrix calculations and

Metadata-Version: 2.1
Name: treams
Version: 0.3.2
Version: 0.4.0
Summary: "T-matrix scattering code for nanophotonic computations"
Home-page: https://git.scc.kit.edu/tfp-photonics/treams
Home-page: https://github.com/tfp-photonics/treams
Author: Dominik Beutel

@@ -7,0 +7,0 @@ Author-email: dominik.beutel@kit.edu

@@ -5,3 +5,3 @@ [metadata]

author_email = dominik.beutel@kit.edu
url = https://git.scc.kit.edu/tfp-photonics/treams
url = https://github.com/tfp-photonics/treams
description = "T-matrix scattering code for nanophotonic computations"

@@ -8,0 +8,0 @@ license = MIT

Metadata-Version: 2.1
Name: treams
Version: 0.3.2
Version: 0.4.0
Summary: "T-matrix scattering code for nanophotonic computations"
Home-page: https://git.scc.kit.edu/tfp-photonics/treams
Home-page: https://github.com/tfp-photonics/treams
Author: Dominik Beutel

@@ -7,0 +7,0 @@ Author-email: dominik.beutel@kit.edu

@@ -114,3 +114,3 @@ import warnings

@classmethod
def sphere(cls, lmax, k0, radii, materials):
def sphere(cls, lmax, k0, radii, materials, poltype=None):
"""T-Matrix of a (multi-layered) sphere.

@@ -130,2 +130,3 @@

outside. The last material in the list specifies the embedding medium.
poltype (str, optional): Polarization type (:ref:`params:Polarizations`).

@@ -135,2 +136,3 @@ Returns:

"""
poltype = config.POLTYPE if poltype is None else poltype
materials = [Material(m) for m in materials]

@@ -149,3 +151,14 @@ radii = np.atleast_1d(radii)

] = miecoeffs[::-1, ::-1]
return cls(tmat, k0=k0, basis=SWB.default(lmax), material=materials[-1])
res = cls(
tmat,
k0=k0,
basis=SWB.default(lmax),
material=materials[-1],
poltype="helicity",
)
if poltype == "helicity":
return res
res = res.changepoltype(poltype)
res[~np.eye(len(res), dtype=bool)] = 0
return res

@@ -314,3 +327,3 @@ @classmethod

re, im = self.real, self.imag
plus = -np.sum(re[sel[:, None] & sel]) / (self.ks[1] * self.ks[1])
plus = -np.sum(re.diagonal()[sel]) / (self.ks[1] * self.ks[1])
re_part = re[:, sel] / self.ks[self.basis.pol, None]

@@ -320,3 +333,3 @@ im_part = im[:, sel] / self.ks[self.basis.pol, None]

sel = ~sel
minus = -np.sum(re[sel[:, None] & sel]) / (self.ks[0] * self.ks[0])
minus = -np.sum(re.diagonal()[sel]) / (self.ks[0] * self.ks[0])
re_part = re[:, sel] / self.ks[self.basis.pol, None]

@@ -746,9 +759,9 @@ im_part = im[:, sel] / self.ks[self.basis.pol, None]

if not isinstance(illu_basis, CWB):
illu = illu.expand(self.basis) @ illu
illu = illu.expand(self.basis)
p = self @ illu
m = self.expand() / self.ks[self.basis.pol]
p_invk = p / self.ks[self.basis.pol]
del illu.modetype
return (
2 * np.real(p.conjugate().T @ (m @ p)) / flux,
-2 * np.real(illu.conjugate().T @ (p / self.ks[self.basis.pol])) / flux,
2 * np.real(p.conjugate().T @ p_invk.expand(p.basis)) / flux,
-2 * np.real(illu.conjugate().T @ p_invk) / flux,
)

@@ -755,0 +768,0 @@

@@ -353,8 +353,11 @@ """Loading and storing data.

return x / c * (xunit / k0unit)
if xtype == "angular_vacuum_wavelength":
if xtype == "vacuum_wavelength":
xunit = LENGTHS[xunit]
return 2 * np.pi / (x * xunit * k0unit)
if xtype == "vacuum_wavenumber":
xunit = INVLENGTHS[xunit]
return 2 * np.pi * x * (xunit / k0unit)
if xtype == "angular_vacuum_wavenumber":
xunit = INVLENGTHS[xunit]
return x * (xunit / k0unit)
if xtype == "angular_vacuum_wavenumber":
xunit = LENGTHS[xunit]
return 2 * np.pi / (x * xunit * k0unit)
raise ValueError(f"unrecognized frequency/wavenumber/wavelength type: {xtype}")

@@ -361,0 +364,0 @@

@@ -567,2 +567,5 @@ """Utilities.

def __complex__(self):
return complex(self._array)
def __array__(self, dtype=None):

@@ -594,4 +597,9 @@ """Convert to an numpy array.

def __getattr__(self, key):
if key in self.ann.as_dict:
res = self.ann.as_dict[key]
# In most cases, we shouldn't arrive here with the key "_ann", an exception is
# pickle.load which needs this early error to not result in an infinite
# recursion
if key == "_ann":
raise AttributeError()
if key in self._ann.as_dict:
res = self._ann.as_dict[key]
if all(res[0] == i for i in res[1:]):

@@ -598,0 +606,0 @@ return res[0]

@@ -71,3 +71,3 @@ import numpy as np

la.lsumcw1d(l, k, kpar, a, r, 0),
np.sum(la.dsumcw1d(l, k, kpar, a, r, np.arange(1_500_000))),
np.sum(la.dsumcw1d(l, k, kpar, a, r, np.arange(1_600_000))),
rel_tol=0.05,

@@ -74,0 +74,0 @@ abs_tol=EPSSQ,

@@ -27,3 +27,3 @@ import numpy as np

def test(self):
assert isclose(cw.rotate(3, 2, 1, 3, 2, 1, 4), np.exp(8j))
assert isclose(cw.rotate(3, 2, 1, 3, 2, 1, 4), np.exp(-8j))

@@ -30,0 +30,0 @@ def test_zero(self):

@@ -367,3 +367,3 @@ import numpy as np

la.lsumcw1d_shift(6, 2 * np.pi, 0, 1, [0.2, 0.1], 0),
-224.73515198832922 + 675.8601437840592j,
-224.72932005925895 + 675.8601828886733j,
1e-5,

@@ -451,3 +451,3 @@ )

la.diffr_orders_circle([[1, 0], [0.5, np.sqrt(0.75)]], 1.1),
[[0, 0], [0, 1], [0, -1], [1, 0], [-1, 0], [1, -1], [-1, 1],],
[[0, 0], [0, 1], [0, -1], [1, 0], [-1, 0], [1, -1], [-1, 1]],
)

@@ -454,0 +454,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display