diff options
-rw-r--r-- | gr-dpd/grc/dpd_memless_poly.xml | 7 | ||||
-rw-r--r-- | gr-dpd/include/dpd/memless_poly.h | 7 | ||||
-rw-r--r-- | live_analyse.grc | 854 | ||||
-rw-r--r-- | live_analyse_py.grc | 81 | ||||
-rw-r--r-- | run.ipynb | 4 | ||||
-rw-r--r-- | two_tone_tuner.ipynb | 74 |
6 files changed, 1003 insertions, 24 deletions
diff --git a/gr-dpd/grc/dpd_memless_poly.xml b/gr-dpd/grc/dpd_memless_poly.xml index ce687a7..98871a1 100644 --- a/gr-dpd/grc/dpd_memless_poly.xml +++ b/gr-dpd/grc/dpd_memless_poly.xml @@ -22,36 +22,43 @@ <param> <name>a2</name> <key>a2</key> + <value>0</value> <type>real</type> </param> <param> <name>a3</name> <key>a3</key> + <value>0</value> <type>real</type> </param> <param> <name>a4</name> <key>a4</key> + <value>0</value> <type>real</type> </param> <param> <name>a5</name> <key>a5</key> + <value>0</value> <type>real</type> </param> <param> <name>a6</name> <key>a6</key> + <value>0</value> <type>real</type> </param> <param> <name>a7</name> <key>a7</key> + <value>0</value> <type>real</type> </param> <param> <name>a8</name> <key>a8</key> + <value>0</value> <type>real</type> </param> <sink> diff --git a/gr-dpd/include/dpd/memless_poly.h b/gr-dpd/include/dpd/memless_poly.h index 921a9df..a3d17d2 100644 --- a/gr-dpd/include/dpd/memless_poly.h +++ b/gr-dpd/include/dpd/memless_poly.h @@ -48,7 +48,14 @@ namespace gr { */ static sptr make(float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8); + virtual void set_a1(float sens) = 0; virtual void set_a2(float sens) = 0; + virtual void set_a3(float sens) = 0; + virtual void set_a4(float sens) = 0; + virtual void set_a5(float sens) = 0; + virtual void set_a6(float sens) = 0; + virtual void set_a7(float sens) = 0; + virtual void set_a8(float sens) = 0; }; diff --git a/live_analyse.grc b/live_analyse.grc index 5483676..04bedef 100644 --- a/live_analyse.grc +++ b/live_analyse.grc @@ -674,7 +674,7 @@ </param> <param> <key>value</key> - <value>20</value> + <value>40</value> </param> <param> <key>_enabled</key> @@ -827,7 +827,7 @@ </param> <param> <key>value</key> - <value>20</value> + <value>80</value> </param> <param> <key>_enabled</key> @@ -883,6 +883,49 @@ </param> </block> <block> + <key>blocks_complex_to_real</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(656, 241)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_complex_to_real_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> <key>blocks_file_source</key> <param> <key>alias</key> @@ -1083,12 +1126,16 @@ </param> </block> <block> - <key>dpd_memless_poly</key> + <key>blocks_null_sink</key> <param> <key>alias</key> <value></value> </param> <param> + <key>bus_conns</key> + <value>[[0,],]</value> + </param> + <param> <key>comment</key> <value></value> </param> @@ -1102,6 +1149,49 @@ </param> <param> <key>_coordinate</key> + <value>(712, 289)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_null_sink_0_2_0</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>dpd_memless_poly</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> <value>(512, 27)</value> </param> <param> @@ -1122,7 +1212,7 @@ </param> <param> <key>a1</key> - <value>1</value> + <value>a_1</value> </param> <param> <key>a2</key> @@ -1189,7 +1279,7 @@ </param> <param> <key>_enabled</key> - <value>True</value> + <value>1</value> </param> <param> <key>fftsize</key> @@ -1197,7 +1287,7 @@ </param> <param> <key>_coordinate</key> - <value>(704, 222)</value> + <value>(712, 142)</value> </param> <param> <key>gui_hint</key> @@ -1425,7 +1515,7 @@ </param> <param> <key>update_time</key> - <value>0.1</value> + <value>0.25</value> </param> <param> <key>wintype</key> @@ -1476,7 +1566,7 @@ </param> <param> <key>_enabled</key> - <value>True</value> + <value>0</value> </param> <param> <key>fftsize</key> @@ -1484,7 +1574,7 @@ </param> <param> <key>_coordinate</key> - <value>(1056, 38)</value> + <value>(1056, 22)</value> </param> <param> <key>gui_hint</key> @@ -1728,6 +1818,724 @@ </param> </block> <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(1056, 102)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value></value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>""</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(848, 222)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0_0</value> + </param> + <param> + <key>legend</key> + <value>True</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value></value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>""</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <block> <key>uhd_amsg_source</key> <param> <key>alias</key> @@ -2442,7 +3250,7 @@ </param> <param> <key>_coordinate</key> - <value>(1056, 119)</value> + <value>(1056, 199)</value> </param> <param> <key>_rotation</key> @@ -3513,7 +4321,7 @@ </param> <param> <key>_enabled</key> - <value>True</value> + <value>1</value> </param> <param> <key>_coordinate</key> @@ -3669,6 +4477,12 @@ </param> </block> <connection> + <source_block_id>blocks_complex_to_real_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> <source_block_id>blocks_file_source_0</source_block_id> <sink_block_id>dpd_memless_poly_0</sink_block_id> <source_key>0</source_key> @@ -3688,6 +4502,12 @@ </connection> <connection> <source_block_id>blocks_multiply_const_vxx_1</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_multiply_const_vxx_1</source_block_id> <sink_block_id>uhd_usrp_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -3706,6 +4526,18 @@ </connection> <connection> <source_block_id>uhd_usrp_source_0</source_block_id> + <sink_block_id>blocks_complex_to_real_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>uhd_usrp_source_0</source_block_id> + <sink_block_id>blocks_null_sink_0_2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>uhd_usrp_source_0</source_block_id> <sink_block_id>qtgui_freq_sink_x_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/live_analyse_py.grc b/live_analyse_py.grc index f24bcab..907de4c 100644 --- a/live_analyse_py.grc +++ b/live_analyse_py.grc @@ -369,7 +369,7 @@ </param> <param> <key>_coordinate</key> - <value>(312, 141)</value> + <value>(192, 133)</value> </param> <param> <key>_rotation</key> @@ -448,6 +448,77 @@ </param> </block> <block> + <key>dpd_memless_poly</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(480, 99)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>dpd_memless_poly_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>a1</key> + <value>1</value> + </param> + <param> + <key>a2</key> + <value>0</value> + </param> + <param> + <key>a3</key> + <value>0</value> + </param> + <param> + <key>a4</key> + <value>0</value> + </param> + <param> + <key>a5</key> + <value>0</value> + </param> + <param> + <key>a6</key> + <value>0</value> + </param> + <param> + <key>a7</key> + <value>0</value> + </param> + <param> + <key>a8</key> + <value>0</value> + </param> + </block> + <block> <key>logpwrfft_x</key> <param> <key>avg_alpha</key> @@ -2457,7 +2528,7 @@ </block> <connection> <source_block_id>blocks_file_source_0</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> + <sink_block_id>dpd_memless_poly_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -2468,6 +2539,12 @@ <sink_key>0</sink_key> </connection> <connection> + <source_block_id>dpd_memless_poly_0</source_block_id> + <sink_block_id>uhd_usrp_sink_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> <source_block_id>logpwrfft_x_0</source_block_id> <sink_block_id>blks2_tcp_sink_1_0</sink_block_id> <source_key>0</source_key> @@ -112,9 +112,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "top." - ] + "source": [] }, { "cell_type": "code", diff --git a/two_tone_tuner.ipynb b/two_tone_tuner.ipynb index 0272401..2b4d5d9 100644 --- a/two_tone_tuner.ipynb +++ b/two_tone_tuner.ipynb @@ -78,28 +78,86 @@ "execution_count": null, "metadata": {}, "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "def measure(param):\n", - " x2 = param[0]\n", - " x3 = param[1]\n", - " x4 = param[2]\n", + " x2, x3, x4, x5, x6, x7, x8 = param\n", + " \n", " repeat = True\n", " while repeat:\n", - " tt.gen_two_tone(debug = True, predist=tt.predist_poly, par=(x2, x3, x4))\n", + " #tt.gen_two_tone(debug = True, predist=tt.predist_poly, par=(x2, x3, x4))\n", + " \n", + " top.dpd_memless_poly_0.set_a1(0.8)\n", + " top.dpd_memless_poly_0.set_a2(x2)\n", + " top.dpd_memless_poly_0.set_a3(x3)\n", + " top.dpd_memless_poly_0.set_a4(x4)\n", + " top.dpd_memless_poly_0.set_a5(x5)\n", + " top.dpd_memless_poly_0.set_a6(x6)\n", + " top.dpd_memless_poly_0.set_a7(x7)\n", + " top.dpd_memless_poly_0.set_a8(x8)\n", + " \n", " sync.has_msg()\n", - " np.array(sync.get_msgs(2))\n", + " np.array(sync.get_msgs(1))\n", " msgs = np.array(sync.get_msgs(5))\n", " msgs = [np.fft.fftshift(msg) for msg in msgs]\n", " \n", " if async.has_msg():\n", + " print (\"repeat due to async message\")\n", " continue\n", " \n", " a = np.array(msgs)\n", " mean_msg = a.mean(axis = 0)\n", - " suffix = \"x_2_%.3f_x_3_%.3f_x_4_%.3f\" % (x2, x3, x4)\n", + " suffix = \"x_2_%.3f_x_3_%.3f_x_4_%.3fx_5_%.3fx_6_%.3fx_7_%.3fx_8_%.3f\" % \\\n", + " (x2, x3, x4, x5, x6, x7, x8)\n", " sig_to_noise = tt.analyse_power_spec(mean_msg, debug=True, debug_path=\"/tmp/out\", suffix=suffix)\n", - " print(sig_to_noise, x2, x3, x4)\n", - " repeat = False" + " print(sig_to_noise, x2, x3, x4, x5, x6, x7, x8)\n", + " repeat = False\n", + " \n", + " return sig_to_noise" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def simple_opt(pars, i, d, func):\n", + " par = pars[i]\n", + " test_pars = []\n", + " for x in [-1, 0, 1]:\n", + " new_par = list(pars)\n", + " new_par[i] = par + x * d \n", + " test_pars.append(new_par)\n", + " res = [func(par_new) for par_new in test_pars]\n", + " sel = np.argmax(res)\n", + " best_par = test_pars[sel]\n", + " return best_par\n", + "\n", + "#pars = [1,1,1]\n", + "#i_rand = np.random.randint(0, len(pars))\n", + "#pars = simple_opt(pars, i_rand, 0.01, lambda x:np.sum(x))\n", + "#pars" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "top.set_txgain(85)\n", + "pars = np.zeros(7)\n", + "\n", + "for i in range(100):\n", + " i_rand = np.random.randint(0, len(pars))\n", + " pars = simple_opt(pars, i_rand, 0.05, measure)\n" ] }, { |