Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to main #9

Open
wants to merge 151 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
8f92197
Added radiative heat transfer problem
sahilbhola14 Jun 14, 2022
79845c4
Added gitignore
sahilbhola14 Jun 14, 2022
8c8b005
Updated print statements
Jun 14, 2022
8dcf971
Added data load functionality
sahilbhola14 Jun 14, 2022
e97ab21
Added identifiability via information theory
sahilbhola14 Jun 28, 2022
37b126f
Identifiability computation (parallel version)
sahilbhola14 Jun 30, 2022
4969d5a
Added log file
sahilbhola14 Jun 30, 2022
ca02e15
Updated the radiative heat transfer case
sahilbhola14 Jun 30, 2022
adf5e1d
Added restart capability to the MI computation
sahilbhola14 Jul 18, 2022
db572da
Daily commit
sahilbhola14 Jul 18, 2022
35208a0
Added restart functionality
sahilbhola14 Jul 20, 2022
ccf3836
Quadrature point imput change
Jul 20, 2022
28f3b9e
Linear gaussian is compatible
sahilbhola14 Jul 25, 2022
a3b9b58
RHT compatible with MI computation
sahilbhola14 Jul 27, 2022
a26a2a7
Added importance sampling feature to RHT
sahilbhola14 Jul 29, 2022
839f27b
Verified the importace sampling
sahilbhola14 Aug 1, 2022
9455550
Added identifiability computation for RHT
sahilbhola14 Aug 2, 2022
2907415
Daily commit
sahilbhola14 Aug 2, 2022
acf5cd1
Added adaptive importance sampling
sahilbhola14 Aug 3, 2022
f0a7114
Updated import statements
sahilbhola14 Aug 9, 2022
3c10e03
Added loading training data to linear Gaussian
sahilbhola14 Aug 10, 2022
c785034
Minor modifications
sahilbhola14 Aug 25, 2022
5a9b320
Added ignition model (incomplete)
sahilbhola14 Sep 1, 2022
2775fdd
(W) Added ignition model for dodecane and methane
sahilbhola14 Sep 23, 2022
d980fce
(W) Added learning model for n_dodecane
sahilbhola14 Sep 23, 2022
2cd288d
(PCA) Added config file
sahilbhola14 Sep 23, 2022
af6060d
(W) Added sub sampling
sahilbhola14 Sep 23, 2022
b5aeba5
(W) Added parameter learning for ignition time
sahilbhola14 Sep 26, 2022
8f4d7eb
(W) Added script to create campaigns
sahilbhola14 Sep 26, 2022
2cb469a
(W) Cleaned redundant files
sahilbhola14 Sep 26, 2022
1de8525
(W) Modifed custom gas creation script
sahilbhola14 Sep 26, 2022
18dcb73
(W) Modifed n dodecane combustion
sahilbhola14 Sep 26, 2022
efdb766
(W) Updated gitignore
sahilbhola14 Sep 26, 2022
396b891
(WIP) Added multiple data points evaluation
sahilbhola14 Sep 27, 2022
b16cda6
(W) Modified plot statement in forward model
sahilbhola14 Sep 27, 2022
022f5d5
(W) Added identifiability computation function
sahilbhola14 Sep 27, 2022
1441574
(W) Updated config file
sahilbhola14 Sep 27, 2022
cf38b0a
(W) Added methane gri and two-step combustion
sahilbhola14 Oct 5, 2022
d5b6122
refactor: Removed the redundant methane_combustion
sahilbhola14 Oct 5, 2022
63b2aac
(refactor) renamed methane_gri
sahilbhola14 Oct 6, 2022
fba8b97
(refactor) removed methane_two_step_ignition
sahilbhola14 Oct 6, 2022
b5ce29c
(feat!) Add methane combustion model
sahilbhola14 Oct 6, 2022
6a99712
(refactor) Add gas definitions as functions
sahilbhola14 Oct 7, 2022
7d70d19
(refactor) Add used gas files to repo
sahilbhola14 Oct 7, 2022
b754f5e
(feat) Add variable Arrhenius parameters
sahilbhola14 Oct 7, 2022
f79edec
(feat) Add MLE and MAP learning
sahilbhola14 Oct 7, 2022
a67b4e4
(style) Modify the campaign creation
sahilbhola14 Oct 7, 2022
d475fd9
(feat) Add training generation feature
sahilbhola14 Oct 7, 2022
8cb3eca
(feat) Add ignition time and adiabatic flame
sahilbhola14 Oct 12, 2022
c40536b
(feat) Add variable absolute tol for ignition time
sahilbhola14 Oct 13, 2022
baf239d
(refactor) Save data in campaign folder
sahilbhola14 Oct 14, 2022
fb942bb
(feat) Add model identifiability to ignition model
sahilbhola14 Oct 14, 2022
dcf0add
(fix) Add config file for ignition delay model
sahilbhola14 Oct 14, 2022
133ae50
(feat) Add data generation script
sahilbhola14 Oct 14, 2022
d236233
(chore) Add campaign creation script
sahilbhola14 Oct 14, 2022
3560911
(chore) Add ipynb to gitignore
sahilbhola14 Oct 18, 2022
8790f2e
(feat) Increase the end time of forward model
sahilbhola14 Oct 18, 2022
dfc5a2f
(feat) Add parameter dependence identifiability
sahilbhola14 Oct 18, 2022
1451364
(refactor) Update config file
sahilbhola14 Oct 18, 2022
24dd34a
(refactor) Change the training data save path
sahilbhola14 Oct 19, 2022
b1b31c8
(refactor) Changed training data load path
sahilbhola14 Oct 19, 2022
0b8377c
(fix) Make ignition time as max time for sim. fail
sahilbhola14 Oct 19, 2022
168a1f5
(feat) Add sobol index computation
sahilbhola14 Oct 19, 2022
c8d37f0
(fix/methane_combustion) Add limiter to a.tol
sahilbhola14 Oct 19, 2022
a8ed135
(refactor) Make importance sampling primary
sahilbhola14 Oct 21, 2022
27960bd
(feat) Add restart feature to sobol index
sahilbhola14 Oct 23, 2022
cf3d2d0
(feat/methane_combustion) Add internal state
sahilbhola14 Oct 23, 2022
71e3b1a
(refactor) Remove legacy conditional evidence comp
sahilbhola14 Oct 23, 2022
d20fd48
(feat/methane_combustion) Add internal state
sahilbhola14 Oct 23, 2022
500a000
(feat) Change model parameterization
sahilbhola14 Nov 1, 2022
090dea9
(refactor) Add forward model heirarchy gaussian
sahilbhola14 Nov 3, 2022
e19a255
(refactor) Add learning model heirarchy gaussian
sahilbhola14 Nov 3, 2022
00b777d
(feat/gaussian) Add data generator
sahilbhola14 Nov 3, 2022
b707f3f
(feat/gaussian) Add template config file
sahilbhola14 Nov 3, 2022
1b4d4e1
(feat/gaussian) Add campaign creator
sahilbhola14 Nov 3, 2022
ecbffa5
(refactor/gaussian) Remove stale files
sahilbhola14 Nov 3, 2022
56d7beb
(fix/identifiability) Fix bug in identifiability
sahilbhola14 Nov 3, 2022
96e1717
(refactor) Modify save file header
sahilbhola14 Nov 3, 2022
24827af
(refactor) Delete redundant files
sahilbhola14 Nov 3, 2022
aa1f074
(feat/methane) Add proc log file write function
sahilbhola14 Nov 3, 2022
6ff1675
(feat/identifiability) Add proc write file
sahilbhola14 Nov 3, 2022
fe52a8c
(refactor) Reorganize the learning model dir
sahilbhola14 Nov 3, 2022
bd1e152
(refactor) Reorganize the learning dir
sahilbhola14 Nov 3, 2022
2ec4703
(chore) Add __pycache__ to ignore
sahilbhola14 Nov 3, 2022
40a4284
(refactor/identifiability) Add normalized MI, CMI
sahilbhola14 Nov 3, 2022
90286c3
(refactor) Change map plot
sahilbhola14 Nov 3, 2022
52d97aa
(feat) Add metropolis hastings sampling
sahilbhola14 Nov 17, 2022
9db8894
(feat) Add mcmc utils
sahilbhola14 Nov 17, 2022
001ae17
(feat) Add custom proposal cov
sahilbhola14 Nov 17, 2022
d666207
(feat) This is a test
sahilbhola14 Nov 20, 2022
4eba61d
(feat) Edited test
Nov 20, 2022
fa2fdbb
(refactor) test file removed
sahilbhola14 Nov 20, 2022
925c27d
(feat) Add test file
sahilbhola14 Nov 20, 2022
8ceba17
refactor(test.py) removed test file
sahilbhola14 Nov 21, 2022
df7104d
feat(mcmc) : Add Adaptive Metropolis hastings
sahilbhola14 Nov 22, 2022
aa4a760
feat (mcmc_utils) : Add chain, hist plotting
sahilbhola14 Nov 22, 2022
6a0a21e
feat (mcmc_utils) : Add build cov
sahilbhola14 Nov 22, 2022
e97530b
feat (mcmc) : Add banana distribution example
sahilbhola14 Nov 22, 2022
95d3a42
fix (mcmc) : Define sd when cov is given
sahilbhola14 Nov 22, 2022
fc88fb5
feat(ignition): Add 8 parameter model for A
sahilbhola14 Nov 23, 2022
aaf7398
fix(adaptiveMHMCMC): Fix negative eig
sahilbhola14 Nov 23, 2022
0c0c6df
fix(mcmc_utils): Add nuggent for cholesky decom.
sahilbhola14 Nov 23, 2022
9d55e61
fix(config/ignition) Update config for mcmc
sahilbhola14 Nov 23, 2022
e1ae5c9
fix(methane_combustion): Add error catching
sahilbhola14 Nov 23, 2022
ab049a9
refactor: Run Black on all files
sahilbhola14 Nov 28, 2022
d060a22
feat(pre-commit): Add pre-commit config
sahilbhola14 Nov 28, 2022
4123c3d
feat(github-actions): Add github acitons
sahilbhola14 Nov 28, 2022
acab129
feat(gaussian): Add mcmc functionality
sahilbhola14 Nov 28, 2022
3fcf818
refactor: Remove sample_based_mutual_information
sahilbhola14 Nov 28, 2022
f30d03b
feat(plotting) Plot information content
sahilbhola14 Nov 28, 2022
b5ec7b3
feat(plotting): Add mcmc hist and chain plotting
sahilbhola14 Nov 28, 2022
9149bac
feat(ignition): Add fixed activation energy model
sahilbhola14 Nov 28, 2022
aed15aa
feat(ignition): Add fixed activation energy model (#3)
sahilbhola14 Nov 28, 2022
1fdb181
Merge branch 'main' into develop
sahilbhola14 Nov 28, 2022
4f0bfa7
Merge branch 'feat_three_param_model' into develop
sahilbhola14 Nov 28, 2022
f6cb3f2
Merge branch 'develop' of github.com:sahilbhola14/GIM into develop
sahilbhola14 Nov 28, 2022
ba90e4e
(refactor) Delete compute_sobol_indices
sahilbhola14 Dec 7, 2022
d0e72f6
feat!(sobol index) Add Sobol index computation
sahilbhola14 Dec 7, 2022
8942540
feat(sobol index) Add Log file
sahilbhola14 Dec 7, 2022
888abfd
feat(pre-commit): Add Flake with E203 ignore
sahilbhola14 Dec 8, 2022
c7234b3
feat(Sobol Index): Add MPI to sobol index comp
sahilbhola14 Dec 8, 2022
4846346
Merge branch 'main' into develop
sahilbhola14 Dec 8, 2022
e2e0222
feat(Sobol Index) Add measurement uncertainty
sahilbhola14 Dec 8, 2022
603d0cd
feat(Sobol Index) Test for Sobol Index computation
sahilbhola14 Dec 8, 2022
faf9e71
chore(pull request) Restructred pull request loc
sahilbhola14 Dec 8, 2022
58c11cd
feat(Sobol Index): Add total sobol index comp
sahilbhola14 Dec 8, 2022
484f640
feat(Sobol Index) Add Total sobol index test
sahilbhola14 Dec 8, 2022
be05f95
fix(pre-commit): Add E402 exception
sahilbhola14 Dec 8, 2022
3a5aa25
feat(Linear Gaussian) Add sobol index comp
sahilbhola14 Dec 8, 2022
f38650b
feat(Ignition model) Added Sobol index computation
sahilbhola14 Dec 9, 2022
fc6fef3
feat(ignition) Add comp sobol flag to config
sahilbhola14 Dec 9, 2022
5492212
chore(plot scripts) Moved plot scripts
sahilbhola14 Dec 12, 2022
e2e0781
chore(scripts) Deleted plot scripts from root
sahilbhola14 Dec 12, 2022
f919c5a
feat(Sobol index) Add sobol build from rank data
sahilbhola14 Dec 12, 2022
4e93ec2
feat(Sobol index) Save rank data for post proc
sahilbhola14 Dec 12, 2022
db6561c
feat(Linear Gaussian): Add Variance convergence
sahilbhola14 Dec 13, 2022
a355aee
refactor(Linear Gaussian): Update Plot titles
sahilbhola14 Dec 14, 2022
f1ecf42
feat(Linear Gaussian): Add Aggregate post comp.
sahilbhola14 Dec 14, 2022
1dd6c30
feat(Linear Gaussian): Save mean and std agg post
sahilbhola14 Dec 14, 2022
8eca4c7
refactor(Compute Identifiability): Run Black
sahilbhola14 Dec 14, 2022
922850b
feat(Linear Gaussian): Add Bias and Variance study
sahilbhola14 Dec 14, 2022
8091ecf
feat(Linear Gaussian): Add identifiability norm.
sahilbhola14 Dec 16, 2022
6276981
feat(Ignition): Add Normalized parameter learning
sahilbhola14 Dec 20, 2022
1d7d193
feat(Scripts): Skip unavailable rank in Sobol
sahilbhola14 Dec 20, 2022
4304f2a
feat(Color schemes): Add color schemes
sahilbhola14 Dec 31, 2022
4c43bea
feat(Ignition) Add plotting for states with MPI
sahilbhola14 Jan 1, 2023
a9a842e
feat(WIP)(non_equil): Add boiler plate
sahilbhola14 Feb 8, 2023
2fc496c
refactor(workflows): Removed workflows
sahilbhola14 Apr 3, 2023
ac5c141
feat(appendix_examples): Add appendix examples
sahilbhola14 Sep 7, 2023
cb4dcfe
feat(sobol): Add generate sobol samples salib
sahilbhola14 Sep 12, 2023
37dc25f
feat(Sobol): Add forward sobol solve for ignition
sahilbhola14 Sep 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
undodir/
*npy
*png
*dat
*ipynb
__pycache__
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: requirements-txt-fixer
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: check-merge-conflict

- repo: https://github.com/ambv/black
rev: 22.10.0
hooks:
- id: black
language: python
types: [python]
args: ["--line-length=88"]

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--max-line-length=88", "--extend-ignore=E203, E402", "--doctests"]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
- id: clang-format
48 changes: 48 additions & 0 deletions examples/appendix_examples/forward_model/linear_gaussian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import numpy as np
import os
import shutil


class linear_gaussian:
def __init__(self, true_theta=np.arange(1, 4), spatial_res=100):
self.spatial_res = spatial_res
self.xtrain = np.linspace(-1, 1, self.spatial_res)
self.true_theta = true_theta
self.num_parameters = self.true_theta.shape[0]
self.vm = self.compute_vm()

def compute_vm(self):
vm = np.tile(self.xtrain[:, None], (1, self.num_parameters))
vm = np.cumprod(vm, axis=1)
return vm

def compute_prediction(self, theta):
return self.vm @ theta.reshape(-1, 1)


def main():
# Begin User Input
true_theta = np.array([1, 2, 3])
spatial_res = 100
# End User Input
model = linear_gaussian(true_theta=true_theta, spatial_res=spatial_res)
prediction = model.compute_prediction(true_theta)

data = np.zeros((spatial_res, 2))
data[:, 0] = model.xtrain
data[:, 1] = prediction[:, 0]

# Create the folders
save_path = "./Output"

if os.path.exists(save_path) is True:
shutil.rmtree(save_path)

os.mkdir(save_path)

data_save_path = os.path.join(save_path, "true_output.npy")
np.save(data_save_path, data)


if __name__ == "__main__":
main()
19 changes: 19 additions & 0 deletions examples/appendix_examples/learning_model/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
campaign_id: 1

total_samples: 100
num_samples: 100

model_noise_cov: 1.0e-1
objective_scaling: 1.0e-10

#
compute_map: False
compute_mle: False
compute_post: False
compute_true_post: True

#
compute_identifiability: True
global_num_outer_samples: 10000
global_num_inner_samples: 5000
restart_identifiability: False
44 changes: 44 additions & 0 deletions examples/appendix_examples/learning_model/create_new_campaign.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

campaign_results_path=$PWD/campaign_results
dname=$campaign_results_path/campaign_${1}

if [[ -d $dname ]]; then

read -p "Campaign already exists! Recreate it? [y/yes/Y] : " flag

if [[ $flag == "y" || $flag == "yes" || $flag == "Y" ]]; then

rm -rf $dname
mkdir -p $dname
fname=$dname/readme.txt
fig_file_name=$dname/Figures
mkdir -p $fig_file_name
echo "Campaign description" >> $fname
cp config.yaml $dname
echo "Campaign "${1}" (Re)created using config.yaml"

# Generating the data from using config file
python generate_training_data.py ${1}

else

echo "Campaign "${1}" was not removed"

fi

else

mkdir -p $dname
fname=$dname/readme.txt
fig_file_name=$dname/Figures
mkdir -p $fig_file_name
echo "Campaign description" >> $fname
cp config.yaml $dname
echo "Campaign "${1}" created using config.yaml"

# Generating the data from using config file
python generate_training_data.py ${1}


fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
import yaml

sys.path.append("../forward_model/")
from linear_gaussian import linear_gaussian


plt.rc("text", usetex=True)
plt.rc("font", family="serif", size=25)
plt.rc("lines", linewidth=3)
plt.rc("axes", labelpad=18, titlepad=20)

with open("./config.yaml", "r") as config_file:
config_data = yaml.safe_load(config_file)

campaign_id = config_data["campaign_id"]

assert campaign_id == int(sys.argv[1]), "Make sure the campaign id match"

total_samples = config_data["total_samples"]
true_model = linear_gaussian(spatial_res=total_samples)
true_prediction = true_model.compute_prediction(theta=true_model.true_theta)

# Subsampling
num_sub_samples = config_data["num_samples"]
assert num_sub_samples <= total_samples
sample_idx = np.arange(total_samples)
np.random.shuffle(sample_idx)
sample_idx = sample_idx[:num_sub_samples]


# Adding noise
model_noise_cov = config_data["model_noise_cov"]
noise = np.sqrt(model_noise_cov) * (np.random.randn(num_sub_samples))
training_data = np.zeros((num_sub_samples, 2))
training_data[:, 0] = true_model.xtrain[sample_idx]
training_data[:, 1] = true_prediction[sample_idx, 0] + noise


# Saving data
data_save_path = os.path.join(
"./campaign_results", "campaign_{0:d}/training_data.npy".format(campaign_id)
)
sample_idx_save_path = os.path.join(
"./campaign_results", "campaign_{0:d}/sample_idx.npy".format(campaign_id)
)
np.save(data_save_path, training_data)
np.save(sample_idx_save_path, sample_idx)


fig_save_path = os.path.join(
"./campaign_results", "campaign_{0:d}/Figures/training_data.png".format(campaign_id)
)
plt.figure(figsize=(10, 5))
plt.plot(true_model.xtrain, true_prediction, label="True", c="r")
plt.scatter(training_data[:, 0], training_data[:, 1], label="Data", c="k")
plt.legend(loc="upper left")
plt.tight_layout()
plt.savefig(fig_save_path)
plt.close()
Loading