# ELM_processing¶

Contacts: David Eldon

## Short Description¶

Finds ELMs using difference-of-smooths type edge detection and supports filtering of data based on relationship to ELM timing

## Keywords¶

ELM detection, ELM filtering

## Long Description¶

This module supports customizable ELM detection and filtering and is intended to be used as a sub-module in other projects. It works by managing instances of the OMFITelm class. The module itself supplies only GUIs and organizational aids.

Automatically picks which filterscope to use for ELM detection.

ELM detection is accomplished via a difference of smooths type edge detection algorithm, or a new “jump and hold” algorithm. Jump and hold finds the start of an ELM by looking for large increases in input signal in short time windows. It finds the end by holding the ELM flag set until the signal to drops close to pre-ELM levels again. The hold logic for finding the end of an ELM can also be applied as a correction to the classic edge detection algorithm. Edge detection operates on a combined D_alpha measurement and on its time derivative. Different smoothing functions are available.

The module includes a database of manually identified ELMs for comparison, as well as some scripts for comparing automatic to manual detection and building a merit function.

ELM filtering is cast in terms of ELM phase and time since end of last ELM. ELM phase is defined as 0 at the end of an ELM. Phase then increases to 1 immediately before the start of the next ELM, and then jumps to -1 immediately after the start of the ELM. Thus, ELM phase is positive between ELMs and negative during ELMs. An ELM filter can be defined by an acceptable ELM phase range and by thresholds on time since last ELM: first, there is a threshold below which all data are rejected (typically small; <= 1 ms), regardless of ELM phase. This prevents double peaked ELMs from triggering data admittance between the peaks, when ELM phase rapidly ramps from 0 to 1 (assuming these are even detected as two separate ELMs in the first place, which hopefully they won’t be). Next, there is a threshold after which all data are accepted (typically >= 25 ms), regardless of ELM phase. This allows analysis of ELMing and ELM-free time periods without changing settings.

## Typical workflows¶

In established modules, ELM_processing will already be interfaced with the necessary scripts. Follow the instructions in the parent module, if any.

In new modules:
1. Import ELM_processing as a child of your module
2. Set up dependencies to point to ELM_processing as needed
3. Link the GUIs together if desired by using OMFITx.CompoundGUI() to include the elm_detection_GUI, elm_filter_GUI, or elm_plot_GUI
4. Have an appropriate script call the ELM filter by doing elm_okay = ELM_processing[‘SCRIPTS’][‘ELM_filter’].importCode(times_to_filter=t).elm_okay

Alternatively, you could use the OMFITelm class directly in the scripts of your new module.

## Supported devices¶

• DIII-D, NSTX, NSTX-U

## Contributors¶

List of contributors sorted by number of lines authored:

2926 David Eldon
9 Sterling Smith
6 Nikolas Logan
1 Orso Meneghini


None

## Users¶

List of usernames sorted by number of module imports: eldond, samuellc, nelsonand, laggnerf, thomek, haskeysr, weisbergd, ashourvana, stagnerl, bgrierson, lindan, bykovi, hongrongjie, smithsp, victorb, austinm, chabanr, curtis, david, grierson, halfmoonm, holland, jianx, johnsonc, knolkerm, leem, mcclenaghanj, meneghini, mordijck, nazikian, orlov, willensdorferm, zhangt, zhaojin, zywickib