Simulate white noise plus Gaussian
Here is a script to replace one channel's signal with Gaussian random white noise, plus a Gaussian source. The source can be varied in witdth and height. We are adding the source in a time series. To translate this into a spatial width, take this example: with a Gaussian sigma of 0.1 seconds and a typical scanning speed of 120"/sec, the temporal sigma corresponds to a spatial sigma of 12 arcsec, or a FWHM of sqrt(8 ln(2))*12 = 2.35*12 arcsec , which is close to the beam of LABOCA.
1 import RandomArray
2
3 # read some initial data
4 data.read('YourPreferedScan')
5
6 # number of the channel to replace
7 channel = 121
8 chanIndex = data.BolometerArray.getChanIndex(channel)[0]
9
10 # get Data
11 time = data.getChanListData('mjd',[channel],flag=0)[0]
12 flux = data.getChanListData('flux',chanList=[channel],flag=0)[0]
13
14 print size(time) # that's how big it is
15 print flux[:10] # have a look what is in it (optional)
16 plot(time,flux,style='l') # plot the data you intend to replace (optional)
17
18 # make random array (arguments: mean, std, size)
19 ranFlux = RandomArray.normal(0,10,size(time))
20
21 plot(time,ranFlux) # plot random array (optional)
22
23 dtime = time[:201]-time[0] # prepare small array to create Gaussian source
24 timeMax = max(dtime) # with 5 ms time stamps this should be 1 sec long
25 width = 0.1 # refers to timeMax, ie the time width of Gaussian array
26 height = 100. # height of Gaussian. Recall that noise has sigma=10
27 xx = height*exp(-0.5* ((dtime/timeMax-0.5)/width)**2 ) # make Gaussian source
28 n = int(.5*size(ranFlux)) # get center index of ranFlux
29 ranFlux[n-101:n+100] = ranFlux[n-101:n+100] + xx # add Gaussian to center of ranFlux
30
31 data.Data[:,chanIndex] = array(ranFlux).astype(Float32) # replace flux of channel
32
33 data.plotFFT([channel],logX=1,logY=1) # that's how source appears in FFT
34 signal(channel,limitsX=[99,101],limitsY=[-30,130]) # plot source signal
35 data.taperFreq(above=20.,N=4) # taper high frequencies
36 signal(channel,overplot=1,ci=3) # look what happend to 'source'
Example
Here I take a specific short scan (staring 200 sec at constant elevation) and replace one channel with Gaussian noise and a 1000 count line with a width that corresponds that of a point source scanned at 2 arcmin/sec. Tapering the noise spectrum above 5 Hz does not affect the line flux significantly. Below 5 Hz however, you will notice flux loss.
Here now I leave the strong noise of the scan and add a faint source of 10 counts peak. Besides tapering I also blank the strong feature at 4.5 Hz. The line comes out nicely afterwards, sitting on a strong, correlated 1/f low-frequency noise.