idstools.compute.edge_profiles¶
This module provides compute functions and classes for edge_profiles ids data
Module Contents¶
- class idstools.compute.edge_profiles.EdgeProfilesCompute(ids)[source]¶
This class provides compute functions for edge profiles ids.
- ids¶
The edge profiles IDS (Integrated Data Structure) object containing edge and scrape-off layer plasma profile data including density, temperature, and potential profiles near the plasma boundary.
- ids¶
- combine_species_when_appear_twice(time_slice, species, nspec_over_ntot, nspec_over_ne, nspec_over_nmaj)[source]¶
This is helper function which checks if there are duplicate entries of species and combine the species. This is in place change of arrays
-
get_a(time_slice: int, element_index: int =
0) list[source]¶ This function returns a list of atomic masses for a given slice and element index.
- Parameters:¶
- Returns:¶
a list of atomic masses for each species in the given slice index and element index.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_a(time_slice=0) [2.0, 4.0, 20.0, 9.0, 2.0]
- get_core_boundry(time_slice)[source]¶
This function get_core_boundry retrieves coordinates for core boundary elements from grid subsets based on specified indices.
- Parameters:¶
- time_slice¶
The time_slice parameter
- Returns:¶
the coordinates of the elements in the grid subset that corresponds to either the core_boundry
or core subset, depending on which one is found and has non-zero elements.
- get_density(time_slice)[source]¶
This function retrieves the electron density array for a given slice index and returns it.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
the electron density array for a specific slice index, and also logging the array and the total electron density.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getDensity(time_slice=0) array([1.83014037e+19, 2.86305333e+19, 4.50302324e+19, 6.99266610e+19, 1.04025196e+20, 1.56969187e+20, 2.32851365e+20, 3.45402170e+20, 4.94164863e+20, 7.07373803e+20])
- get_electron_density(time_slice, x, y)[source]¶
The function get_electron_density calculates the electron density at a given position (x, y) by interpolating values from a grid.
- get_ion_density(time_slice, x, y)[source]¶
The function get_ion_density calculates the ion density at a given position (x, y) by interpolating values from a grid.
- get_labels(time_slice: int)[source]¶
This function returns a list of labels for all species in a given time slice.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getLabels(time_slice=0) ['D', 'He', 'Ne', 'Be', ' D2+']
- get_ne(time_slice: int) float[source]¶
This function calculates the total number of electrons (ne) based on the volume and electron density of a given slice.
- Parameters:¶
- Returns:¶
the total number of electrons (ne) in the given slice of the object, calculated by multiplying the volume of the slice with its electron density and summing the results.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_ne(time_slice=0) 1.7465285792413856e+22
- get_neutral_density(time_slice, x, y)[source]¶
The function get_neutral_density calculates the neutral density at a given position (x, y) by interpolating values from a grid.
- get_nspec_over_ne(time_slice)[source]¶
This function calculates the ratio of species density to electron density.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
the ratio of the species density list to the electron density (ne).
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_nspec_over_ne(time_slice=0) array([9.49141717e-01, 7.83135442e-03, 3.56547366e-03, 7.73580187e-04, 4.78443692e-06])
- get_nspec_over_nmaj(time_slice) list[source]¶
This function returns a list of the ratio of each species density to the maximum species density.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
a list of values obtained by dividing each element of the list species_density_list by the maximum value in that list. This list represents the ratio of the density of each species to the density of the most abundant species.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_nspec_over_nmaj() array([1.00000000e+00, 8.25098537e-03, 3.75652402e-03, 8.15031278e-04,5.04080353e-06])
- get_nspec_over_ntot(time_slice)[source]¶
This function calculates the ratio of the number of species to the total number of particles in a plasma.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
The function get_nspec_over_ntot is returning the ratio of the list of species densities to the total density (ntot).
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_nspec_over_ntot(time_slice=0) array([9.87334881e-01, 8.14648566e-03, 3.70894720e-03, 8.04708810e-04, 4.97696116e-06])
- get_outer_midplane_array_index(time_slice)[source]¶
This function get_outer_midplane_array_index searches for a specific grid subset with an index of 11 and returns its position within the list of subsets.
- Returns:¶
The function getOuterMidplaneArrayIndex returns the index of the grid subset that has an identifier index of 11, representing the outer midplane GGD grid subset. If the subset is found, it returns the index of that subset. If the subset is not found, it logs a warning message and returns None.
- static get_plasma_composition_with_species_concentration(ids, time_slice) dict | int[source]¶
- Function retrives composition and species concentration in below format
- Spcies_label
a
nspec_over_ne
nspec_over_nmaj
nspec_over_ntot
species [mendeleiev_table]
- states
label
n_ni
states_density [list]
z_average
Example
import imas from idstools.compute.edge_profiles import EdgeProfilesCompute connection = imas.DBEntry( "imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') connection.close() result = EdgeProfilesCompute.get_plasma_composition_with_species_concentration(idsObj, 0) {'0': {'a': 2.0, 'label': 'D', 'nspec_over_ne': 0.0, 'nspec_over_nmaj': 0.0, 'nspec_over_ntot': 0.0, 'species': 'D', 'states': {'0': {'label': ' D+1', 'n_ni': 100.0, 'states_density': [1.6577031350573213e+22], 'z_average': 1.0}}, 'z': 1}, '1': {'a': 4.0, 'label': 'He', 'nspec_over_ne': 0.007831354424836625, 'nspec_over_nmaj': 0.008250985371197173, 'nspec_over_ntot': 0.008146485662619047, 'species': 'He4', 'states': {'0': {'label': ' He+1', 'n_ni': 0.9279275264034698, 'states_density': [1.2691899775336492e+18, 1.3550765319392264e+20], 'z_average': 1.0}, '1': {'label': ' He+2', 'n_ni': 99.07207247359639, 'states_density': [1.2691899775336492e+18, 1.3550765319392264e+20], 'z_average': 2.0}}, 'z': 2},
-
get_rectangular_grid(num_points=
400)[source]¶ The function get_rectangular_grid returns two arrays x and y that represent a meshgrid of points within a specified range.
- get_rz(time_slice)[source]¶
The function get_rz returns the r_edge and z_edge coordinates of vertices in a grid.
- get_separatrix(time_slice)[source]¶
This function get_separatrix retrieves coordinates for the separatrix from a grid subset based on a given time slice.
- Parameters:¶
- time_slice¶
The time_slice parameter
- Returns:¶
The function get_separatrix is returning the coordinates of the separatrix elements found in the grid subset for the given time slice. The coordinates are stored in a NumPy array sep_coords, where each row represents the coordinates of a separatrix element.
- get_species(time_slice) list[source]¶
This function creates a Mendeleiev table and returns a list of species based on the values of a, z, and the table.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
a list of species based on the values of a, z, and the Mendeleev table.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getSpecies() ['D', 'He4', 'Ne', 'Be', 'D']
- get_species_density(time_slice: int) tuple[source]¶
This function calculates the density of different species in a given slice and returns a tuple containing the species density list, the total density, and the index of the species with the maximum density.
- Parameters:¶
- Returns:¶
a list of species density, the total density of all species, and the index of the species with the maximum density.
- Return type:¶
a tuple containing three values
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getSpeciesDensity(time_slice=0) ([1.6577031350573213e+22, 1.3677684317145648e+20, 6.227201649981566e+19, 1.3510799045753078e+19, 8.356155820974862e+16], 1.6789674570848447e+22, 0)
- get_states(time_slice: int)[source]¶
This function returns quantities related to the different states of the species (ionisation, energy, excitation, …) for each species
- Parameters:¶
- Returns:¶
a list of states (ionisation, energy, excitation, etc.) in the input data of each species .
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getStates(time_slice=0) print(result[0]) # state object from species # class 'imas_3_38_1_ual_4_11_4.edge_profiles.ggd_ion_state__structArray'
- get_states_data(time_slice: int) dict[source]¶
This function returns a dictionary containing data on the states and densities of different species in a plasma simulation.
- Parameters:¶
- Returns:¶
a dictionary containing information about the states of different species in a plasma, including their labels, z-averages, densities, and relative densities.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getStatesData(time_slice=0) {'0': {'0': {'label': ' D+1', 'n_ni': 100.0, 'states_density': [1.6577031350573213e+22], 'z_average': 1.0}}, '1': {'0': {'label': ' He+1', 'n_ni': 0.9279275264034698, 'states_density': [1.2691899775336492e+18, 1.3550765319392264e+20], 'z_average': 1.0}, '1': {'label': ' He+2', 'n_ni': 99.07207247359639, 'states_density': [1.2691899775336492e+18, 1.3550765319392264e+20], 'z_average': 2.0}},
- get_volume(time_slice) list | None[source]¶
This function calculates the volume of a grid subset using either pre-calculated volume data or by manually calculating it from the nodes.
- Parameters:¶
- time_slice¶
time slice on which function should operate on. Defaults to 0.
- Returns:¶
a list of volumes for each element in the grid subset. If the volumes are not available in the cells, it calculates the volumes manually from the nodes. If the volumes are still empty, it returns None. Finally, it returns the volumes list.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.getVolume(time_slice=0) [0.00037247887179986, 0.00036873285033229, 0.00036505732877168, 0.00035287806726545, 0.00034083126399982, 0.00032428140427918, 0.00030192063059504, 0.00027702026849475, 0.0002505748085483, 0.00021528820409221]
-
get_z(time_slice: int, element_index: int =
0) list[source]¶ This function returns a list of nuclear charges for each species in a given slice and element index.
- Parameters:¶
- Returns:¶
a list of nuclear charges for each species in the given time_slice and element_index.
Example
import imas connection = imas.DBEntry("imas:mdsplus?user=public;pulse=123276;run=1;database=ITER;version=3", "r") idsObj = connection.get('edge_profiles') computeObj = EdgeProfilesCompute(idsObj) result = computeObj.get_z(time_slice=0) [1, 2, 10, 4, 1]
- getnrho(time_slice)[source]¶
This function getnrho returns the number of elements in the rho_tor_norm or rho_tor grid based on the provided slice index.
- Parameters:¶
- time_slice¶
The time_slice parameter in the getnrho method is used to specify which slice of the profiles_1d data to access.
- Returns:¶
The getnrho method is returning the number of elements in the rho_tor_norm or rho_tor attribute of the grid object within the profiles_1d attribute of the ids object at the specified time_slice. If either of these attributes has elements, the length of that attribute is returned as the number of elements (nrho).
- idstools.compute.edge_profiles.logger¶