def load_isochrone(logAge=6.78, AKs=defaultAKs, distance=defaultDist): inFile = '/u/jlu/work/arches/models/iso/' inFile += 'iso_%.2f_hst_%4.2f_%4s.pickle' % (logAge, AKs, str(distance).zfill(4)) if not os.path.exists(inFile): make_observed_isochrone_hst(logAge=logAge, AKs=AKs, distance=distance) _in = open(inFile, 'rb') iso = objects.DataHolder() iso.M = pickle.load(_in) iso.T = pickle.load(_in) iso.logg = pickle.load(_in) iso.logL = pickle.load(_in) iso.mag127m = pickle.load(_in) iso.mag139m = pickle.load(_in) iso.mag153m = pickle.load(_in) iso.magJ = pickle.load(_in) iso.magH = pickle.load(_in) iso.magK = pickle.load(_in) iso.magKp = pickle.load(_in) iso.magLp = pickle.load(_in) iso.isWR = pickle.load(_in) iso.mag814w = pickle.load(_in) _in.close() return iso
def load_completeness(alignDir): print 'Loading star planting data from:' print ' %s' % alignDir + 'all_results.dat' _pickleFile = open(alignDir + 'all_results.dat', 'r') data = objects.DataHolder() # Individual measurements for every planted star data.x_in = pickle.load(_pickleFile) data.y_in = pickle.load(_pickleFile) data.m_in = pickle.load(_pickleFile) data.f_in = pickle.load(_pickleFile) data.x_out = pickle.load(_pickleFile) data.y_out = pickle.load(_pickleFile) data.m_out = pickle.load(_pickleFile) data.f_out = pickle.load(_pickleFile) # Combined for unique magnitude bins. data.mag = pickle.load(_pickleFile) data.midx = pickle.load(_pickleFile) data.countPlanted = pickle.load(_pickleFile) data.countFound = pickle.load(_pickleFile) data.completeness = pickle.load(_pickleFile) # Combined for unique positions on the detector. data.x = pickle.load(_pickleFile) data.y = pickle.load(_pickleFile) data.xy_idx = pickle.load(_pickleFile) return data
def load_masseron_table(): data = pyfits.getdata('masseron2010.fits') d = objects.DataHolder() d.name = data.field('Name') d.type = data.field('Type') d.ra = data.field('_RA') d.dec = data.field('_DE') d.simbadName = data.field('SimbadName') d.FeH = data.field('[Fe/H]') d.CFe = data.field('[C/Fe]') d.BaFe = data.field('[Ba/Fe]') d.EuFe = data.field('[Eu/Fe]') d.BaEu = d.BaFe - d.EuFe d.V = getVbandFromSimbad(d.simbadName) return d
def read_jay(filename, filter): zp = {'F127M': 24.65, 'F139M': 24.49} tab = asciidata.open(filename) d = objects.DataHolder() d.x = tab[0].tonumpy() d.y = tab[1].tonumpy() d.m = tab[2].tonumpy() d.xe = tab[3].tonumpy() d.ye = tab[4].tonumpy() d.me = tab[5].tonumpy() # Photometrically calibrate. d.m += zp[filter] return d
def load_ao_info(pickleFile): # Hang everything off this object. o = objects.DataHolder() _out = open(pickleFile, 'r') o.imgCount = pickle.load(_out) o.starCount = pickle.load(_out) o.x = pickle.load(_out) o.y = pickle.load(_out) o.m = pickle.load(_out) o.r = pickle.load(_out) o.sfile = pickle.load(_out) o.strehl = pickle.load(_out) o.fwhm = pickle.load(_out) o.mjd = pickle.load(_out) o.hour = pickle.load(_out) o.minute = pickle.load(_out) o.second = pickle.load(_out) o.mass_seeing = pickle.load(_out) o.dimm_seeing = pickle.load(_out) o.iso_angle = pickle.load(_out) o.tau0 = pickle.load(_out) o.airmass = pickle.load(_out) o.r0 = pickle.load(_out) o.xrms = pickle.load(_out) o.yrms = pickle.load(_out) o.mrms = pickle.load(_out) _out.close() return o
def load_klf(): pickleFile = '/u/jlu/work/gc/imf/gcows/klf.dat' _in = open(pickleFile, 'r') d = objects.DataHolder() d.fields = pickle.load(_in) d.Kp = pickle.load(_in) d.N = pickle.load(_in) d.eN = pickle.load(_in) d.N_ext = pickle.load(_in) d.eN_ext = pickle.load(_in) d.KLF = pickle.load(_in) d.eKLF = pickle.load(_in) d.KLF_ext = pickle.load(_in) d.eKLF_ext = pickle.load(_in) d.KLF_ext_cmp1 = pickle.load(_in) d.eKLF_ext_cmp1 = pickle.load(_in) d.KLF_ext_cmp2 = pickle.load(_in) d.eKLF_ext_cmp2 = pickle.load(_in) d.comp_imag_ext = pickle.load(_in) d.comp_spec_ext = pickle.load(_in) d.comp_plant_ext = pickle.load(_in) d.comp_found_ext = pickle.load(_in) _in.close() return d
def load_frebel_table(verbose=False): d = objects.DataHolder() # Load fits table. data = pyfits.getdata(dir + 'frebel2010_fixed.fits') name = data.field('NAME') simbad = data.field('SIMBAD') ra = data.field('RA') dec = data.field('DEC') B = data.field('B') V = data.field('V') R = data.field('R') I = data.field('I') FeH = data.field('FEH') # Iron abundance abundances = data.field('XFE') # All [X/Fe] abundances, carbon is idx=1 upperlim = data.field('UPPERLIM') rv = data.field('RV') ref = data.field('ABUNDREF') refYear = np.zeros(len(ref), dtype=int) for rr in range(len(ref)): tmp = ref[rr][3:5] if tmp.startswith('0'): refYear[rr] = float('20%s' % tmp) else: refYear[rr] = float('19%s' % tmp) # Report how many stars don't have info: idx = np.where(ra < 0)[0] if verbose: print 'Found %d out of %d stars without information\n' % \ (len(idx), len(name)) idx_C = frebel_elements.index('C') idx_Ba = frebel_elements.index('Ba') idx_Eu = frebel_elements.index('Eu') # Pull out some elements of interest CFe = abundances[:, idx_C] BaFe = abundances[:, idx_Ba] EuFe = abundances[:, idx_Eu] BaEu = BaFe - EuFe # First we need to deal with duplicates if verbose: print '## Duplicates' duplicates = np.array([], dtype=int) for ii in range(len(name)): if ii in duplicates: # Already addressed this duplicate star, skip it continue idx = np.where(name == name[ii])[0] if len(idx) > 1: if verbose: print '%20s %10.5f %10.5f %5.2f %7.2f %7.2f %7.2f %7.2f' % \ (name[ii], ra[ii], dec[ii], V[ii], FeH[ii], CFe[ii], BaFe[ii], EuFe[ii]) # The easy case is where there is only one measurement # for a given element. Then we just take the one. good = np.where(FeH[idx] != 0)[0] if len(good) == 1: FeH[idx[0]] = FeH[idx][good[0]] if len(good) > 1: # otherwise take the most recent one recent = refYear[idx][good].argmax() FeH[idx[0]] = FeH[idx][good][recent] # The easy case is where there is only one measurement # for a given element. Then we just take the one. good = np.where(CFe[idx] > -999)[0] if len(good) == 1: CFe[idx[0]] = CFe[idx][good[0]] if len(good) > 1: # otherwise take the most recent one recent = refYear[idx][good].argmax() CFe[idx[0]] = CFe[idx][good][recent] if len(good) == 0: # No carbon measurements, get rid of star all together. if verbose: print 'No C measurements for %s' % name[ii] duplicates = np.append(duplicates, idx) # The easy case is where there is only one measurement # for a given element. Then we just take the one. good = np.where(BaFe[idx] > -999)[0] if len(good) == 1: BaFe[idx[0]] = BaFe[idx][good[0]] if len(good) > 1: # otherwise take the most recent one recent = refYear[idx][good].argmax() BaFe[idx[0]] = BaFe[idx][good][recent] # The easy case is where there is only one measurement # for a given element. Then we just take the one. good = np.where(EuFe[idx] > -999)[0] if len(good) == 1: EuFe[idx[0]] = EuFe[idx][good[0]] if len(good) > 1: # otherwise take the most recent one recent = refYear[idx][good].argmax() EuFe[idx[0]] = EuFe[idx][good][recent] if verbose: print '%20s %10.5f %10.5f %5.2f %7.2f %7.2f %7.2f %7.2f' % \ (name[ii], ra[ii], dec[ii], V[ii], FeH[ii], CFe[ii], BaFe[ii], EuFe[ii]) # Delete the other ones duplicates = np.append(duplicates, idx[1:]) # Now delete the duplicates from the tables. d.name = np.delete(name, duplicates) d.simbad = np.delete(simbad, duplicates) d.ra = np.array(np.delete(ra, duplicates), dtype=float) d.dec = np.array(np.delete(dec, duplicates), dtype=float) d.B = np.array(np.delete(B, duplicates), dtype=float) d.V = np.array(np.delete(V, duplicates), dtype=float) d.R = np.array(np.delete(R, duplicates), dtype=float) d.I = np.array(np.delete(I, duplicates), dtype=float) d.FeH = np.array(np.delete(FeH, duplicates), dtype=float) d.abundances = np.array(np.delete(abundances, duplicates), dtype=float) d.rv = np.array(np.delete(rv, duplicates), dtype=float) d.ref = np.delete(ref, duplicates) d.refYear = np.delete(refYear, duplicates) d.CFe = np.array(np.delete(CFe, duplicates), dtype=float) d.BaFe = np.array(np.delete(BaFe, duplicates), dtype=float) d.EuFe = np.array(np.delete(EuFe, duplicates), dtype=float) d.BaEu = np.array(np.delete(BaEu, duplicates), dtype=float) if verbose: print '## Removed %d duplicates, %d stars left' % \ (len(duplicates), len(name)) return d
def call_fit_mtf(imageRoot, dataDir='/u/jlu/data/w51/10aug14/combo/', starsSuffix='_0.8_stf.lis', resolvedSources=None, maskSize=150, xcenter=None, ycenter=None, clip=0.02, weights=None, outDir='./'): """ weights - {None, 'std', 0.1} where the last can be any scale factor. None = no weighting, or same as constant weights. 'std' = use 1 / standard deviation of averaged 1D power spectrum. <frac> = use 1 / (any scale factor * 'std') """ ############################## # H-band wide image ############################## imageFile = dataDir + imageRoot + '.fits' img, hdr = pyfits.getdata(imageFile, header=True) wavelength = hdr['CENWAVE'] * 1e-6 focallength = mtf.Fvalues[hdr['CAMNAME'].strip()] pupil = hdr['PMSNAME'] # Mask resolved sources if resolvedSources != None: print 'MTF: Masking %d resolved sources' % len(resolvedSources) img = mask_image(imageFile, resolvedSources, maskSize=maskSize) gcutil.rmall([outDir + imageRoot + '_masked.fits']) pyfits.writeto(outDir + imageRoot + '_masked.fits', img) print 'MTF: Set initial guesses for parameters' #definitions of starting parameters [from fitmtf_keck.pro] # # wave=1.65d-6 # wavelength in meters # F=557.0 # effective focal length of Keck AO (narrow) # D=10.99 # primary's diameter in meters # pupil=0.266 # central obscuration # pupil='largehex' # NIRC2 pupil-stop # Apix=27d-6 # width of detector's pixel in meters # L0=20. # outer scale of turbulence in meters # sigma=.56 # Infl Func width on primary in meters # w=1.3 # Influence Function height # Delta=0 # wavefront measurement error # Cmult=10. # multiplicative constant # N=1d-2 # additive noise floor constant # r0=0.5 # wavelength specific fried parameter in meters startp = { 'wave': wavelength, 'D': 10.99, 'F': focallength, 'Apix': 27e-6, 'pupil': pupil, 'r0': 0.5, 'L0': 30.0, 'cmult': 1.0, 'N': 1e-5, 'w': 1.3, 'delta': 0.0, 'sigma': 0.56, } # Load up the starfinder results for this image print 'MTF: Read in preliminary starlist.' stfLis = dataDir + 'starfinder/' + imageRoot + starsSuffix table = asciidata.open(stfLis) name = table[0].tonumpy() mag = table[1].tonumpy() x = table[3].tonumpy() y = table[4].tonumpy() flux = 10**((mag[0] - mag) / 2.5) # Create sources array (delta functions * flux) for the stars. print 'MTF: Creating 2D source array' sources = np.zeros(img.shape, dtype=float) sources[np.array(y, dtype=int), np.array(x, dtype=int)] = flux # If this is a wide camera image, trim down to the central 512x512 # in order to limit the impact of anisoplanatism. if hdr['CAMNAME'].strip() == 'wide': # Make image square new_size = (np.array(img.shape) / 2.0).min() xlo = xcenter - (new_size / 2) xhi = xcenter + (new_size / 2) ylo = ycenter - (new_size / 2) yhi = ycenter + (new_size / 2) img = img[ylo:yhi, xlo:xhi] sources = sources[ylo:yhi, xlo:xhi] py.figure(2) py.clf() py.imshow(np.log10(img)) py.draw() py.figure(1) print 'MTF: Calling getmtf' foo = mtf.get_mtf(img, startp, sources=sources) nu = foo[0] power = foo[1] error = foo[2] pspec_sources = foo[3] weightMsg = 'Weighting by 1 / STD of azimuthal average power spectrum' # Defuault, assume weight = 'std' and just use the # standard deviation of azimuthal average of the power spectrum. if weights == None: weightMsg = 'Unweighted' # we will be working in log space, so need to 0.1 instead of 1.0 to # avoid dividing by log(1.0) = 0. error = np.ones(len(error)) * 0.1 if (type(weights) == float) and (weights <= 1) and (weights > 0): weightMsg = 'Weighting by 1 / power * scaleFactor of %.3f' % weights error = power * weights print weightMsg # Fit the power spectrum print 'MTF: Fitting the power spectrum (round 1)' fit = mtf.fitmtf_keck(nu, power, error, pspec_sources, startParams=startp, relStep=0.2, clip=clip) print 'MTF: Fitting the power spectrum (round 2)' fit = mtf.fitmtf_keck(nu, power, error, pspec_sources, startParams=fit.params, relStep=0.02, clip=clip) pspec_fit = mtf.mtffunc_keck(fit.params, nu=nu, sources=pspec_sources) mtfOut = mtf.mtffunc_keck(fit.params, nu=nu) print 'Calculating PSF' # PSF psf2d, psf1d = mtf.mtf2psf(fit.params, 2.0) print 'Calculating EE ' # Encircled Energy pix = np.arange(100, dtype=float) ee = mtf.mtf2ee(fit.params, pix) print 'Calculating Strehl' # Strehl sr = mtf.strehl(fit.params) # Make some output objects p_obs = objects.DataHolder() p_obs.nu = nu p_obs.pspec = power p_obs.pspec_error = error p_obs.pspec_sources = pspec_sources p_fit = objects.DataHolder() p_fit.all_params = fit.params p_fit.all_errors = fit.perror p_fit.fit_params = fit.fit_params p_fit.fit_covar = fit.fit_covar p_fit.fit_stat = fit.fit_stat p_fit.pspec_fit = pspec_fit p_fit.mtf_system = mtfOut p_fit.mtf_perfect = fit.tperf p_fit.psf1d = psf1d p_fit.psf2d = psf2d p_fit.strehl = sr p_fit.encircled_energy = ee # Save output to a pickle file outfile = open(outDir + imageRoot + '_mtf.pickle', 'w') pickle.dump(p_obs, outfile) pickle.dump(p_fit, outfile) outfile.close()
def make_observed_isochrone_hst_test(logAge, AKs=defaultAKs, k=3, distance=defaultDist, verbose=False): redlaw_k = RedLawNishiyama09(k=k) isoDir = 'iso_k{0}'.format(k) startTime = time.time() print('Making isochrone: log(t) = %.2f AKs = %.2f dist = %d' % \ (logAge, AKs, distance)) print(' Starting at: ', datetime.datetime.now(), ' Usually takes ~5 minutes') outFile = '/u/jlu/work/wd1/models/' + isoDir + '/' outFile += 'iso_%.2f_hst_%4.2f_%4s.pickle' % (logAge, AKs, str(distance).zfill(4)) c = constants # Get solar mettalicity models for a population at a specific age. evol = evolution.get_merged_isochrone(logAge=logAge) # Lets do some trimming down to get rid of repeat masses or # mass resolutions higher than 1/1000. We will just use the first # unique mass after rounding by the nearest 0.001. mass_rnd = np.copy(evol.mass) idx = np.where(evol.mass > 10)[0] mass_rnd[idx] = np.round(evol.mass[idx], decimals=0) print(mass_rnd[0:10]) mass_rnd = np.round(mass_rnd, decimals=1) print(mass_rnd[0:10]) tmp, idx = np.unique(mass_rnd, return_index=True) print('Number of stars {0}'.format(len(idx))) mass = evol.mass[idx] logT = evol.logT[idx] logg = evol.logg[idx] logL = evol.logL[idx] isWR = logT != evol.logT_WR[idx] temp = 10**logT # Output magnitudes for each temperature and extinction value. mag814w = np.zeros(len(temp), dtype=float) mag125w = np.zeros(len(temp), dtype=float) mag139m = np.zeros(len(temp), dtype=float) mag160w = np.zeros(len(temp), dtype=float) filt814w = get_filter_info('acs,f814w,wfc1') filt125w = get_filter_info('wfc3,ir,f125w') filt139m = get_filter_info('wfc3,ir,f139m') filt160w = get_filter_info('wfc3,ir,f160w') # Make reddening red814w = redlaw_k.reddening(AKs).resample(filt814w.wave) red125w = redlaw_k.reddening(AKs).resample(filt125w.wave) red139m = redlaw_k.reddening(AKs).resample(filt139m.wave) red160w = redlaw_k.reddening(AKs).resample(filt160w.wave) # Convert luminosity to erg/s L_all = 10**(logL) * c.Lsun # luminsoity in erg/s # Calculate radius R_all = np.sqrt(L_all / (4.0 * math.pi * c.sigma * temp**4)) R_all /= (c.cm_in_AU * c.AU_in_pc) # For each temperature extract the synthetic photometry. for ii in range(len(temp)): gravity = logg[ii] L = L_all[ii] # in erg/s T = temp[ii] # in Kelvin R = R_all[ii] # in pc # Get the atmosphere model now. Wavelength is in Angstroms star = atm.get_merged_atmosphere(temperature=T, gravity=gravity) # Trim wavelength range down to JHKL range (0.5 - 4.25 microns) star = spectrum.trimSpectrum(star, 5000, 42500) # Convert into flux observed at Earth (unreddened) star *= (R / distance)**2 # in erg s^-1 cm^-2 A^-1 # ---------- # Now to the filter integrations # ---------- mag814w[ii] = mag_in_filter(star, filt814w, red814w) mag125w[ii] = mag_in_filter(star, filt125w, red125w) mag139m[ii] = mag_in_filter(star, filt139m, red139m) mag160w[ii] = mag_in_filter(star, filt160w, red160w) if verbose: print('M = %7.3f Msun T = %5d K R = %2.1f Rsun logg = %4.2f F814W = %4.2f F125W = %4.2f F139M = %4.2f F160W = %4.2f' % \ (mass[ii], T, R * c.AU_in_pc / c.Rsun, logg[ii], mag814w[ii], mag125w[ii], mag139m[ii], mag160w[ii])) iso = objects.DataHolder() iso.M = mass iso.T = temp iso.logg = logg iso.logL = logL iso.mag814w = mag814w iso.mag125w = mag125w iso.mag139m = mag139m iso.mag160w = mag160w iso.isWR = isWR _out = open(outFile, 'wb') pickle.dump(mass, _out) pickle.dump(temp, _out) pickle.dump(logg, _out) pickle.dump(logL, _out) pickle.dump(mag814w, _out) pickle.dump(mag125w, _out) pickle.dump(mag139m, _out) pickle.dump(mag160w, _out) pickle.dump(isWR, _out) _out.close() endTime = time.time() print(' Time taken: %d seconds' % (endTime - startTime))
def make_observed_isochrone_hst(logAge, AKs=defaultAKs, distance=defaultDist, verbose=False, massSampling=10): """ massSampling - Sample the raw isochrone every ## steps. The default is massSampling = 10, which takes every 10th point. The isochrones are already very finely sampled. Must be an integer value. """ startTime = time.time() print 'Making isochrone: log(t) = %.2f AKs = %.2f dist = %d' % \ (logAge, AKs, distance) print ' Starting at: ', datetime.datetime.now( ), ' Usually takes ~5 minutes' # outFile = '/u/mwhosek/Desktop/699-2/isochrones/' outFile = '/u/jlu/work/arches/models/iso/' outFile += 'iso_%.2f_hst_%4.2f_%4s.pickle' % (logAge, AKs, str(distance).zfill(4)) c = constants # Get solar mettalicity models for a population at a specific age. evol = evolution.get_merged_isochrone(logAge=logAge) print 'Elapsed time while getting merged isochrone: ', time.time( ) - startTime #Eliminate cases where log g is less than 0 idx = np.where(evol.logg > 0) mass = evol.mass[idx] logT = evol.logT[idx] logg = evol.logg[idx] logL = evol.logL[idx] isWR = logT != evol.logT_WR[idx] mass = mass[::massSampling] logT = logT[::massSampling] logg = logg[::massSampling] logL = logL[::massSampling] isWR = isWR[::massSampling] temp = 10**logT # Output magnitudes for each temperature and extinction value. mag814w = np.zeros(len(temp), dtype=float) mag127m = np.zeros(len(temp), dtype=float) mag139m = np.zeros(len(temp), dtype=float) mag153m = np.zeros(len(temp), dtype=float) magJ = np.zeros(len(temp), dtype=float) magH = np.zeros(len(temp), dtype=float) magK = np.zeros(len(temp), dtype=float) magKp = np.zeros(len(temp), dtype=float) magLp = np.zeros(len(temp), dtype=float) filt814w = get_filter_info('wfc3,uvis1,f814w') filt127m = get_filter_info('wfc3,ir,f127m') filt139m = get_filter_info('wfc3,ir,f139m') filt153m = get_filter_info('wfc3,ir,f153m') filtJ = get_filter_info('nirc2,J') filtH = get_filter_info('nirc2,H') filtK = get_filter_info('nirc2,K') filtKp = get_filter_info('nirc2,Kp') filtLp = get_filter_info('nirc2,Lp') # Make reddening red814w = redlaw.reddening(AKs).resample(filt814w.wave) red127m = redlaw.reddening(AKs).resample(filt127m.wave) red139m = redlaw.reddening(AKs).resample(filt139m.wave) red153m = redlaw.reddening(AKs).resample(filt153m.wave) redJ = redlaw.reddening(AKs).resample(filtJ.wave) redH = redlaw.reddening(AKs).resample(filtH.wave) redK = redlaw.reddening(AKs).resample(filtK.wave) redKp = redlaw.reddening(AKs).resample(filtKp.wave) redLp = redlaw.reddening(AKs).resample(filtLp.wave) # Convert luminosity to erg/s L_all = 10**(logL) * c.Lsun # luminsoity in erg/s # Calculate radius R_all = np.sqrt(L_all / (4.0 * math.pi * c.sigma * temp**4)) R_all /= (c.cm_in_AU * c.AU_in_pc) # For each temperature extract the synthetic photometry. for ii in range(len(temp)): gravity = logg[ii] L = L_all[ii] # in erg/s T = temp[ii] # in Kelvin R = R_all[ii] # in pc # Get the atmosphere model now. Wavelength is in Angstroms star = atm.get_phoenix_atmosphere(temperature=T, gravity=gravity) # Trim wavelength range down to JHKL range (0.5 - 4.25 microns) star = spectrum.trimSpectrum(star, 5000, 42500) # Convert into flux observed at Earth (unreddened) star *= (R / distance)**2 # in erg s^-1 cm^-2 A^-1 # ---------- # Now to the filter integrations # ---------- mag814w[ii] = mag_in_filter(star, filt814w, red814w) mag127m[ii] = mag_in_filter(star, filt127m, red127m) mag139m[ii] = mag_in_filter(star, filt139m, red139m) mag153m[ii] = mag_in_filter(star, filt153m, red153m) magJ[ii] = mag_in_filter(star, filtJ, redJ) magH[ii] = mag_in_filter(star, filtH, redH) magK[ii] = mag_in_filter(star, filtK, redK) magKp[ii] = mag_in_filter(star, filtKp, redKp) magLp[ii] = mag_in_filter(star, filtLp, redLp) if verbose: print 'M = %7.3f Msun T = %5d K R = %2.1f Rsun logg = %4.2f F127M = %4.2f F139M = %4.2f F153M = %4.2f elapsed time = %4s' % \ (mass[ii], T, R * c.AU_in_pc / c.Rsun, logg[ii], mag127m[ii], mag139m[ii], mag153m[ii], time.time() - startTime) iso = objects.DataHolder() iso.M = np.array(mass) iso.T = np.array(temp) iso.logg = np.array(logg) iso.logL = np.array(logL) iso.mag127m = mag127m iso.mag139m = mag139m iso.mag153m = mag153m iso.magJ = magJ iso.magH = magH iso.magK = magK iso.magKp = magKp iso.magLp = magLp iso.isWR = isWR iso.mag814w = mag814w _out = open(outFile, 'wb') pickle.dump(mass, _out) pickle.dump(temp, _out) pickle.dump(logg, _out) pickle.dump(logL, _out) pickle.dump(mag127m, _out) pickle.dump(mag139m, _out) pickle.dump(mag153m, _out) pickle.dump(magJ, _out) pickle.dump(magH, _out) pickle.dump(magK, _out) pickle.dump(magKp, _out) pickle.dump(magLp, _out) pickle.dump(isWR, _out) pickle.dump(mag814w, _out) _out.close() pdb.set_trace() endTime = time.time() print ' Time taken: %d seconds' % (endTime - startTime)