2121
2222
2323def setup_simulation ():
24-
2524 # Define the parameters for the simulation
2625 n = 128
2726 nt = 100 * int (n / 128 )
@@ -54,7 +53,6 @@ def setup_simulation():
5453
5554
5655def solve_inverse_problem (sim ):
57-
5856 # Load the target density field
5957 target_data = img .imread ("target.png" )[:, :, 0 ]
6058 rho_target = jnp .flipud (jnp .array (target_data , dtype = float ))
@@ -89,7 +87,6 @@ def loss_function(theta, rho_target):
8987
9088
9189def rerun_simulation (sim , theta ):
92-
9390 # Re-run the simulation with the optimal initial conditions
9491 sim .state ["t" ] = 0.0
9592 sim .state ["psi" ] = jnp .exp (1.0j * theta )
@@ -100,7 +97,6 @@ def rerun_simulation(sim, theta):
10097
10198
10299def make_plot (psi , theta ):
103-
104100 # Plot the solution
105101 plt .figure (figsize = (6 , 4 ), dpi = 80 )
106102 grid = plt .GridSpec (1 , 2 , wspace = 0.0 , hspace = 0.0 )
@@ -130,7 +126,6 @@ def make_plot(psi, theta):
130126
131127
132128def main ():
133-
134129 sim = setup_simulation ()
135130 theta = solve_inverse_problem (sim )
136131 psi = rerun_simulation (sim , theta )
0 commit comments