Beispiel #1
0
def main():
    #write_test_data()
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'
    test_dir = '/d/bip3/ezbc/planck/tests/'

    (data, header) = pl.get_data(data_type='857',
                                 data_location=data_location,
                                 coord_type='galactic',
                                 x_range=(280, 300),
                                 y_range=(-40, -20))

    fits.writeto(test_dir + 'LMC_857ghz.fits',
                 data,
                 header=header,
                 clobber=True,
                 output_verify='fix')

    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    l_range = (155, 165)
    b_range = (-25, -10)

    (data, header) = pl.get_data(data_location=data_location,
                                 data_type='CO-Type3',
                                 x_range=l_range,
                                 y_range=b_range,
                                 coord_type='galactic',
                                 field=0,
                                 dr_version=1,
                                 resolution=0.1,
                                 cut_last_pixel=False,
                                 verbose=True)

    fits.writeto(test_dir + 'perseus_galactic_ebv.fits',
                 data,
                 header=header,
                 clobber=True,
                 output_verify='fix')
def main():
    #write_test_data()
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'
    test_dir = '/d/bip3/ezbc/planck/tests/'

    (data, header) = pl.get_data(data_type='857',
                                 data_location=data_location,
                                 coord_type='galactic',
                                 x_range=(280, 300),
                                 y_range=(-40, -20))

    fits.writeto(test_dir + 'LMC_857ghz.fits',
                data,
                header = header,
                clobber = True,
                output_verify = 'fix')

    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    l_range = (155, 165)
    b_range = (-25, -10)

    (data, header) = pl.get_data(data_location = data_location,
            data_type = 'CO-Type3',
            x_range = l_range,
            y_range = b_range,
            coord_type = 'galactic',
            field = 0,
            dr_version =1,
            resolution = 0.1,
            cut_last_pixel = False,
            verbose = True)

    fits.writeto(test_dir + 'perseus_galactic_ebv.fits',
                data,
                header = header,
                clobber = True,
                output_verify = 'fix')
Beispiel #3
0
    def extract_test_data():
        ''' Creates test data of the Taurus molecular cloud
        '''

        data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

        dec_range = (21.3, 30.3)
        ra_range = (60.0, 73.0)

        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=0,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

        return (data, header)
    def extract_test_data():

        ''' Creates test data of the perseus molecular cloud
        '''

        data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

        dec_range = (21.3, 30.3)
        ra_range = (60.0, 73.0)

        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 0,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)

        return (data, header)
Beispiel #5
0
def extract_data(datatype='ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    ra_range = (22.5, 82.5)
    dec_range = (20, 38)

    if datatype == 'co-type3':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='CO-Type3',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=0,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

    if datatype == 'co-type3_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='CO-Type3',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

    if datatype == 'co-type1-j10':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='CO-Type1',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=0,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

    if datatype == 'co-type1-j10_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='CO-Type1',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     dr_version=2,
                                     verbose=True)

    if datatype == 'ebv_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=3,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     dr_version=2,
                                     verbose=True)

    if datatype == 'temp':
        ra_range = (40, 70)
        dec_range = (20, 38)

        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=4,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     dr_version=2,
                                     verbose=True)

    if datatype == 'temp_error':
        ra_range = (40, 70)
        dec_range = (20, 38)
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=5,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     dr_version=2,
                                     verbose=True)

    return (data, header)
def extract_data(datatype = 'ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    dec_range = (21, 38)
    ra_range = (40, 70)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 2,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'ebv_err':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 3,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 0,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 4,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 5,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '857':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '857',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '545':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '545',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '353',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)

    return (data, header)
def extract_data(datatype='ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    dec_range = (15, 48)
    ra_range = (32, 85)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=2,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'ebv_err':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=3,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=0,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=4,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=5,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'beta':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=6,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'beta_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=7,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '857':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='857',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     dr_version=1,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '545':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='545',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     dr_version=1,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '353':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='353',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     dr_version=1,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)

    return (data, header)
def extract_data(datatype='ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    ra_range = (55, 81)
    dec_range = (25, 45)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=2,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=0,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=1,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=4,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=ra_range,
                                     y_range=dec_range,
                                     coord_type='equatorial',
                                     field=5,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    return (data, header)
def extract_data(datatype='ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    # get bounding box around galactic box
    glon_range = (70, 90)
    glat_range = (-4, 5)
    #glon_range = (170, 180)
    #glat_range = (-20, -10)
    ra_range, dec_range = get_galactic_limits(glon_range, glat_range)

    coord_type = 'equatorial'
    coord_type = 'galactic'
    x_range, y_range = glon_range, glat_range
    #x_range, y_range = ra_range, dec_range

    print x_range, y_range
    #x_range = (170, 181)
    #y_range = (-1, 1)

    #x_range = (0, 360)
    #y_range = (-90, 90)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=2,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'ebv_err':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=3,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=0,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=1,
                                     dr_version=2,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=4,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='Dust Opacity',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=5,
                                     dr_version=2,
                                     resolution=0.05,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '857':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='857',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=1,
                                     dr_version=1,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '545':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='545',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=1,
                                     dr_version=1,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)
    elif datatype == '353':
        (data, header) = pl.get_data(data_location=data_location,
                                     data_type='353',
                                     x_range=x_range,
                                     y_range=y_range,
                                     coord_type=coord_type,
                                     field=1,
                                     dr_version=1,
                                     resolution=0.01,
                                     cut_last_pixel=False,
                                     verbose=True)

    return (data, header)
def extract_data(datatype = 'ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    ra_range = (22.5, 82.5)
    dec_range = (20, 38)

    if datatype == 'co-type3':
        (data, header) = pl.get_data(data_location = data_location,
        data_type = 'CO-Type3',
        x_range = ra_range,
        y_range = dec_range,
        coord_type = 'equatorial',
        field = 0,
        resolution = 0.01,
        cut_last_pixel = False,
        verbose = True)

    if datatype == 'co-type3_error':
        (data, header) = pl.get_data(data_location = data_location,
        data_type = 'CO-Type3',
        x_range = ra_range,
        y_range = dec_range,
        coord_type = 'equatorial',
        field = 1,
        resolution = 0.01,
        cut_last_pixel = False,
        verbose = True)

    if datatype == 'co-type1-j10':
        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'CO-Type1',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 0,
            resolution = 0.01,
            cut_last_pixel = False,
            verbose = True)

    if datatype == 'co-type1-j10_error':
        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'CO-Type1',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 1,
            resolution = 0.01,
            cut_last_pixel = False,
            verbose = True)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'Dust Opacity',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 2,
            resolution = 0.01,
            cut_last_pixel = False,
            dr_version = 2,
            verbose = True)

    if datatype == 'ebv_error':
        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'Dust Opacity',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 3,
            resolution = 0.01,
            cut_last_pixel = False,
            dr_version = 2,
            verbose = True)

    if datatype == 'temp':
        ra_range = (40, 70)
        dec_range = (20, 38)

        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'Dust Opacity',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 4,
            resolution = 0.01,
            cut_last_pixel = False,
            dr_version = 2,
            verbose = True)

    if datatype == 'temp_error':
        ra_range = (40, 70)
        dec_range = (20, 38)
        (data, header) = pl.get_data(data_location = data_location,
            data_type = 'Dust Opacity',
            x_range = ra_range,
            y_range = dec_range,
            coord_type = 'equatorial',
            field = 5,
            resolution = 0.01,
            cut_last_pixel = False,
            dr_version = 2,
            verbose = True)

    return (data, header)
def extract_data(datatype = 'ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    # Goal: RA from 1:30 to 5:30hrs, Dec = 20 to 38deg

    dec_range = (15, 35)
    ra_range = (52.5, 82.5)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 2,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    if datatype == 'radiance':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 3,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 0,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 4,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 5,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_1to0':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type2',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 0,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_1to0_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type2',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_2to1':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type2',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 4,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_2to1_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type2',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 5,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_3to2':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type1',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 8,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_3to2_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type1',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 9,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type3',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 0,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'co_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'CO-Type3',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '857':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '857',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '545':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '545',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '353',
                x_range = ra_range,
                y_range = dec_range,
                coord_type = 'equatorial',
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)

    return (data, header)
def extract_data(datatype = 'ebv'):
    data_location = '/d/bip3/ezbc/planck/planck_raw_data/'

    # get bounding box around galactic box
    glon_range = (70, 90)
    glat_range = (-4, 5)
    #glon_range = (170, 180)
    #glat_range = (-20, -10)
    ra_range, dec_range = get_galactic_limits(glon_range, glat_range)

    coord_type = 'equatorial'
    coord_type = 'galactic'
    x_range, y_range = glon_range, glat_range
    #x_range, y_range = ra_range, dec_range

    print x_range, y_range
    #x_range = (170, 181)
    #y_range = (-1, 1)

    #x_range = (0, 360)
    #y_range = (-90, 90)

    if datatype == 'ebv':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 2,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'ebv_err':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 3,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 0,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'tau353err':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 1,
                dr_version = 2,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 4,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == 'temp_error':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = 'Dust Opacity',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 5,
                dr_version = 2,
                resolution = 0.05,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '857':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '857',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '545':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '545',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)
    elif datatype == '353':
        (data, header) = pl.get_data(data_location = data_location,
                data_type = '353',
                x_range = x_range,
                y_range = y_range,
                coord_type = coord_type,
                field = 1,
                dr_version = 1,
                resolution = 0.01,
                cut_last_pixel = False,
                verbose = True)

    return (data, header)