vertices = [] for i in range(0,23,2): vertices.append([b[i][5],b[i][6]]) vertices.append([b[i][3],b[i][4]]) for i in range(21,0,-2): vertices.append([b[i][1],b[i][2]]) vertices.append([b[i][7],b[i][8]]) path = Path(vertices) toTest = [(r,d) for r,d in zip(ra_matched, dec_matched)] inds = path.contains_points(toTest) oh_we_care_about = obj_oh[inds] dist_oh = np.array([computeDist(r,d, tanplane = False) for r,d in zip(ra_matched, dec_matched)]) #oh_out = np.column_stack((ra_matched, dec_matched, dist_oh, obj_oh, obj_eoh)) #np.savetxt('HII_OH_all.txt', oh_out, fmt = ('%10.8f','%10.8f','%6.4f','%4.3f','%4.3f')) #pdb.set_trace() #pOH = np.polyfit(dist_oh, obj_oh[inds],1) #-----------Get SPLASH data----------------------------- cmbase = CM_MASTER.CM_Master() #dr = 0.24*cosdg(cmbase.d31) #dd = 0.24 #rbins = np.arange(min(cmbase.ra*cosdg(cmbase.d31)),max(cmbase.ra*cosdg(cmbase.d31)),dr) #dbins = np.arange(min(cmbase.dec), max(cmbase.dec),dd) radbins = np.arange(3, 25, 5)
hdu = pyfits.open('/Users/khamren/M31_Research/splash_data/subMasterSPLASH_zerr.fits') data = hdu[1].data cstars = data[(data.CID == 'c') & (data.FIELDTYPE == 'disk') & (data.RA != '00:00:00')] agb = data[((data.EVSTAGE == 'AGB') | (data.EVSTAGE == 'agb')) & (data.FIELDTYPE == 'disk') & (data.RA != '00:00:00')] agb_noc = data[((data.EVSTAGE == 'AGB') | (data.EVSTAGE == 'agb')) & (data.FIELDTYPE == 'disk') & (data.RA != '00:00:00') & (data.CID != 'c')] #cvel = (cstars.Z*c) - (cstars.ABAND*c) - helcorr(keck_long,keck_lat,keck_alt,cra, cdec,cstars.MJD)[0] cra = np.array([hms2deg(r,d)[0] for r,d in zip(cstars.RA, cstars.DEC)]) cra2 = cra*cosdg(d31) cdec = np.array([hms2deg(r,d)[1] for r,d in zip(cstars.RA, cstars.DEC)]) cdist = computeDist(cra, cdec) ara = np.array([hms2deg(r,d)[0] for r,d in zip(agb_noc.RA, agb_noc.DEC)]) ara2 = ara*cosdg(d31) adec = np.array([hms2deg(r,d)[1] for r,d in zip(agb_noc.RA, agb_noc.DEC)]) ara_all = np.array([hms2deg(r,d)[0] for r,d in zip(agb.RA, agb.DEC)]) ara2_all = ara_all*cosdg(d31) adec_all = np.array([hms2deg(r,d)[1] for r,d in zip(agb.RA, agb.DEC)]) cvel = np.array([((z*c) - (aband*c) - helcorr(keck_long,keck_lat,keck_alt,r,d, mjd)[0]) for z, aband, r, d, mjd in zip(cstars.Z, cstars.ABAND, cra, cdec, cstars.MJD)]) avel = np.array([((z*c) - (aband*c) - helcorr(keck_long, keck_lat,keck_alt, r,d, mjd)[0]) for z, aband, r, d, mjd in zip(agb_noc.Z, agb_noc.ABAND, ara, adec, agb_noc.MJD)]) averr = agb_noc.Z_ERR*c avel_all = np.array([((z*c) - (aband*c) - helcorr(keck_long, keck_lat,keck_alt, r,d, mjd)[0]) for z, aband, r, d, mjd in zip(agb.Z, agb.ABAND, ara_all, adec_all, agb.MJD)]) averr_all = agb.Z_ERR*c