scatteringmodel API
mixscatter.scatteringmodel
Calculate form factors of multicomponent systems.
This module provides classes and functions for calculating form factors of multicomponent systems. It includes definitions for various layer profiles, particles composed of these layers, and models to calculate scattering properties for these particles.
Classes:
| Name | Description |
|---|---|
LayerProfile |
Defines the interface for layer profiles. |
EmptyProfile |
Represents an empty layer profile. |
ConstantProfile |
Represents a layer profile with constant contrast. |
LinearProfile |
Represents a layer profile with linearly varying contrast. |
Particle |
Represents a particle composed of multiple layers. |
ParticleBuilder |
A builder class for constructing Particle instances. |
ScatteringModel |
Calculates scattering properties for a list of particles. |
SimpleSphere |
A convenience class for creating a scattering model of homogeneously scattering spheres. |
SimpleCoreShell |
A convenience class for creating a scattering model of core-shell particles. |
SimpleGradient |
A convenience class for creating a scattering model with gradient profiles. |
Examples:
Create a simple scattering model for spheres:
>>> from mixscatter.mixture import Mixture
>>> import numpy as np
>>> wavevector = np.linspace(0.01, 1.0, 100)
>>> mixture = Mixture(number_fraction=[0.5, 0.5], radius=[1.0, 2.0])
>>> model = SimpleSphere(wavevector, mixture, contrast=1.0)
>>> form_factor = model.average_form_factor
Create a core-shell particle model:
>>> model = SimpleCoreShell(wavevector, mixture, core_to_total_ratio=0.5, core_contrast=1.0, shell_contrast=0.5)
>>> form_factor = model.average_form_factor
Create a gradient profile particle model:
>>> model = SimpleGradient(wavevector, mixture, center_contrast=1.0, boundary_contrast=0.5)
>>> form_factor = model.average_form_factor
ConstantProfile
Bases: LayerProfile
Represents a layer profile with constant contrast.
Attributes:
| Name | Type | Description |
|---|---|---|
radius_inner |
float
|
Inner radius of the layer. |
radius_outer |
float
|
Outer radius of the layer. |
contrast |
float
|
Scattering contrast of the layer. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a constant layer profile. |
calculate_amplitude |
Calculate the amplitude for the given wavevector. |
calculate_forward_amplitude |
Calculate the forward amplitude. |
get_profile |
Get the profile for the given distance from the origin. |
calculate_second_moment |
Calculate the second moment. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
__init__(radius_inner, radius_outer, contrast)
Initialize a constant layer profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius_inner
|
float
|
Inner radius of the layer. |
required |
radius_outer
|
float
|
Outer radius of the layer. |
required |
contrast
|
float
|
Scattering contrast of the layer. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_amplitude(wavevector)
Calculate the amplitude for the given wavevector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Scattering wavevector. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Calculated amplitude array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_forward_amplitude()
Calculate the forward amplitude.
Returns:
| Type | Description |
|---|---|
float
|
The calculated forward amplitude. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_second_moment()
Calculate the second moment.
Returns:
| Type | Description |
|---|---|
float
|
The calculated second moment. |
get_profile(distance)
Get the profile for the given distance from the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
ArrayLike
|
Distance from the origin. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The profile evaluated on the distance array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
EmptyProfile
Bases: LayerProfile
Represents an empty layer profile.
Attributes:
| Name | Type | Description |
|---|---|---|
radius_inner |
float
|
Inner radius of the empty layer. |
radius_outer |
float
|
Outer radius of the empty layer. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize an empty layer profile. |
calculate_amplitude |
Calculate the amplitude for the given wavevector. |
calculate_forward_amplitude |
Calculate the forward amplitude. |
get_profile |
Get the profile for the given distance from the origin. |
calculate_second_moment |
Calculate the second moment. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
__init__(radius_inner, radius_outer)
Initialize an empty layer profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius_inner
|
float
|
Inner radius of the empty layer. |
required |
radius_outer
|
float
|
Outer radius of the empty layer. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_amplitude(wavevector)
Calculate the amplitude for the given wavevector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Scattering wavevector. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Zero array of the same shape as wavevector. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_forward_amplitude()
calculate_second_moment()
get_profile(distance)
Get the profile for the given distance from the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
ArrayLike
|
Distance from the origin. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Zero array of the same shape as distance. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
LayerProfile
Bases: Protocol
Defines the interface for layer profiles.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_amplitude(wavevector)
calculate_forward_amplitude()
calculate_second_moment()
LinearProfile
Bases: LayerProfile
Represents a layer profile with linearly varying contrast.
Attributes:
| Name | Type | Description |
|---|---|---|
radius_inner |
float
|
Inner radius of the layer. |
radius_outer |
float
|
Outer radius of the layer. |
contrast_inner |
float
|
Contrast at the inner radius. |
contrast_outer |
float
|
Contrast at the outer radius. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a linearly varying layer profile. |
calculate_amplitude |
Calculate the amplitude for the given wavevector. |
calculate_forward_amplitude |
Calculate the forward amplitude. |
get_profile |
Get the profile for the given distance from the origin. |
calculate_second_moment |
Calculate the second moment. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
__init__(radius_inner, radius_outer, contrast_inner, contrast_outer)
Initialize a linearly varying layer profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius_inner
|
float
|
Inner radius of the layer. |
required |
radius_outer
|
float
|
Outer radius of the layer. |
required |
contrast_inner
|
float
|
Contrast at the inner radius. |
required |
contrast_outer
|
float
|
Contrast at the outer radius. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If radius_inner is greater than radius_outer. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
_two_point_to_slope_intercept(x_1, y_1, x_2, y_2)
staticmethod
Calculate the slope and intercept for a linear function passing through two points.
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
A tuple containing the intercept and slope. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_amplitude(wavevector)
Calculate the amplitude for the given wavevector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Scattering wavevector. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The calculated amplitude array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_forward_amplitude()
Calculate the forward amplitude.
Returns:
| Type | Description |
|---|---|
float
|
The calculated forward amplitude. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_second_moment()
Calculate the second moment.
Returns:
| Type | Description |
|---|---|
float
|
The calculated second moment. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
get_profile(distance)
Get the profile for the given distance from the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
ArrayLike
|
Distance from the origin. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The profile evaluated on the distance array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
Particle
Represents a particle composed of multiple layers.
Attributes:
| Name | Type | Description |
|---|---|---|
layers |
list
|
List of |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a particle with given layers. |
calculate_amplitude |
Calculate the amplitude for the given wavevector. |
calculate_forward_amplitude |
Calculate the forward amplitude. |
calculate_form_factor |
Calculate the form factor for the given wavevector. |
get_profile |
Get the profile for the given distance from the origin. |
calculate_square_radius_of_gyration |
Calculate the squared radius of the gyration. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
__init__(layers)
Initialize a particle with given layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layers
|
list[LayerProfile]
|
List of |
required |
calculate_amplitude(wavevector)
Calculate the amplitude for the given wavevector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Scattering wavevector. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The calculated amplitude array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_form_factor(wavevector)
Calculate the form factor for the given wavevector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Scattering wavevector. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The calculated form factor array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_forward_amplitude()
Calculate the forward amplitude.
Returns:
| Type | Description |
|---|---|
float
|
The calculated forward amplitude. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
calculate_square_radius_of_gyration()
Calculate the squared radius of the gyration. Returns: The calculated squared radius of the gyration.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
get_profile(distance)
Get the profile for the given distance from the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
ArrayLike
|
Distance from the origin. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The profile evaluated on the distance array. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
ParticleBuilder
A builder class for constructing Particle instances.
This class facilitates the step-by-step construction of Particle objects composed of multiple
layers, where each layer is represented by a LayerProfile instance. The builder ensures that layers
are added sequentially, with checks for connectivity between layers and overlap prevention.
Attributes:
| Name | Type | Description |
|---|---|---|
layers |
list
|
List to store |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes an empty |
add_layer |
Adds a layer to the particle being built. Ensures the new layer connects correctly to the previous layer and does not overlap with existing layers. |
reset |
Resets the builder instance, clearing all layers stored in the layers list. |
get_particle |
Constructs and returns a |
pop_particle |
Constructs and returns a |
Usage
The typical usage involves creating a ParticleBuilder instance, adding layers using add_layer(),
and finally retrieving the constructed particle using get_particle() or pop_particle().
Example
Construct a particle using ParticleBuilder:
>>> from mixscatter.scatteringmodel import ParticleBuilder, ConstantProfile
>>> layer1 = ConstantProfile(radius_inner=0.0, radius_outer=2.0, contrast=1.0)
>>> layer2 = ConstantProfile(radius_inner=2.0, radius_outer=5.0, contrast=0.5)
>>> builder = ParticleBuilder()
>>> particle = builder.add_layer(layer1).add_layer(layer2).get_particle()
Notes
- The add_layer() method ensures that each added layer starts where the previous layer ends, preventing gaps or overlaps between layers.
- The reset() method allows reusing the same builder instance to construct multiple particles.
- The pop_particle() method is useful when constructing and retrieving particles in a single step, resetting the builder for the next particle construction.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
Raised by add_layer() method if the added layer does not connect correctly to the previous layer or if there is an overlap with existing layers. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | |
__init__()
add_layer(layer)
Add a layer to the particle being built.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer
|
LayerProfile
|
|
required |
Returns:
| Type | Description |
|---|---|
Self
|
The builder instance. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the added layer does not connect to the previous layer or if layers overlap. |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
get_particle()
Constructs and returns a Particle instance using the layers added so far.
Returns:
| Type | Description |
|---|---|
Particle
|
The constructed |
pop_particle()
Constructs and returns a Particle instance using the layers added so far,
then resets the builder instance to start building a new particle.
Returns:
| Name | Type | Description |
|---|---|---|
Particle |
Particle
|
The constructed |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
ScatteringModel
Calculates scattering properties for a list of particles.
This class computes various scattering properties, including amplitudes, form factors, and averages over multiple particles. It handles both single-particle and multi-particle scattering scenarios.
Attributes:
| Name | Type | Description |
|---|---|---|
wavevector |
NDArray[float64]
|
Array of wavevector values at which scattering properties are computed. |
mixture |
MixtureLike
|
|
particles |
list
|
List of |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes a |
Usage
The typical usage involves creating an instance of ScatteringModel with wavevector, mixture,
and a list of particles. Methods such as amplitude(), average_form_factor(), etc., can then
be called to compute specific scattering properties.
Example
Create a ScatteringModel instance from a list of particles:
>>> import numpy as np
>>> from mixscatter import Mixture, Particle, ScatteringModel
>>> wavevector = np.linspace(0.01, 1.0, 100)
>>> mixture = Mixture(number_fraction=[0.5, 0.5], radius=[1.0, 2.0])
>>> particle1 = Particle([ConstantProfile(0, 1.0, 1.0)])
>>> particle2 = Particle([ConstantProfile(0, 2.0, 0.5)])
>>> model = ScatteringModel(wavevector, mixture, [particle1, particle2])
>>> form_factor = model.average_form_factor
Notes
- Scattering calculations are cached for efficiency.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
amplitude
cached
property
Calculates the scattering amplitude for each particle.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Array of amplitudes for each particle at each wavevector point. |
average_form_factor
cached
property
The average squared scattering amplitude, normalized by the average forward scattering amplitude.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The average form factor. |
average_square_amplitude
cached
property
The sum of the squared scattering amplitudes, weighted by the number fraction.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The average squared scattering amplitude. |
average_square_forward_amplitude
cached
property
The sum of the squared forward scattering amplitudes, weighted by the number fraction.
Returns:
| Type | Description |
|---|---|
float
|
The average squared forward scattering amplitude. |
average_square_radius_of_gyration
cached
property
Computes the average, apparent radius of gyration of the system. The apparent radius of gyration determines the initial slope of the average form factor.
Returns:
| Type | Description |
|---|---|
float
|
The average radius of gyration of the system. |
forward_amplitude
cached
property
Calculate the forward amplitude for each particle.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
An array of forward amplitudes for each particle. |
single_form_factor
cached
property
Computes the normalized form factors of the single species particles.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Form factors of the single species particles. |
square_radius_of_gyration
cached
property
Calculate the radius of gyration for each particle.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
An array containing the square radius of gyration for each particle. |
__init__(wavevector, mixture, particles)
Initializes a ScatteringModel instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Array of wavevector values at which scattering properties are computed. |
required |
mixture
|
MixtureLike
|
Mixture object containing number fractions and radii of particle components. |
required |
particles
|
list[Particle]
|
List of |
required |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
SimpleCoreShell
Bases: ScatteringModel
A convenience class for creating a scattering model of core-shell particles with a constant core-to-shell ratio.
This class simplifies the creation of a scattering model where particles are represented by core-shell structures with varying contrasts for the core and shell layers.
Attributes:
| Name | Type | Description |
|---|---|---|
wavevector |
NDArray[float64]
|
Array of wavevector values at which scattering properties are computed. |
mixture |
MixtureLike
|
|
particles |
list
|
List of |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes a |
Usage
The typical usage involves creating an instance of SimpleCoreShell with specific wavevector, mixture,
core-shell ratio, and contrast parameters, then using its inherited methods to compute scattering
properties.
Example
Initialize a SimpleCoreShell instance with wavevector, mixture, and contrast parameters
>>> import numpy as np
>>> from mixscatter import Mixture, SimpleCoreShell
>>> wavevector = np.linspace(0.01, 1.0, 100)
>>> mixture = Mixture(number_fraction=[0.5, 0.5], radius=[1.0, 2.0])
>>> model = SimpleCoreShell(
... wavevector, mixture, core_to_total_ratio=0.5, core_contrast=1.0, shell_contrast=0.5
... )
>>> form_factor = model.average_form_factor
Notes
- The particle radii are inferred from the provided
Mixtureinstance.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
__init__(wavevector, mixture, core_to_total_ratio, core_contrast, shell_contrast)
Initializes a SimpleCoreShell instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Array of wavevector values at which scattering properties are computed. |
required |
mixture
|
MixtureLike
|
|
required |
core_to_total_ratio
|
float
|
Ratio of core radius to total particle radius. |
required |
core_contrast
|
float
|
Scattering contrast of the core. |
required |
shell_contrast
|
float
|
Scattering contrast of the shell. |
required |
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
SimpleGradient
Bases: ScatteringModel
A convenience class for creating a scattering model of particles with a linear contrast gradient.
This class simplifies the creation of a scattering model representing particles with a scattering contrast varying linearly from the contrast at the particle center to the contrast at the boundary.
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes a |
Usage
The typical usage involves creating an instance of SimpleGradient with specific wavevector, mixture,
and contrast profile, then using its inherited methods to compute scattering properties.
Example
Initialize a SimpleGradient instance with wavevector, mixture, and contrast parameters:
>>> import numpy as np
>>> from mixscatter import Mixture
>>> wavevector = np.linspace(0.01, 1.0, 100)
>>> mixture = Mixture(number_fraction=[0.5, 0.5], radius=[1.0, 2.0])
>>> model = SimpleGradient(wavevector, mixture, center_contrast=1.0, boundary_contrast=0.5)
>>> form_factor = model.average_form_factor
Notes
- The particle radii are inferred from the provided
Mixtureinstance.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
SimpleSphere
Bases: ScatteringModel
A convenience class for creating a scattering model of homogeneously scattering spheres.
This class simplifies the creation of a scattering model where particles are represented by homogeneously scattering spheres with a common, constant contrast.
Attributes:
| Name | Type | Description |
|---|---|---|
wavevector |
NDArray[float64]
|
Array of wavevector values at which scattering properties are computed. |
mixture |
MixtureLike
|
|
particles |
list
|
List of |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes a |
Usage
The typical usage involves creating an instance of SimpleSphere with specific wavevector,
mixture, and contrast parameters, then using its inherited methods to compute scattering properties.
Example
Initialize a SimpleSphere instance with wavevector, mixture, and contrast parameters:
>>> import numpy as np
>>> from mixscatter import Mixture, SimpleSphere
>>> wavevector = np.linspace(0.01, 1.0, 100)
>>> mixture = Mixture(number_fraction=[0.5, 0.5], radius=[1.0, 2.0])
>>> model = SimpleSphere(wavevector, mixture, contrast=1.0)
>>> form_factor = model.average_form_factor
Notes
- The particle radii are inferred from the provided
Mixtureinstance.
Source code in src/mixscatter/scatteringmodel/scatteringmodel.py
__init__(wavevector, mixture, contrast)
Initializes a SimpleSphere instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavevector
|
ArrayLike
|
Array of wavevector values at which scattering properties are computed. |
required |
mixture
|
MixtureLike
|
|
required |
contrast
|
float
|
Scattering contrast of the spheres. |
required |