## Solar Drift Scan Technique

#### BAO

15 July, 2015 2:40 PM

In this tutorial I will show you how to perform Drift Scan Observation of the Sun using the 2.3m SALSA Radio Telescope located in Onsala Space Observatory, Sweden. The telescope is free for everyone to use ( http://vale.oso.chalmers.se/salsa/) .The detailed operation procedure can be found in the user’s manual (http://vale.oso.chalmers.se/salsa/node/3) . This tutorial also includes how to analyze the data using Python standard libraries. So let’s get started.

What is Drift Scan:

Drift scan is a type of radio astronomical observation where the radio telescope is kept stationary (tracking mode is turned off) and let the desired object to pass over the antenna’s beam. Intensity as Antenna Temperature data is taken from the telescope at a particular time interval and finally plotted as Intensity vs. Time format.
From the drift scan we get an idea of the antenna’s radiation pattern, the time object takes to cross over the antenna beam. In 1931 Karl Jansky discovered the radio emission from the Milky Way by Drift Scan procedure.

What it tells us?

From this graph we see a peak at the center which actually tells us that the Sun was just over the antenna at this time and what we assumed that Sun will be there at that time becomes true. The graph also tells us about the antenna beamwidth we used in this observation. Antenna beamwidth is calculated from the -3db point (look at the figure below). From the graph we cannot tell where is the exact value of -3db point because we do not know what is the exact unit of the amplitude here. But we can assume. Approximately 41 mins and 74 mins are the points. If we subtract 41 from 74 we get 33. As we know Earth rotates 15 degrees in 60 mins, we get (33*15)/60=8.25 degrees. So the antenna beamwidth we get is approximately 8.25 deg.

Procedure:

If we want to do a drift scan of the Sun, first we need to know the current position of the Sun and where it will be after a particular time period, say 1 hour. Then we will move the telescope to that position. Tracking mode is turned off in this case. After that we will start taking data at a particular time interval and finally plot the data with respect to time. The step by step procedure is given below: Fig: Solar Drift Scan Procedure Diagram.

1. Log into the Telescope session (details will be found in the User’s manual of SALSA).
2. Start Kstars or any other Planetarium software. Step ahead time to find out where the Sun will be after 1 hour in the telescope location.
3. Note the Right Ascention (RA) and Declination of the Sun at that time.
4. Start Qradio put the position and move the Telescope to that position. Do Not click track button!
5. Start taking data at 1 min time interval at an integration time of 30 seconds.
6. Continue the observation for total 2 hours (follow the diagram above).
7. Download the observation files in fits format (Follow SALSA User Manual)

Data Analyzing:
Data files (fits) can be analyzed in several methods (See the User Manual). Here I will show you how easily the files can be analyzed in python language.

Interactive Method:
Interactive method is to use python interactively in IDLE Interpreter or CMD or Terminal. I have used Terminal in Linux Mint distribution for this. If you are Windows user you can use cmd as well.

Libraries we need: Pyfits, Numpy, Matplotlib

Code: Open up Terminal and type:

>> python                                                     # Start Python

>>import pyfits                                              # Load pyfits library
>>from numpy import*                                    # Load numpy library
>>import matplotlib.pyplot as plt                      # Load pyplot from matplotlib library
>>data = pyfits.getdata(‘0001s.fits’)                  # Load the data file
>> print data                                                   # See the data. You can skip it if you want
>>data.shape                                                  # See the shape of the data array. You can skip it if you want
>>data = data[0,0]                                           # Slice the data you are interested in
>>plt.plot(data)                                                # Plot the spectrum. You can skip it if you want
>>plt.show()                                                    # Show the plot. You can skip it if you want
>>data = data[5:]                                             # Notice: spikes in the first few samples are just unwanted noise
# You might want to skip them. So take your data after 5th sample
>>x = max(data)                                              # Find the peak of the spectrum
>>y = []                                                           # Declare a variable as array
>>y.append(x)                                                  # Put the peak value in the y array

Now we have the peak intensity value of the first spectrum in y array. We need to process all the files in the same way. We can skip some steps to save time. Let’s analyze the next file. This time we will type those commands which are necessary.

>>data = pyfits.getdata(‘0002s.fits’)
>>data = data[0,0]
>>data = data[5:]
>>x = max(data)
>>y.append(x)

Repeat these commands for every next files. Finally we might want to export our analyzed intensity values in a csv file and plot the values.

>>savetxt(‘driftscan.csv’,y)
>>plt.plot(y)
>>plt.show()

Python Script:
Here we will write one single script to analyze all the files at once. This is the most time effective way to analyze a lots of files under same analyzing procedure.

Code:

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 `# Import all the necessary Libraries` `from` `numpy ``import``*` `import` `matplotlib.pyplot as plt` `import` `pyfits` `import` `os` `# Put the path of your files. Change it according to your files destination folder.` `path ``=` `'/home/tarif/Desktop/scan_file/'`   `# File renaming and sorting block. We need to rename all the files in a numerical sequence.` `i ``=` `1` `files ``=` `sorted``(os.listdir(path)) ``# List the files in sorted sequence` `for` `file` `in` `files:` `    ``if` `file``.startswith(``'drift_scan_plotter'``): ``# Skips your program file from the directory` `        ``continue` `    ``new_file ``=` `str``(i)``+``".fits"` `    ``os.rename(``file``, new_file)    ``# Files are renaming here` `    ``i``=``i``+``1` `length ``=` `len``(files)``-``1`   `# Data processing block` `y ``=` `[]` `for` `l ``in` `range``(length):` `    ``l ``+``=` `1` `    ``data ``=` `pyfits.getdata(path``+``str``(l)``+``'.fits'``)` `    ``data ``=` `data[``0``,``0``]` `    ``data ``=` `data[``5``:]` `    ``x ``=` `max``(data)` `    ``y.append(x)` `savetxt(``'driftscan.csv'``,y) ``# Save data in a csv file in the same directory` `plt.plot(y)` `plt.title(``"Solar Drift Scan Plot"``)` `plt.xlabel(``"Time"``)` `plt.ylabel(``"Antenna Temperature(K)"``)` `plt.grid(``True``)` `plt.savefig(``'Solar_drift.png'``)` `plt.show()`

First copy all of your files in a folder (i.e: scan_file). Open a text editor and copy or type the script. Notice you have to change the path in this script according to your files folder destination. Save the file in that folder. Name it: drift_scan_plotter.py Note the extension must be .py since this is a python file. To run the program open Terminal in that folder or cd into that folder (google it, if you don’t know how to do it) and type:

python drift_scan_plotter.py

Here you go! If you are correct in all the steps then you must see all the files are renamed sequentially, the plot comes up, a png image file of the plot and a csv file containing intensity data are saved in the same folder. Fig : A Solar Drift Scan Plot showing the Antenna pattern of the Brage Antenna of the SALSA Radio telescope. The plot is generated using the script above.