def add_stokes_axis_to_wcs(wcs, add_before_ind):
 inds = [(i + 1) for i in range(wcs.wcs.naxis)]
 inds.insert(add_before_ind, 0)
 newwcs = wcs.sub(inds)
 newwcs.wcs.ctype[add_before_ind] = u'STOKES'
 newwcs.wcs.cname[add_before_ind] = u'STOKES'
 return newwcs

def add_stokes_axis_to_wcs ( wcs , add_before_ind ) : inds = [ ( i + 1 ) for i in range ( wcs . wcs . naxis ) ] inds . insert ( add_before_ind , 0 ) newwcs = wcs . sub ( inds ) newwcs . wcs . ctype [ add_before_ind ] = u'STOKES' newwcs . wcs . cname [ add_before_ind ] = u'STOKES' return newwcs
add a new stokes axis that is uncorrelated with any other axes .