In [1]:
# Typical imports here
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import astropy.constants as c
In [2]:
%load_ext autoreload
%autoreload 2
In [3]:
from pyND.gbt import *
In [4]:
input_filename = 'data/GBTdata.fits'
x = GBTsurvey.from_GBTIDL(input_filename)
In [5]:
x.index
Out[5]:
In [6]:
x.save2pickle('data/GBTdata.pkl')
In [7]:
x.sort('b')
x.index['b'].data
Out[7]:
In [8]:
x.sort('b',reverse=True)
x.index['b'].data
Out[8]:
In [9]:
x.survey[0].plotspectrum()
In [10]:
# for j in np.arange(len(x.index)):
# x.survey[j].plotspectrum()
In [11]:
x.data_file,x.GBTFITS_file
Out[11]:
In [12]:
x_new = x.copy()
new_velocity = np.arange(-400,100,10.)
x_new.resample_survey(new_velocity)
In [13]:
x.survey[0].plotspectrum()
x_new.survey[0].plotspectrum()
In [30]:
fig=plt.figure(figsize=(8,10))
ax1=fig.add_subplot(211)
ax1.plot(x.survey[0].velocity,x.survey[0].Tb,drawstyle='steps-mid',label='Original')
ax1.plot(x_new.survey[0].velocity,x_new.survey[0].Tb,drawstyle='steps-mid',label='Resampled',lw=2)
ax1.set_xlim(-200,50)
ax1.set_xlabel('Velocity')
ax1.set_ylabel('Tb [K]')
ax1.legend(loc='upper left',title=x.index['object'][0])
ax2=fig.add_subplot(212)
ax2.plot(x.survey[4].velocity,x.survey[4].Tb,drawstyle='steps-mid',
label='Original[4]',lw=2,color='C2')
ax2.plot(x_new.survey[4].velocity,x_new.survey[4].Tb,drawstyle='steps-mid',
label='Resampled[4]',lw=2,color='C3')
ax2.set_xlim(-200,50)
ax2.set_xlabel('Velocity')
ax2.set_ylabel('Tb [K]')
ax2.legend(loc='upper left',title=x.index['object'][4])
Out[30]:
In [ ]: