def set_fn_model(flg=0): """ Load up f(N) model Parameters ---------- flg : int, optional * 0 = Default model * 1 = Gamma Returns ------- sfN_model : FNModel """ if flg == 0: # I may choose to pickle a few of these sfN_model = FNModel.default_model(use_mcmc=True) # Hermite Spline elif flg == 1: sfN_model = FNModel('Gamma') elif flg == 2: tfN_model = FNModel.default_model() NHI_pivots = [11., 15., 17.0, 20.0, 21.5, 22.] param = [] for NHI in NHI_pivots: imin = np.argmin(np.abs(NHI - tfN_model.pivots)) param.append(tfN_model.param['sply'][imin]) # Init sfN_model = FNModel('Hspline', zmnx=(0.5, 5.5), pivots=NHI_pivots, param=dict(sply=np.array(param))) else: raise ValueError( 'mcmc.set_model: Not ready for this type of fN model {:d}'.format( flg)) # return sfN_model
def set_fn_model(flg=0, use_p14=False): """ Load up f(N) model Parameters ---------- flg : int, optional * 0 = Default model * 1 = Gamma Returns ------- sfN_model : FNModel """ if flg == 0: # I may choose to pickle a few of these sfN_model = FNModel.default_model(use_mcmc=True) # Hermite Spline elif flg == 1: sfN_model = FNModel('Gamma') elif flg == 2: tfN_model = FNModel.default_model() # GGG analysis pdb.set_trace() # BEING DEVELOPED IN GGG/LLS/Analysis/py zpivot = 4.4 #NHI_pivots = [11., 15., 17.0, 20.0, 21.5, 22.] NHI_pivots = [11., 15., 17.0, 18.0, 20.0, 21.5, 22.] if use_p14: param = [] for NHI in NHI_pivots: imin = np.argmin(np.abs(NHI - tfN_model.pivots)) # Adjust for zpivot adj_parm = tfN_model.param['sply'][imin] + np.log10( ((1 + zpivot) / (1 + tfN_model.zpivot))**tfN_model.gamma) param.append(adj_parm) else: #param = [-8.45, -13.959, -18.06, -21.000, -23.735, -24.88] if len(param) != len(NHI_pivots): raise ValueError("Incorrect number of parameters") # Init sfN_model = FNModel('Hspline', zmnx=(0.5, 5.5), pivots=NHI_pivots, zpivot=zpivot, param=dict(sply=np.array(param))) else: raise ValueError( 'mcmc.set_model: Not ready for this type of fN model {:d}'.format( flg)) # return sfN_model
def test_init_I14(): # Class fN_I14 = FNModel('Gamma') # Mtype assert fN_I14.mtype == 'Gamma' assert fN_I14.zmnx == (0., 10.)