diff --git a/scripts/train_ntrace.py b/scripts/train_ntrace.py index 1ead7e112f53e302b18286e41346992c143a9a02..97519d5b3e6d7b35563465128fdf52ea3e7936e2 100644 --- a/scripts/train_ntrace.py +++ b/scripts/train_ntrace.py @@ -23,7 +23,7 @@ if __name__ == "__main__": "optimizer": "Adam", "loss": "composite", "cache_dir": "data", - "experiment_name": "nTrace_cu_film_6layer", + "experiment_name": "nTrace_xx_film_6layer", "run_name": "d2048_h32_l6", "datadir": "expdata", } diff --git a/src/tgreft/utils/data/data_loader.py b/src/tgreft/utils/data/data_loader.py index b80df4bb3274e4b942bc93b94f3b7d2f6df15cef..2486aeed3774d0705cec7d1b1565de266b72d815 100644 --- a/src/tgreft/utils/data/data_loader.py +++ b/src/tgreft/utils/data/data_loader.py @@ -85,50 +85,26 @@ def generate_data( # NOTE: the n-Trace model is more expressive with relaxed bounds # cu_film, 6 layer - parameters_ref = np.column_stack( - [ - np.random.uniform(5.0, 7.0, n_dataset), # electolyte_sld, - np.random.uniform(5, 120, n_dataset), # electolyte_roughness, - - np.random.uniform(-5.0, 6.5, n_dataset), # sei_sld, - np.random.uniform(10, 500, n_dataset), # sei_thickness, - np.random.uniform(1, 80, n_dataset), # sei_roughness, - - np.random.uniform(-2, 6, n_dataset), # material_sld, - np.random.uniform(10, 200, n_dataset), # material_thickness, - np.random.uniform(1, 35, n_dataset), # material_roughness, - - np.random.uniform(6, 7, n_dataset), # cu_sld, - np.random.uniform(20, 700, n_dataset), # cu_thickness, - np.random.uniform(1, 35, n_dataset), # cu_roughness, - - np.random.uniform(-3.5, 0, n_dataset), # ti_sld, - np.random.uniform(10, 100, n_dataset), # ti_thickness, - np.random.uniform(1, 35, n_dataset), # ti_roughness, - - np.random.uniform(1, 4.2, n_dataset), # oxide_sld, - np.random.uniform(5, 50, n_dataset), # oxide_thickness, - np.random.uniform(1, 10, n_dataset), # oxide_roughness, - ] - ) - - # mo_film, 5 layer # parameters_ref = np.column_stack( # [ - # np.random.uniform(-1.0, 7.0, n_dataset), # electolyte_sld, I changed the lower bound to -1 to include air and H2O + # np.random.uniform(5.0, 7.0, n_dataset), # electolyte_sld, # np.random.uniform(5, 120, n_dataset), # electolyte_roughness, # np.random.uniform(-5.0, 6.5, n_dataset), # sei_sld, # np.random.uniform(10, 500, n_dataset), # sei_thickness, # np.random.uniform(1, 80, n_dataset), # sei_roughness, - # np.random.uniform(-2, 7, n_dataset), # bulk_3_sld, + # np.random.uniform(-2, 6, n_dataset), # material_sld, # np.random.uniform(10, 200, n_dataset), # material_thickness, - # np.random.uniform(1, 55, n_dataset), # material_roughness, - - # np.random.uniform(2, 6, n_dataset), # bulk_2_sld, + # np.random.uniform(1, 35, n_dataset), # material_roughness, + + # np.random.uniform(6, 7, n_dataset), # cu_sld, # np.random.uniform(20, 700, n_dataset), # cu_thickness, - # np.random.uniform(1, 55, n_dataset), # cu_roughness, + # np.random.uniform(1, 35, n_dataset), # cu_roughness, + + # np.random.uniform(-3.5, 0, n_dataset), # ti_sld, + # np.random.uniform(10, 100, n_dataset), # ti_thickness, + # np.random.uniform(1, 35, n_dataset), # ti_roughness, # np.random.uniform(1, 4.2, n_dataset), # oxide_sld, # np.random.uniform(5, 50, n_dataset), # oxide_thickness, @@ -136,10 +112,10 @@ def generate_data( # ] # ) - # extended 6 layer model + # mo_film, 5 layer # parameters_ref = np.column_stack( # [ - # np.random.uniform(-1.0, 7.0, n_dataset), # electolyte_sld, including air and H2O + # np.random.uniform(-1.0, 7.0, n_dataset), # electolyte_sld, I changed the lower bound to -1 to include air and H2O # np.random.uniform(5, 120, n_dataset), # electolyte_roughness, # np.random.uniform(-5.0, 6.5, n_dataset), # sei_sld, @@ -147,23 +123,42 @@ def generate_data( # np.random.uniform(1, 80, n_dataset), # sei_roughness, # np.random.uniform(-2, 7, n_dataset), # bulk_3_sld, - # np.random.uniform(10, 200, n_dataset), # bulk_3_thickness, - # np.random.uniform(1, 55, n_dataset), # bulk_3_roughness, - - # np.random.uniform(2, 7, n_dataset), # bulk_2_sld, - # np.random.uniform(20, 700, n_dataset), # bulk_2_thickness (cu_thickness), - # np.random.uniform(1, 55, n_dataset), # bulk_2_roughness (cu_roughness), - - # np.random.uniform(-3.5, 7, n_dataset), # bulk_1_sld, - # np.random.uniform(10, 200, n_dataset), # bulk_1_thickness, - # np.random.uniform(1, 55, n_dataset), # bulk_1_roughness, - + # np.random.uniform(10, 200, n_dataset), # material_thickness, + # np.random.uniform(1, 55, n_dataset), # material_roughness, + + # np.random.uniform(2, 6, n_dataset), # bulk_2_sld, + # np.random.uniform(20, 700, n_dataset), # cu_thickness, + # np.random.uniform(1, 55, n_dataset), # cu_roughness, + # np.random.uniform(1, 4.2, n_dataset), # oxide_sld, # np.random.uniform(5, 50, n_dataset), # oxide_thickness, # np.random.uniform(1, 10, n_dataset), # oxide_roughness, # ] # ) + # xx_film, 6 layer model + parameters_ref = np.column_stack( + [ + np.random.uniform(-1.0, 7.0, n_dataset), # electolyte_sld, including air and H2O + np.random.uniform(5, 120, n_dataset), # electolyte_roughness, + np.random.uniform(-5.0, 6.5, n_dataset), # sei_sld, + np.random.uniform(10, 500, n_dataset), # sei_thickness, + np.random.uniform(1, 80, n_dataset), # sei_roughness, + np.random.uniform(-2, 7, n_dataset), # bulk_3_sld, + np.random.uniform(10, 200, n_dataset), # bulk_3_thickness, + np.random.uniform(1, 55, n_dataset), # bulk_3_roughness, + np.random.uniform(2, 7, n_dataset), # bulk_2_sld, + np.random.uniform(20, 700, n_dataset), # bulk_2_thickness (cu_thickness), + np.random.uniform(1, 55, n_dataset), # bulk_2_roughness (cu_roughness), + np.random.uniform(-3.5, 7, n_dataset), # bulk_1_sld, + np.random.uniform(10, 200, n_dataset), # bulk_1_thickness, + np.random.uniform(1, 55, n_dataset), # bulk_1_roughness, + np.random.uniform(1, 4.2, n_dataset), # oxide_sld, + np.random.uniform(5, 50, n_dataset), # oxide_thickness, + np.random.uniform(1, 10, n_dataset), # oxide_roughness, + ] + ) + # generate the reference rcurves r_curves = np.apply_along_axis(param_to_rcurve, 1, parameters_ref) logger.debug(f"r_curves.shape: {r_curves.shape}") @@ -203,12 +198,12 @@ def param_to_rcurve(param: np.ndarray) -> np.ndarray: def param_to_sld(param: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: """Convert the parameters to the SLD profile. - + Parameters ---------- param : np.ndarray The parameters. - + Returns ------- Tuple[np.ndarray, np.ndarray]