<commit_before>import numpy as np
import ipdb
import matplotlib.pylab as pl
pl.ion()
datadir = 'data/'
from astropy.io import fits
import cPickle as pickle
#import healpy as hp
from cosmolopy import distance, fidcosmo
cosmo = fidcosmo

def main( hemi='south'):
    grid = grid3d(hemi=hemi)
    d_data = load_sdss_data_both_catalogs(hemi)
    n_data = grid.num_from_radecz(d_data['ra'],d_data['dec'], d_data['z'])
    d_rand = load_sdss_randoms_both_catalogs(hemi)
    n_rand = grid.num_from_radecz(d_rand['ra'],d_rand['dec'], d_rand['z'])
    n_rand *= (1.*n_data.sum()/n_rand.sum())
    from scipy.ndimage import gaussian_filter
    fwhm_sm = 2.
    sigma_sm = fwhm_sm/2.355
    # tmpp, replace with a wiener filter that knows about LSS and shot noise.
    n_data = gaussian_filter(n_data, sigma_sm)
    n_rand = gaussian_filter(n_rand, sigma_sm)
    delta = (n_data-n_rand)/n_rand
    delta[n_rand==0]=0.
    delta_max = 3.
    delta[delta>delta_max]=delta_max
    pl.clf(); pl.imshow(delta[:,:,140])
    ipdb.set_trace()
    

class grid3d(object):
    def __init__(self, hemi='south', reso_mpc=16.0, <commit_msg>factor<commit_after>import numpy as np
import ipdb
import matplotlib.pylab as pl
pl.ion()
datadir = 'data/'
from astropy.io import fits
import cPickle as pickle
#import healpy as hp
from cosmolopy import distance, fidcosmo
cosmo = fidcosmo

def main( hemi='south'):
    grid = grid3d(hemi=hemi)
    n_data = num_sdss_data_both_catalogs(hemi)
    n_rand = num_sdss_randoms_both_catalogs(hemi)
    n_rand *= (1.*n_data.sum()/n_rand.sum())
    delta, weight = num_to_delta(n_data, n_rand, fwhm_sm=2)
    ipdb.set_trace()

    
def num_sdss_data_both_catalogs(hemi):    
    d_data = load_sdss_data_both_catalogs(hemi)
    return grid.num_from_radecz(d_data['ra'],d_data['dec'], d_data['z'])

def num_sdss_random_both_catalogs(hemi):    
    d_random = load_sdss_random_both_catalogs(hemi)
    return grid.num_from_radecz(d_random['ra'],d_random['dec'], d_random['z'])




def num_to_delta(n_data, n_rand, fwhm_sm=2, delta_max=3.):
    from scipy.ndimage import gaussian_filter
    sigma_sm = fwhm_sm/2.355
    # smooth randoms
    n_rand = gaussian_filter(n_rand, sigma_sm)

    # smooth data
    # tmpp, replace with a filter that knows about LSS and shot noise.
    n_data = gaussian_filter(n_data, sigma_sm)

    delta = (n_data-n_rand)/n_rand
    delta[n_rand==0]=0.
    delta[delta>delta_max]=delta_max
    weight = n_rand/np.max(n_rand)
    return delta, weight

    

class grid3d(object):
    def __init__(self, hemi='south', reso_mpc=16.0, 
{'fraction_non_alphanumeric': 0.11748633879781421, 'fraction_numerical': 0.01249024199843872, 'mean_word_length': 4.295454545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2686600', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1029, 'n_words': 202}