turnOffs = list() for mag, path in zip(mags, paths): color = mag["WFC3_UVIS_F606W"]-mag["WFC3_UVIS_F814W"] idStr = re.findall('Pop[A|E]\+0\.\d+', str(path))[0] pop = idStr[3] Y = float(idStr[5:]) turnOffColor = min(mag["WFC3_UVIS_F606W"] - mag["WFC3_UVIS_F814W"]) turnOffMag = mag[color==turnOffColor]["WFC3_UVIS_F606W"] if turnOffColor < 0.48: turnOffs.append((turnOffColor, turnOffMag.values[0], pop, Y)) meanTurnOffColorA = sum([x[0] for x in turnOffs if x[2] == 'A'])/(len(turnOffs)/2) meanTurnOffMagA = sum([x[1] for x in turnOffs if x[2] == 'A'])/(len(turnOffs)/2) meanTurnOffColorE = sum([x[0] for x in turnOffs if x[2] == 'E'])/(len(turnOffs)/2) meanTurnOffMagE = sum([x[1] for x in turnOffs if x[2] == 'E'])/(len(turnOffs)/2)