Signal Processing REU talk 14jun11 Phil Perillat
Talk Outline • Signals and Noise • Properties: Bandwidth, mean value, rms • Sine and cosine functions. • Sampling • Nyquist theorem • Time and frequency domain • FFT • Averaging • Example: • Observing a galaxy and reducing the data. • Summary Online: http://www.naic.edu/~phil/talks/talks.html jun11 signal procsessing ;reu11
Signals and noise • Signals are generated by some physical process: • Transitions between energy levels of an atom. Emits energy at a particular frequency. • Electrons spiraling in a magnetic field: emit energy at a range of frequencies. • One persons signal is the other persons noise: • Hot crab nebula with crab pulsar embedded in it. • For pulsar observer, nebula is noise to overcome • For someone studying continuum from the nebula, the pulsar is noise. • The goal is to maximize the ratio of: • (signal strength)/(noise strength)
Noise • Noise is a random signal • Knowing the value of the signal at time T tells you nothing about the value at time T+1. • Example from nature: incoherent emission between energy levels: • If the emission from 1 atom does not affect the emission from an adjacent atom, then the sum will be noise like even though they may all be making the same transition. • Sources of noise in experiments at AO: • Thermal noise (electrons bouncing around): • properties depend on temperature (blackbody spectrum) • The physical temperature of our receivers adds thermal noise to the signal coming in from the sky. This is why we try to cool our amplifiers. • The microwave background radiation (from the big bang) is present where ever we look in the sky and has a temp of 2.7K.
Properties: bandwidth • How often a signal can change in 1 second. • The bandwidth is a measure of how much independent information can be stored in a signal. • Example: • Suppose you want to flash the lights in a room and your signals had bandwidths of 1 and 10 Hz. • The 1 Hz signal would let you do it once a second • The 10 Hz signal path would allow you do to it up to 10 times in a second. • The bandwidth of a signal we measure is often limited by filters we place in the signal path. • Needed to satisfy Nyquist’s sampling theorem (..coming up).
Properties: mean,rms • Mean value. Sum N values then divide by N. • Zero mean: e.g. E field, voltage. • Non zero mean: e.g. Intensity: E*E always positive • Sigma or rms: • Measures the spread of the values about the mean value. • Sigma=sqrt( (∑(xi – xavg)^2)/(n-1) ) • Also called rms (Root Mean Square) • When computing the rms, you need to make sure that the noise is sitting on a flat mean. Later we will see how the bandpass and ripples can make it hard to compute the true rms of the noise.
Cosines and sines • Periodic functions with properties: • Amplitude, frequency, phase, period • A*cos(w*t – ph) or A*sin(w*t-ph) • Cos, sin take radians where 2pi radians=1 cycle. • Instead of f(Hz) use angular frequency w(rad/sec) • w(rad/sec)=2*pi*f(Hz) • Period: time between peaks = 1/freq. • Phase: (ph) can also be written as a sum of cos,sin: Acos(wt-ph)=Acos(ph)cos(wt) + Asin(ph)sin(wt) • So B=Acos(ph), C=.Asin(ph) then ph=arctan(C/B) • Why bother? • fitting for A,ph at fixed w: Acos(wt-ph) is a non linear fit where Acos(ph)*cos(wt) + Asin(ph)sin(wt) is a linear fit.
Why cosines and sines?? • Cosine and sine functions form a complete basis set. That means: • We can express most functions as a sum of cosines and sines (using the fourier transform .. coming) • Example: approximate square wave using 20 sine waves. • If we show something is true for sines and cosines (like the sampling theorem) we are assured that it will work for general functions. • We can do our analysis using sines and cosines and then transform back to our original function. • Cos and sines are solutions to the wave equation which models many physical processes.
Sampling: AtoD • Analog to Digital converter (AtoD) • Has a max and min allowable voltage input range. • e.g.:RI: +/- 2.5 volts, mock Spectrometer +/- .76 volts, • Breaks this range up into N levels and then converts it to digital. • 8 bit AtoD has 2^8 or 256 levels • 12 bit AtoD has 2^12 or 4096 levels • You adjust the input voltage so that the noise input level takes up about 4 bits. The rest of the range is used whenever strong rfi (or signals) occur.
Sampling: Nyquist • Nyquist theorem: • You need at least two samples at the highest frequency of your signal to reconstruct your analog signal without aliasing. • Since the bandwidth tells you the highest freq., sample at twice the bandwidth (or a little more…) • Example: • Sample a 1 Hz signal at 2 samples/second. • Incorrectly sample a 4 Hz signal at 2 samples/sec. • Then connect the sampled points. what do you get…
Real versus complex sampling • Nyquist sampling needs 2 samples at highest freq. • Period of highest freq=1/bandwidth • Real sampling uses 1 AtoD converter • Take 2 samples spaced by .5/bandwidth seconds • Complex sampling uses 2 AtoD converters. • Analog signal is split and the two signals are delayed relative to each other by 90 degrees. A single complex sample of the pair samples the signal at two different places in time. Sample rate is equal to the bandwidth but you need more hardware (twice as many AtoD converters).
Sampling: summary • Use analog filter to band limit the signal • Adjust AtoD input levels to give 3-4 bits on the noise. • Make sure AtoD has enough bits for any large signals that may occur (rfi). • Run the sampler at twice the bandwidth if real sampling or at the bandwidth if complex sampling.
Time domain to Freq domain • The Fourier transform converts signals in the time domain to signals in the frequency domain. • The FFT (Fast Fourier transform) does this on discretely sampled finite duration data sets. • The FFT assumes that finite duration data sets repeat themselves. • The FFT is defined as: • X(k)=∑ x(n)e2πikn/N n=0..N-1 • Where to these different parts come from..
FFT • Sample time=dt with N samples gives Total time=N*dt • Smallest freq has 1 cycle over total time • f0 =1/(N*dt) • Let x(n*dt) n=0..N-1 be the N time samples • Let X(k*f0) be the k=0..N-1 frequency channels X(k*f0)=∑n=0,N-1x(n*dt)*(cos(2π*k*f0*n*dt)+isin(2π*k*f0*n*dt)) • 2π*k*f0 is one of our angular frequencies • n*dt runs through the n time samples spaced by dt. • But f0*dt=dt/(N*dt)=1/N so the dt’s cancel out.
FFT… • Canceling the dt’s gives: X(k*f0)=∑n=0,N-1x(n*dt)*(cos(2π*k*n/N)+isin(2π*k*n/N)) • You can use complex notation: ei θ=cos(θ) + isin(θ) • Giving: X(k*f0)=∑n=0,N-1x(n*dt)*e2πikn/N
Why the FFT works • If you multiply 2 cosines with different frequencies and then average over complete cycles, they average to 0. • Earlier we said that any function could be constructed from a sum of cosines of different frequencies. • When each freq of the FFT multplies x(t) and then sums over time, only components of x(t) that equal this frequency will be non zero. All other frequency components will average to 0.
The spectral density function • The spectral density function (or spectrum) tells how much energy there in each frequency channel.. • If N channels S(1..N) then • S(n)=energy in channel n • Total power ∑S(n) over the N frequency channels • Radio astronomy receivers measure the E & B fields. • Energy is the square of the E & B fields. • When we FFT our voltage (E&B field) samples we have frequency channels that are still in voltage units. • You need to square the output of the FFT to get energy. • Since the FFT gives a complex result you take the FFT output times it’s complex conjugate.
Averaging and sigma • Adding a constant number A to itself N times gives N*A. • Adding noise signals together increases the rms value by sqrt(N). • Sometimes you add numbers together of opposite sign. • To average numbers you sum N times and then divide by N. • Constant: (∑1..NA )/ N = A no change • Noise : (∑1,,Nxi)/N = Sqrt(N)/N = 1/sqrt(N) averaging N noise samples decreases rms by 1/sqrt(N)
The radiometer equation • Suppose we have a single spectrum with: • Nchan frequency channels. • bwTot total bandwidth, • chnBw=bwTot/Nchan bandwidth of each channel • How many independent samples are in each chan of 1 spectra (spc)? • chnBw=bwTot/Nchan. This can change chnBw times per sec. • Each spectra lasts for Nchan * 1/bwTot secs so • # IndSamples=chnBw*timeSpc=(bwTot/Nchan)*(Nchan/bwTot)=1 • Each spectra has 1 independent sample per channel • If we average a spectra for 1 second we get: • Time 1spec=1/chnBw • Spectra in 1 second= 1/timespec= chnBw • Averaging a spectra for 1 second has chnBw independent sample in each channel.
Radiometer equation • The relative error in our spectrum S is then: • ∆S/S=1/sqrt(# of independent samples) • ∆S/S=1/sqrt(chnBw *Integrationtime) • ∆S/S=1/sqrt((totBw/Nchan)*time) • Properties: • Increasing the integration time: • decreases error by 1/sqrt(time) • Increasing the channel width (smoothing) • decreases the error by 1/sqrt(channelWidth)
Observing the galaxy U5852 • One second spectral average • 1420.4058 is the hydrogen spin flip transition • You can see our galaxy sticking up. • 1406 Mhz: Dc spike from complex sampling • 1381 Mhz: GPS L3 satellite rfi. Looking for nuclear explosions. • Bandpass shape origin: • filters in our if/lo system. • small ripples caused by signals bouncing between the platform and the dish (standing waves). • Y axis units are arbitrary counts from the mock spectrometer. They are linear in power.
Position switching • Averaging the On for 300 seconds decreases the noise. • We still need to remove the band pass shape. • need to divide by a band pass correction (bpc) that does not include the galaxy. • The noise in the bpc must be small enough to not increase the noise of the result (integration times for on, off should be similar). • On, Off position switching: • On: track galaxy for 300 secs • Off:go back and track the same part of the dish. • sky has moved, you are no longer looking at the galaxy. • Removes bandpass shape from our system (IF/LO) as well as a large fraction of the standing waves. • Picture: 300 sec on,off. Galaxy missing from off, off lower than on.
Converting to Kelvins with the cal • We need to convert to physical energy units to do science. • Spectra measured in spectrometer counts (spcCnts). • The cal diode injects a known amount of noise into the receiver. • The lbw cal at 1400 Mhz = 8.8 Kelvins • KperSpcCnt=CalDefl(inDegK)/calDefl(inSpcCnt) • Spc(spcCnts)*KperSpcCnt= spc(K) • We only integrated the cal for 10 seconds. Why not 150 seconds?? Adds noise to the system.. • Need to average over frequency so we don’t increase the noise on our 300 second integrated spectra
(On-off)/off in DegK • Note: (On-Off)/Off = (On/Off – 1) • Subtract (on – off) • We can see the galaxy, but still has bandpass shape. • Units are spectrometer units (spcU). • Divide by off. • Removes band pass, but changes units to off (or Tsys) • To use cal conversation, we must put the spectrometer units back in: • Compute mean of off spectra and multiply into (on-off)/off
U5852 in Jy vs vel • Plot using Janskys and velocity • Jansky = 10-26 watts/m2/hz measures power received • Velocity km/sec measures the doppler shift from expansion of the universe and the rotation velocity of the galaxy. • What we learn of the astronomy: • Distance, lookback time, mass, rotational velocity, morphology (double or single peaked). • Galaxy is also generating continuum radiation (offset from 0)
Summary • Noise comes from our equip (thermal) and the sky. • Cos and sines can represent arbitrary functions • Nyquist sampling requires a sample rate of at least 2*bw • The FFT lets you convert from the time to the freq. domain. • Averaging N samples decreases noise by 1/sqrt(N) • Radiometer equation: ∆T/T=1/sqrt(chanBw*time) • Position switching removes band pass and standing waves. • Cals convert from spectrometer units to degK • The spectral density function lets us measure physical quantities of interest.