Calculation of wiggler spectrum and its absorption in media