BeamFormer2([ws, parfile]) | The function will calculate multiple beams for a list of files and a series of antennas (all integrated into one compex spectrum per beam). |
fmin(func, x0[, args, xtol, ftol, maxiter, ...]) | Minimize a function using the downhill simplex algorithm. |
getfile(ws) | To produce an error message in case the file does not exist |
Calculate complex beams towards multiple directions. Also calculates the average spectrum in each beam and for an incoherent beam.
Module author: Heino Falcke <h.falcke@astro.ru.nl>
Example:
self=Task
self.beams[...,0].nyquistswap(self.NyquistZone)
fxb=cr.hArray(float,[2,self.blocklen],name="TIMESERIES_DATA"); fxb[...].saveinvfftw(self.beams[...,0],1); fxb.abs()
fxb[...].plot(clf=True); cr.plt.show()
The function will calculate multiple beams for a list of files and a series of antennas (all integrated into one compex spectrum per beam). Also incoherent beams can be calculated and the sifted time series of each antenna can be retrieved.
This beamformer will read all selected antennas at once into memory and hence is optimized for short datasets with many antennas (e.g. cosmic ray event ).
It can also be called without a datafile and just hArrays as input. In this case provide the following information:
Task(data=timeseries_data, antennas=file["SELECTED_DIPOLES"], antpos=file["ANTENNA_POSITIONS"], sample_interval=file["SAMPLE_INTERVAL"][0], pointings=[dict(az=143.4092*deg,el= 81.7932*deg, r=600.3)])
If the FFT of the time series data is already available, it can be provided with the parameter fft_data (in addition to the time series that - at this moment - is still required). You then have to also set dofft=False to avoid the FFT being recalculated.
The desired frequency resolution is provided with the parameter delta_nu, but by default this will be rounded off to the nearest value using channel numbers of a power of 2. This will then set the block size for reading in the data.
Results The resulting beam is stored in the array Task.beam and written to disk as an hArray with parameters stored in the header dict (use getHeader('BeamFormer2') to retrieve this.)
The incoherent and beamed average spectra are stored in Task.avspec_incoherent and Task.avspec respectively. They are also available as attributes to Task.bf.par (also when stored to disk).
The incoherent beam is found in Task.tbeam_incoherent.
The beam can be FFTed back to time using Task.tcalc and viewed with Task.tplot.
Input parameters
Output parameters
nofAntennas
Plot the dynamic spectrum. Provide the dynamic spectrum computed by the Task DynamicSpectrum as input.
Parameter | Default | Description |
---|---|---|
plot_cleanspec | None | If False, don’t plot the cleaned spectrum (provided as dynspec.par.cleanspec). |
dmin | None | Minimum z-value (intensity) in dynamic spectrum to plot |
dmax | None | Maximum z-value (intensity) in dynamic spectrum to plot |
cmin | None | Minimum z-value (intensity) in clean dynamic spectrum to plot |
cmax | None | Maximum z-value (intensity) in clean dynamic spectrum to plot |
Example:
tload "DynamicSpectrum"
dsp=cr.hArrayRead("Saturn.h5.dynspec.pcr")
Task.dynplot(dsp,cmin=2.2*10**-5,cmax=0.002,dmin=6.8,dmax=10)
Use scipy’s fmin function (downhill-simplex minimizer) to obtain a maximum pulse power.
Run the program.
Maximizer function to be called with scipy.fmin. Parameter ‘direction’ is a tuple (az, el) in radians. (but somehow, the fmin function passes an np.array([az, el]) instead...)
It calls self.run() again, with a new ‘self.pointings’ towards given direction.
Calculate the time series after beamforming, i.e. take the result of the BeamForm task, i.e. an array of dimensions [self.nblocks,self.nbeams,self.speclen], do a NyquistSwap, if necessary, and then an inverse FFT.
Parameter | Default | Description |
---|---|---|
beams | None | Input array. Take self.beams from task, if None. |
NyquistZone | 1 | NyquistZone=2,4,... means flip the data left to right before FFT. |
doabs | False | Take the absolute of the timeseries, if True. |
smooth | 0 | If > 0 smooth datat with a Gaussian kernel of that size. |
The final time series (all blocks) is stored in Task.tbeams and returned.
Take the result of the BeamForm task, i.e. an array of dimensions [self.nblocks,self.nbeams,self.speclen], do a NyquistSwap, if necessary, and then calculate an inverse FFT. If the time series (self.tbeams) has already been caclulated it will only be recalculated if explicitly asked for with recalc=True.
Properties
Parameter | Default | Description |
---|---|---|
beams | None | Input array. Take self.beams from task, if None. |
recalc | False | If true force a recalculation of the time series beam if it exists |
block | 0 | Which block to plot, or Ellipsis (‘...’) for all |
NyquistZone | 1 | NyquistZone=2,4,... means flip the data left to right before FFT. |
doabs | True | Take the absolute of the timeseries before plotting. |
smooth | 0 | If > 0 smooth data with a Gaussian kernel of that size. |
plotspec | False | If True plot the average spectrum instead. |
xlim | None | Tuple with minimum and maximum limits for the x-axis. |
ylim | None | Tuple with minimum and maximum limits for the y-axis. |
The final time series (all blocks) is stored in Task.tbeams.
To produce an error message in case the file does not exist