for i in range(Nres_bins): f3.write(fmt % (res_bin_cen[i], histR[i], histS[i], histU[i])) f3.close() # npz file with the full Dictionary fname4 = 'SpecResidStats4DR2_AllDict.' + suf np.savez_compressed(fname4, D) sys.exit('bai') frac = 0.999 l_int = np.arange(3650, 7200, 2) Nl_int = len(l_int) import CALIFAUtils gals, _ = CALIFAUtils.sort_gals('/Users/lacerda/CALIFA/listv20_q050.d15a.txt') #gals, _ = CALIFAUtils.sort_gals('/Users/lacerda/CALIFA/listq50test.txt') RF_SumR__l = np.ma.zeros((1601)) RF_SumR2__l = np.ma.zeros((1601)) RF_NOk__l = np.ma.zeros((1601)) for iGal, K in CALIFAUtils.loop_cubes(gals.tolist(), v_run=-1): isFlagOk__lz = np.where(K.f_flag == 0, 1, 0) isErrOk__lz = np.where(K.f_err > 0, 1, 0) isWeiOk__lz = np.where(K.f_wei > 0, 1, 0) isOk__lz = isFlagOk__lz * isWeiOk__lz * isErrOk__lz rad__z = np.sqrt((K.zonePos['x'] - K.x0)**2. + (K.zonePos['y'] - K.y0)**2.) / K.HLR_pix isInRad__z = np.where(rad__z >= 1., 1, 0) * np.where(rad__z < 999.0, 1, 0) isOkAndInRad__lz = isOk__lz * isInRad__z
# Parse arguments args = parser_args(sys.argv[0]) C.debug_var(True, args = args.__dict__) Zsun = 0.019 # Creating radial bins. Rbin__r = np.arange(args.rbinini, args.rbinfin + args.rbinstep, args.rbinstep) RbinCenter__r = (Rbin__r[:-1] + Rbin__r[1:]) / 2.0 NRbins = len(RbinCenter__r) RColor = [ 'r', 'y', 'b', 'k' ] RRange = [ .5, 1., 1.5, 2. ] Rbin_oneHLR = [1. - args.rbinstep, 1. + args.rbinstep] # Reading galaxies file, gals, _ = C.sort_gals(gals = args.gals_filename, order = 1) N_gals = len(gals) maxGals = None if args.debug: maxGals = 10 if N_gals > maxGals: N_gals = maxGals # SFR-time-scale array (index __T) base = StarlightBase('/Users/lacerda/LOCAL/data/BASE.CALIFA.gsd6.h5', 'gsd6e', hdf5 = True) #tSF__T = np.array([0.032 , 0.3 , 1.5, 14.2]) * 1.e9 tSF__T = np.asarray(base.ageBase) #tSF__T = np.array([1, 3.2, 10, 100]) * 1e7 N_T = len(tSF__T) # Z-time-scale array (index __U).
fnamesuffix = '.pdf' if args.slice_gals is None: N_gals = H.N_gals gals_slice__g = np.ones_like(H.zone_dist_HLR__g, dtype = np.bool) gals_slice__rg = np.ones((NRbins, H.N_gals_all), dtype = np.bool) gals_slice__integr = np.ones(H.califaIDs_all.shape, dtype = np.bool) gals_txt = '' else: gals_slice__g, N_gals = H.get_mask_zones_list(args.slice_gals, return_ngals = True) gals_slice__rg, N_gals = H.get_mask_radius_list(args.slice_gals, return_ngals = True) gals_txt = (args.slice_gals).split('/')[-1] fnamesuffix = '_%s%s' % (gals_txt, fnamesuffix) #integrated l_gals, _ = C.sort_gals(args.slice_gals) l_gals = sorted(l_gals) gals_slice__integr = np.zeros(H.califaIDs_all.shape, dtype = np.bool) for g in l_gals: i = H.califaIDs_all.tolist().index(g) gals_slice__integr[i] = True mask__Tg = np.zeros((N_T, H.N_zones__g.sum()), dtype = bool) for iT in xrange(N_T): mask__Tg[iT] = mask_zones_iT(iT, H, args.bamin, gals_slice__g) for iGal, califaID in enumerate(H.califaIDs): K = C.read_one_cube(califaID, EL = True, GP = True, debug = args.debug, v_run = args.v_run) tipos, tipo, tipo_m, tipo_p = C.get_morfologia(califaID) my_type = C.my_morf(tipos) N_zone = K.N_zone
#example(listfile, sortby, order = 1) f = open('/Users/lacerda/CALIFA/list_SFR/rem_ba_morph/list_1234.txt', 'r') l = f.readlines() f.close() listgals_toberemoved = [l[i].strip() for i in np.arange(len(l))] f = open('/Users/lacerda/CALIFA/list_SFR/rem_ba_morph/list_0_si_si.txt', 'r') l = f.readlines() f.close() listgals_zero = [l[i].strip() for i in np.arange(len(l))] kwargs = dict(EL=True, nuc_R=0.15) gals, data__g = C.sort_gals( gals='/Users/lacerda/CALIFA/listOf298GalPrefixes.txt', func=sort_f, order=1, **kwargs) for i, g in enumerate(gals): j = -1 try: j = listgals_zero.index(g) mark = '0' except: mark = None #EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE # if mark == None: # try: