Coverage for calc_CHNO_fracKin.py : 76%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# NOTE: requires numpy npz file: calc_CHNO_fracKin.npz in local folder (i.e. here)
Rthrt=Rthrt, pcentBell=pcentBell, MR=MR)
frozen=0, frozenAtThroat=0, min_fraction=0.000005)
#asonic = ceaObj.get_Chamber_SonicVel( Pc=Pc, MR=MR, eps=eps) #tauRt = Rthrt / asonic
#z100 = Rthrt * ( sqrt(eps) - 1.0 ) / tan( radians(15.) ) #Lnoz = z100 * pcentBell / 100.0 #tauLnoz = Lnoz / asonic
# condition Pc, eps, Rthrt, pcentBell, gammaInit, TcCham (pcentBell-60)/60.0, (gammaInit-1.1)/0.57, TcCham/7000.0, MolWt/30.0]
#log10(tauRt)/6.0, log10(tauLnoz)/5.0]
# ----------- start forward pass ------------ coefs_[i]) # For the hidden layers # For the last layer
"""Compute the rectified linear unit function inplace. Parameters ---------- X : array-like, sparse matrix, shape (n_samples, n_features) The input data. Returns ------- X_new : array-like, sparse matrix, shape (n_samples, n_features) The transformed data. """
"""Simply return the input array. Parameters ---------- X : array-like, sparse matrix, shape (n_samples, n_features) Data, where n_samples is the number of samples and n_features is the number of features. Returns ------- X : array-like, sparse matrix, shape (n_samples, n_features) Same as the input data. """
"""Dot product that handle the sparse matrix case correctly Parameters ---------- a : array or sparse matrix b : array or sparse matrix dense_output : boolean, (default=False) When False, ``a`` and ``b`` both being sparse will yield sparse output. When True, output will always be a dense array. Returns ------- dot_product : array or sparse matrix sparse if ``a`` and ``b`` are sparse and ``dense_output=False``. """ if sparse.issparse(a): # sparse is always 2D. Implies b is 3D+ # [i, j] @ [k, ..., l, m, n] -> [i, k, ..., l, n] b_ = np.rollaxis(b, -2) b_2d = b_.reshape((b.shape[-2], -1)) ret = a @ b_2d ret = ret.reshape(a.shape[0], *b_.shape[1:]) elif sparse.issparse(b): # sparse is always 2D. Implies a is 3D+ # [k, ..., l, m] @ [i, j] -> [k, ..., l, j] a_2d = a.reshape(-1, a.shape[-1]) ret = a_2d @ b ret = ret.reshape(*a.shape[:-1], b.shape[1]) else: ret = np.dot(a, b) else: and dense_output and hasattr(ret, "toarray")): return ret.toarray()
hidden_layer_sizes = [hidden_layer_sizes]
raise Exception('Need to add activation other than relu')
raise Exception('Need to add out_activation_ other than identity')
from rocketcea.cea_obj import CEA_Obj
ceaObj = CEA_Obj(oxName='N2O4', fuelName='A50', useFastLookup=0)
ypred = calc_fracKin(ceaObj, Pc=500, eps=20, Rthrt=1, pcentBell=80, MR=2) print( 'ypred fracKin =', ypred )
IspODK = calc_IspODK(ceaObj, Pc=500, eps=20, Rthrt=1, pcentBell=80, MR=2) print('IspODK =', IspODK) |