from numbers import Numbervelocitygroups
Create and manipulate a list of bins of the atomic velocity distribution for use in the LGS model
VelocityGroups
def VelocityGroups(
bins:Union=6, # Iterable of velocity group edges or int specifying number of evenly spaced velocity groups
range:Union=3, # Default range (`min_vel`, `max_vel`) or half-width `max_vel` for velocity groups
):
VelocityGroups contains informations about the centers, edges, and relative densities of a list of velocity group bins.
Create a list of two evenly spaced velocity groups:
vg = VelocityGroups(2)
vg{'VGCenter': array([ -1.5 , 1.5 ]),
'VGDensity': array([ 0.5 , 0.5 ]),
'VGWidth': array([ 3.0 , 3.0 ]),
'VGInverseWidth': array([ 0.33 , 0.33 ]),
'VGNumber': 2,
'velocity_groups': array([ 1.0 , 1.0 ])}
VelocityGroups.subdivide
def subdivide(
indices:int | numpy.ndarray | slice=slice(None, None, None), # Indices, boolean array, or slice object specifying velocity groups to subdivide
n:int=2, # Number of groups to subdivide into
):
Divide the velocity groups with indices indices in two.
Return a new VelocityGroups object with the groups at index 1 divided in two:
vg.subdivide([1]).subdivide([1, 2]){'VGCenter': array([ -1.5 , 0.38 , 1.1 , 1.9 , 2.6 ]),
'VGDensity': array([ 0.5 , 0.36 , 0.13 , 0.016 , 0.00072]),
'VGWidth': array([ 3.0 , 0.75 , 0.75 , 0.75 , 0.75 ]),
'VGInverseWidth': array([ 0.33 , 1.3 , 1.3 , 1.3 , 1.3 ]),
'VGNumber': 5,
'velocity_groups': array([ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ])}
vg.subdivide([1], n=4){'VGCenter': array([ -1.5 , 0.38 , 1.1 , 1.9 , 2.6 ]),
'VGDensity': array([ 0.5 , 0.36 , 0.13 , 0.016 , 0.00072]),
'VGWidth': array([ 3.0 , 0.75 , 0.75 , 0.75 , 0.75 ]),
'VGInverseWidth': array([ 0.33 , 1.3 , 1.3 , 1.3 , 1.3 ]),
'VGNumber': 5,
'velocity_groups': array([ 1.0 , 1.0 , 1.0 , 1.0 , 1.0 ])}
VelocityGroups.identity
def identity(
)->Operator:
The velocity-space identity operator.
vg.identity()-
- IdentityOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
# _.to_numpy()VelocityGroups.velocity_diagonal
def velocity_diagonal(
)->Operator:
A velocity-space operator with the velocity on the diagonal.
vg.velocity_diagonal()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 32B <COO: shape=(2, 2), dtype=float64, nnz=2, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ -1.5 , 0 ],
[ 0 , 1.5 ]])
velocity_density_vector
def velocity_density_vector(
vg
):
VelocityGroups.n_times_1
def n_times_1(
)->Operator:
Operator that sums over all velocity groups then scales by the Maxwell-Boltzmann distribution.
vg.n_times_1()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 96B <COO: shape=(2, 2), dtype=float64, nnz=4, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ 0.5 , 0.5 ],
[ 0.5 , 0.5 ]])
VelocityGroups.drho_dv
def drho_dv(
)->Operator:
Derivative with respect to velocity operator.$
vg.drho_dv()-
- XarrayMatrixOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
<xarray.DataArray (Atomic velocity (range): 2, Atomic velocity (source): 2)> Size: 48B <COO: shape=(2, 2), dtype=float64, nnz=3, fill_value=0.0> Coordinates: * Atomic velocity (range) (Atomic velocity (range)) float64 16B -1.5 1.5 * Atomic velocity (source) (Atomic velocity (source)) float64 16B -1.5 1.5
_.to_numpy()array([[ 0.33 , 0 ],
[ -0.33 , 0.33 ]])
VelocityGroups.normalize
def normalize(
)->Operator:
Returns the operator that normalizes a vector by dividing each component by the width of the corresponding velocity group.
vg.normalize()-
- ScaleOperator
- Atomic velocity(2) → Atomic velocity(2)
- []
VelocityGroups.sum
def sum(
)->Operator:
Returns the operator that sums a vector over velocity groups.
vg.sum()-
- SumOperator
- Atomic velocity(2) → Sum(1)
- []