A <phase>-element determines a phase based on a condition formula given as the content of the element. If the value of the formula is bigger than 0, the corresponding frame is part of the phase.
Ether the „condition“ attribute or the attributes „startevent“ and „endevent“ must be used.
|Name||Name of the created phase type, also used as a prefix of created timeseries of condition an value tjaectories.||Yes|
|startEvent||Create a phase based on existing start event for pre- or stepbystep processing. For postprocessing phases are created with an additional suffix „Global“, integrated in the condition.||No|
|endEvent||Create a phase based on existing start event for pre- or stepbystep processing. For postprocessing phases are created with an additional suffix „Global“, integrated in the condition.||No|
|phase||not used||If set to an existing phase and if startEvent/endEvent is not used, a frame es included only if the frame is additionally also included in the given phase.||No|
|process||stepbystep||Available values: stepbystep, post, pre; The „process phase“, in which the time phase is created. If the condition attribute is used, the condition traj wrapper is calculated step-by-step, but the phases are created also in the postprocess phase. If start-/end-event is used, the phases are created with the first frame.||No|
|value||Used only, if process phase == stepbystep and condition is used. Phases created by the condition are excluded, if for the double timeseries defined by this attribute the values are bigger than the value of the maxvalue attribute or smaller than the value of the minvalue attribute.||No|
|contiguous||true||Used only if startEventTypeName == endEventTypeName. If set to false, an event is used eather as start- or end-event to create non contiguous phases.||No|
|maxvalue||Double.MAX_VALUE||The timserie defined by the „value“ attribute is tested if it contains a value higher than the value of this attribute. If this is the case the complete phase is excluded. This attribute is respected only, if the process-flag is set to „post“.||No|
|minvalue||-Double.MAX_VALUE||The timeserie defined by the value attribute is tested, if it contains a value lower than the value of this attribute. If this is the case the complete phase is excluded. This attribute is respected only, if the process-flag is set to „post“.||No|
|minwidth||0||Only phases with more than „minwidth“ frames are created. Phases with less frames are ignored. Be careful: The atttribute must define an integer value.||No|
|maxwidth||Integer.MAX_VALUE||Only phases with less than maxwidth frames are created. Phases with more frames are ignored. Be carefule: The attribute must define an integer value.||No|
|expectedPhasesCount||-1||Defines the expected count of phases which should be created. If the created count does not fit the number defined by this attribute a warning is written.||No|
|invert||false||If set to true a new set of phases is returnded in the areas of no phases.||No|
|<name>Condition||double traj||If the child element or the attribute „expr“ (deprecated) is used (set to a formula), the values of this timeseries represents the status of each frame. Zero value indicates not included, else included. Typically the formula defines a function which result in the values 0 and 1 only.|
|<name>Value||double traj||If the „value“ attribute is used, this timeserie includes the values of the its formula.|
Determined events and phases
|<name>Global||If the attributes startEventType != null and endEventType != null or phaseTypeName != null, than corresponding phases with this name are created and the condition that only frames which are included in these phases are used.|
<Phase name="ABC">abc > 10.0</Phase>
The following code fragment, creates a phase with minimal width of 10 frames, for frames where the value of the timeserie RShoulderEleDepHDCalDirCosAngle is smaller than 30 degrees.
<Phase name="REleStart" process="post" minwidth="10" value="RGlenohumeralEleDepHDCalDirCos" includes="dynamic_abduk_events">RShoulderEleDepHDCalDirCosAngle < 30.0</Phase>
The following code fragment creates phases based simply on existing events:
<Phase name="RAbduk" startEvent="RHS" endEvent="RTO" process="post" calibrateIncludes="dynamic_calibrate_right_shoulder" includes="dummy"/>
The following code fragment creates phases based on the given condition but only if they are included completly into phases which are defined by the given start- and end-event.
<Phase name="LEleStartPhase" process="post" minwidth="10" startEvent="LHS" endEvent="LTO" value="LShoulderEleDepHDCalDirCosAngle*1.0" includes="ShoulderAbdAdd,ShoulderAnteRetro">LShoulderEleDepHDCalDirCosAngle < 30.0</Phase>
A <Event>-element defines an event, based on the values of a double trajectorie (only), as its child and optional based on a given phase type name. All implemented methods are based on „post processing“. Future methods cauld be based on other processing methods, e.g. „step by step“.
|name||Name of the created event type, also used as a prefix of created timeseries of condition an value trajectories.||Yes|
|method||min||„max“, „min“, „minvelocity“, „maxveclocity“, „frame“, „value“ and if the attribute phase is set additional the methods „start“ and „end“||No|
|process||post||Only postprocessing is supported. Preprocessing und process step by step are not yet implemented.||No|
|tolerance||If set local maxima/minima are determined by first creating phases with values between global min/max and min*(1+tolerance/100) or max*(1-tolerance/100)||No|
|phase||Used only, if the attribute „tolerance“ is not set. Better use tolerance instead if possible Phase type name which defines phases, for each the event is set.||No|
|value||Used from methods „frame“, „value“ and „percent“. In the first case it must be an integer value, in the second and third case a double.||No|
|event||A new event is created at the position of the given event moved about a given number of frames.||No|
|minthreshold||not used||Used in combination with the methods „min“, „max“, „minvelocity“ and „maxvelocity“. If the minimum threshold is not reached no event is created||No|
|maxthreshold||not used||Used in combination with the methods „min“, „max“, „minvelocity“ and „maxvelocity“. If the maxium threshold is not reached no event is created||No|
Available methods defined by the <event>-elements attribute „method“:
|frame||The attribute „value“ must be set to an integer between 0 (inclusive) and trial length (exclusive). The attributes „tolerance“ and „phase“ are not set.||Creates an event at the given position.|
|value||The attribute „phase“ must be set.||Create events for each phase of the given type at positions where the given timeserie has the smallest difference to the value given by the „value“-attribute.|
|min||Ether the attribute „phase“ or the attribute „tolerance“ ist set.||In a first step the global minimum or the minimum in the given phases, of the given timeseries is determined. Than phases are created in the range of [minimum; minimum*(1+percentTolerance/100)]. Last, for each of these phases an event is created at the position, where the timeseries reaches its minimum.|
|max||Ether the attribute „phase“ or the attribute „tolerance“ ist set.||In a first step the global maximum or the maximum in the given phases, of the given timeseries is determined. Than phases are created in the range of [maximum*(1-percentTolerance/100); maximum]. Last, for each of these phases an event is created at the position, where the timeseries reaches its maximum.|
|minvelocity||Ether the attribute „phase“ or the attribute „tolerance“ ist set.||Same as with method „min“, based on the derivative of the given timeserie.|
|maxvelocity||Ether the attribute „phase“ or the attribute „tolerance“ ist set.||Same as with method „max, based on the derivative of the given timeserie.|
|maxabsvelocity||Ether the attribute „phase“ or the attribute „tolerance“ ist set.||Same as with method „maxvelocity“. Only the abs values of the diff trajectory are calculated before.|
|start||Attribute „phase“ is set.||Creates an event at the start of the given phase.|
|end||Attribute „phase“ is set.||Creates an event at the end of the given phase.|
|percent||Attribute „phase“ is set.||Creates an event at the given percentage of the width of the given phase.|
Determined events and phases
|<name>||event||In each determined phase an event is created at position with max or min value as configured by the method attribute.|
|<name>||phase||Phases created to define areas between given tolerance values|
<!-- be careful: the event is set to the minimum, that means, that this position is 90Grad only if this position is reached in the RoM --> <Event name="ABC" method="min">180.0-RElbowFlex2Angle</Event>
Notes If the method „minvelocity“ or „maxvelocity“ is used, than a trajectory with the derivation is determined and saved in the trial. But this is a not wanted implementation detail and it will be gone in the future.
If the content is the name of a timeserie only, a classcast exeception is thrown.
A complex example
Have a look at the following plot. It shows an elevation/depression movement with three repetitions:
For all repetitions of the movement in the phase defined by RHS and RTO events the elevation phase should be extracted. The position of RHS is 482 and the position from RTO is 2697.
Have a look at the following code fragment which solves this problem:
<Phase name="REleStartPhase" process="post" minwidth="10" startEvent="RHS" endEvent="RTO" includes="ShoulderAbdAdd">RShoulderEleDepHDCalDirCosAngle < 30.0</Phase> <Event name="REleStart" phase="REleStartPhase" method="min" includes="ShoulderAbdAdd" process="post">RShoulderEleDepHDCalDirCosAngle*1.0</Event> <Phase name="REleEndPhase" process="post" minwidth="40" startEvent="RHS" endEvent="RTO" includes="ShoulderAbdAdd">RShoulderEleDepHDCalDirCosAngle > 60.0</Phase> <Event name="REleEnd" phase="REleEndPhase" method="max" includes="ShoulderAbdAdd" process="post">RShoulderEleDepHDCalDirCosAngle*1.0</Event> <Phase name="RElePhase" startEvent="REleStart" endEvent="REleEnd" process="post" contiguous="false" includes="ShoulderAbdAdd">RShoulderEleDepHDCalDirCosAngle < 90.0</Phase>
The first element defines a phase with name „REleStartPhase“ with the following assumptions:
This result in two phases: [926;1341], [2156;2618]. You can see the first movement is excluded because of the first assumption.
The element „REleStart“ determines for each of the phases above an event at the position where the curve has its minimum. So we have the start positions of the wanted elevation phases: 1164, 2399
„REleEndPhase“ looks for phases where the y-values of the curve are bigger than 60 and also the assumption defined by RHS and RTO and a min length of 40 frames. „Bigger than 60“ results in the need of a minimum elevation of 60+40=100 degree to autodetect a REleEndPhase.
The interesting thing is that this results in four instead of three phases: [482;836], [1436;1634], [1637;2054] and [2691;2697]. The second phase is split because of a gap in the curve.
The element „REleEnd“ determines the maxima of each of these phases: 523, 1636, 1757, 2697.
From the events „REleStart“ and „REleEnd“ the element „RElePhase“ determines two phases: [2399;2764], [1164;1520]. The nice thing is that the algorithm creates phases without gaps and the additional condition that the phases include frames only if the values of the curve are less than 90 degrees.
To plot these phases you have to add the following code fragment into your sheet definition:
<View> <Phases> <Phase name="RElePhase"/> </Phases> <Alignment phase="RElePhase" normalization="RElePhase"/> </View>