44import sys
55
66
7- def example (resource_name , options , center_frequency , span , reference_level , number_of_spectral_lines ):
7+ def example (resource_name , options , center_frequency , span , reference_level ):
88 with nirfsa .Session (resource_name = resource_name , id_query = False , reset_device = False , options = options ) as rfsa_session :
99 # Configurations
1010 rfsa_session .acquisition_type = nirfsa .AcquisitionType .SPECTRUM
1111 rfsa_session .reference_level = reference_level
1212 rfsa_session .resolution_bandwidth = 10e3
13-
1413 rfsa_session .configure_spectrum_frequency (center_frequency = center_frequency , span = span )
15- rfsa_session .number_of_spectral_lines = number_of_spectral_lines
1614
17- spectrum_buf = np .zeros (rfsa_session .number_of_spectral_lines , dtype = np .float64 )
15+ spectrum_buffer = np .zeros (rfsa_session .number_of_spectral_lines , dtype = np .float64 )
1816
19- spectrum_info = rfsa_session .read_power_spectrum_into (spectrum_buf , timeout = 10.0 )
17+ spectrum_info = rfsa_session .read_power_spectrum_into (spectrum_buffer , timeout = 10.0 )
2018
2119 # Do something useful with the data.
2220 # We will find the highest peak in a bin, which is not the actual highest
@@ -39,10 +37,9 @@ def _main(argsv):
3937 parser .add_argument ('-c' , '--center-frequency' , default = 1e9 , type = float , help = 'Center frequency in Hz.' )
4038 parser .add_argument ('-s' , '--span' , default = 100e6 , type = float , help = 'Span in Hz.' )
4139 parser .add_argument ('-r' , '--reference-level' , default = 0.0 , type = float , help = 'Reference level in dBm.' )
42- parser .add_argument ('-l' , '--number-of-spectral-lines' , default = 1024 , type = int , help = 'Number of spectral lines to acquire.' )
4340 parser .add_argument ('-op' , '--option-string' , default = '' , type = str , help = 'Option string for the session.' )
4441 args = parser .parse_args (argsv )
45- example (args .resource_name , args .option_string , args .center_frequency , args .span , args .reference_level , args . number_of_spectral_lines )
42+ example (args .resource_name , args .option_string , args .center_frequency , args .span , args .reference_level )
4643
4744
4845def main ():
@@ -55,7 +52,7 @@ def test_example():
5552
5653
5754def test_main ():
58- cmd_line = ['--resource-name' , 'simulated5841' , '--center-frequency' , '1e9' , '--span' , '100e6' , '--reference-level' , '-10' , '--number-of-spectral-lines' , '1024' , '-- option-string' , 'Simulate=1, DriverSetup=Model:5841' ]
55+ cmd_line = ['--resource-name' , 'simulated5841' , '--center-frequency' , '1e9' , '--span' , '100e6' , '--reference-level' , '-10' , '--option-string' , 'Simulate=1, DriverSetup=Model:5841' ]
5956 _main (cmd_line )
6057
6158
0 commit comments