def read_data(ser): # Read what comes back until you see the "begin data transmission" az = [] el = [] pwr = [] buf = ser.readline() print buf while (buf != BDTX): buf = ser.readline() print buf while (buf != EDTX): buf = ser.readline() if (buf != EDTX): a, e, p = buf.split() az.append(a) el.append(e) pwr.append(p) #output.append(buf) print buf #output.pop() az = np.array(az, dtype='float64') el = np.array(el, dtype='float64') pwr = np.array(pwr, dtype='float64') pwr = mrt.zx47_60(pwr) return (az, el, pwr)
def numpyState(state): ndata = {} for i in np.arange(len(state_vars)): ndata[state_vars[i]] = np.array(state[state_vars[i]], dtype=state_dtypes[i]) ndata['pwr'] = mrt.zx47_60(ndata['voltage']) # Both readState and readStream run through here. # Apply offsets ndata['azDeg'] = np.mod(-ndata['azDeg'] - azoff, 360) ndata['elDeg'] -= eloff return ndata
def numpyState(state): """Get the state going""" ndata = {} for i in np.arange(len(mrtstate.state_vars)): ndata[mrtstate.state_vars[i]] = np.array(state[mrtstate.state_vars[i]], dtype=mrtstate.state_dtypes[i]) ndata['pwr'] = mrt.zx47_60(ndata['voltage']) # Both readState and readStream run through here. # Apply offsets ndata['azDeg'] = np.round(np.mod(-ndata['azDeg'] - mrtstate.offsets['azoff'] ,360),3) ndata['elDeg'] = np.round(ndata['elDeg'] - mrtstate.offsets['eloff'], 3) return ndata
def numpyState(state): ndata = {} for i in np.arange(len(mrtstate.state_vars)): ndata[mrtstate.state_vars[i]] = np.array(state[mrtstate.state_vars[i]], dtype=mrtstate.state_dtypes[i]) ndata['pwr'] = mrt.zx47_60(ndata['voltage']) # Both readState and readStream run through here. # Apply offsets ndata['azDeg'] = np.mod(-ndata['azDeg'] - azoff,360) ndata['elDeg'] -= eloff return ndata
def read_data_rx(ser): # Read what comes back until you see the "begin data transmission" pwr = [] volt = [] buf = ser.readline() print buf while (buf != BDTX): buf = ser.readline() print buf while (buf != EDTX): buf = ser.readline() if (buf != EDTX): v = buf #buf.split() pwr.append(v) volt.append(v) print buf pwr = np.array(pwr, dtype='float64') volt = np.array(volt, dtype='float64') pwr = mrt.zx47_60(pwr) return (volt, pwr)
# -*- coding: utf-8 -*- """ Created on Wed Jul 20 22:54:01 2016 @author: jaguirre """ import numpy as np import pylab as plt import MRTtools as mrt reload(mrt) az,el,v = np.loadtxt('DATA',unpack=True) p = mrt.zx47_60(v) N= 50 smp = np.convolve(p, np.ones((N,))/N,mode='same') smp -= 16. smp /= smp.max() plt.figure(1) plt.clf() #plt.plot(az,p) plt.plot(az,smp) plt.plot([az.min(),az.max()],[0,0]) plt.plot([az.min(),az.max()],[0.5,0.5]) plt.plot([21.5,21.5],[0,1],'c') plt.plot([34,34],[0,1],'c')
# -*- coding: utf-8 -*- """ Created on Wed Jul 20 22:54:01 2016 @author: jaguirre """ import numpy as np import pylab as plt import MRTtools as mrt reload(mrt) az, el, v = np.loadtxt('DATA', unpack=True) p = mrt.zx47_60(v) N = 50 smp = np.convolve(p, np.ones((N, )) / N, mode='same') smp -= 16. smp /= smp.max() plt.figure(1) plt.clf() #plt.plot(az,p) plt.plot(az, smp) plt.plot([az.min(), az.max()], [0, 0]) plt.plot([az.min(), az.max()], [0.5, 0.5]) plt.plot([21.5, 21.5], [0, 1], 'c') plt.plot([34, 34], [0, 1], 'c')
# Number 1 MHz bins in the bandwidth BW_N1MHz = 800. G_amp = dB2g(15.) G_LNA = 9e4 G_tot = G_amp * G_LNA GdB = 10. * np.log10(G_tot) lmbda = (c.c / (12. * u.GHz)).to(u.m) A_tel = np.pi * np.power(0.2 * u.m, 2) Omega_tel = ((np.power(lmbda, 2) / A_tel).to(u.dimensionless_unscaled)).value Omega_sun = np.pi * np.power(np.radians(0.5 / 2.), 2) Omega_jup = np.pi * np.power(np.radians(30. / 3600.), 2) #Spectrometer should see print "The spectrometer (pre-amplification) should see", mrt.W2dBm( (Wthermal1MHz * G_LNA).value), "dBm" print "The spectrometer (post-amplification) should see", mrt.W2dBm( (Wthermal1MHz * G_tot).value), "dBm" print "The power detector should see", (Wthermal1MHz * G_tot * BW_N1MHz).value * 1e6, "microW" print "The power detector should see", mrt.W2dBm( (Wthermal1MHz * G_tot * BW_N1MHz).value), "dBm" # What's the dynamic range we expect to see? print print "Atmosphere:", mrt.W2dBm( (Pthermal(20. * u.K, 800. * u.MHz) * G_tot).value), "dBm" print "Room:", mrt.W2dBm( (Pthermal(300. * u.K, 800. * u.MHz) * G_tot).value), "dBm" print "Sun:", mrt.W2dBm( (Pthermal(5800. * np.power(0.5 / 4.5, 2) * u.K, 800. * u.MHz) *