Nickname Setting
Overview¤
A module for handling the EFIT tree nickname passed in the RetrievalSettings
class.
DisruptionPy uses the nickname setting to determine which MDSplus EFIT tree to get data from.
This module defines the abstract class NicknameSetting
that can have subclasses passed as the
efit_nickname_setting
parameter to the RetrievalSettings
class.
It also provides built-in classes and mappings to easily set the nickname for data retrieval for common use cases.
Usage¤
Currently, these are the options that can be passed to the efit_nickname_setting
parameter in RetrievalSettings
:
- An instance of a subclass of
NicknameSetting
- A string identifier in the
_nickname_setting_mappings
dictionary:_nickname_setting_mappings: Dict[str, NicknameSetting] = { "default": DefaultNicknameSetting(), "disruption": DisruptionNicknameSetting(), # deprecated "analysis": DefaultNicknameSetting(), "disruption_warning": DisruptionNicknameSetting(), }
- A dictionary mapping tokamak type strings to the desired
NicknameSetting
for that tokamak. E.g.{'cmod': 'efit'}
. Currently supported tokamak type strings are:"cmod", "d3d"
Built-in Implemenations¤
This module provides classes for handling nickname settings, which are used to resolve MDSplus tree names for various tokamaks.
disruption_py.settings.nickname_setting.StaticNicknameSetting ¤
Bases: NicknameSetting
Static nickname setting that always returns a fixed tree name.
PARAMETER | DESCRIPTION |
---|---|
tree_name |
The tree name to be returned.
TYPE:
|
Source code in disruption_py/settings/nickname_setting.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
__init__ ¤
__init__(tree_name: str)
PARAMETER | DESCRIPTION |
---|---|
tree_name |
The fixed tree name.
TYPE:
|
Source code in disruption_py/settings/nickname_setting.py
160 161 162 163 164 165 166 167 168 169 |
|
_get_tree_name ¤
_get_tree_name(params: NicknameSettingParams) -> str
Return the static tree name.
PARAMETER | DESCRIPTION |
---|---|
params |
Parameters needed to determine the nickname.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The fixed tree name. |
Source code in disruption_py/settings/nickname_setting.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
disruption_py.settings.nickname_setting.DefaultNicknameSetting ¤
Bases: NicknameSetting
Nickname setting to resolve the '_efit_tree' nickname to the default EFIT tree.
Source code in disruption_py/settings/nickname_setting.py
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 |
|
__init__ ¤
__init__()
Source code in disruption_py/settings/nickname_setting.py
193 194 195 196 197 198 199 200 |
|
_get_tree_name ¤
_get_tree_name(params: NicknameSettingParams) -> str
Raise error if tokamak override is not found.
PARAMETER | DESCRIPTION |
---|---|
params |
Parameters needed to determine the nickname.
TYPE:
|
Source code in disruption_py/settings/nickname_setting.py
202 203 204 205 206 207 208 209 210 211 212 213 |
|
disruption_py.settings.nickname_setting.DisruptionNicknameSetting ¤
Bases: NicknameSetting
Nickname setting to resolve the '_efit_tree' nickname to the disruption EFIT tree.
Source code in disruption_py/settings/nickname_setting.py
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 259 260 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 |
|
__init__ ¤
__init__()
Source code in disruption_py/settings/nickname_setting.py
221 222 223 224 225 226 227 228 |
|
_cmod_nickname ¤
_cmod_nickname(params: NicknameSettingParams) -> str
Get the disruption EFIT tree name for CMOD.
PARAMETER | DESCRIPTION |
---|---|
params |
Parameters needed to determine the nickname.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The resolved EFIT tree name. |
Source code in disruption_py/settings/nickname_setting.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
_d3d_nickname ¤
_d3d_nickname(params: NicknameSettingParams) -> str
Get the disruption EFIT tree name for D3D.
PARAMETER | DESCRIPTION |
---|---|
params |
Parameters needed to determine the nickname.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The resolved EFIT tree name. |
Source code in disruption_py/settings/nickname_setting.py
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 |
|
_get_tree_name ¤
_get_tree_name(params: NicknameSettingParams) -> str
Raise error if tokamak override is not found.
PARAMETER | DESCRIPTION |
---|---|
params |
Parameters needed to determine the nickname.
TYPE:
|
Source code in disruption_py/settings/nickname_setting.py
275 276 277 278 279 280 281 282 283 284 285 286 |
|
Custom Implementations¤
Custom implementations of a nickname setting must inherit from the NicknameSetting
abstract class, implementing the abstract methods.
This module provides classes for handling nickname settings, which are used to resolve MDSplus tree names for various tokamaks.
disruption_py.settings.nickname_setting.NicknameSetting ¤
Bases: ABC
Abstract base class for nickname settings to resolve tree names for MDSPlus data.
METHOD | DESCRIPTION |
---|---|
get_tree_name |
Resolve the tree name based on the given params. |
Source code in disruption_py/settings/nickname_setting.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
_get_tree_name
abstractmethod
¤
_get_tree_name(params: NicknameSettingParams) -> str
Abstract method for resolving the MDSPlus tree name.
PARAMETER | DESCRIPTION |
---|---|
params |
The parameters required to retrieve the tree name.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The resolved MDSPlus tree name. |
Source code in disruption_py/settings/nickname_setting.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
get_tree_name ¤
get_tree_name(params: NicknameSettingParams) -> str
Resolve the MDSPlus tree name using the provided params.
PARAMETER | DESCRIPTION |
---|---|
params |
The parameters needed to determine the tree name.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The resolved MDSPlus tree name. |
Source code in disruption_py/settings/nickname_setting.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
disruption_py.settings.nickname_setting.NicknameSettingParams
dataclass
¤
Parameters passed to nickname trees for resolving tree nicknames.
ATTRIBUTE | DESCRIPTION |
---|---|
shot_id |
The shot ID for which to resolve nicknames.
TYPE:
|
mds_conn |
MDSConnection object for accessing MDSPlus data.
TYPE:
|
database |
Database connection for querying tokamak shot data.
TYPE:
|
disruption_time |
The time of the disruption in seconds.
TYPE:
|
tokamak |
The tokamak for which results are being processed.
TYPE:
|
logger |
Logger for logging relevant messages.
TYPE:
|
Source code in disruption_py/settings/nickname_setting.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|