Created
June 22, 2021 01:15
-
-
Save SimonEnsemble/a58ecbe7bc58f4afa817e36bf458be4a to your computer and use it in GitHub Desktop.
construct pyIAST `ModelIsotherm` without data, using only isotherm parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## for example, construct a Lanmguir model with params M, K | |
def construct_langmuir_model(M, K): | |
df_bogus = pd.DataFrame([[1.0, 1.0]], columns=["P_bogus", "N_bogus"]) # bogus data | |
m = pyiast.ModelIsotherm(df, model="Langmuir", pressure_key="P", loading_key="N") # will fit Langmuir model with bogus params | |
# overwrite bogus model params | |
m.params['M'] = M | |
m.params['K'] = K | |
# overwrite bogus data to be sure it is never used. | |
m.df = pd.DataFrame([[np.NaN, np.NaN]], columns=["P_bogus", "N_bogus"]) # bogus data | |
return m | |
# some tests to convince yourself it's all right | |
m = construct_langmuir_model(1.0, 10.0) # M = 1, K = 10 | |
m.loading(1000.0) # n(inf) = M | |
m.loading(1 / 10.0) # n(1/K) = 0.5 M | |
m.df # should have NaN's to clarify this is bogus data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment