Comparing LOFARBeam with everybeam : results and speed
Hi,
I'm trying to use everybeam in DDFacet, and with help from Frits Sweijen as a first step understand how everybeam works as compared to LOFARBeam.
As a general remark - everybeam is harder to use - probably due to that it aims as modeling more things. Also as a side note, I had to have an astron account to open an issue here, which might become problematic if everybeam aims at being something widely used.
I wrote a little script recycling Frits's script (attached at the end of this message) that plots side by side the two beam models for a given antenna, time and frequency (this for an HBA dataset).
Array factor
The call looks like this:
obs = everybeam.load_telescope(self.MSName)
reference_xyz = radec_to_xyz(self.rac * u.rad, self.decc * u.rad, time)
for iDir in range(ra.size):
phase_xyz = radec_to_xyz(ra[iDir] * u.rad, dec[iDir] * u.rad, time)
for ifreq,freq in enumerate(freqs.tolist()):
for iAnt in range(na):
JOut[iDir,iAnt,ifreq,:,:] = obs.array_factor(time, iAnt, freq, phase_xyz, reference_xyz)
(note: I've tried to use use_differential_beam and use_channel_frequency options without noticable differences)
with Frits function to get xyz
loc_LOFAR = EarthLocation(lon=0.11990128407256424, lat=0.9203091252660295, height=6364618.852935438*u.m)
def radec_to_xyz(ra, dec, time):
obstime = Time(time/3600/24, scale='utc', format='mjd')
dir_pointing = SkyCoord(ra, dec)
dir_pointing_altaz = dir_pointing.transform_to(AltAz(obstime=obstime, location=loc_LOFAR))
dir_pointing_xyz = dir_pointing_altaz.transform_to(ITRS)
pointing_xyz = np.asarray([dir_pointing_xyz.x, dir_pointing_xyz.y, dir_pointing_xyz.z])
return pointing_xyz
Here are the differences I find Array factor (A mode hereafter):
- First line is LOFARBeam (Abs(4 pols), Phase(4 pols))
- Second line is everybeam (Abs(4 pols), Phase(4 pols))
- Third line is difference between the two
Times:
- LOFARBeam 0.9760282039642334 s
- EveryBeam 3.0056395530700684 s
Beam peaks as 1 for everybeam, and at 0.95 for LOFARBeam. Difference could be that LOFARBeam takes tile phase center being a discrete grid in the sky?
And time difference is quite large (everybeam 3x slower). Maybe my call looping over antenna, freqs, direction can be made differently. I've searched but I did not see other smarter way to do. Any idea?
And Element Beam + Array factor (AE mode):
The call looks like
obs = everybeam.load_telescope(self.MSName)[TestEveryBeam.py](/uploads/e52d87a8c1cbe3c62b2cb369a8ba925b/TestEveryBeam.py)
for iDir in range(ra.size):
for ifreq,freq in enumerate(freqs.tolist()):
for iAnt in range(na):
JOut[iDir,iAnt,ifreq,:,:] = obs.station_response(time=time, station_idx=iAnt, freq=freq, ra=ra[iDir], dec=dec[iDir])
Times:
- LOFARBeam 1.4445462226867676 s
- EveryBeam 28.683594703674316 s
Agreement is very good, but the time difference is even larger than for A mode (everybeam is 20x slower).
So all in all:
- is the difference I see in A-mode understood?
- do you have any idea how I could improve the speed?
- I found much larger differences using an LBA dataset, but the MS was old - not sure if that could play a role... Did anyone try this?
I attach my script: TestEveryBeam.py, to run just in a python env (also needs an MS, hardcoded here)
import TestEveryBeam
TestEveryBeam.test()