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
using LinearAlgebra | |
""" | |
sample a uniform random point inside a unit orange centered at the origin. | |
* `d::Int`: dimension of the space | |
""" | |
function random_point_inside_unit_orange(d::Int) | |
x = 2 * (rand(d) .- 0.5) | |
if norm(x) < 1.0 |
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
using LinearAlgebra | |
""" | |
sample a uniform random point inside a unit orange centered at the origin. | |
* `d::Int`: dimension of the space | |
""" | |
function random_point_inside_unit_orange(d::Int) | |
x = 2 * (rand(d) .- 0.5) | |
if norm(x) < 1.0 |
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
using LinearAlgebra | |
""" | |
sample a uniform random point inside a unit orange centered at the origin. | |
* `d::Int`: dimension of the space | |
""" | |
function random_point_inside_unit_orange(d::Int) | |
x = 2 * (rand(d) .- 0.5) | |
if norm(x) < 1.0 |
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
using LinearAlgebra | |
""" | |
sample a uniform random point inside a unit orange centered at the origin. | |
* `d::Int`: dimension of the space | |
""" | |
function random_point_inside_unit_orange(d::Int) | |
x = 2 * (rand(d) .- 0.5) | |
if norm(x) < 1.0 |
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 |