Scatterers#
- class Sphere(source, diameter, refractive_index, medium_refractive_index)[source]#
Bases:
BaseScatterer,SequentialA data class that represents a spherical scatterer configuration used in PyMieSim simulations.
This class provides specific implementations for setting up and binding spherical scatterers with their refractive_index to a simulation environment. It extends the BaseScatterer class by adding spherical-specific attributes and methods for handling simulation setups.
- Parameters:
source (PyMieSim.experiment.source.base.BaseSource) – Light source configuration for the simulation.
diameter (Length) – Diameter(s) of the spherical scatterers in meters.
refractive_index (List[BaseMaterial] | List[RefractiveIndex]) – Refractive index or indices of the spherical scatterers themselves.
medium_refractive_index (List, optional) – BaseMaterial(s) defining the medium, used if medium_index is not provided.
- attributes = ['diameter', 'refractive_index', 'medium_refractive_index']#
- available_measure_list = ['Qsca', 'Qext', 'Qabs', 'Qratio', 'Qforward', 'Qback', 'Qpr', 'Csca', 'Cext', 'Cabs', 'Cratio', 'Cforward', 'Cback', 'Cpr', 'a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'g', 'coupling']#
- classmethod build_sequential(total_size=None, **kwargs)#
Broadcast scalar or single-element parameters to NumPy arrays of uniform length and construct a new instance of the class.
Each parameter passed via keyword arguments may be provided as a scalar or as a list/array. Scalars or single-element lists/arrays will be repeated to match the length of the longest parameter. If any parameter is given as a list/array with more than one element, its length must equal the maximum length among all parameters (or the explicit total_size if provided); otherwise, a ValueError is raised.
Additionally, if a keyword argument ‘source’ is provided, it is removed from the broadcasted parameters and passed directly to the class constructor.
- Parameters:
total_size (int, optional) – The explicit target size for broadcasting. Must be a positive integer if provided. If not specified, the target size is determined by the maximum size among the input parameters.
**kwargs (dict) – Arbitrary keyword arguments mapping parameter names to values. Each value may be a scalar or a list/array of values. Examples include parameters such as source, diameter, property, or medium_property.
- Returns:
A new instance of the class with all provided parameters broadcasted as NumPy arrays of equal length. If ‘source’ is provided, it is passed directly to the class constructor.
- Return type:
object
- Raises:
ValueError – If any parameter provided as a list/array has a length greater than one that does not match the target size.
- is_sequential = False#
- class CoreShell(source, core_diameter, shell_thickness, core_refractive_index, shell_refractive_index, medium_refractive_index)[source]#
Bases:
BaseScatterer,SequentialA data class representing a core-shell scatterer configuration used in PyMieSim simulations.
This class facilitates the setup and manipulation of core-shell scatterers by providing structured attributes and methods that ensure the scatterers are configured correctly for simulations. It extends the BaseScatterer class, adding specific attributes and methods relevant to core-shell geometries.
- Parameters:
source (PyMieSim.experiment.source.base.BaseSource) – Light source configuration for the simulation.
core_diameter (Length) – Diameters of the core components.
shell_thickness (Length) – Thicknesses of the shell components.
core_refractive_index (List[BaseMaterial] | List[RefractiveIndex]) – Refractive index or indices of the core.
shell_refractive_index (List[BaseMaterial] | List[RefractiveIndex]) – Refractive index or indices of the shell.
medium_refractive_index (List[BaseMaterial] | List[RefractiveIndex]) – BaseMaterial(s) defining the medium, used if medium_index is not provided.
- attributes = ['core_diameter', 'shell_thickness', 'core_refractive_index', 'shell_refractive_index', 'medium_refractive_index']#
- available_measure_list = ['Qsca', 'Qext', 'Qabs', 'Qratio', 'Qforward', 'Qback', 'Qpr', 'Csca', 'Cext', 'Cabs', 'Cratio', 'Cforward', 'Cback', 'Cpr', 'a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'g', 'coupling']#
- classmethod build_sequential(total_size=None, **kwargs)#
Broadcast scalar or single-element parameters to NumPy arrays of uniform length and construct a new instance of the class.
Each parameter passed via keyword arguments may be provided as a scalar or as a list/array. Scalars or single-element lists/arrays will be repeated to match the length of the longest parameter. If any parameter is given as a list/array with more than one element, its length must equal the maximum length among all parameters (or the explicit total_size if provided); otherwise, a ValueError is raised.
Additionally, if a keyword argument ‘source’ is provided, it is removed from the broadcasted parameters and passed directly to the class constructor.
- Parameters:
total_size (int, optional) – The explicit target size for broadcasting. Must be a positive integer if provided. If not specified, the target size is determined by the maximum size among the input parameters.
**kwargs (dict) – Arbitrary keyword arguments mapping parameter names to values. Each value may be a scalar or a list/array of values. Examples include parameters such as source, diameter, property, or medium_property.
- Returns:
A new instance of the class with all provided parameters broadcasted as NumPy arrays of equal length. If ‘source’ is provided, it is passed directly to the class constructor.
- Return type:
object
- Raises:
ValueError – If any parameter provided as a list/array has a length greater than one that does not match the target size.
- core_diameter: Length#
- core_refractive_index: List[BaseMaterial] | List[RefractiveIndex]#
- is_sequential = False#
- medium_refractive_index: List[BaseMaterial] | List[RefractiveIndex]#
- shell_refractive_index: List[BaseMaterial] | List[RefractiveIndex]#
- shell_thickness: Length#
- source: BaseSource#