Coverage for rocketisp\nozzle\calc_full_Cd.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_full_Cd.npz in local folder (i.e. here)
##massWtD, masseFracD = ceaObj.get_SpeciesMassFractions( Pc=Pc, MR=MR, eps=eps, ## frozen=0, frozenAtThroat=0, min_fraction=0.000005)
#_, _, TcCham, MolWt, gammaInit = ceaObj.get_IvacCstrTc_ChmMwGam( Pc=Pc, MR=MR, eps=eps)
#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
##for sp in speciesL: ## vL = masseFracD.get( sp, [0.,0.] ) ## inpL.append( vL[-1] - vL[1] ) # chamber mass frac difference for species
# ----------- 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='MMH', useFastLookup=0)
ypred = calc_Cd( Pc=500.0, Rthrt=1.0, RWTU=1.0 ) print( 'ypred Cd =', ypred ) |