dysh for GBTIDL Users#

Some key differences#

  • No longer tied to a single input and output file, can load as many SDFITS files as RAM allows

  • No longer tied to a finite number of data containers, you can have as many ScanBlock/Spectrum objects as RAM allows

  • Python allows for well-trackable local and global variables

Rough equivalents#

In the tables below, it is assumed you have executed the following commands in Python:

from dysh.fits.gbtfitsload import GBTFITSLoad

File I/O and Metadata Operations#

GBTIDL

dysh

Notes

online

sdf = GBTOnline(); sdf = GBTOnline([projID])

Monitor the currently online project or a specific project projID. Load the SDFITS into sdf.

offline

sdf = GBTOffline([projID])

Load data from project/session projID into sdf.

filein, [SDFITS file]

sdfits = GBTFITSLoad( [SDFITSfile] )

This will directly load a SDFITS file into python.

dirin, [SDFITS dir]

sdfits = GBTFITSLoad( [SDFITS dir] )

This will load each SDFITS file in a directory into python, in the case it is a project directory where each file is a different VEGAS bank. (A, B, C, etc.). The implementation is identical to the single SDFITS file load.

fileout

There is no direct translation; in dysh, simply specify a filename with the spectrum.write function

keep

spec.write( [SDFITSfile], format=[fmt] )

Write the spectrum spec to the output SDFITS file specified, using the format fmt

summary

sdfits.summary()

In dysh, you can also input a list of scan numbers you would like to see.

list

sdfits.summary( verbose=True )

Using the “verbose=True” option returns similar results to GBTIDL’s “list”.

header, scan_info

spec.meta

Return meta information about the spectrum spec. In GBTIDL, this returns a text printout. In dysh, this returns a dictionary with all SDFITS keywords and values.

Calibration and Data Retrieval#

GBTIDL

dysh

explanation

select

sdf.select( [col1]=[val1], [col2]=[val2] )

Select subsets of the GBTFITSLoad object sdf based on the constraints on col1 and col2 given by val1 and val2

flag

sdf.flag( [col1]=[val1], [col2]=[val2] )

Create flagging rules of the GBTFITSLoad object sdf based on the constraints on col1 and col2 given by val1 and val2. See flagging examples given in the Recipes.

gettp, [scan_num]

sdfits.gettp( scan=[scan_num] )

Returns a Scan Block. Get a total power scan, with the option in dysh to optionally calibrate it.

getps, [scan_num]

sdfits.getps( scan=[scan_num] )

Returns a Scan Block. Retrieve and calibrate position-switched data.

getfs, [scan_num]

sdfits.getfs( scan=[scan_num] )

Returns a Scan Block. Retrieve and calibrate frequency-switched data.

getnod, [scan_num]

sdfits.getnod( scan=[scan_num] )

Returns a Scan Block.

show

spec.plot()

Plot the spectrum spec. Calibration routines in GBTIDL do this automatically.

Spectrum Operations#

GBTIDL

dysh

Notes

baseline, bshape, bsubtract, nfit

spec.baseline( [deg], exclude=[ex_reg],remove=True/False )

Compute and optionally remove a baseline with degree deg and exclusion regions ex_reg

gsmooth, [int]

spec.smooth( “gauss”, [int] )

Convolve spec with a Gaussian kernel. Default behavior is to decimate, which isn’t true in GBTIDL

hanning

spec.smooth( “hann” )

Convolve spec with a Hanning window. Default behavior is to decimate, which isn’t true in GBTIDL

boxcar, [int]

spec.smooth( “box”, [int] )

Convolve spec with a boxcar window. This matches the GBTIDL results only when integer int is an odd number. Default behavior is to decimate, which isn’t true in GBTIDL

add/subtract/divide/scale

spec + other, spec - other, spec/other, spec*other

Perform element-wise math between spectrum spec and other vector/scalar other.

bias, [bias]

spec + bias

Add scalar bias to spectrum spec. The units of bias must match those of spec.flux.

accum

average_spectra(list of spectra)

ave

scanblock.timeaverage(); scan.timeaverage()

Average a set of scans inside Scan Block scanblock or Scan scan.

stats

spec.stats()

Print statistics of spectrum spec.

fshift, vshift, xshift

spec.find_shift(other)

Find the shift between spec and other.

gshift

spec.shift(shift) spec.align_to(other)

Shift spec by shift. Find the shift between spec and other and apply. Equivalent to spec.shift(spec.find_shift(other)).

write_ascii, filename

spec.write(filename, format=”ascii.basic”)

Write the contents of spec to a text file in ascii format with minimum header information.