def pwd_phasebin(phases, mags, binsize=<NUM_LIT>, minbin=<NUM_LIT:9>):
bins = np.arange(<NUM_LIT:0.0>, <NUM_LIT:1.0>, binsize)<EOL>binnedphaseinds = npdigitize(phases, bins)<EOL>binnedphases, binnedmags = [], []<EOL>for x in npunique(binnedphaseinds):<EOL><INDENT>thisbin_inds = binnedphaseinds == x<EOL>thisbin_phases = phases[thisbin_inds]<EOL>thisbin_mags = mags[thisbin_inds]<EOL>if thisbin_inds.size > minbin:<EOL><INDENT>binnedphases.append(npmedian(thisbin_phases))<EOL>binnedmags.append(npmedian(thisbin_mags))<EOL><DEDENT><DEDENT>return np.array(binnedphases), np.array(binnedmags)<EOL>
This bins the phased mag series using the given binsize.