At the very least, these kappa appends are unnecessary when get_kappa is false.  However, I think it makes more sense to break this into two functions: getShear and getKappa.  There isn't actually any advantage to doing these both at once, and I think it is just confusing to have kappa returned from a function named getShear.