Example #1
0
def set_fn_model(flg=0):
    '''
	Load up f(N) data

    Parameters
    ----------

    Returns
    -------
    fN_data :: List of fN_Constraint Classes

    JXP on 27 Nov 2014
    '''
    if flg == 0:  # I may choose to pickle a few of these
        sfN_model = xifm.default_model(recalc=True,
                                       use_mcmc=True)  # Hermite Spline
    elif flg == 1:
        sfN_model = xifm.fN_Model('Gamma')
    else:
        raise ValueError(
            'mcmc.set_model: Not ready for this type of fN model {:d}'.format(
                flg))
    #
    #print(sfN_model)
    return sfN_model
Example #2
0
def set_fn_model(flg=0):
    '''
	Load up f(N) data

    Parameters
    ----------

    Returns
    -------
    fN_data :: List of fN_Constraint Classes

    JXP on 27 Nov 2014
    '''
    if flg==0: # I may choose to pickle a few of these
        sfN_model = xifm.default_model(recalc=True,use_mcmc=True) # Hermite Spline 
    elif flg==1:
        sfN_model = xifm.fN_Model('Gamma')
    else: 
        raise ValueError('mcmc.set_model: Not ready for this type of fN model {:d}'.format(flg))
    #
    #print(sfN_model)
    return sfN_model
Example #3
0
    #flg_test += 2**3 # l(X)
    #flg_test += 64 # Akio
    #flg_test += 2**7 # rho_HI
    flg_test += 2**8  # Create Pickle file
    #flg_test = 0 + 64

    if (flg_test % 2) == 1:
        # MCMC Analysis
        chain_file = os.environ.get(
            'DROPBOX_DIR') + 'IGM/fN/MCMC/mcmc_spline_k13r13o13n12_8.fits.gz'
        outp = mcmc.chain_stats(chain_file)

        # Build a model
        NHI_pivots = [12., 15., 17.0, 18.0, 20.0, 21., 21.5, 22.]
        fN_model = xifm.fN_Model('Hspline',
                                 zmnx=(0.5, 3.0),
                                 pivots=NHI_pivots,
                                 param=outp['best_p'])
        #xdb.set_trace()
        print(fN_model)

    # Compare default against P+13
    if (flg_test % 2**2) >= 2**1:
        fN_model = xifm.default_model()
        p13_file = (os.environ.get('DROPBOX_DIR') +
                    'IGM/fN/fN_spline_z24.fits.gz')
        hdu = fits.open(p13_file)
        p13_data = hdu[1].data

        plt.clf()
        plt.scatter(p13_data['LGN'], p13_data['FN'])
        #plt.plot(p13_data['LGN'],p13_data['FN'], '-')
Example #4
0
    flg_test = 0 
    #flg_test += 2**1 # Compare models
    #flg_test += 2**2 # Data
    #flg_test += 2**3 # l(X)
    #flg_test += 64 # Akio
    flg_test += 2**7 # rho_HI
    #flg_test = 0 + 64
    
    if (flg_test % 2) == 1:
        # MCMC Analysis
        chain_file = os.environ.get('DROPBOX_DIR')+'IGM/fN/MCMC/mcmc_spline_k13r13o13n12_8.fits.gz'
        outp = mcmc.chain_stats(chain_file)

        # Build a model
        NHI_pivots = [12., 15., 17.0, 18.0, 20.0, 21., 21.5, 22.]
        fN_model = xifm.fN_Model('Hspline', zmnx=(0.5,3.0),
                            pivots=NHI_pivots, param=outp['best_p'])
        #xdb.set_trace()
        print(fN_model)

    # Compare default against P+13
    if (flg_test % 4) >= 2:
        fN_model = xifm.default_model()
        p13_file = (os.environ.get('DROPBOX_DIR')+'IGM/fN/fN_spline_z24.fits.gz')
        hdu = fits.open(p13_file)
        p13_data = hdu[1].data
        
        plt.clf()
        plt.scatter(p13_data['LGN'],p13_data['FN'])
        #plt.plot(p13_data['LGN'],p13_data['FN'], '-')
        xplt = np.linspace(12., 22, 10000)
        yplt = fN_model.eval(xplt, 2.4)