Skip to content

Commit

Permalink
added lines in the sample script to save results to a .mat file
Browse files Browse the repository at this point in the history
  • Loading branch information
lrajendr committed Jan 24, 2020
1 parent 5367b90 commit 5bf2784
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Binary file added sample-result.mat
Binary file not shown.
7 changes: 6 additions & 1 deletion sample_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# Load the data:
data = loadmat('sample-data.mat', squeeze_me=True)

# set the density uncertainty at the boundary points
sigma_rho_dirichlet = 0.01

# calculate density and uncertainty
Expand All @@ -27,6 +28,9 @@
sigma_grad_x=data['sigma_rho_x'], sigma_grad_y=data['sigma_rho_y'],
sigma_dirichlet=sigma_rho_dirichlet)

# save the results to file
savemat(file_name='sample-result.mat', mdict={'X': data['X'], 'Y': data['Y'], 'rho': rho, 'sigma_rho': sigma_rho}, long_field_names=True)

# Plot the results
fig1 = plt.figure(1, figsize=(12,8))
plt.figure(1)
Expand Down Expand Up @@ -60,7 +64,8 @@
plt.title('sigma rho')

plt.tight_layout()
# save results to file

# save plot to file
plt.savefig('sample-result.png')
plt.close()

Expand Down

0 comments on commit 5bf2784

Please sign in to comment.