06-25-2024, 09:16 AM
Seems like you answered most of the questions yourself
The visual editor does some half-hearted validation. But it can only use modules that are known to it and it will generate the entire XML file from scratch, so there is no way to use it with new modules.
requireFill is only designed to observe a single buffer and it is indeed an attribute to the analysis tag. Since it controls if the analysis modules are executed at all, there is no workaround to observe multiple buffers at the moment.
Here is an example of how I use the split module to calculate a moving average of 100 values. The split module keeps enough values (99) around for the next iteration, so the moving average has enough historic values to continue with the next new value. Note, that this is somewhat specific to the moving average module as it has the option to only output results when it has consumed enough values. Also note, that if you would try this example, the results on Android would be wrong as I made a mistake when implementing the movingaverage. It will be fixed in the next release.
If I ever come across a time machine I will rewrite phyphox with Python support instead of its own exotic XML-based language
The visual editor does some half-hearted validation. But it can only use modules that are known to it and it will generate the entire XML file from scratch, so there is no way to use it with new modules.
requireFill is only designed to observe a single buffer and it is indeed an attribute to the analysis tag. Since it controls if the analysis modules are executed at all, there is no workaround to observe multiple buffers at the moment.
Here is an example of how I use the split module to calculate a moving average of 100 values. The split module keeps enough values (99) around for the next iteration, so the moving average has enough historic values to continue with the next new value. Note, that this is somewhat specific to the moving average module as it has the option to only output results when it has consumed enough values. Also note, that if you would try this example, the results on Android would be wrong as I made a mistake when implementing the movingaverage. It will be fixed in the next release.
Code:
<phyphox version="1.18" locale="en">
<title>Moving average demo</title>
<category>Test</category>
<description>Demo for the new movingaverage and split analysis modules.</description>
<data-containers>
<container size="0">accT</container>
<container size="0">accNew</container>
<container size="0">accTodo</container>
<container size="0">accRaw</container>
<container size="0">accAvg</container>
</data-containers>
<input>
<sensor type="accelerometer">
<output component="t">accT</output>
<output component="z">accNew</output>
</sensor>
</input>
<views>
<view label="Graph">
<graph label="z Raw" timeOnX="true" labelX="[[quantity_short_time]]" unitX="[[unit_short_second]]" labelY="[[quantity_short_acceleration]]" unitY="[[unit_short_meter_per_square_second]]" unitYperX="m/s³" partialUpdate="true" color="red">
<input axis="x">accT</input>
<input axis="y">accRaw</input>
</graph>
<graph label="z Moving Average" timeOnX="true" labelX="[[quantity_short_time]]" unitX="[[unit_short_second]]" labelY="[[quantity_short_acceleration]]" unitY="[[unit_short_meter_per_square_second]]" unitYperX="m/s³" partialUpdate="true" color="green">
<input axis="x">accT</input>
<input axis="y">accAvg</input>
</graph>
</view>
</views>
<analysis requireFill="accNew" requireFillThreshold="100">
<split>
<input as="data">accNew</input>
<input as="overlap" type="value">99</input>
<output>accTodo</output>
<output>accNew</output>
</split>
<subrange>
<input keep="true">accTodo</input>
<input as="from" type="value">99</input>
<output append="true">accRaw</output>
</subrange>
<movingaverage dropIncomplete="true">
<input as="data">accTodo</input>
<input as="width" type="value">100</input>
<output append="true">accAvg</output>
</movingaverage>
</analysis>
</phyphox>
If I ever come across a time machine I will rewrite phyphox with Python support instead of its own exotic XML-based language