ozzy.statistics
The statistics submodule encompasses functions that process particle data or otherwise synthesize data into lower-dimensional measures. A classic example is getting the centroid (mean transverse position) of a particle distribution.
_check_n0_input
§
_check_n0_input(n0, xi_var)
Check if the xi_var
is provided when n0
is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float | None
|
Reference density value. |
required |
|
str | None
|
Name of the variable representing the \(\xi\) axis. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If |
Notes
If n0
and xi_var
are both provided, a warning is printed assuming the \(\xi\) axis is in normalized units.
_check_raw_and_grid
§
_check_raw_and_grid(raw_ds, grid_ds)
Check if the input datasets contain particle and grid data, respectively.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset
|
Dataset containing particle data. |
required |
|
Dataset
|
Dataset containing grid data. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the input datasets do not contain particle and grid data, respectively. |
_define_q_units
§
_define_q_units(n0, xi_var, dens_ds)
Define the units for the charge density based on the data origin and input parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
float | None
|
Reference density value. |
required |
|
str | None
|
Name of the variable representing the xi axis. |
required |
|
Dataset
|
Dataset containing density data. |
required |
Returns:
Name | Type | Description |
---|---|---|
units_str |
str
|
String representing the units for the charge density. |
charge_in_field_quadrants
§
charge_in_field_quadrants(
raw_ds,
fields_ds,
time_dim="t",
weight_var="q",
n0=None,
xi_var=None,
)
Calculate the amount of charge in different quadrants of the "field space". By quadrants we mean the four possible combinations of positive/negative longitudinal fields and positive/negative transverse fields.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset
|
Dataset containing particle data. |
required |
|
Dataset
|
Dataset containing field data. Warning This function expects the |
required |
|
str
|
Name of the time dimension in the input datasets. Default is |
't'
|
|
str
|
Name of the variable representing particle weights or particle charge in |
'q'
|
|
float | None
|
Reference plasma density value, in \(\mathrm{cm}^{-3}\). If provided, the charge is converted to physical units. Default is None. |
None
|
|
str | None
|
Name of the variable representing the longitudinal axis. Required if |
None
|
Returns:
Name | Type | Description |
---|---|---|
charge_ds |
Dataset
|
Dataset containing the charge in different quadrants of the "field space". |
Raises:
Type | Description |
---|---|
ValueError
|
If the input datasets do not contain particle and grid data, respectively, or if |
field_space
§
field_space(raw_ds, fields_ds, spatial_dims=['x1', 'x2'])
Get values of fields in the cell where each particle is located (no interpolation is done).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Dataset
|
Dataset containing particle data. |
required |
|
Dataset
|
Dataset containing field data. |
required |
|
list[str]
|
List of spatial dimension names in the input datasets. Default is |
['x1', 'x2']
|
Returns:
Name | Type | Description |
---|---|---|
raw_ds |
Dataset
|
Dataset containing particle data with interpolated field values. |
Raises:
Type | Description |
---|---|
ValueError
|
If the input datasets contain a time dimension, or if the input datasets do not contain particle and grid data, respectively. |
Warning
This function assumes that the second element of spatial_dims
is the vertical dimension.