Examples¶
Example snippet¶
Here’s an example code snippet you can try out with Virgo
to acquire data
using a low-cost RTL-SDR receiver:
import virgo
# Define observation parameters
obs = {
'dev_args': '',
'rf_gain': 30,
'if_gain': 25,
'bb_gain': 18,
'frequency': 1420e6,
'bandwidth': 2.4e6,
'channels': 2048,
't_sample': 1,
'duration': 60,
'loc': '',
'ra_dec': '',
'az_alt': ''
}
# Check source position
virgo.predict(lat=39.8, lon=-74.9, source='Cas A', date='2020-12-26')
# Begin data acquisition
virgo.observe(obs_parameters=obs, obs_file='observation.dat')
# Analyze data, mitigate RFI and export the data as a CSV file
virgo.plot(obs_parameters=obs, n=20, m=35, f_rest=1420.4057517667e6,
vlsr=False, meta=False, avg_ylim=(-5,15), cal_ylim=(-20,260),
obs_file='observation.dat', rfi=[(1419.2e6, 1419.3e6), (1420.8e6, 1420.9e6)],
dB=True, spectra_csv='spectrum.csv', plot_file='plot.png')
The above script will plot the position of the supernova remnant Cassiopeia A in the celestial sphere of the observer and configure the device by tuning the receiver to the given observing parameters and acquire data.
Once the observation is complete (60 sec in this case), the data will be automatically processed and analyzed, applying a median filter to both the time series and the frequency domain, and masking a channel range, ultimately suppressing radio-frequency interference. In this example, dB scaling is used, enabling the plot to support a wide dynamic range.
Lastly, the data is plotted as a PNG file and the discrete spectrum datapoints are exported as a CSV document for further manual analysis (optional).
Example observation¶
Example source prediction¶
Example HI profile retrieval¶
Offline experiments¶
For users who wish to experiment with the package’s data acquisition, processing and analysis pipelines, but do not have any supported hardware at hand, an example observation file is included in the repository of the software on GitHub.
This folder includes three files, which can be used to test the software without any access to equipment:
observation.dat
: ON-source observationcalibration.dat
: OFF-source observation (reference calibration)joss_example.py
: Example script for (spectrum) calibration and data visualization