예제 #1
0
def test_elem_calib_outsiderange_dwarfs():
    #Test that the elem calibration does not extend outside of the calibration
    #temperature range
    from apogee.tools import _ELEM_SYMBOL
    elems = [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    TeffMin = 3800.
    TeffMax = 7500.
    dwarfs= (_DATA['FPARAM'][:,paramIndx('logg')] >= (2./1300.\
                 *(_DATA['FPARAM'][:,paramIndx('teff')]-3500.)+2.))\
                 +(_DATA['FPARAM'][:,paramIndx('logg')] >= 4.)\
                 +(_DATA['FPARAM'][:,paramIndx('teff')] >= 7000.)
    for elem in elems:
        calibDiff= _DATA['FELEM'][:,elemIndx(elem)]\
            -_DATA['ELEM'][:,elemIndx(elem)]
        #Only consider good stars for this element
        indx= ((_DATA['ASPCAPFLAG'] & 2**23) == 0)\
            *(_DATA['FPARAM'][:,paramIndx('teff')] > -1000.)\
            *dwarfs\
            *(_DATA['FELEM'][:,elemIndx(elem)] > -1000.)\
            *(_DATA['ELEM'][:,elemIndx(elem)] > -1000.)
        try:
            loTIndx = numpy.argmin(
                numpy.fabs(_DATA['FPARAM'][indx, paramIndx('teff')] - TeffMin))
        except ValueError:
            pass
        else:
            assert numpy.all(
                numpy.fabs(calibDiff[indx][
                    _DATA['FPARAM'][indx, paramIndx('teff')] < TeffMin] -
                           calibDiff[indx][loTIndx]) < 10.**-3.
            ), 'Calibration offset does not saturate below the minimum calibration temperature of %i for element %s' % (
                TeffMin, elem)
        try:
            hiTIndx = numpy.argmin(
                numpy.fabs(_DATA['FPARAM'][indx, paramIndx('teff')] - TeffMax))
        except ValueError:
            pass
        else:
            assert numpy.all(
                numpy.fabs(calibDiff[indx][
                    _DATA['FPARAM'][indx, paramIndx('teff')] > TeffMax] -
                           calibDiff[indx][hiTIndx]) < 10.**-2.
            ), 'Calibration offset does not saturate above the maximum calibration temperature of %i for element %s' % (
                TeffMax, elem)
    return None
예제 #2
0
def test_elem_err_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL
    elems= ['C','N','O','Mg','Si','S','Ca','Ti',
            'Ni','Fe','Al','K','Na','V','Mn']
    for ii,elem in enumerate(elems):
        errDiff= _DATA['ELEM_ERR'][:,elemIndx(elem)]\
            -_DATA[elem.upper()+'_H_ERR']
        assert numpy.all(numpy.fabs(errDiff) < 10.**-10.), 'ELEM_ERR value for %s_H_ERR does not agree with named tag' % elem 
    return None
예제 #3
0
def test_elem_err_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL
    elems= ['C','N','O','Mg','Si','S','Ca','Ti',
            'Ni','Fe','Al','K','Na','V','Mn']
    for ii,elem in enumerate(elems):
        errDiff= _DATA['ELEM_ERR'][:,elemIndx(elem)]\
            -_DATA[elem.upper()+'_H_ERR']
        assert numpy.all(numpy.fabs(errDiff) < 10.**-10.), 'ELEM_ERR value for %s_H_ERR does not agree with named tag' % elem 
    return None
예제 #4
0
def test_elem_err_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL
    from apogee.tools import _ELEM_SYMBOL
    elems= [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    for ii,elem in enumerate(elems):
        errDiff= _DATA['ELEM_ERR'][:,elemIndx(elem)]\
            -_DATA[elem.upper()+'_H_ERR']
        assert numpy.all(numpy.fabs(errDiff) < 10.**-10.), 'ELEM_ERR value for %s_H_ERR does not agree with named tag' % elem 
    return None
예제 #5
0
def test_elem_err_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL
    from apogee.tools import _ELEM_SYMBOL
    elems= [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    for ii,elem in enumerate(elems):
        errDiff= _DATA['ELEM_ERR'][:,elemIndx(elem)]\
            -_DATA[elem.upper()+'_H_ERR']
        assert numpy.all(numpy.fabs(errDiff) < 10.**-10.), 'ELEM_ERR value for %s_H_ERR does not agree with named tag' % elem 
    return None
예제 #6
0
def test_elem_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL 
    elems= ['C','N','O','Mg','Si','S','Ca','Ti',
            'Ni','Fe','Al','K','Na','V','Mn']
    ferreOverM= ['C','N','O','Mg','Si','S','Ca','Ti']
    for ii,elem in enumerate(elems):
        elemval= copy.copy(_DATA['ELEM'][:,elemIndx(elem)])
        if elem in ferreOverM: elemval+= _DATA['FPARAM'][:,paramIndx('metals')]
        #BOVY: What about the following?
        goodIndx= _DATA['FPARAM'][:,paramIndx('metals')] != -9999.
        assert numpy.all(numpy.fabs(elemval[goodIndx]-_DATA[elem.upper()+'_H'][goodIndx]) < 10.**-10.), 'ELEM value for %s_H does not agree with named tag' % elem 
    return None
예제 #7
0
def test_elem_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL 
    from apogee.tools import _ELEM_SYMBOL
    elems= [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    ferreOverM= ['C','N','O','Mg','Si','S','Ca','Ti']
    for ii,elem in enumerate(elems):
        if elem == 'C' or elem == 'N' or elem == 'O': continue
        elemval= copy.copy(_DATA['ELEM'][:,elemIndx(elem)])
        if elem in ferreOverM: elemval+= _DATA['FPARAM'][:,paramIndx('metals')]
        #BOVY: What about the following?
        goodIndx= (_DATA['FPARAM'][:,paramIndx('metals')] != -9999.)\
            *(_DATA[elem.upper()+'_H'] != -9999.)
        assert numpy.all(numpy.fabs(elemval[goodIndx]-_DATA[elem.upper()+'_H'][goodIndx]) < 10.**-10.), 'ELEM value for %s_H does not agree with named tag' % elem 
    return None
예제 #8
0
def test_elem_named():
    #Test that the named tags for the elements correspond to the correct values in elem according to ELEM_SYMBOL 
    from apogee.tools import _ELEM_SYMBOL
    elems= [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    ferreOverM= ['C','N','O','Mg','Si','S','Ca','Ti']
    for ii,elem in enumerate(elems):
        if elem == 'C' or elem == 'N' or elem == 'O': continue
        elemval= copy.copy(_DATA['ELEM'][:,elemIndx(elem)])
        if elem in ferreOverM: elemval+= _DATA['FPARAM'][:,paramIndx('metals')]
        #BOVY: What about the following?
        goodIndx= (_DATA['FPARAM'][:,paramIndx('metals')] != -9999.)\
            *(_DATA[elem.upper()+'_H'] != -9999.)
        assert numpy.all(numpy.fabs(elemval[goodIndx]-_DATA[elem.upper()+'_H'][goodIndx]) < 10.**-10.), 'ELEM value for %s_H does not agree with named tag' % elem 
    return None
예제 #9
0
def test_elem_calib_outsiderange_dwarfs():
    #Test that the elem calibration does not extend outside of the calibration
    #temperature range
    from apogee.tools import _ELEM_SYMBOL
    elems= [e.capitalize() for e in _ELEM_SYMBOL if e != 'ci' and e != 'tiii']
    TeffMin= 3800.
    TeffMax= 7500.
    dwarfs= (_DATA['FPARAM'][:,paramIndx('logg')] >= (2./1300.\
                 *(_DATA['FPARAM'][:,paramIndx('teff')]-3500.)+2.))\
                 +(_DATA['FPARAM'][:,paramIndx('logg')] >= 4.)\
                 +(_DATA['FPARAM'][:,paramIndx('teff')] >= 7000.)
    for elem in elems:
        calibDiff= _DATA['FELEM'][:,elemIndx(elem)]\
            -_DATA['ELEM'][:,elemIndx(elem)]
        #Only consider good stars for this element
        indx= ((_DATA['ASPCAPFLAG'] & 2**23) == 0)\
            *(_DATA['FPARAM'][:,paramIndx('teff')] > -1000.)\
            *dwarfs\
            *(_DATA['FELEM'][:,elemIndx(elem)] > -1000.)\
            *(_DATA['ELEM'][:,elemIndx(elem)] > -1000.)
        try:
            loTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                             paramIndx('teff')]
                                             -TeffMin))
        except ValueError:
            pass
        else:
            assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] < TeffMin]-calibDiff[indx][loTIndx]) < 10.**-3.), 'Calibration offset does not saturate below the minimum calibration temperature of %i for element %s' % (TeffMin,elem)
        try:
            hiTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                             paramIndx('teff')]
                                             -TeffMax))
        except ValueError:
            pass
        else:
            assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] > TeffMax]-calibDiff[indx][hiTIndx]) < 10.**-2.), 'Calibration offset does not saturate above the maximum calibration temperature of %i for element %s' % (TeffMax,elem)
    return None
예제 #10
0
def test_elem_calib_outsiderange():
    #Test that the elem calibration does not extend outside of the calibration
    #temperature range
    elems= ['C','N','O','Mg','Si','S','Ca','Ti',
            'Ni','Fe','Al','K','Na','V','Mn']
    TeffMin= 3800.
    TeffMax= 5250.
    for elem in elems:
        calibDiff= _DATA['FELEM'][:,elemIndx(elem)]\
            -_DATA['ELEM'][:,elemIndx(elem)]
        #Only consider good stars for this element
        indx= ((_DATA['ASPCAPFLAG'] & 2**23) == 0)\
            *(_DATA['FPARAM'][:,paramIndx('teff')] > -1000.)\
            *(_DATA['FELEM'][:,elemIndx(elem)] > -1000.)\
            *(_DATA['ELEM'][:,elemIndx(elem)] > -1000.)
        loTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                         paramIndx('teff')]
                                         -TeffMin))
        hiTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                         paramIndx('teff')]
                                         -TeffMax))
        assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] < TeffMin]-calibDiff[indx][loTIndx]) < 10.**-3.), 'Calibration offset does not saturate below the minimum calibration temperature of %i for element %s' % (TeffMin,elem)
        assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] > TeffMax]-calibDiff[indx][hiTIndx]) < 10.**-2.), 'Calibration offset does not saturate above the maximum calibration temperature of %i for element %s' % (TeffMax,elem)
    return None
예제 #11
0
def test_elem_calib_outsiderange():
    #Test that the elem calibration does not extend outside of the calibration
    #temperature range
    elems= ['C','N','O','Mg','Si','S','Ca','Ti',
            'Ni','Fe','Al','K','Na','V','Mn']
    TeffMin= 3800.
    TeffMax= 5250.
    for elem in elems:
        calibDiff= _DATA['FELEM'][:,elemIndx(elem)]\
            -_DATA['ELEM'][:,elemIndx(elem)]
        #Only consider good stars for this element
        indx= ((_DATA['ASPCAPFLAG'] & 2**23) == 0)\
            *(_DATA['FPARAM'][:,paramIndx('teff')] > -1000.)\
            *(_DATA['FELEM'][:,elemIndx(elem)] > -1000.)\
            *(_DATA['ELEM'][:,elemIndx(elem)] > -1000.)
        loTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                         paramIndx('teff')]
                                         -TeffMin))
        hiTIndx= numpy.argmin(numpy.fabs(_DATA['FPARAM'][indx,
                                                         paramIndx('teff')]
                                         -TeffMax))
        assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] < TeffMin]-calibDiff[indx][loTIndx]) < 10.**-3.), 'Calibration offset does not saturate below the minimum calibration temperature of %i for element %s' % (TeffMin,elem)
        assert numpy.all(numpy.fabs(calibDiff[indx][_DATA['FPARAM'][indx,paramIndx('teff')] > TeffMax]-calibDiff[indx][hiTIndx]) < 10.**-2.), 'Calibration offset does not saturate above the maximum calibration temperature of %i for element %s' % (TeffMax,elem)
    return None