@@ -0,0 +1,1809 @@
+import path as appath%0Aimport fitsio%0Atry:%0A    indexArrays= fitsio.read(appath.allStarPath(),3)%0Aexcept ValueError:%0A    _INDEX_ARRAYS_LOADED= False%0Aelse:%0A    _INDEX_ARRAYS_LOADED= True%0A    _PARAM_SYMBOL= %5Bindex.strip().lower() for index in indexArrays%5B'PARAM_SYMBOL'%5D.flatten()%5D%0A    _ELEM_SYMBOL= %5Bindex.strip().lower() for index in indexArrays%5B'ELEM_SYMBOL'%5D.flatten()%5D%0A%0Adef paramIndx(param):%0A    %22%22%22%0A    NAME:%0A       paramIndx%0A    PURPOSE:%0A       return the index into the PARAM/FPARAM  arrays corresponding to a given stellar parameter %0A    INPUT:%0A       param - the stellar parameter (one of TEFF,LOGG,LOG10VDOP,METALS,C,N,ALPHA)%0A    OUTPUT:%0A       index into PARAM/FPARAM array%0A    HISTORY:%0A       2014-08-19 - Written - Bovy (IAS)%0A    %22%22%22%0A    if not _INDEX_ARRAYS_LOADED: raise ImportError(%22paramIndx function cannot be used, because the allStar file could not be properly loaded%22)%0A    if param.lower() == 'alpha': return _PARAM_SYMBOL.index('o mg si s ca ti')%0A    else: %0A        try:%0A            return _PARAM_SYMBOL.index(param.lower())%0A        except ValueError:%0A            raise KeyError(%22Stellar parameter %25s not recognized%22 %25 param)%0A%0Adef elemIndx(elem):%0A    %22%22%22%0A    NAME:%0A       elemIndx%0A    PURPOSE:%0A       return the index into the ELEM/FELEM arrays corresponding to a given element%0A    INPUT:%0A       elem - the element (string like 'C')%0A    OUTPUT:%0A       index into ELEM/FELEM array%0A    HISTORY:%0A       2014-08-19 - Written - Bovy (IAS)%0A    %22%22%22%0A    if not _INDEX_ARRAYS_LOADED: raise ImportError(%22paramIndx function cannot be used, because the allStar file could not be properly loaded%22)%0A    try:%0A        return _ELEM_SYMBOL.index(elem.lower())%0A    except ValueError:%0A        raise KeyError(%22Element %25s is not part of the APOGEE elements (can't do everything!) or something went wrong)%22 %25 elem)%0A

add index functions to find the right index into the param/fparam/elem/felem arrays