====== Event Minimum ======
=====Overview=====
The 'Event_Minimum' command identifies the minimum value of a signal within a defined frame window, and creates an event at that frame.
* Unlike Event Global Minimum, which finds the absolute lowest point over a trial or event phase, 'Event_Minimum' looks within a sliding frame window, allowing for detection of multiple local minima across repeated movements.
* The target signal must already exist and be accessible via its type, label, and folder.
* To review the difference between local and global minimum values please see [[Visual3D:Documentation:Pipeline:General_Information:Global_vs_Loca_Max_and_Min|here]].
* Other options within the command such as **Exclude Event**, and **Select Subsequence** are explained in detail on the [[Visual3D:Documentation:Pipeline:Event_Commands:Event_Global_Minimum#Examples|Event_Global_Minimum]] page.
* If /THRESHOLD is empty, all local minimum are identified. If it has a value or expression, only local minimum that are less than the threshold are identified.
=====Pipeline Command=====
The command below is as seen on the Visual3D application, it has many parameters as there are many options to manipulate this command.
Event_Minimum
/RESULT_EVENT_NAME=
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
! /FRAME_OFFSET=0
! /TIME_OFFSET=
! /EVENT_SEQUENCE=
! /EXCLUDE_EVENTS=
! /EVENT_SEQUENCE_INSTANCE=0
! /EVENT_SUBSEQUENCE=
! /SUBSEQUENCE_EXCLUDE_EVENTS=
! /EVENT_SUBSEQUENCE_INSTANCE=0
! /EVENT_INSTANCE=0
! /FRAME_WINDOW=8
! /THRESHOLD=
;
=====Command Parameters=====
The following table shows the command parameters and descriptions.
|**Parameter** |**Description**|
|**/RESULT_EVENT_NAME=** | Name of the new event created at each local minimum. |
|**!/SIGNAL_TYPES=** | Type of signal (e.g., `LINK_MODEL_BASED`, `ANALOG`). |
|**!/SIGNAL_FOLDER=** | Folder where the signal is stored, such as 'ORIGINAL' or 'PROCESSED'.|
|**!/SIGNAL_NAMES=** | Name of the signal to analyze (e.g., Left_Knee_Angle`). |
|**!/SIGNAL_COMPONENTS=** | Component(s) of the signal (e.g., `Z` or vector index). |
|**!/FRAME_OFFSET=** | Shifts the resulting event forward or backward in time (in frames). |
|**!/TIME_OFFSET=** | Time-based offset (in seconds). |
|**!/EVENT_SEQUENCE=** | Sequence of events to define the search range (e.g., `LHS,LTO`). |
|**!/EXCLUDE_EVENTS=** | Exclude these events from forming valid event pairs. |
|**!/EVENT_SEQUENCE_INSTANCE=** | Specific instance of the event sequence to analyze (0 = all). |
|**!/EVENT_SUBSEQUENCE=** | Optional inner sequence used to narrow the search window. |
|**!/SUBSEQUENCE_EXCLUDE_EVENTS=**| Events that invalidate a subsequence. |
|**!/EVENT_SUBSEQUENCE_INSTANCE=**| Index of the subsequence to analyze (0 = all). |
|**!/EVENT_INSTANCE=** | Controls how many minima are found per window (0 = all, 1 = first, -1 = last). |
|**!/FRAME_WINDOW=** | Size of the frame window to search around each point (must be an odd number). |
|**!/THRESHOLD=** | Minimum value required to qualify as a valid minimum.|
=====Dialog=====
This command can be used via text or the dialog interface. To open the dialog, double-click the command or click the **Edit** button in the pipeline editor.
{{:visual3d:documentation:pipeline:event_commands:event_min_dialog.png?400|}}
* **New Event Label Name**: Name of event created at the local minimum points.
* **Signal Component**: Which direction of the signal to analyze.
* **Frame Window**: Size of window to look for a local minimum around each frame.
* **Frame Offset**: Shift the resulting event by a number of frames.
* **Time Offset**: Move the event by a time shift (in seconds)
* **Threshold**: Only create an event if the minimum exceeds this value.
* **Event Instance to Create**: Choose which minimum to create if there are multiple dipss in a search window
* **Event Sequence and Instance for Range**: Limits where to search for minima
* **Subsequence and Instance within Event Sequence**: Further limits search inside smaller phase within main event range.
=====Examples=====
The following examples will go through the use of the Event_Minimum command in the Visual3D application.
====Example 1====
In the first example, we will create an event named RKFlex_MinLocal using the command.
* This represents the local minima of the **Right Knee Angle** signal between RHS events.
**1.** Enter information into dialog box OR text editor:
* **Event_Name:** RKFlex_MinLocal
* **Select Frame Offset:** 0
* **Signal Components:** X
* **Event Sequence Instance:** 0
* Adjust frame window based on size of trials. (this example- 40 Frames)
|{{:visual3d:documentation:pipeline:event_commands:eventmin_ex1_dialog.png?400|}}|
Event_Minimum
/RESULT_EVENT_NAME=RKFlex_MinLocal
/SIGNAL_TYPES= LINK_MODEL_BASED
! /SIGNAL_FOLDER=ORIGINAL
/SIGNAL_NAMES= Right Knee Angle
/SIGNAL_COMPONENTS=X
! /FRAME_OFFSET=0
! /TIME_OFFSET=
/EVENT_SEQUENCE=RHS+RHS
! /EXCLUDE_EVENTS=
! /EVENT_SEQUENCE_INSTANCE=0
! /EVENT_SUBSEQUENCE=
! /SUBSEQUENCE_EXCLUDE_EVENTS=
! /EVENT_SUBSEQUENCE_INSTANCE=0
! /EVENT_INSTANCE=0
! /FRAME_WINDOW=40
! /THRESHOLD=
;
|
**2.** Select desired signal:
* Select **signal from data tree** Right_Knee_Angle
* Click **Import Selected Signals**
{{:Event_Min_RKFlex_MinLocal_Import.jpg?500}}
**RKFlex_Min** will be created at the minimum value during the gait cycle within the specified frame window:
|{{:visual3d:documentation:pipeline:event_commands:eventmin_ex1_correctgrph.png?600|}}|
====Example 2====
In this more complex example, we will delete the previously set RKFlex_MinLocal, instead we want to identify the minimum angle of the right knee ONLY during the swing phase AND only include minima that fall **below a functional threshold**, and extract the signal value at those minima.
Commands:
* Event_Delete - Remove any prior version of these minima to avoid duplication.
* Event_Minimum - Find minima during swing (RTO to RHS)
* Metric_Signal_Value_At_Event - Extract angle values at these minima for reporting.
Event_Delete
/EVENT_NAME= RKFlex_MinLocal
!/EVENT_SEQUENCE=
!/EXCLUDE_EVENTS=
!/EVENT_INSTANCE=
!/TIME=
;
Event_Minimum
/RESULT_EVENT_NAME=RKFlex_MinLocal
/SIGNAL_TYPES=LINK_MODEL_BASED
/SIGNAL_FOLDER=ORIGINAL
/SIGNAL_NAMES=Right Knee Angle
/SIGNAL_COMPONENTS=X
/FRAME_OFFSET=0
/TIME_OFFSET=
/EVENT_SEQUENCE=RTO+RHS
/EXCLUDE_EVENTS=
/EVENT_SEQUENCE_INSTANCE=0
/EVENT_SUBSEQUENCE=
/SUBSEQUENCE_EXCLUDE_EVENTS=
/EVENT_SUBSEQUENCE_INSTANCE=0
/EVENT_INSTANCE=0
/FRAME_WINDOW=9
/THRESHOLD=-10
;
Metric_Signal_Value_At_Event
/SIGNAL_FOLDER=ORIGINAL
/SIGNAL_LABEL=
/EVENT_NAME=RKFlex_MinLocal
/RESULT_METRIC_NAME=Knee_Min_Angle
;
----
=====Notes=====
* The `/FRAME_WINDOW=` must be an **odd number** (e.g., 7, 9, 11) to center the search correctly.
* The `/EVENT_INSTANCE=` lets you fine-tune whether you want **all minima**, or just the **first or last** in a range.
* Use a **threshold** to avoid selecting trivial dips or noise artifacts.
* To isolate **one minimum per step**, set `/EVENT_INSTANCE=1`.
==== Version 4 ====
Event_Minimum
/Signal_Types=The type of signal to be evaluated
/Signal_Names=The names of the signals to be evaluated
/Signal_Folder=The name of the signal folder
/Event_Name=The name to be given to the threshold event
/Select_X=(True or False)Use this component of the signal
/Select_Y=(True or False)Use this component of the signal
/Select_Z=(True or False)Use this component of the signal
/Frame_Window=The range of frames of data that must be below the minimum
/Start_At_Event=The search begins from the start event
/End_At_Event=The search ends at the end event
/Event_Instance=See below
;
Dialog that pops up when pipeline selection is edited by double clicking with the left mouse button.\\ {{:MinMaxDlg.jpg}}
\\
**Event Instance:** There may be several local minima. A value of 0 results in all minima being assigned a label. A positive number indicates the event (in sequence) to select. A negative number indicates the event starting from the last event and progressing to the first event.\\