Beispiel #1
0
def main():
    ptable = KC.ProjectionTableDB()

    mg = [1., 4.78, 10.96, 14.45, 19.05]
    mg_ivar = [1100., 28., 7.7, 4.4, 2.5]
    redshift = 0.03

    filters = KC.FilterList(['sdss_u0', 'sdss_g0', 'sdss_r0',
                             'sdss_i0', 'sdss_z0'])

    o1 = KC.KCorrect(redshift, filters, mg, mg_ivar, ptable=ptable)

    print(o1.kcorrect(band_shift=0.1))

    mg = [1., 4.73, 11.26, 14.25, 18.85]
    mg_ivar = [1100., 28., 7.7, 4.4, 2.5]

    o2 = KC.KCorrect(redshift, filters, mg, mg_ivar, ptable=ptable)

    print(o2.kcorrect(band_shift=0.1))

    x, y = o1.model_spectrum(None, 2000., 12000.)
    if with_pyplot:
        plt.plot(x, y)
        plt.show()

    print(o1.model_maggie)

    bessel = KC.FilterList(['bessell_B', 'bessell_V'])
    mags = o1.appmag(bessel)[0]
    vega2ab = KC.vega2ab(bessel)
    Bmag, Vmag = mags - vega2ab
    print(Bmag - Vmag)

    mg = [1., 4.78, 10.96, 14.45, 19.05]
    mg_ivar = [1100., 28., 7.7, 4.4, 2.5]
    filters = KC.FilterList(['sdss_u0', 'sdss_g0', 'sdss_r0',
                             'sdss_i0', 'sdss_z0'])
    d = KC.fit_photoz([mg], [mg_ivar], ptable[filters])
    print(d)
Beispiel #2
0
def main():
    d = np.loadtxt('test/sdss.dat', dtype=float)
    z = d[:, 0]
    lup = d[:, 2:7]
    dlup = d[:, 7:12]
    red = d[:, 12:17]

    ####
    kc = SDSSPhotoZ(lup, dlup, red)
    print(kc.redshift)
    print(z)
    plt.plot(z, kc.redshift, 'o')
    plt.show()
    ####

    kc = SDSSKCorrect(z, lup, dlup, red, cosmo=(0.3, 0.7, 1.0))

    print('### k-corrections: SDSS ugriz ###')
    kcorr = kc.kcorrect()
    for each in kcorr: print('%+.6f %+.6f %+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: SDSS ugriz ###')
    absmag = kc.absmag()
    for each in absmag: print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: SDSS ugriz band-shifted to z=0.1 ###')
    band_shift = 0.1
    kcorr = kc.kcorrect(band_shift=band_shift)
    for each in kcorr: print('%+.6f %+.6f %+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: SDSS ugriz band-shifted to z=0.1 ###')
    absmag = kc.absmag(band_shift=band_shift)
    for each in absmag: print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI ###')
    fl = KC.FilterList(['bessell_U','bessell_B','bessell_V',
                        'bessell_R','bessell_I'])
    absmag = kc.absmag(fl)
    for each in absmag: print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI band-shifted to z=0.1 ###')
    absmag = kc.absmag(fl,band_shift)
    for each in absmag: print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI ###')
    fl = KC.FilterList(['deep_B','deep_R','deep_I'])
    fl.plot()
    mag = kc.appmag(fl)
    for each in mag: print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI on Vega scale ###')
    vega2ab = KC.vega2ab(fl)
    mag = kc.appmag(fl) - vega2ab
    for each in mag: print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI if at z = 1 ###')
    mag = kc.appmag(fl,redshift=1.0)
    for each in mag: print('%+.4f %+.4f %+.4f' % tuple(each))
    print()
Beispiel #3
0
def main():
    d = np.loadtxt('test/sdss.dat', dtype=float)
    z = d[:, 0]
    lup = d[:, 2:7]
    dlup = d[:, 7:12]
    red = d[:, 12:17]

    ####
    kc = SDSSPhotoZ(lup, dlup, red)
    print(kc.redshift)
    print(z)
    plt.plot(z, kc.redshift, 'o')
    plt.show()
    ####

    kc = SDSSKCorrect(z, lup, dlup, red, cosmo=(0.3, 0.7, 1.0))

    print('### k-corrections: SDSS ugriz ###')
    kcorr = kc.kcorrect()
    for each in kcorr:
        print('%+.6f %+.6f %+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: SDSS ugriz ###')
    absmag = kc.absmag()
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: SDSS ugriz band-shifted to z=0.1 ###')
    band_shift = 0.1
    kcorr = kc.kcorrect(band_shift=band_shift)
    for each in kcorr:
        print('%+.6f %+.6f %+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: SDSS ugriz band-shifted to z=0.1 ###')
    absmag = kc.absmag(band_shift=band_shift)
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI ###')
    fl = KC.FilterList(
        ['bessell_U', 'bessell_B', 'bessell_V', 'bessell_R', 'bessell_I'])
    absmag = kc.absmag(fl)
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI band-shifted to z=0.1 ###')
    absmag = kc.absmag(fl, band_shift)
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI ###')
    fl = KC.FilterList(['deep_B', 'deep_R', 'deep_I'])
    fl.plot()
    mag = kc.appmag(fl)
    for each in mag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI on Vega scale ###')
    vega2ab = KC.vega2ab(fl)
    mag = kc.appmag(fl) - vega2ab
    for each in mag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitudes: DEEP BRI if at z = 1 ###')
    mag = kc.appmag(fl, redshift=1.0)
    for each in mag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()
Beispiel #4
0
def main():
    d = np.loadtxt('test/deep.dat',
                   dtype=[('z', float), ('dz', float), ('B', float),
                          ('R', float), ('I', float)])
    z = d['z']
    mag = np.transpose([d['B'], d['R'], d['I']])

    # testing photo-z
    pz = DEEPPhotoZ(mag)
    print(pz.redshift)
    print(z)
    exit()
    # photo-z end

    kc = DEEPKCorrect(z, mag, cosmo=(0.3, 0.7, 1.0))

    print('### k-corrections: DEEP BRI ###')
    kcorr = kc.kcorrect()
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: DEEP BRI ###')
    absmag = kc.absmag()
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: DEEP BRI band-shifted to z=1 ###')
    band_shift = 1.0
    kcorr = kc.kcorrect(band_shift=band_shift)
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: DEEP BRI band-shifted to z=1 ###')
    absmag = kc.absmag(band_shift=band_shift)
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: NUB (IDL default) ###')
    fl = KC.FilterList(['galex_NUV', 'bessell_U', 'bessell_B'])
    kcorr = kc.kcorrect(fl)
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: NUB (IDL default) ###')
    absmag = kc.absmag(fl)
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI on Vega scale ###')
    fl = KC.FilterList(
        ['bessell_U', 'bessell_B', 'bessell_V', 'bessell_R', 'bessell_I'])
    vega2ab = KC.vega2ab(fl)
    absmag = kc.absmag(fl) - vega2ab
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitude SDSS ugriz if at z = 0.1 ###')
    fl = KC.FilterList(['sdss_u0', 'sdss_g0', 'sdss_r0', 'sdss_i0', 'sdss_z0'])
    mag = kc.appmag(fl, redshift=0.1)
    for each in mag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()
Beispiel #5
0
def main():
    d = np.loadtxt('test/deep.dat',
                   dtype=[('z', float), ('dz', float),
                          ('B', float), ('R', float), ('I', float)])
    z = d['z']
    mag = np.transpose([d['B'], d['R'], d['I']])

    # testing photo-z
    pz = DEEPPhotoZ(mag)
    print(pz.redshift)
    print(z)
    exit()
    # photo-z end


    kc = DEEPKCorrect(z, mag, cosmo=(0.3, 0.7, 1.0))

    print('### k-corrections: DEEP BRI ###')
    kcorr = kc.kcorrect()
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: DEEP BRI ###')
    absmag = kc.absmag()
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: DEEP BRI band-shifted to z=1 ###')
    band_shift = 1.0
    kcorr = kc.kcorrect(band_shift=band_shift)
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: DEEP BRI band-shifted to z=1 ###')
    absmag = kc.absmag(band_shift=band_shift)
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### k-corrections: NUB (IDL default) ###')
    fl = KC.FilterList(['galex_NUV', 'bessell_U', 'bessell_B'])
    kcorr = kc.kcorrect(fl)
    for each in kcorr:
        print('%+.6f %+.6f %+.6f' % tuple(each))
    print()

    print('### absolute magnitudes: NUB (IDL default) ###')
    absmag = kc.absmag(fl)
    for each in absmag:
        print('%+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### absolute magnitudes: Bessell UBVRI on Vega scale ###')
    fl = KC.FilterList(['bessell_U', 'bessell_B', 'bessell_V',
                        'bessell_R', 'bessell_I'])
    vega2ab = KC.vega2ab(fl)
    absmag = kc.absmag(fl) - vega2ab
    for each in absmag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()

    print('### apparent magnitude SDSS ugriz if at z = 0.1 ###')
    fl = KC.FilterList(['sdss_u0', 'sdss_g0', 'sdss_r0',
                        'sdss_i0', 'sdss_z0'])
    mag = kc.appmag(fl,redshift=0.1)
    for each in mag:
        print('%+.4f %+.4f %+.4f %+.4f %+.4f' % tuple(each))
    print()