<phyphox xmlns="http://phyphox.org/xml" xmlns:editor="http://phyphox.org/editor/xml" version="1.7" editor:version="1.0" locale="en">
	<title>Magnetic sensor</title>
	<category>1) Sussex</category>
	<description/>
	<data-containers>
		<!-- initialize buffers-->
		<container size="100" init="-9.8,-9.7,-9.6,-9.5,-9.4,-9.3,-9.2,-9.1,-9,-8.9,-8.8,-8.7,-8.6,-8.5,-8.4,-8.3,-8.2,-8.1,-8,-7.9,-7.8,-7.7,-7.6,-7.5,-7.4,-7.3,-7.2,-7.1,-7,-6.9,-6.8,-6.7,-6.6,-6.5,-6.4,-6.3,-6.2,-6.1,-6,-5.9,-5.8,-5.7,-5.6,-5.5,-5.4,-5.3,-5.2,-5.1,-5,-4.9,-4.8,-4.7,-4.6,-4.5,-4.4,-4.3,-4.2,-4.1,-4,-3.9,-3.8,-3.7,-3.6,-3.5,-3.4,-3.3,-3.2,-3.1,-3,-2.9,-2.8,-2.7,-2.6,-2.5,-2.4,-2.3,-2.2,-2.1,-2,-1.9,-1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,-1,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0,0.1" static="false">I_t_100
		</container>
		<container size="100" static="false">I_Bx_100</container>
		<container size="100" static="false">I_By_100</container>
		<container size="100" static="false">I_Bz_100</container>
		<container size="100" static="false">I_Babs_100</container>
		<!-- R for raw data stright from sensor, _100 for buffer size  , _O for values minus offsets-->
		<container size="100" static="false">R_t_100</container>
		<container size="100" static="false">R_t_80</container>
		<container size="100" static="false">R_Bx_100</container>
		<container size="100" static="false">R_By_100</container>
		<container size="100" static="false">R_Bz_100</container>
		<container size="100" static="false">R_Babs_100</container>
		<container size="100" static="false">R_Bx_100_O</container>
		<container size="100" static="false">R_By_100_O</container>
		<container size="100" static="false">R_Bz_100_O</container>
		<container size="100" static="false">R_Babs_100_O</container>
		<container size="1" static="false">R_Bx0</container>
		<container size="1" static="false">R_By0</container>
		<container size="1" static="false">R_Bz0</container>
		<container size="1" static="false">R_Babs0</container>
		<!-- S for gaussian smoothed data, _100 for buffer size  , _O for values minus offsets-->
		<container size="100" static="false">RS_t_100</container>
		<container size="100" static="false">RS_Bx_100</container>
		<container size="100" static="false">RS_By_100</container>
		<container size="100" static="false">RS_Bz_100</container>
		<container size="100" static="false">RS_Babs_100</container>
		<container size="100" static="false">S_t_100</container>
		<container size="100" static="false">S_Bx_100</container>
		<container size="100" static="false">S_By_100</container>
		<container size="100" static="false">S_Bz_100</container>
		<container size="100" static="false">S_Babs_100</container>
		<container size="80" static="false">S_Bx_80</container>
		<container size="80" static="false">S_By_80</container>
		<container size="80" static="false">S_Bz_80</container>
		<container size="80" static="false">S_Babs_80</container>
		<container size="100" static="false">S_Bx_100_O</container>
		<container size="100" static="false">S_By_100_O</container>
		<container size="100" static="false">S_Bz_100_O</container>
		<container size="100" static="false">S_Babs_100_O</container>
		<container size="80" static="false">S_Bx_80_O</container>
		<container size="80" static="false">S_By_80_O</container>
		<container size="80" static="false">S_Bz_80_O</container>
		<container size="80" static="false">S_Babs_80_O</container>
		<container size="1" static="false">S_Bx_mean</container>
		<container size="1" static="false">S_By_mean</container>
		<container size="1" static="false">S_Bz_mean</container>
		<container size="1" static="false">S_Babs_mean</container>
		<container size="1" static="false">Bx0</container>
		<container size="1" static="false">By0</container>
		<container size="1" static="false">Bz0</container>
		<container size="1" static="false">Babs0</container>
		<container size="1" static="false">S_Bx</container>
		<container size="1" static="false">S_By</container>
		<container size="1" static="false">S_Bz</container>
		<container size="1" static="false">S_Babs</container>
		<container size="1" init="0" static="false">C</container>
	</data-containers>
	<input>
		<sensor rate="10" average="true" type="magnetic_field">
			<output component="x">R_Bx_100</output>
			<output component="y">R_By_100</output>
			<output component="z">R_Bz_100</output>
			<output component="t">R_t_100</output>
			<output component="abs">R_Babs_100</output>
		</sensor>
	</input>
	<output>
    </output>
	<analysis sleep=".1" onUserInput="false">
		<!-- make cycle index  
		<if  less="false" equal="true" greater="true">
            <input as="a" clear="false">C</input>
            <input as="b" type="value">1</input>
            <input as="true" clear="false">C</input>
            <input as="false" type="value">0</input>
            <output as="result">C</output>
        </if> -->
		<formula cycles="1-" formula="[1]+1">
			<input as="in" clear="false">C</input>
			<output as="out">C</output>
		</formula>
		<!-- cycle 0 - fill bufferes with initial reading -->
		<if less="true" equal="true" greater="false">
			<input as="a" clear="false">C</input>
			<input as="b" type="value">10</input>
			<input as="true" clear="false">R_Bx_100</input>
			<output as="result">Bx0</output>
		</if>
		<if less="true" equal="true" greater="false">
			<input as="a" clear="false">C</input>
			<input as="b" type="value">10</input>
			<input as="true" clear="false">R_By_100</input>
			<output as="result">By0</output>
		</if>
		<if less="true" equal="true" greater="false">
			<input as="a" clear="false">C</input>
			<input as="b" type="value">10</input>
			<input as="true" clear="false">R_Bz_100</input>
			<output as="result">Bz0</output>
		</if>
		<if less="true" equal="true" greater="false">
			<input as="a" clear="false">C</input>
			<input as="b" type="value">10</input>
			<input as="true" clear="false">R_Babs_100</input>
			<output as="result">Babs0</output>
		</if>
		<const>
			<input as="value" clear="false">Bx0</input>
			<output as="out">I_Bx_100</output>
		</const>
		<const>
			<input as="value" clear="false">By0</input>
			<output as="out">I_By_100</output>
		</const>
		<const>
			<input as="value" clear="false">Bz0</input>
			<output as="out">I_Bz_100</output>
		</const>
		<const>
			<input as="value" clear="false">Babs0</input>
			<output as="out">I_Babs_100</output>
		</const>
		<append>
			<input as="in" clear="false">I_t_100</input>
			<input as="in" clear="false">R_t_100</input>
			<output as="out">RS_t_100</output>
		</append>
		<append>
			<input as="in" clear="false">I_Bx_100</input>
			<input as="in" clear="false">R_Bx_100</input>
			<output as="out">RS_Bx_100</output>
		</append>
		<append>
			<input as="in" clear="false">I_By_100</input>
			<input as="in" clear="false">R_By_100</input>
			<output as="out">RS_By_100</output>
		</append>
		<append>
			<input as="in" clear="false">I_Bz_100</input>
			<input as="in" clear="false">R_Bz_100</input>
			<output as="out">RS_Bz_100</output>
		</append>
		<append>
			<input as="in" clear="false">I_Babs_100</input>
			<input as="in" clear="false">R_Babs_100</input>
			<output as="out">RS_Babs_100</output>
		</append>
		<!-- R for raw data -->
		<subtract cycles="3-">
			<input as="minuend" clear="false">R_Bx_100</input>
			<input as="subtrahend" clear="false">Bx0</input>
			<output as="difference">R_Bx_100_O</output>
		</subtract>
		<subtract cycles="3-">
			<input as="minuend" clear="false">R_By_100</input>
			<input as="subtrahend" clear="false">By0</input>
			<output as="difference">R_By_100_O</output>
		</subtract>
		<subtract cycles="3-">
			<input as="minuend" clear="false">R_Bz_100</input>
			<input as="subtrahend" clear="false">Bz0</input>
			<output as="difference">R_Bz_100_O</output>
		</subtract>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">R_Bx_100_O</input>
			<input as="in" clear="false">R_By_100_O</input>
			<input as="in" clear="false">R_Bz_100_O</input>
			<output as="out">R_Babs_100_O</output>
		</formula>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">R_Bx0</input>
			<input as="in" clear="false">R_By0</input>
			<input as="in" clear="false">R_Bz0</input>
			<output as="out">R_Babs0</output>
		</formula>
		<!-- smoothed data , gaussian smoothing sigma requires window size of 6 sigma -1 , FWHM is ~2.35 sigma so for 0.1Hz rate FWHM of 1s needs sigma 4.2 -->
		<gausssmooth cycles="3-" sigma="6">
			<input as="in" clear="false">RS_Bx_100</input>
			<output as="out" clear="false">S_Bx_100</output>
		</gausssmooth>
		<gausssmooth cycles="3-" sigma="6">
			<input as="in" clear="false">RS_By_100</input>
			<output as="out" clear="false">S_By_100</output>
		</gausssmooth>
		<gausssmooth cycles="3-" sigma="6">
			<input as="in" clear="false">RS_Bz_100</input>
			<output as="out" clear="false">S_Bz_100</output>
		</gausssmooth>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">S_Bx_100</input>
			<input as="in" clear="false">S_By_100</input>
			<input as="in" clear="false">S_Bz_100</input>
			<output as="out">S_Babs_100</output>
		</formula>
		<subrange cycles="3-">
			<input as="in" clear="false">RS_t_100</input>
			<input as="from" type="value">10</input>
			<input as="length" type="value">80</input>
			<output as="out">R_t_80</output>
		</subrange>
		<subrange cycles="3-">
			<input as="in" clear="false">S_Bx_100</input>
			<input as="from" type="value">10</input>
			<input as="length" type="value">80</input>
			<output as="out">S_Bx_80</output>
		</subrange>
		<subrange cycles="3-">
			<input as="in" clear="false">S_By_100</input>
			<input as="from" type="value">10</input>
			<input as="length" type="value">80</input>
			<output as="out">S_By_80</output>
		</subrange>
		<subrange cycles="3-">
			<input as="in" clear="false">S_Bz_100</input>
			<input as="from" type="value">10</input>
			<input as="length" type="value">80</input>
			<output as="out">S_Bz_80</output>
		</subrange>
		<subrange cycles="3-">
			<input as="in" clear="false">S_Babs_100</input>
			<input as="from" type="value">10</input>
			<input as="length" type="value">80</input>
			<output as="out">S_Babs_80</output>
		</subrange>
		<average cycles="3-">
			<input as="buffer" clear="false">S_Bx_80</input>
			<output as="average" clear="false">S_Bx_mean</output>
		</average>
		<average cycles="3-">
			<input as="buffer" clear="false">S_By_80</input>
			<output as="average" clear="false">S_By_mean</output>
		</average>
		<average cycles="3-">
			<input as="buffer" clear="false">S_Bz_80</input>
			<output as="average" clear="false">S_Bz_mean</output>
		</average>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">S_Bx_mean</input>
			<input as="in" clear="false">S_By_mean</input>
			<input as="in" clear="false">S_Bz_mean</input>
			<output as="out">S_Babs_mean</output>
		</formula>
		<subtract cycles="3-">
			<input as="minuend" clear="false">S_Bx_80</input>
			<input as="subtrahend" clear="false">Bx0</input>
			<output as="difference">S_Bx_80_O</output>
		</subtract>
		<subtract cycles="3-">
			<input as="minuend" clear="false">S_By_80</input>
			<input as="subtrahend" clear="false">By0</input>
			<output as="difference">S_By_80_O</output>
		</subtract>
		<subtract cycles="3-">
			<input as="minuend" clear="false">S_Bz_80</input>
			<input as="subtrahend" clear="false">Bz0</input>
			<output as="difference">S_Bz_80_O</output>
		</subtract>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">S_Bx_80_O</input>
			<input as="in" clear="false">S_By_80_O</input>
			<input as="in" clear="false">S_Bz_80_O</input>
			<output as="out">S_Babs_80_O</output>
		</formula>
		<formula cycles="3-" formula="sqrt([1_]*[1_]+[2_]*[2_]+[3_]*[3_])">
			<input as="in" clear="false">Bx0</input>
			<input as="in" clear="false">By0</input>
			<input as="in" clear="false">Bz0</input>
			<output as="out">Babs0</output>
		</formula>
	</analysis>
	<views>
		<view label="B Field">
			<separator height="0.2" color="404040">            </separator>
			<info label="Magnetometer (direct measurment)" color="white" align="center" size="1.5">            </info>
			<separator height="0.5" color="202020">           </separator>
			<graph label="" aspectRatio="3" style="lines" lineWidth="1" color="green" partialUpdate="true" history="1" labelX="time" labelY="B" labelZ="" unitX="s" unitY="μT" unitZ="" logX="false" logY="false" logZ="false" xPrecision="1" yPrecision="1" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
				<input axis="x" color="green">R_t_100</input>
				<input axis="y">R_Bx_100</input>
				<input axis="x" color="blue">R_t_100</input>
				<input axis="y">R_By_100</input>
				<input axis="x" color="yellow">R_t_100</input>
				<input axis="y">R_Bz_100</input>
				<input axis="x" color="white">R_t_100</input>
				<input axis="y">R_Babs_100</input>
			</graph>
			<separator editor:uuid="110" height="0.5" color="202020"/>
			<value label="Bx" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>R_Bx_100</input>
			</value>
			<value label="By" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>R_By_100</input>
			</value>
			<value label="Bz" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>R_Bz_100</input>
			</value>
			<value label="Babs" size="1" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>R_Babs_100</input>
			</value>
			<separator height="0.5" color="202020">            </separator>
			<separator height="0.1" color="404040">            </separator>
			<button label="Set zero point">
				<input>R_Bx_100</input>
				<output>Bx0</output>
				<input>R_By_100</input>
				<output>By0</output>
				<input>R_Bz_100</input>
				<output>Bz0</output>
			</button>
			<value label="Bx0" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>Bx0</input>
			</value>
			<value label="By0" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>By0</input>
			</value>
			<value label="Bz0" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>Bz0</input>
			</value>
			<value label="Babs0" size="1" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>Babs0</input>
			</value>
			<separator height="0.5" color="202020">            </separator>
			<separator height="0.1" color="404040">            </separator>
			<info label="Magnetometer (with offset adjustment)" color="white" align="center" size="1.5">            </info>
			<separator height="0.5" color="202020">            </separator>
			<graph label="" aspectRatio="2.5" style="lines" lineWidth="1" color="green" partialUpdate="true" history="1" labelX="time" labelY="B" scientificX="false" labelZ="" unitX="s" unitY="μT" unitZ="" logX="false" logY="false" logZ="false" xPrecision="1" yPrecision="1" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
				<input axis="x" color="green">R_t_100</input>
				<input axis="y">R_Bx_100_O</input>
				<input axis="x" color="blue">R_t_100</input>
				<input axis="y">R_By_100_O</input>
				<input axis="x" color="yellow">R_t_100</input>
				<input axis="y">R_Bz_100_O</input>
				<input axis="x" color="white">R_t_100</input>
				<input axis="y">R_Babs_100_O</input>
			</graph>
			<value label="Bx - Bx0" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>R_Bx_100_O</input>
			</value>
			<value label="By - By0" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>R_By_100_O</input>
			</value>
			<value label="Bz - Bz0" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>R_Bz_100_O</input>
			</value>
			<value label="|Babs - Babs0|" size="2" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>R_Babs_100_O</input>
			</value>
			<value label="..." size="2" precision="0" scientific="false" factor="1" color="White">
				<input>C</input>
				<map max="10">....Initializing</map>
				<map min="10">Running</map>
			</value>
		</view>
		<view label="B Field -smoothed">
			<separator height="0.2" color="404040">            </separator>
			<info label="Magnetometer (direct measurment)" color="white" align="center" size="1.5">            </info>
			<separator height="0.5" color="202020">           </separator>
			<graph label="" aspectRatio="3" style="lines" lineWidth="1" color="green" partialUpdate="true" history="1" labelX="time" labelY="B" labelZ="" unitX="s" unitY="μT" unitZ="" logX="false" logY="false" logZ="false" xPrecision="1" yPrecision="1" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
				<input axis="x" color="green">R_t_80</input>
				<input axis="y">S_Bx_80</input>
				<input axis="x" color="blue">R_t_80</input>
				<input axis="y">S_By_80</input>
				<input axis="x" color="yellow">R_t_80</input>
				<input axis="y">S_Bz_80</input>
				<input axis="x" color="white">R_t_80</input>
				<input axis="y">S_Babs_80</input>
			</graph>
			<separator height="0.5" color="202020"/>
			<value label="Bx" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>S_Bx_mean</input>
			</value>
			<value label="By" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>S_By_mean</input>
			</value>
			<value label="Bz" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>S_Bz_mean</input>
			</value>
			<value label="Babs" size="1" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>S_Babs_mean</input>
			</value>
			<separator height="0.5" color="202020">            </separator>
			<separator height="0.1" color="404040">            </separator>
			<button label="Set zero point">
				<input>S_Bx_mean</input>
				<output>Bx0</output>
				<input>S_By_mean</input>
				<output>By0</output>
				<input>S_Bz_mean</input>
				<output>Bz0</output>
			</button>
			<value label="Bx0" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>Bx0</input>
			</value>
			<value label="By0" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>By0</input>
			</value>
			<value label="Bz0" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>Bz0</input>
			</value>
			<value label="Babs0" size="1" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>Babs0</input>
			</value>
			<separator height="0.5" color="202020">            </separator>
			<separator height="0.1" color="404040">            </separator>
			<info label="Magnetometer (with offset adjustment)" color="white" align="center" size="1.5">            </info>
			<separator height="0.5" color="202020">            </separator>
			<graph label="" aspectRatio="2.5" style="lines" lineWidth="1" color="green" partialUpdate="true" history="1" labelX="time" labelY="B" labelZ="" unitX="s" unitY="μT" unitZ="" logX="false" logY="false" logZ="false" xPrecision="1" yPrecision="1" zPrecision="3" scaleMinX="auto" scaleMaxX="auto" scaleMinY="auto" scaleMaxY="auto" scaleMinZ="auto" scaleMaxZ="auto" minX="0" maxX="0" minY="0" maxY="0" minZ="0" maxZ="0" mapWidth="0">
				<!-- Smoothed-->
				<input axis="x" color="green">R_t_80</input>
				<input axis="y">S_Bx_80_O</input>
				<input axis="x" color="blue">R_t_80</input>
				<input axis="y">S_By_80_O</input>
				<input axis="x" color="yellow">R_t_80</input>
				<input axis="y">S_Bz_80_O</input>
				<input axis="x" color="white">R_t_80</input>
				<input axis="y">S_Babs_80_O</input>
				<input axis="x" color="0C4B16">R_t_100</input>
				<input axis="y">R_Bx_100_O</input>
				<input axis="x" color="11304C">R_t_100</input>
				<input axis="y">R_By_100_O</input>
				<input axis="x" color="47491F">R_t_100</input>
				<input axis="y">R_Bz_100_O</input>
				<input axis="x" color="4C4C4C">R_t_100</input>
				<input axis="y">R_Babs_100_O</input>
			</graph>
			<value label="Bx - Bx0" size="1" unit="μT" precision="1" color="green" scientific="false" factor="1">
				<input>S_Bx_80_O</input>
			</value>
			<value label="By - By0" size="1" unit="μT" precision="1" color="blue" scientific="false" factor="1">
				<input>S_By_80_O</input>
			</value>
			<value label="Bz - Bz0" size="1" unit="μT" precision="1" color="yellow" scientific="false" factor="1">
				<input>S_Bz_80_O</input>
			</value>
			<value label="|Babs - Babs0|" size="2" unit="μT" precision="1" color="white" scientific="false" factor="1">
				<input>S_Babs_80_O</input>
			</value>
			<value label="..." size="2" precision="0" scientific="false" factor="1" color="White">
				<input>C</input>
				<map max="10">....Initializing</map>
				<map min="10">Running</map>
			</value>
		</view>
		<view label="Help">
			<separator height="0.2" color="404040">            </separator>
			<info label="Magnetometer Help" color="white" align="center" size="1.5">            </info>
			<info label="Magnetometer Help" color="white" align="center" size="1">            </info>
		</view>
	</views>
	<export>
    </export>
</phyphox>
