Thermo-oxidative degradation of polyamides and polyimides