Skip to content

Commit c9f3759

Browse files
fixed module path
1 parent e47348d commit c9f3759

File tree

7 files changed

+44
-22
lines changed

7 files changed

+44
-22
lines changed

experiments/four_f_optimizer.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
import os
2+
import sys
3+
4+
# Setting the path for XLuminA modules:
5+
current_path = os.path.abspath(os.path.join('..'))
6+
module_path = os.path.join(current_path)
7+
8+
if module_path not in sys.path:
9+
sys.path.append(module_path)
10+
111
from four_f_optical_table import *
2-
# from xlumina.toolbox import MultiHDF5DataLoader
12+
from xlumina.toolbox import MultiHDF5DataLoader
313
import time
414
import jax
5-
from jax import grad, jit
6-
from jax.example_libraries import optimizers
15+
import optax
16+
from jax import jit
717
import numpy as np
818
import jax.numpy as jnp
919

@@ -82,7 +92,7 @@ def update(params, opt_state, input_fields, target_fields):
8292

8393
# Optimizer settings
8494
num_iterations = 50000
85-
num_samples = 50
95+
num_samples = 1
8696
# Step size engineering:
8797
STEP_SIZE = 0.01
8898
WEIGHT_DECAY = 0.0001

experiments/generate_synthetic_data.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Setting the path for XLuminA modules:
22
import os
33
import sys
4+
5+
# Setting the path for XLuminA modules:
46
current_path = os.path.abspath(os.path.join('..'))
5-
dir_path = os.path.dirname(current_path)
6-
module_path = os.path.join(dir_path)
7+
module_path = os.path.join(current_path)
8+
79
if module_path not in sys.path:
810
sys.path.append(module_path)
9-
11+
1012
import numpy as np
1113
import jax.numpy as jnp
12-
from __init__ import um, nm, mm, degrees, radians
14+
from __init__ import um, nm
1315
from xlumina.wave_optics import *
14-
from wave_optics import *
16+
from xlumina.optical_elements import *
1517
from xlumina.toolbox import space
1618
import h5py
1719

@@ -95,7 +97,7 @@ def generate_synthetic_annular(gb, num_samples):
9597
input_fields = jnp.vstack([input_circles, input_squares, input_annular])
9698
target_fields = jnp.vstack([target_circles, target_squares, target_annular])
9799

98-
filename = f"training_data_4f/synthetic_data_{s}.hdf5"
100+
filename = f"new_training_data_4f/new_synthetic_data_{s+150}.hdf5"
99101

100102
with h5py.File(filename, 'w') as hdf:
101103
# Create datasets for your data

experiments/hybrid_optimizer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
22
import sys
3+
4+
# Setting the path for XLuminA modules:
35
current_path = os.path.abspath(os.path.join('..'))
4-
dir_path = os.path.dirname(current_path)
5-
module_path = os.path.join(dir_path)
6+
module_path = os.path.join(current_path)
7+
68
if module_path not in sys.path:
79
sys.path.append(module_path)
810

experiments/hybrid_sharp_optical_table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Setting the path for XLuminA modules:
22
import os
33
import sys
4+
5+
# Setting the path for XLuminA modules:
46
current_path = os.path.abspath(os.path.join('..'))
5-
dir_path = os.path.dirname(current_path)
6-
module_path = os.path.join(dir_path)
7+
module_path = os.path.join(current_path)
8+
79
if module_path not in sys.path:
810
sys.path.append(module_path)
911

experiments/hybrid_sted_optical_table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Setting the path for XLuminA modules:
22
import os
33
import sys
4+
5+
# Setting the path for XLuminA modules:
46
current_path = os.path.abspath(os.path.join('..'))
5-
dir_path = os.path.dirname(current_path)
6-
module_path = os.path.join(dir_path)
7+
module_path = os.path.join(current_path)
8+
79
if module_path not in sys.path:
810
sys.path.append(module_path)
911

experiments/hybrid_with_fixed_PM.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Setting the path for XLuminA modules:
22
import os
33
import sys
4+
5+
# Setting the path for XLuminA modules:
46
current_path = os.path.abspath(os.path.join('..'))
5-
dir_path = os.path.dirname(current_path)
6-
module_path = os.path.join(dir_path)
7+
module_path = os.path.join(current_path)
8+
79
if module_path not in sys.path:
810
sys.path.append(module_path)
9-
10-
from xlumina.__init__ import um, nm, cm, mm
11+
12+
from xlumina.__init__ import um, nm, mm
1113
from xlumina.vectorized_optics import *
1214
from xlumina.optical_elements import hybrid_setup_fixed_slms_fluorophores, hybrid_setup_fixed_slms
1315
from xlumina.loss_functions import vectorized_loss_hybrid

experiments/six_times_six_ansatz_with_fixed_PM.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Setting the path for XLuminA modules:
22
import os
33
import sys
4+
5+
# Setting the path for XLuminA modules:
46
current_path = os.path.abspath(os.path.join('..'))
5-
dir_path = os.path.dirname(current_path)
6-
module_path = os.path.join(dir_path)
7+
module_path = os.path.join(current_path)
8+
79
if module_path not in sys.path:
810
sys.path.append(module_path)
911

0 commit comments

Comments
 (0)