@jit(nopython=True)<EOL>def interp_values(mass_arr, age_arr, feh_arr, icol, <EOL>grid, mass_col, ages, fehs, grid_Ns):
N = len(mass_arr)<EOL>results = np.zeros(N)<EOL>Nage = len(ages)<EOL>Nfeh = len(fehs)<EOL>for i in range(N):<EOL><INDENT>mass = mass_arr[i]<EOL>age = age_arr[i]<EOL>feh = feh_arr[i]<EOL>ifeh = searchsorted(fehs, Nfeh, feh)<EOL>iage = searchsorted(ages, Nage, age)<EOL>pts = np.zeros((<NUM_LIT:8>,<NUM_LIT:3>))<EOL>vals = np.zeros(<NUM_LIT:8>)<EOL>i_f = ifeh - <NUM_LIT:1><EOL>i_a = iage - <NUM_LIT:1><EOL>Nmass = grid_Ns[i_f, i_a]<EOL>imass = searchsorted(grid[i_f, i_a, :, mass_col], Nmass, mass)<EOL>pts[<NUM_LIT:0>, <NUM_LIT:0>] = grid[i_f, i_a, imass, mass_col]<EOL>pts[<NUM_LIT:0>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:0>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:0>] = grid[i_f, i_a, imass, icol]<EOL>pts[<NUM_LIT:1>, <NUM_LIT:0>] = grid[i_f, i_a, imass-<NUM_LIT:1>, mass_col]<EOL>pts[<NUM_LIT:1>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:1>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:1>] = grid[i_f, i_a, imass-<NUM_LIT:1>, icol]<EOL>i_f = ifeh - <NUM_LIT:1><EOL>i_a = iage <EOL>Nmass = grid_Ns[i_f, i_a]<EOL>imass = searchsorted(grid[i_f, i_a, :, mass_col], Nmass, mass)<EOL>pts[<NUM_LIT:2>, <NUM_LIT:0>] = grid[i_f, i_a, imass, mass_col]<EOL>pts[<NUM_LIT:2>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:2>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:2>] = grid[i_f, i_a, imass, icol]<EOL>pts[<NUM_LIT:3>, <NUM_LIT:0>] = grid[i_f, i_a, imass-<NUM_LIT:1>, mass_col]<EOL>pts[<NUM_LIT:3>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:3>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:3>] = grid[i_f, i_a, imass-<NUM_LIT:1>, icol]<EOL>i_f = ifeh<EOL>i_a = iage - <NUM_LIT:1><EOL>Nmass = grid_Ns[i_f, i_a]<EOL>imass = searchsorted(grid[i_f, i_a, :, mass_col], Nmass, mass)<EOL>pts[<NUM_LIT:4>, <NUM_LIT:0>] = grid[i_f, i_a, imass, mass_col]<EOL>pts[<NUM_LIT:4>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:4>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:4>] = grid[i_f, i_a, imass, icol]<EOL>pts[<NUM_LIT:5>, <NUM_LIT:0>] = grid[i_f, i_a, imass-<NUM_LIT:1>, mass_col]<EOL>pts[<NUM_LIT:5>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:5>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:5>] = grid[i_f, i_a, imass-<NUM_LIT:1>, icol]<EOL>i_f = ifeh <EOL>i_a = iage<EOL>Nmass = grid_Ns[i_f, i_a]<EOL>imass = searchsorted(grid[i_f, i_a, :, mass_col], Nmass, mass)<EOL>pts[<NUM_LIT:6>, <NUM_LIT:0>] = grid[i_f, i_a, imass, mass_col]<EOL>pts[<NUM_LIT:6>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:6>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:6>] = grid[i_f, i_a, imass, icol]<EOL>pts[<NUM_LIT:7>, <NUM_LIT:0>] = grid[i_f, i_a, imass-<NUM_LIT:1>, mass_col]<EOL>pts[<NUM_LIT:7>, <NUM_LIT:1>] = ages[i_a]<EOL>pts[<NUM_LIT:7>, <NUM_LIT:2>] = fehs[i_f]<EOL>vals[<NUM_LIT:7>] = grid[i_f, i_a, imass-<NUM_LIT:1>, icol]<EOL>results[i] = interp_box(mass, age, feh, pts, vals)<EOL><DEDENT>return results<EOL>
mass_arr, age_arr, feh_arr are all arrays at which values are desired

    icol is the column index of desired value
    grid is nfeh x nage x max(nmass) x ncols array
    mass_col is the column index of mass
    ages is grid of ages
    fehs is grid of fehs
    grid_Ns keeps track of nmass in each slice (beyond this are nans)