<jupyter_start><jupyter_text>Should work if you have done git clone https://github.com/desihub/LSS.git and edited the part appending to the path or just made sure you are in LSS/Sandbox<jupyter_code>import sys, os, glob, time
import numpy as np
import matplotlib.pyplot as plt
import fitsio
sys.path.append('../py') #this works if you are in the Sandbox directory, check with os.getcwd()
from LSS.mkCat_singletile  import xitools
import subprocess
import importlib
importlib.reload(xitools) #this is just for when I developed the code during the notebook creation
#directories for intermediate files
dirpcadw = os.environ['CSCRATCH']+'/pcadw/'
dirpc = os.environ['CSCRATCH']+'/paircounts/'
if not os.path.exists(dirpc):
    os.mkdir(dirpcadw)
if not os.path.exists(dirpc):
    os.mkdir(dirpc)
rmax = 10 # number of random files to use
tp='ELG'
tile = '80606'
night = 'deep'
zmin = 0.8
zmax=1.1
catdir = '/global/cfs/cdirs/desi/survey/catalogs/SV1/LSS/LSScats/v0/'
gf = xitools.createSourcesrd_ad(tp,tile,night,zmin=zmin,zmax=zmax,datadir=catdir)
subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
subprocess.run('./dopc'+gf+'.sh')
#above did first random file, do the rest
for i in range(1,rmax):
    gf = xitools.createSourcesrd_ari(tp,tile,night,i,zmin=zmin,zmax=zmax,datadir=catdir)
    subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
    subprocess.run('./dopc'+gf+'.sh')
    
#calculates xi0, writes to cwd
xitools.ppxilcalc_LSDfjack_bs(tp,tile,night,zmin=zmin,zmax=zmax,bs=5,nran=rmax,wmu='')
#repeat for the rest of the ELG tiles (could have used all, 
#but with five tiles far apart, might as well go tile by tile)
tiles = ['80608','80610','80621','80623']
for tile in tiles:
    gf = xitools.createSourcesrd_ad(tp,tile,night,zmin=zmin,zmax=zmax,datadir=catdir)
    subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
    subprocess.run('./dopc'+gf+'.sh')
    for i in range(1,rmax):
        gf = xitools.createSourcesrd_ari(tp,tile,night,i,zmin=zmin,zmax=zmax,datadir=catdir)
        subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
        subprocess.run('./dopc'+gf+'.sh')
    xitools.ppxilcalc_LSDfjack_bs(tp,tile,night,zmin=zmin,zmax=zmax,bs=5,nran=rmax,wmu='')
bs=5
xidir=''
d1 = np.loadtxt(xidir+'xi0ELG80606_deep_zm0.8zx1.1'+str(bs)+'st0.dat').transpose() 
d2 = np.loadtxt(xidir+'xi0ELG80608_deep_zm0.8zx1.1'+str(bs)+'st0.dat').transpose()
d3 = np.loadtxt(xidir+'xi0ELG80610_deep_zm0.8zx1.1'+str(bs)+'st0.dat').transpose()
d4 = np.loadtxt(xidir+'xi0ELG80621_deep_zm0.8zx1.1'+str(bs)+'st0.dat').transpose()
d5 = np.loadtxt(xidir+'xi0ELG80623_deep_zm0.8zx1.1'+str(bs)+'st0.dat').transpose()
dme = (d1[1]+d2[1]+d3[1]+d4[1]+d5[1])/5. #just take mean    
eme = 0.5/np.sqrt(5)*((d1[1]-dme)**2.+(d2[1]-dme)**2.+(d3[1]-dme)**2.+(d4[1]-dme)**2.+(d5[1]-dme)**2.)**.5 #standard deviation
#check what this looks like
plt.errorbar(d1[0],(dme+0.02)*d1[0]**2.,eme*d1[0]**2.,fmt='-',color='b',label='0.8<z<1.1')
plt.xlim(0,50)
plt.ylim(-25,59)
plt.xlabel('s (Mpc/h)')
plt.ylabel(r'$s^2\xi_0$')
plt.show()
#repeat for higher redshift range
zmin = 1.1
zmax = 1.6
tiles = ['80606','80608','80610','80621','80623']
for tile in tiles:
    gf = xitools.createSourcesrd_ad(tp,tile,night,zmin=zmin,zmax=zmax,datadir=catdir)
    subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
    subprocess.run('./dopc'+gf+'.sh')
    for i in range(1,rmax):
        gf = xitools.createSourcesrd_ari(tp,tile,night,i,zmin=zmin,zmax=zmax,datadir=catdir)
        subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
        subprocess.run('./dopc'+gf+'.sh')
    xitools.ppxilcalc_LSDfjack_bs(tp,tile,night,zmin=zmin,zmax=zmax,bs=5,nran=rmax,wmu='')
bs=5
xidir=''
d1 = np.loadtxt(xidir+'xi0ELG80606_deep_zm1.1zx1.6'+str(bs)+'st0.dat').transpose() 
d2 = np.loadtxt(xidir+'xi0ELG80608_deep_zm1.1zx1.6'+str(bs)+'st0.dat').transpose()
d3 = np.loadtxt(xidir+'xi0ELG80610_deep_zm1.1zx1.6'+str(bs)+'st0.dat').transpose()
d4 = np.loadtxt(xidir+'xi0ELG80621_deep_zm1.1zx1.6'+str(bs)+'st0.dat').transpose()
d5 = np.loadtxt(xidir+'xi0ELG80623_deep_zm1.1zx1.6'+str(bs)+'st0.dat').transpose()
dh = (d1[1]+d2[1]+d3[1]+d4[1]+d5[1])/5. #just take mean    
eh = 0.5/np.sqrt(5)*((d1[1]-dme)**2.+(d2[1]-dme)**2.+(d3[1]-dme)**2.+(d4[1]-dme)**2.+(d5[1]-dme)**2.)**.5 #standard deviation
#run the alltiles version to compare
tile = 'alltiles'
gf = xitools.createSourcesrd_ad(tp,tile,night,zmin=zmin,zmax=zmax,datadir=catdir)
subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
subprocess.run('./dopc'+gf+'.sh')
for i in range(1,rmax):
    gf = xitools.createSourcesrd_ari(tp,tile,night,i,zmin=zmin,zmax=zmax,datadir=catdir)
    subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
    subprocess.run('./dopc'+gf+'.sh')
xitools.ppxilcalc_LSDfjack_bs(tp,tile,night,zmin=zmin,zmax=zmax,bs=5,nran=rmax,wmu='')
dha = np.loadtxt('xi0ELGalltiles_deep_zm1.1zx1.65st0.dat').transpose()
plt.errorbar(d1[0]+.5,(dh+0.02)*d1[0]**2.,eh*d1[0]**2.,fmt='-',color='b',label='1.1<z<1.6, tile by tile')
plt.plot(d[0],(dha[1]+0.02)*d[0]**2.,'-',color='g',label='1.1<z<1.6, alltiles')
plt.xlabel('s (Mpc/h)')
plt.ylabel(r'$s^2\xi_0$')
plt.xlim(0,50)
plt.ylim(-25,59)
plt.legend()
plt.show()
xilin = np.loadtxt(os.environ['HOME']+'/BAOtemplates/xi0Challenge_matterpower0.563.04.07.015.00.dat').transpose()
plt.errorbar(d1[0],(dme+0.02)*d1[0]**2.,eme*d1[0]**2.,fmt='-',color='b',label='0.8<z<1.1')
plt.errorbar(d1[0]+.5,(dh+0.02)*d1[0]**2.,eh*d1[0]**2.,fmt='-',color='purple',label='1.1<z<1.6')
plt.plot(xilin[0],xilin[0]**2.*xilin[1]*.7,'k:',label=r'$\xi_{\rm 0}(z=0),b/D(z)=\sqrt{0.7},\beta=0.56$')
plt.plot(xilin[0],xilin[0]**2.*xilin[1]*.5,'k-.',label=r'$\xi_{\rm 0}(z=0),b/D(z)=\sqrt{0.5},\beta=0.56$')
plt.xlabel('s (Mpc/h)')
plt.ylabel(r'$s^2\xi_0$')

plt.xlim(0,50)
plt.ylim(-29,59)
plt.legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Below looks at finer division in redshift to see if anything obvious pops out<jupyter_code>tile = 'alltiles'
zms = [0.6,.8,1.,1.2,1.4]
for zmin in zms:
    zmax = round(zmin + 0.2,1)
    print(zmin,zmax)
    gf = xitools.createSourcesrd_ad(tp,tile,night,zmin=zmin,zmax=zmax,datadir=catdir)
    subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
    subprocess.run('./dopc'+gf+'.sh')
    for i in range(1,rmax):
        gf = xitools.createSourcesrd_ari(tp,tile,night,i,zmin=zmin,zmax=zmax,datadir=catdir)
        subprocess.run(['chmod','+x','dopc'+gf+'.sh'])
        subprocess.run('./dopc'+gf+'.sh')
    xitools.ppxilcalc_LSDfjack_bs(tp,tile,night,zmin=zmin,zmax=zmax,bs=5,nran=rmax,wmu='')
d1 = np.loadtxt('xi0ELGalltiles_deep_zm0.6zx0.85st0.dat').transpose()
d2 = np.loadtxt('xi0ELGalltiles_deep_zm0.8zx1.05st0.dat').transpose()
d3 = np.loadtxt('xi0ELGalltiles_deep_zm1.0zx1.25st0.dat').transpose()
d4 = np.loadtxt('xi0ELGalltiles_deep_zm1.2zx1.45st0.dat').transpose()
d5 = np.loadtxt('xi0ELGalltiles_deep_zm1.4zx1.65st0.dat').transpose()
plt.plot(d1[0],(d1[1]+0.02)*d1[0]**2.,label='0.6<z<0.8')
plt.plot(d1[0],(d2[1]+0.02)*d1[0]**2.,label='0.8<z<1.0')
plt.plot(d1[0],(d3[1]+0.02)*d1[0]**2.,label='1.0<z<1.2')
plt.plot(d1[0],(d4[1]+0.02)*d1[0]**2.,label='1.2<z<1.4')
plt.plot(d1[0],(d5[1]+0.02)*d1[0]**2.,label='1.4<z<1.6')
plt.plot(xilin[0],xilin[0]**2.*xilin[1]*.7,'k:',label=r'$\xi_{\rm 0}(z=0),b/D(z)=\sqrt{0.7},\beta=0.56$')
plt.plot(xilin[0],xilin[0]**2.*xilin[1]*.5,'k-.',label=r'$\xi_{\rm 0}(z=0),b/D(z)=\sqrt{0.5},\beta=0.56$')
plt.xlabel('s (Mpc/h)')
plt.ylabel(r'$s^2\xi_0$')

plt.xlim(0,50)
plt.ylim(-79,79)
plt.legend()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.24552188552188553, 'fraction_numerical': 0.07461279461279462, 'mean_word_length': 6.426, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '59343', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 3836, 'n_tokens_neox': 3619, 'n_words': 374, 'path': 'Sandbox/SV1xi.ipynb', 'repo_name': 'echaussidon/LSS', 'size': '7425'}