From 5b540123320be5f33d93bf5f20b6d8da1543d91c Mon Sep 17 00:00:00 2001 From: Jeff Moe Date: Tue, 17 Jan 2023 09:09:05 -0700 Subject: [PATCH] py 2to3 --- CygnusRFI.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CygnusRFI.py b/CygnusRFI.py index c70b1c6..a95c609 100644 --- a/CygnusRFI.py +++ b/CygnusRFI.py @@ -51,20 +51,20 @@ print('\033[1;33;48m+=========================================================== sleep(0.5) print('\n\033[1;33;48m\033[4;33;48mRFI Measurement Parameters:\033[0;32;48m') sleep(0.15) -print('\033[1;32;48mFrequency range to scan: \033[1;36;48m'+str(float(fmin)/1000000)+'-'+str(float(fmax)/1000000)+' MHz') +print(('\033[1;32;48mFrequency range to scan: \033[1;36;48m'+str(float(fmin)/1000000)+'-'+str(float(fmax)/1000000)+' MHz')) sleep(0.15) -print('\033[1;32;48mBandwidth per spectrum: \033[1;36;48m'+str(float(bandwidth)/1000000)+' MHz') +print(('\033[1;32;48mBandwidth per spectrum: \033[1;36;48m'+str(float(bandwidth)/1000000)+' MHz')) sleep(0.15) -print('\033[1;32;48mIntegration time per spectrum: \033[1;36;48m'+duration+' sec') +print(('\033[1;32;48mIntegration time per spectrum: \033[1;36;48m'+duration+' sec')) sleep(0.15) -print('\033[1;32;48mNumber of channels per spectrum (FFT Size should be a power of 2): \033[1;36;48m'+str(channels)) +print(('\033[1;32;48mNumber of channels per spectrum (FFT Size should be a power of 2): \033[1;36;48m'+str(channels))) sleep(0.15) -print('\033[1;32;48mIntegration time per FFT sample: \033[1;36;48m'+t_int+' sec') +print(('\033[1;32;48mIntegration time per FFT sample: \033[1;36;48m'+t_int+' sec')) sleep(0.5) -print("\n\033[1;32;48mEstimated completion time: \033[1;36;48m"+str(float(duration)*float(fmax-fmin)/float(bandwidth))+" sec") +print(("\n\033[1;32;48mEstimated completion time: \033[1;36;48m"+str(float(duration)*float(fmax-fmin)/float(bandwidth))+" sec")) sleep(0.5) -proceed = input("\n\033[1;36;48mProceed to measurement? [Y/n]: \033[1;33;48m") +proceed = eval(input("\n\033[1;36;48mProceed to measurement? [Y/n]: \033[1;33;48m")) if proceed.lower() != 'n' and proceed.lower() != 'no': print('\n\033[1;33;48m+=================================================================+') @@ -73,7 +73,7 @@ if proceed.lower() != 'n' and proceed.lower() != 'no': q=0 for freq in range(int(fmin), int(fmax), int(float(bandwidth))): - print("\033[1;33;48m\n---------------------------------------------------------------------------\n \033[1;33;48m[*] \033[1;32;48mCurrently monitoring f_center = "+str(0.000001*freq)+" +/- "+str(float(float(bandwidth)*0.000001)/2)+" MHz (iteration: "+str(q)+")...\n\033[1;33;48m---------------------------------------------------------------------------") + print(("\033[1;33;48m\n---------------------------------------------------------------------------\n \033[1;33;48m[*] \033[1;32;48mCurrently monitoring f_center = "+str(0.000001*freq)+" +/- "+str(float(float(bandwidth)*0.000001)/2)+" MHz (iteration: "+str(q)+")...\n\033[1;33;48m---------------------------------------------------------------------------")) #Define observation frequency f_center = str(freq) @@ -81,7 +81,7 @@ if proceed.lower() != 'n' and proceed.lower() != 'no': #Execute top_block.py with parameters print('\033[0m') sys.argv = ['top_block.py', '--c-freq='+f_center, '--samp-rate='+bandwidth, '--nchan='+channels, '--nbin='+nbins, '--obs-time='+duration] - execfile('top_block.py') + exec(compile(open('top_block.py', "rb").read(), 'top_block.py', 'exec')) os.rename('observation.dat', str(q)+'.dat') q = q+1 @@ -91,7 +91,7 @@ if proceed.lower() != 'n' and proceed.lower() != 'no': f_center = str(fmin) sys.argv = ['rfi_plotter.py', 'freq='+f_center, 'samp_rate='+bandwidth, 'nchan='+channels, 'nbin='+nbins, 'n='+str(q), 'dur='+duration, 'fminimum='+str(fmin), 'fmaximum='+str(fmax)] - execfile('rfi_plotter.py') + exec(compile(open('rfi_plotter.py', "rb").read(), 'rfi_plotter.py', 'exec')) print('\033[1;32;48mYour data has been saved as \033[1;36;48mrfi_plot.png\033[1;32;48m.') else: