if opts.realtime: '''#################################################### # REALTIME # ####################################################''' from ECHO_time_utils import find_peak from ECHO_plot_utils import * fmin,fmax = int(opts.freq)-1,int(opts.freq)+1 # MHz; for plotting time_range = 200 # Time range in seconds of peak plot window rmswindow = 10 # Get initial data from Signal Hound spec_times,spec_raw,freqs,lats,lons,alts = get_data(opts.acc_file, filetype='echo', freq=137.500) #print freqs.shape,spec_raw.shape if spec_times.shape[0] == 0: # Ensure data in inFile print 'Invalid data: array with zero dimension\nExiting...\n' sys.exit() # Initialize plotting figure fig = plt.figure(figsize=(16,9),dpi=80,facecolor='w',edgecolor='w') #mng = plt.get_current_fig_manager() # Make figure full screen fig.suptitle('ECHO Realtime Data Visualization for %s' %opts.acc_file,fontsize=16) # Spectrum plot initialization gsl = gridspec.GridSpec(2,1) # Sets up grid for placing plots spec_plot = fig.add_subplot(gsl[0]) # Initialize the spectrum plot in figure spec_line, = spec_plot.plot(freqs,spec_raw[0,:])
# Check for latitude and longitude of antenna under test if not (opts.lat0 and opts.lon0): print '\nLatitude (--lat0) and Longitude (--lon0) required...\n' sys.exit() DELAY_TIME = 0.3 # Time delay between queries of ECHO_server.py last_row_index = 0 # Index for SH time queries freq_chan = 0 # Index in spectrum of Valon synth peak freq freqs = [] # Store frequencies in SH spectrum print ' ' # Read in initial SH data spec_times, spec_raw, freqs, freq_chan = get_data(opts.spec_file, filetype='sh', freqs=freqs, freq=opts.freq, freq_chan=freq_chan, width=opts.width, nfft=opts.nfft) #, #isList=opts.isList) print 'Read in %s spectra spanning %s frequencies\n' % (spec_times.shape[0], freqs.shape[0]) # Get date/time info for file naming date_time = spec_times[0].iso.split(' ') time_str = '-'.join(date_time[-1].split(':')).split('.')[0] #outfile_str = 'acc_'+date_time[0]+'_'+time_str+'.txt' outfile_str = opts.acc_file # Header information for output file headstr = '# Accumulated data for ' + ','.join(date_time)
import numpy as np import time,optparse,sys from glob import glob import healpy as hp from astropy.time import Time from ECHO.read_utils import get_data from ECHO.plot_utils import make_beam,grid_to_healpix from ECHO.time_utils import unix_to_gps from ECHO.read_utils import read_apm_logs,flag_angles,apply_flagtimes,read_orbcomm_spectrum,channel_select,interp_rx,dB o = optparse.OptionParser() o.add_option('--nsides',type=int,default=8, help='Number of sides for Healpix plotting (Default = 8)') opts,args = o.parse_args(sys.argv[1:]) infile = sys.argv[1] spec_times,spec_raw,freqs,lats,lons,alts = get_data(infile, filetype='echo') hpx_beam,hpx_rms,hpx_counts = grid_to_healpix(lats[1:],lons[1:], alts,spec_raw, lat0=lats[0], lon0=lons[0], nside=opts.nsides) hp.write_map(infile[:-4]+'_'+str(opts.nsides)+'_beam.fits',hpx_beam) hp.write_map(infile[:-4]+'_'+str(opts.nsides)+'_rms.fits',hpx_rms) hp.write_map(infile[:-4]+'_'+str(opts.nsides)+'_counts.fits',hpx_counts)
if not (opts.lat0 and opts.lon0): print '\nLatitude (--lat0) and Longitude (--lon0) required...\n' sys.exit() DELAY_TIME = 0.3 # Time delay between queries of ECHO_server.py last_row_index = 0 # Index for SH time queries freq_chan = 0 # Index in spectrum of Valon synth peak freq freqs = [] # Store frequencies in SH spectrum print ' ' # Read in initial SH data spec_times,spec_raw,freqs,freq_chan = get_data(opts.spec_file, filetype='sh', freqs=freqs, freq=opts.freq, freq_chan=freq_chan, width=opts.width, nfft=opts.nfft)#, #isList=opts.isList) print 'Read in %s spectra spanning %s frequencies\n' %(spec_times.shape[0], freqs.shape[0]) # Get date/time info for file naming date_time = spec_times[0].iso.split(' ') time_str = '-'.join(date_time[-1].split(':')).split('.')[0] #outfile_str = 'acc_'+date_time[0]+'_'+time_str+'.txt' outfile_str = opts.acc_file # Header information for output file
if opts.realtime: '''#################################################### # REALTIME # ####################################################''' from ECHO_time_utils import find_peak from ECHO_plot_utils import * fmin, fmax = int(opts.freq) - 1, int(opts.freq) + 1 # MHz; for plotting time_range = 200 # Time range in seconds of peak plot window rmswindow = 10 # Get initial data from Signal Hound spec_times, spec_raw, freqs, lats, lons, alts = get_data(opts.acc_file, filetype='echo', freq=137.500) #print freqs.shape,spec_raw.shape if spec_times.shape[0] == 0: # Ensure data in inFile print 'Invalid data: array with zero dimension\nExiting...\n' sys.exit() # Initialize plotting figure fig = plt.figure(figsize=(16, 9), dpi=80, facecolor='w', edgecolor='w') #mng = plt.get_current_fig_manager() # Make figure full screen fig.suptitle('ECHO Realtime Data Visualization for %s' % opts.acc_file, fontsize=16) # Spectrum plot initialization gsl = gridspec.GridSpec(2, 1) # Sets up grid for placing plots spec_plot = fig.add_subplot(