'parce .xml to txt data (from oscilloscop)
I have data in .xml format, that I would like to present on graph. Going through code I am undable to destinguish which data to access and how. I was measuring voltage on chanels 1 and 2. The data was measured on oscciloscope, and the two graphs were supposed to present oscilations.
I tried using import xml.etree.ElementTree as ET, is there any other way to access data, while you are unsure which numbers are the ones to check?
Thank you.
<?xml version="1.0" encoding="UTF-8"?>
<nsp_config>
<acq_setup>
<acq_mode>2</acq_mode>
<ave_num>2</ave_num>
<enhance_bits>0</enhance_bits>
<acq_xy>0</acq_xy>
<acq_sequence>0</acq_sequence>
<mem_depth>0</mem_depth>
<insert_mode>1</insert_mode>
<acq_rate>0</acq_rate>
<acq_roll>0</acq_roll>
<segment>2</segment>
<usr_acq_roll>0</usr_acq_roll>
<anti_alias_filter>0</anti_alias_filter>
</acq_setup>
<ch_setup>
<CH1>
<act>1</act>
<prioty>2</prioty>
<coup>0</coup>
<bwl>1</bwl>
<adj>0</adj>
<probe>3</probe>
<visible>1</visible>
<custom_probe_value_a>
<data>1000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_a>
<custom_probe_value_b>
<data>10000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_b>
<custom_probe_value_c>
<data>100000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_c>
<custom_probe_value_d>
<data>1000000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_d>
<z>0</z>
<unit>0</unit>
<invert>0</invert>
<skew>0</skew>
<skew_val>
<data>0.000000</data>
<unit_type>17</unit_type>
</skew_val>
<ch_vertical>
<vdiv>1</vdiv>
<fvdiv>0</fvdiv>
<vpos>0</vpos>
<vdiv_val>
<data>1000.000000</data>
<unit_type>0</unit_type>
</vdiv_val>
<vpos_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</vpos_val>
</ch_vertical>
</CH1>
<CH2>
<act>1</act>
<prioty>0</prioty>
<coup>0</coup>
<bwl>1</bwl>
<adj>0</adj>
<probe>3</probe>
<visible>1</visible>
<custom_probe_value_a>
<data>1000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_a>
<custom_probe_value_b>
<data>10000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_b>
<custom_probe_value_c>
<data>100000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_c>
<custom_probe_value_d>
<data>1000000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_d>
<z>0</z>
<unit>0</unit>
<invert>0</invert>
<skew>0</skew>
<skew_val>
<data>0.000000</data>
<unit_type>17</unit_type>
</skew_val>
<ch_vertical>
<vdiv>1</vdiv>
<fvdiv>0</fvdiv>
<vpos>-93</vpos>
<vdiv_val>
<data>1000.000000</data>
<unit_type>0</unit_type>
</vdiv_val>
<vpos_val>
<data>-1860.000077</data>
<unit_type>0</unit_type>
</vpos_val>
</ch_vertical>
</CH2>
<CH3>
<act>1</act>
<prioty>3</prioty>
<coup>0</coup>
<bwl>1</bwl>
<adj>0</adj>
<probe>3</probe>
<visible>1</visible>
<custom_probe_value_a>
<data>1000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_a>
<custom_probe_value_b>
<data>10000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_b>
<custom_probe_value_c>
<data>100000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_c>
<custom_probe_value_d>
<data>1000000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_d>
<z>0</z>
<unit>0</unit>
<invert>0</invert>
<skew>0</skew>
<skew_val>
<data>0.000000</data>
<unit_type>17</unit_type>
</skew_val>
<ch_vertical>
<vdiv>10</vdiv>
<fvdiv>0</fvdiv>
<vpos>0</vpos>
<vdiv_val>
<data>1000000.000000</data>
<unit_type>0</unit_type>
</vdiv_val>
<vpos_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</vpos_val>
</ch_vertical>
</CH3>
<CH4>
<act>1</act>
<prioty>1</prioty>
<coup>0</coup>
<bwl>1</bwl>
<adj>0</adj>
<probe>3</probe>
<visible>0</visible>
<custom_probe_value_a>
<data>1000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_a>
<custom_probe_value_b>
<data>10000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_b>
<custom_probe_value_c>
<data>100000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_c>
<custom_probe_value_d>
<data>1000000000.000000</data>
<unit_type>15</unit_type>
</custom_probe_value_d>
<z>0</z>
<unit>0</unit>
<invert>0</invert>
<skew>0</skew>
<skew_val>
<data>0.000000</data>
<unit_type>17</unit_type>
</skew_val>
<ch_vertical>
<vdiv>7</vdiv>
<fvdiv>0</fvdiv>
<vpos>0</vpos>
<vdiv_val>
<data>100000.000000</data>
<unit_type>0</unit_type>
</vdiv_val>
<vpos_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</vpos_val>
</ch_vertical>
</CH4>
</ch_setup>
<curs_setup>
<curs_switch>0</curs_switch>
<mode>0</mode>
<xy_type>0</xy_type>
<curs_select>0</curs_select>
<msrc>0</msrc>
<mhistogram>0</mhistogram>
<tsrc1>0</tsrc1>
<tsrc2>0</tsrc2>
<x_pos>175,525,</x_pos>
<y_pos>75,325,</y_pos>
<zoom_x_pos>175,525,</zoom_x_pos>
<zoom_y_pos>200,399,</zoom_y_pos>
<disp_type>0</disp_type>
<x_expand>0</x_expand>
<y_expand>0</y_expand>
</curs_setup>
<disp_setup>
<type>0</type>
<color>0</color>
<persist>0</persist>
<grid>0</grid>
<intensity>50</intensity>
<graticule>15</graticule>
<backlight>50</backlight>
<transparence>80</transparence>
</disp_setup>
<hori_setup>
<tdiv>15</tdiv>
<trig_delay>751</trig_delay>
<td_val>
<data>20.000000</data>
<unit_type>17</unit_type>
</td_val>
<trig_delay_val>
<data>300.400000</data>
<unit_type>17</unit_type>
</trig_delay_val>
<store_len>7000</store_len>
<smp_rate>
<data>25000000000000.000000</data>
<unit_type>-1087131680</unit_type>
</smp_rate>
</hori_setup>
<math_setup>
<Mfunc1>
<math_switch>0</math_switch>
<cur_fx_index>0</cur_fx_index>
<Fx_id_1>
<math_type>0</math_type>
<fft>
<src>0</src>
<scale>7</scale>
<pos>0</pos>
<hzdiv>0</hzdiv>
<f_hzdiv>
<data>2000000000000.000000</data>
<unit_type>16</unit_type>
</f_hzdiv>
<center>0</center>
<move_point>585899360</move_point>
<ave_times>4</ave_times>
<f_center>
<data>5000000000000.000000</data>
<unit_type>16</unit_type>
</f_center>
<scale_val>
<data>20000000.000000</data>
<unit_type>34</unit_type>
</scale_val>
<pos_val>
<data>-0.000000</data>
<unit_type>13</unit_type>
</pos_val>
<window>2</window>
<unit>0</unit>
<diplay>0</diplay>
<mode>0</mode>
<ext_load>50</ext_load>
<max_num>10</max_num>
<tool_type>2</tool_type>
<sort_by>0</sort_by>
<peak_list>0</peak_list>
<peak_show_freq>0</peak_show_freq>
<marker_list>0</marker_list>
<marker_show_freq>0</marker_show_freq>
<marker_show_delta>0</marker_show_delta>
<select_marker>0</select_marker>
<marker_switch>1,0,0,0,0,0,0,0,</marker_switch>
<peaks_threshold>
<data>-160000000.000000</data>
<unit_type>13</unit_type>
</peaks_threshold>
<peaks_excursion>
<data>20000000.000000</data>
<unit_type>13</unit_type>
</peaks_excursion>
<markers_threshold>
<data>-160000000.000000</data>
<unit_type>13</unit_type>
</markers_threshold>
<markers_excursion>
<data>20000000.000000</data>
<unit_type>13</unit_type>
</markers_excursion>
</fft>
<add>
<src1>0</src1>
<src2>0</src2>
<invert>0</invert>
</add>
<sub>
<src1>0</src1>
<src2>0</src2>
<invert>0</invert>
</sub>
<mult>
<src1>0</src1>
<src2>0</src2>
<invert>0</invert>
</mult>
<div>
<src1>0</src1>
<src2>0</src2>
<invert>0</invert>
</div>
<dt>
<src>0</src>
<dx>1</dx>
</dt>
<integral>
<src>0</src>
<offset>0</offset>
<offset_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</offset_val>
<gate>0</gate>
<open_gate_fx>2</open_gate_fx>
</integral>
<sqrt_src>0</sqrt_src>
<scale>10</scale>
<pos>0</pos>
<scale_val>
<data>1000000.000000</data>
<unit_type>0</unit_type>
</scale_val>
<pos_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</pos_val>
</Fx_id_1>
<Fx_id_2>
<math_type>4</math_type>
<fft>
<scale>7</scale>
<pos>-50</pos>
<hzdiv>0</hzdiv>
<f_hzdiv>
<data>0.000000</data>
<unit_type>585933680</unit_type>
</f_hzdiv>
<center>0</center>
<move_point>585899128</move_point>
<ave_times>4</ave_times>
<f_center>
<data>125000000000000.000000</data>
<unit_type>16</unit_type>
</f_center>
<scale_val>
<data>200000.000000</data>
<unit_type>34</unit_type>
</scale_val>
<pos_val>
<data>0.000000</data>
<unit_type>13</unit_type>
</pos_val>
<window>0</window>
<unit>0</unit>
<diplay>0</diplay>
<mode>585934000</mode>
<ext_load>50</ext_load>
<max_num>10</max_num>
<tool_type>0</tool_type>
<sort_by>585933496</sort_by>
<peak_list>17</peak_list>
<peak_show_freq>586127544</peak_show_freq>
<marker_list>68</marker_list>
<marker_show_freq>585933592</marker_show_freq>
<marker_show_delta>3</marker_show_delta>
<select_marker>0</select_marker>
<marker_switch>1,0,0,0,0,0,0,0,</marker_switch>
<peaks_threshold>
<data>-0.000000</data>
<unit_type>34</unit_type>
</peaks_threshold>
<peaks_excursion>
<data>0.000000</data>
<unit_type>34</unit_type>
</peaks_excursion>
<markers_threshold>
<data>-0.000000</data>
<unit_type>34</unit_type>
</markers_threshold>
<markers_excursion>
<data>0.000000</data>
<unit_type>34</unit_type>
</markers_excursion>
</fft>
<add>
<src2>0</src2>
<invert>0</invert>
</add>
<sub>
<src2>0</src2>
<invert>0</invert>
</sub>
<mult>
<src2>0</src2>
<invert>0</invert>
</mult>
<div>
<src2>0</src2>
<invert>0</invert>
</div>
<dt>
<dx>0</dx>
</dt>
<integral>
<offset>0</offset>
<offset_val>
<data>0.000000</data>
<unit_type>0</unit_type>
</offset_val>
<gate>0</gate>
<open_gate_fx>2</open_gate_fx>
</integral>
<scale>10</scale>
<pos>0</pos>
<scale_val>
<data>1000000.000000</data>
<unit_type>196614</unit_type>
</scale_val>
<pos_val>
<data>0.000000</data>
<unit_type>825601084</unit_type>
</pos_val>
</Fx_id_2>
</Mfunc1>
</math_setup>
<mea_setup>
<mea_switch>0</mea_switch>
<mea_way>0</mea_way>
<hist_switch>0</hist_switch>
<mea_src>1</mea_src>
<mea_delay_srca>0</mea_delay_srca>
<mea_delay_srcb>0</mea_delay_srcb>
<mea_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</mea_type>
<curr_mea>
<curr_mea_num>2</curr_mea_num>
<curr_mea_type1>
<scp_mea_type>2</scp_mea_type>
<sourceA>0</sourceA>
<sourceB>29</sourceB>
</curr_mea_type1>
<curr_mea_type2>
<scp_mea_type>17</scp_mea_type>
<sourceA>0</sourceA>
<sourceB>29</sourceB>
</curr_mea_type2>
<curr_mea_type3>
<scp_mea_type>38</scp_mea_type>
<sourceA>0</sourceA>
<sourceB>0</sourceB>
</curr_mea_type3>
<curr_mea_type4>
<scp_mea_type>38</scp_mea_type>
<sourceA>0</sourceA>
<sourceB>0</sourceB>
</curr_mea_type4>
<curr_mea_type5>
<scp_mea_type>38</scp_mea_type>
<sourceA>0</sourceA>
<sourceB>0</sourceB>
</curr_mea_type5>
</curr_mea>
<stat_switch>0</stat_switch>
<all_mea_switch>0</all_mea_switch>
<mea_gate_switch>0</mea_gate_switch>
</mea_setup>
<gate_setup>
<gate_select>0</gate_select>
<curs_posA>0</curs_posA>
<curs_posB>0</curs_posB>
<zoom_posA>0</zoom_posA>
<zoom_posB>0</zoom_posB>
<meas_gate_switch>0</meas_gate_switch>
<math_gate_switch>0</math_gate_switch>
<gate_type>0</gate_type>
</gate_setup>
<trig_setup>
<trig_mode>2</trig_mode>
<trig_type>0</trig_type>
<run_stop_status>0</run_stop_status>
<edge_setup>
<trig_src>3</trig_src>
<slope_type>0</slope_type>
<holdoff_switch>0</holdoff_switch>
<holdoff_type>1</holdoff_type>
<holdoff_start>0</holdoff_start>
<holdoff_event>1</holdoff_event>
<holdoff_val>
<data>0.080000</data>
<unit_type>0</unit_type>
</holdoff_val>
<trig_coup>0</trig_coup>
<noise_reject>0</noise_reject>
<ext_impedance>0</ext_impedance>
<triglevel>
<level>0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</level>
<level_val>
<data>0.000000,0.000000,0.000000,18000.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</level_val>
</triglevel>
</edge_setup>
<slope_setup>
<trig_src>0</trig_src>
<slope_type>1</slope_type>
<lmtrng>0</lmtrng>
<low>
<data>0.002000,0.002000,0.002000,0.002000,</data>
<unit_type>0,0,0,0,</unit_type>
</low>
<high>
<data>0.002000,0.002000,0.003000,0.003000,</data>
<unit_type>0,0,0,0,</unit_type>
</high>
<holdoff_switch>0</holdoff_switch>
<holdoff_type>0</holdoff_type>
<holdoff_start>0</holdoff_start>
<holdoff_event>1</holdoff_event>
<holdoff_val>
<data>0.080000</data>
<unit_type>0</unit_type>
</holdoff_val>
<trig_coup>0</trig_coup>
<noise_reject_switch>0</noise_reject_switch>
<ltriglevel>
<level>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</level>
<level_val>
<data>0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</level_val>
</ltriglevel>
<htriglevel>
<level>160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</level>
<level_val>
<data>160000.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</level_val>
</htriglevel>
</slope_setup>
<pulse_setup>
<trig_src>3</trig_src>
<polarity>1</polarity>
<lmtrng>0</lmtrng>
<low>
<data>0.002000,0.002000,0.002000,0.002000,</data>
<unit_type>0,0,0,0,</unit_type>
</low>
<high>
<data>0.002000,0.002000,0.003000,0.003000,</data>
<unit_type>0,0,0,0,</unit_type>
</high>
<holdoff_switch>0</holdoff_switch>
<holdoff_type>0</holdoff_type>
<holdoff_start>0</holdoff_start>
<holdoff_event>1</holdoff_event>
<holdoff_val>
<data>0.080000</data>
<unit_type>0</unit_type>
</holdoff_val>
<trig_coup>0</trig_coup>
<noise_reject>0</noise_reject>
<triglevel>
<level>160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</level>
<level_val>
<data>160000.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</level_val>
</triglevel>
</pulse_setup>
<wind_setup>
<trig_src>0</trig_src>
<window_type>0</window_type>
<low>80,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,</low>
<high>80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</high>
<center>80,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,-25,</center>
<delta>0,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,</delta>
<low_val>
<data>80000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,-1000000.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</low_val>
<high_val>
<data>80000.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</high_val>
<center_val>
<data>80000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,-500000.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</center_val>
<delta_val>
<data>0.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,500000.000000,</data>
<unit_type>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,</unit_type>
</delta_val>
<holdoff_switch>0</holdoff_switch>
<holdoff_type>0</holdoff_type>
<holdoff_start>0</holdoff_start>
<holdoff_event>1</holdoff_event>
<holdoff_val>
<data>0.080000</data>
<unit_type>0</unit_type>
</holdoff_val>
<trig_coup>0</trig_coup>
<noise_reject>0</noise_reject>
</wind_setup>
<video_setup>
<trig_src>0</trig_src>
<tvstd>0</tvstd>
<sync>1</sync>
<line>1</line>
<field>0</field>
<custom>
<frame_rate>0</frame_rate>
<of_lines>300</of_lines>
<of_fields>0</of_fields>
<interlace>0</interlace>
<sync>1</sync>
<line>1</line>
<field>0</field>
```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
