def __init__(self, xi2dfname=None, wpfname=None, wpicovfname=None, xiellfname=None, xiellicovfname=None, xidatfname=None): """ Uses file inputs to read in various correlation function statistics (xi2d, xiell, wp) into a xi object. The main purpose of this class is to package a single model/measurement together and make a fancy plot. """ if xidatfname is not None: ifp = open(xidatfname, 'r') print 'reading info from', xidatfname for line in ifp: if xi2dfname is None: if (re.match('xi2d:', line)): xi2dfname = line.split(':')[1].strip(' \n') if wpfname is None: if (re.match('wp:', line)): x = line.split(':')[1].split(',') assert len(x) == 1 or len(x) == 2 wpfname = x[0].strip(' \n') if (len(x) == 2 and wpicovfname is None): wpicovfname = x[1].strip(' \n') if xiellfname is None: if (re.match('xiell:', line)): x = line.split(':')[1].split(',') assert len(x) == 1 or len(x) == 2 xiellfname = x[0].strip(' \n') if (len(x) == 2 and xiellicovfname is None): xiellicovfname = x[1].strip(' \n') self.xi2dfname = xi2dfname self.wpfname = wpfname self.xiellfname = xiellfname if (xi2dfname is not None): self.xi2d = xi2d.xi2d(xi2dfname) else: self.xi2d = None if (wpfname is not None): self.wp = wp.wp(wpfname, icovfname=wpicovfname) else: self.wp = None if (xiellfname is not None): self.xiell = xiell.xiell(xiellfname, icovfname=xiellicovfname) else: self.xiell = None
def __init__(self,xi2dfname=None,wpfname=None,wpicovfname=None,xiellfname=None,xiellicovfname=None,xidatfname=None): """ Uses file inputs to read in various correlation function statistics (xi2d, xiell, wp) into a xi object. The main purpose of this class is to package a single model/measurement together and make a fancy plot. """ if xidatfname is not None: ifp = open(xidatfname,'r') print 'reading info from',xidatfname for line in ifp: if xi2dfname is None: if(re.match('xi2d:',line)): xi2dfname = line.split(':')[1].strip(' \n') if wpfname is None: if(re.match('wp:',line)): x = line.split(':')[1].split(',') assert len(x) == 1 or len(x) == 2 wpfname = x[0].strip(' \n') if(len(x) == 2 and wpicovfname is None): wpicovfname = x[1].strip(' \n') if xiellfname is None: if(re.match('xiell:',line)): x = line.split(':')[1].split(',') assert len(x) == 1 or len(x) == 2 xiellfname = x[0].strip(' \n') if(len(x) == 2 and xiellicovfname is None): xiellicovfname = x[1].strip(' \n') self.xi2dfname = xi2dfname self.wpfname = wpfname self.xiellfname = xiellfname if(xi2dfname is not None): self.xi2d = xi2d.xi2d(xi2dfname) else: self.xi2d = None if(wpfname is not None): self.wp = wp.wp(wpfname,icovfname=wpicovfname) else: self.wp = None if(xiellfname is not None): self.xiell = xiell.xiell(xiellfname,icovfname=xiellicovfname) else: self.xiell = None
import xi reload(xi2d) reload(xiell) reload(wp) # <codecell> ## correlation function measurements, computed elsewhere in a parallel C code. fN = 'xifiles/data/collidedBR-collate-cmass-dr10v7-N-FBBRang_xigrid.butterfly' fS = 'xifiles/data/collidedBR-collate-cmass-dr10v7-S-FBBRang_xigrid.butterfly' ## a theoretical prediction for xi in the absence of any peculiar velocities fTreal = 'xifiles/theory/makeHJcatalogv2zspace2.cat.zspace-1.xiell.nbins900.butterfly' xiN = xi2d.xi2d(fN) xiS = xi2d.xi2d(fS) xireal = xi2d.xi2d(fTreal) # this function uses the filename associated with the object, and looks in the appropriate spot for the correct optimal weighting between the data sets. # it also does sanity checks that the same binning was used, etc. xiD = xiN+xiS #overload print statement too give some relevant information about where the data came from, what the binning looks like, etc. print xiD # <codecell> #see what raw correlation looks like. ff = plt.figure(figsize=[6,6]) ii=plt.imshow(xiD.xi.reshape(xiD.n1d,xiD.n1d),extent=[xiD.rsig.min(),xiD.rsig.max(),xiD.rpi.max(),xiD.rpi.min()])