Acquiring Data from the ADC on Pulsar

Data is acquired from pulsar through IDL either as a function (sampler.pro) or as a procedure (samptext.pro). The main difference between the two methods is the procedure outputs a text file and the function returns the array output as an IDL variable.

sampler.pro

syntax
example
output
result = sampler(nsamples, freq, /dual) v = sampler(4096, 1e6, /dual) A one (or two) by nsamples array of voltages will be saved in v.

parameters definition limits for required parameters, default behavior for optional keywords
nsamples (REQUIRED) number of samples to record Limits: 0 < n < 262144
freq (REQUIRED) sampling frequency
Limits: 1 KHz < f < 10 MHz for dual channel
1 KHz < f < 20 MHz for single channel
dual (optional) to get two channels of data one channel of data is saved


samptext.pro

syntax
example
output
samptext, n, f, /dual, /lo, /integer, filename='samples.txt' samptext, 128, 10e6, /dual, /lo, /integer, filename='samples.txt' A text file will be saved with one or two columns of numbers that are the measured voltages.

parameters definition limits for required parameters, default behavior for optional keywords
n (REQUIRED) number of samples to record Limits: 0 < n < 262144
f (REQUIRED) sampling frequency
Limits: 0 < f < 10 MHz for dual channel
0 < f < 20 MHz for single channel
dual (optional) to get two channels of data one channel of data is saved
lo (optional)
"lo"="Low Voltage" - for voltages within +/- 1 V

"lo" mode can increase the resolution when samping low voltages

The sampler measures the range +/- 5V
integer (optional) "integer' mode is faster and uses the following scale:
(0 to 4095) = (-5V to 5V)
or
(0 to 4095) = (-1V to 1V)   if the "lo" keyword is used
 Decimal values are saved for voltages.
(-5.0 to 5.0) with resolution = (10.0 V / 4096)
or
(-1.0 to 1.0) with resolution = (2.0 V / 4096)
filename (optional) location of stored data file saved as "data.txt"



To read the text file, you can use 'readcol', however for faster reads of text files with two channels and 262144 samples use:
'read_262144_text'

Syntax:
v=read_262144_text('filename')

Return:
v=complex with first column of 'filename' as the real component.