Repository: esa/NIDN (language: python)

Issue:
Example notebook for users
# Example notebook for users - first half


Discussion / hints:

Fix patch:
diff --git a/nidn/materials/data/aluminium_arsenide.csv b/nidn/materials/data/aluminium_arsenide.csv
new file mode 100644
index 0000000..23aa0c2
--- /dev/null
+++ b/nidn/materials/data/aluminium_arsenide.csv
@@ -0,0 +1,201 @@
+Wavelength	n	k
+0.2214	1.4237	3.1989
+0.22242	1.4464	3.237
+0.22345	1.4711	3.2763
+0.22448	1.4978	3.3169
+0.22553	1.5267	3.3588
+0.22659	1.5582	3.402
+0.22765	1.5925	3.4464
+0.22873	1.6297	3.492
+0.22981	1.6704	3.5388
+0.23091	1.7147	3.5865
+0.23202	1.7631	3.635
+0.23314	1.8158	3.6842
+0.23427	1.8735	3.7337
+0.23541	1.9363	3.7832
+0.23656	2.0049	3.8322
+0.23772	2.0796	3.8802
+0.23889	2.1607	3.9264
+0.24008	2.2487	3.9701
+0.24128	2.3437	4.0102
+0.24249	2.4458	4.0457
+0.24371	2.5549	4.0754
+0.24494	2.6705	4.0979
+0.24619	2.792	4.1118
+0.24745	2.9184	4.116
+0.24872	3.0482	4.1094
+0.25	3.1797	4.0911
+0.2513	3.311	4.061
+0.25261	3.4402	4.0192
+0.25394	3.5655	3.9665
+0.25528	3.6854	3.9039
+0.25663	3.7992	3.8331
+0.258	3.9065	3.7552
+0.25939	4.0077	3.6714
+0.26078	4.1035	3.5819
+0.2622	4.1942	3.4863
+0.26363	4.2798	3.3831
+0.26507	4.3583	3.2708
+0.26653	4.4266	3.1486
+0.26801	4.4802	3.0177
+0.2695	4.5155	2.8819
+0.27101	4.5307	2.7466
+0.27254	4.5267	2.6174
+0.27408	4.5065	2.4988
+0.27564	4.4738	2.3933
+0.27722	4.4324	2.3022
+0.27882	4.3854	2.2255
+0.28044	4.3354	2.1629
+0.28207	4.2841	2.1138
+0.28373	4.233	2.0777
+0.2854	4.1834	2.0547
+0.28709	4.1364	2.0451
+0.28881	4.0937	2.0499
+0.29054	4.0578	2.0705
+0.2923	4.0327	2.1088
+0.29407	4.0255	2.1658
+0.29587	4.047	2.2402
+0.29769	4.1111	2.3229
+0.29954	4.2293	2.3918
+0.3014	4.3953	2.4124
+0.30329	4.573	2.3581
+0.30521	4.7129	2.2396
+0.30714	4.7926	2.0998
+0.30911	4.8263	1.9772
+0.31109	4.8436	1.8865
+0.31311	4.8714	1.8217
+0.31515	4.927	1.7621
+0.31721	5.0094	1.6785
+0.31931	5.0937	1.5487
+0.32143	5.1445	1.3781
+0.32358	5.1442	1.1957
+0.32576	5.1001	1.0288
+0.32797	5.0298	0.88937
+0.3302	4.9482	0.77761
+0.33247	4.8644	0.68904
+0.33477	4.783	0.61852
+0.33711	4.7063	0.56168
+0.33947	4.6347	0.51517
+0.34187	4.5685	0.47648
+0.3443	4.5073	0.44379
+0.34677	4.4508	0.41574
+0.34928	4.3985	0.39132
+0.35182	4.35	0.36975
+0.35439	4.3051	0.35043
+0.35701	4.2633	0.3329
+0.35966	4.2243	0.31678
+0.36236	4.188	0.30175
+0.36509	4.1541	0.28754
+0.36787	4.1225	0.27391
+0.37069	4.0928	0.26063
+0.37355	4.0651	0.24746
+0.37645	4.0391	0.23415
+0.37941	4.0148	0.22033
+0.38241	3.9919	0.20543
+0.38545	3.9704	0.18785
+0.38855	3.939	0.1651
+0.39169	3.9102	0.15569
+0.39489	3.8858	0.14573
+0.39814	3.8636	0.13506
+0.40145	3.843	0.12336
+0.4048	3.8225	0.10981
+0.40822	3.7968	0.093241
+0.41169	3.7615	0.078298
+0.41523	3.7313	0.065678
+0.41882	3.7068	0.047059
+0.42248	3.6782	0.033231
+0.4262	3.6505	0.028085
+0.42999	3.625	0.025642
+0.43385	3.6011	0.023682
+0.43777	3.5786	0.021879
+0.44177	3.5571	0.020202
+0.44584	3.5366	0.018643
+0.44999	3.5169	0.017194
+0.45421	3.498	0.015849
+0.45852	3.4798	0.014601
+0.46291	3.4622	0.013442
+0.46738	3.4452	0.012368
+0.47194	3.4287	0.011372
+0.47659	3.4128	0.01045
+0.48133	3.3973	0.0095962
+0.48616	3.3823	0.0088061
+0.4911	3.3677	0.0080755
+0.49614	3.3535	0.0074003
+0.50128	3.3398	0.0067766
+0.50653	3.3264	0.0062009
+0.51188	3.3133	0.00567
+0.51736	3.3006	0.0051805
+0.52295	3.2883	0.0047296
+0.52867	3.2762	0.0043146
+0.53451	3.2645	0.0039329
+0.54048	3.253	0.003582
+0.54659	3.2418	0.0032598
+0.55283	3.2309	0.0029641
+0.55922	3.2203	0.002693
+0.56576	3.2099	0.0024446
+0.57246	3.1997	0.0022172
+0.57931	3.1898	0.0020092
+0.58633	3.1802	0.0018191
+0.59353	3.1707	0.0016455
+0.6009	3.1615	0.0014872
+0.60846	3.1525	0.0013429
+0.61621	3.1437	0.0012114
+0.62416	3.135	0.0010918
+0.63231	3.1266	0.00098315
+0.64069	3.1184	0.00088444
+0.64929	3.1103	0.00079488
+0.65812	3.1025	0.00071371
+0.66719	3.0948	0.0006402
+0.67652	3.0872	0.0005737
+0.68612	3.0799	0.00051361
+0.69599	3.0727	0.00045935
+0.70615	3.0656	0.00041042
+0.71661	3.0587	0.00036632
+0.72738	3.052	0.00032663
+0.73849	3.0454	0.00029094
+0.74993	3.039	0.00025889
+0.76174	3.0326	0.00023012
+0.77393	3.0265	0.00020434
+0.78651	3.0204	0.00018125
+0.79951	3.0146	0.0001606
+0.81294	3.0088	0.00014215
+0.82684	3.0031	0.00012568
+0.84122	2.9976	0.000111
+0.8561	2.9922	0.000097927
+0.87152	2.987	0.000086297
+0.88751	2.9818	0.000075962
+0.9041	2.9768	0.00006679
+0.92132	2.9719	0.000058658
+0.9392	2.967	0.000051457
+0.9578	2.9623	0.000045088
+0.97714	2.9578	0.000039461
+0.99729	2.9533	0.000034496
+1.0183	2.9489	0.000030119
+1.0402	2.9446	0.000026266
+1.063	2.9405	0.000022878
+1.0869	2.9364	0.000019903
+1.1119	2.9324	0.000017293
+1.138	2.9285	0.000015006
+1.1655	2.9248	0.000013006
+1.1942	2.9211	0.000011257
+1.2245	2.9175	0.0000097316
+1.2563	2.914	0.0000084014
+1.2897	2.9106	0.0000072435
+1.3251	2.9073	0.0000062368
+1.3624	2.9041	0.0000053626
+1.4019	2.9009	0.0000046046
+1.4437	2.8979	0.0000039483
+1.4881	2.8949	0.0000033806
+1.5353	2.892	0.0000028904
+1.5857	2.8893	0.0000024676
+1.6394	2.8865	0.0000021035
+1.6969	2.8839	0.0000017904
+1.7586	2.8814	0.0000015216
+1.8249	2.8789	0.000001291
+1.8965	2.8765	0.0000010936
+1.9738	2.8742	9.2491e-7
+2.0578	2.872	7.8088e-7
+2.1492	2.8699	6.5813e-7
+2.2491	2.8678	5.5368e-7
+2.3588	2.8658	4.6496e-7
+2.4797	2.8639	3.8971e-7
\ No newline at end of file
diff --git a/nidn/materials/data/gallium_arsenide.csv b/nidn/materials/data/gallium_arsenide.csv
new file mode 100644
index 0000000..e3a8bbc
--- /dev/null
+++ b/nidn/materials/data/gallium_arsenide.csv
@@ -0,0 +1,201 @@
+Wavelength	n	k
+0.20664	1.0752	2.5927
+0.20767	1.0835	2.6151
+0.2087	1.0921	2.6382
+0.20975	1.1011	2.6619
+0.21081	1.1104	2.6865
+0.21188	1.1201	2.7118
+0.21295	1.1303	2.7379
+0.21404	1.141	2.7649
+0.21515	1.1522	2.7928
+0.21626	1.164	2.8217
+0.21738	1.1765	2.8517
+0.21852	1.1896	2.8827
+0.21967	1.2036	2.9149
+0.22083	1.2184	2.9484
+0.222	1.2342	2.9832
+0.22318	1.2511	3.0194
+0.22438	1.2692	3.057
+0.22559	1.2887	3.0963
+0.22681	1.3097	3.1373
+0.22805	1.3325	3.1801
+0.2293	1.3572	3.2248
+0.23057	1.3841	3.2715
+0.23184	1.4136	3.3204
+0.23314	1.446	3.3716
+0.23444	1.4817	3.4253
+0.23577	1.5214	3.4816
+0.2371	1.5656	3.5405
+0.23845	1.6152	3.6023
+0.23982	1.6711	3.667
+0.2412	1.7347	3.7346
+0.2426	1.8077	3.8049
+0.24402	1.8923	3.8773
+0.24545	1.9915	3.9508
+0.2469	2.1089	4.0226
+0.24837	2.2487	4.0877
+0.24985	2.4139	4.1368
+0.25135	2.6026	4.1559
+0.25287	2.8014	4.1304
+0.25441	2.9856	4.0569
+0.25597	3.1332	3.9517
+0.25755	3.2409	3.8408
+0.25914	3.3219	3.7405
+0.26076	3.3908	3.653
+0.26239	3.4558	3.5739
+0.26405	3.5194	3.4981
+0.26573	3.5818	3.4226
+0.26743	3.6421	3.3457
+0.26915	3.6999	3.2664
+0.27089	3.7546	3.1839
+0.27266	3.8054	3.0973
+0.27445	3.8508	3.006
+0.27626	3.8889	2.9098
+0.2781	3.9173	2.8098
+0.27996	3.9343	2.7081
+0.28185	3.9393	2.6075
+0.28376	3.9324	2.511
+0.2857	3.9153	2.4209
+0.28766	3.8898	2.3391
+0.28966	3.8583	2.2665
+0.29168	3.8227	2.2031
+0.29372	3.7851	2.1489
+0.2958	3.7467	2.1031
+0.29791	3.7088	2.065
+0.30005	3.6723	2.0337
+0.30222	3.6377	2.0085
+0.30442	3.6054	1.9886
+0.30665	3.5757	1.9733
+0.30891	3.5487	1.9619
+0.31121	3.5245	1.9539
+0.31354	3.5031	1.9489
+0.31591	3.4845	1.9464
+0.31832	3.4686	1.9461
+0.32076	3.4553	1.9477
+0.32324	3.4446	1.951
+0.32576	3.4365	1.9556
+0.32831	3.4307	1.9616
+0.33091	3.4272	1.9686
+0.33355	3.426	1.9767
+0.33623	3.427	1.9858
+0.33896	3.4302	1.9958
+0.34173	3.4354	2.0067
+0.34454	3.4427	2.0187
+0.34741	3.4521	2.0317
+0.35032	3.4636	2.0459
+0.35328	3.4775	2.0616
+0.35629	3.4938	2.079
+0.35935	3.513	2.0985
+0.36246	3.5358	2.1206
+0.36563	3.5632	2.1457
+0.36886	3.5967	2.174
+0.37214	3.6387	2.2056
+0.37548	3.6926	2.2391
+0.37888	3.7618	2.271
+0.38235	3.8487	2.2944
+0.38588	3.9508	2.2995
+0.38947	4.0575	2.2786
+0.39313	4.1533	2.2339
+0.39686	4.2284	2.1791
+0.40066	4.2865	2.131
+0.40454	4.3416	2.0989
+0.40849	4.411	2.0805
+0.41252	4.5082	2.0625
+0.41663	4.6366	2.0226
+0.42082	4.783	1.9374
+0.4251	4.9184	1.7965
+0.42947	5.0126	1.6118
+0.43392	5.0515	1.4109
+0.43847	5.0406	1.2197
+0.44312	4.9948	1.0524
+0.44786	4.9289	0.91267
+0.45271	4.8537	0.7986
+0.45767	4.7761	0.70605
+0.46273	4.6998	0.63081
+0.46791	4.6268	0.56924
+0.4732	4.5579	0.51842
+0.47862	4.4934	0.47607
+0.48416	4.4332	0.44046
+0.48983	4.3772	0.41023
+0.49564	4.325	0.38435
+0.50158	4.2764	0.36203
+0.50767	4.231	0.34264
+0.51391	4.1887	0.32567
+0.5203	4.1491	0.31073
+0.52686	4.1121	0.2975
+0.53358	4.0775	0.28572
+0.54048	4.045	0.27517
+0.54756	4.0145	0.26567
+0.55482	3.9859	0.25707
+0.56228	3.959	0.24924
+0.56994	3.9338	0.24206
+0.57782	3.9101	0.23543
+0.58591	3.8879	0.22926
+0.59424	3.8671	0.22348
+0.60281	3.8476	0.21799
+0.61162	3.8294	0.21272
+0.6207	3.8123	0.2076
+0.63005	3.7965	0.20254
+0.63969	3.7818	0.19745
+0.64963	3.7681	0.19224
+0.65988	3.7556	0.18676
+0.67046	3.744	0.18085
+0.68138	3.7336	0.17423
+0.69267	3.7241	0.16637
+0.70433	3.7155	0.15566
+0.7164	3.6968	0.14206
+0.72889	3.682	0.13842
+0.74182	3.6703	0.1344
+0.75521	3.6602	0.12994
+0.7691	3.6515	0.1249
+0.78351	3.644	0.11913
+0.79847	3.6376	0.11237
+0.81402	3.6322	0.10425
+0.83018	3.6279	0.094172
+0.84699	3.6238	0.080533
+0.8645	3.607	0.059067
+0.88275	3.5815	0.044254
+0.90179	3.5664	0.022701
+0.92166	3.5453	0.016655
+0.94243	3.5276	0.015411
+0.96416	3.5119	0.014358
+0.98691	3.4977	0.013366
+1.0108	3.4845	0.012431
+1.0358	3.4722	0.011553
+1.0621	3.4606	0.010728
+1.0898	3.4497	0.0099539
+1.119	3.4393	0.0092282
+1.1497	3.4294	0.0085484
+1.1822	3.4199	0.0079119
+1.2166	3.4109	0.0073164
+1.2531	3.4022	0.0067596
+1.2918	3.3939	0.0062393
+1.3329	3.386	0.0057535
+1.3768	3.3784	0.0053002
+1.4237	3.3711	0.0048775
+1.4739	3.3641	0.0044836
+1.5277	3.3574	0.0041169
+1.5857	3.3509	0.0037755
+1.6482	3.3448	0.0034582
+1.7158	3.3388	0.0031633
+1.7892	3.3332	0.0028894
+1.8692	3.3277	0.0026354
+1.9566	3.3225	0.0023999
+2.0527	3.3175	0.0021818
+2.1586	3.3128	0.0019799
+2.2761	3.3082	0.0017932
+2.4071	3.3039	0.0016206
+2.5541	3.2998	0.0014614
+2.7203	3.2959	0.0013145
+2.9095	3.2922	0.0011792
+3.1271	3.2886	0.0010546
+3.3798	3.2853	0.00094004
+3.677	3.2821	0.00083479
+4.0315	3.2792	0.0007382
+4.4616	3.2764	0.00064966
+4.9945	3.2738	0.0005686
+5.6719	3.2714	0.00049446
+6.5619	3.2692	0.00042674
+7.7832	3.2671	0.00036498
+9.5631	3.2652	0.00030871
+12.398	3.2635	0.00025753
\ No newline at end of file
diff --git a/nidn/materials/data/indium_arsenide.csv b/nidn/materials/data/indium_arsenide.csv
new file mode 100644
index 0000000..092b2db
--- /dev/null
+++ b/nidn/materials/data/indium_arsenide.csv
@@ -0,0 +1,201 @@
+Wavelength	n	k
+0.20664	1.2743	1.581
+0.20767	1.2771	1.5975
+0.2087	1.2799	1.6144
+0.20975	1.2829	1.6316
+0.21081	1.2859	1.6493
+0.21188	1.289	1.6673
+0.21295	1.2923	1.6859
+0.21404	1.2956	1.7049
+0.21515	1.2991	1.7244
+0.21626	1.3027	1.7444
+0.21738	1.3065	1.765
+0.21852	1.3104	1.7862
+0.21967	1.3145	1.808
+0.22083	1.3187	1.8305
+0.222	1.3232	1.8537
+0.22318	1.3279	1.8777
+0.22438	1.3328	1.9024
+0.22559	1.3381	1.928
+0.22681	1.3436	1.9545
+0.22805	1.3495	1.982
+0.2293	1.3558	2.0106
+0.23057	1.3625	2.0403
+0.23184	1.3698	2.0711
+0.23314	1.3776	2.1033
+0.23444	1.386	2.1368
+0.23577	1.3952	2.1718
+0.2371	1.4052	2.2085
+0.23845	1.4162	2.2468
+0.23982	1.4284	2.287
+0.2412	1.4418	2.3291
+0.2426	1.4568	2.3734
+0.24402	1.4735	2.42
+0.24545	1.4922	2.4691
+0.2469	1.5134	2.5207
+0.24837	1.5373	2.5752
+0.24985	1.5646	2.6326
+0.25135	1.5959	2.693
+0.25287	1.6317	2.7567
+0.25441	1.673	2.8235
+0.25597	1.7209	2.8936
+0.25755	1.7765	2.9666
+0.25914	1.8413	3.0422
+0.26076	1.9169	3.1195
+0.26239	2.0051	3.1975
+0.26405	2.1081	3.2741
+0.26573	2.2277	3.3468
+0.26743	2.3656	3.4117
+0.26915	2.5228	3.4637
+0.27089	2.6987	3.4965
+0.27266	2.8901	3.503
+0.27445	3.0909	3.4765
+0.27626	3.2916	3.4121
+0.2781	3.4802	3.3091
+0.27996	3.6446	3.1719
+0.28185	3.7753	3.0098
+0.28376	3.8678	2.8349
+0.2857	3.9228	2.6592
+0.28766	3.945	2.4922
+0.28966	3.9411	2.3403
+0.29168	3.9181	2.2064
+0.29372	3.8823	2.0914
+0.2958	3.8388	1.9943
+0.29791	3.7914	1.9136
+0.30005	3.7429	1.8474
+0.30222	3.6951	1.7936
+0.30442	3.6493	1.7505
+0.30665	3.6064	1.7164
+0.30891	3.5667	1.6899
+0.31121	3.5304	1.6698
+0.31354	3.4978	1.6551
+0.31591	3.4688	1.645
+0.31832	3.4432	1.6386
+0.32076	3.4211	1.6355
+0.32324	3.4023	1.635
+0.32576	3.3865	1.6369
+0.32831	3.3738	1.6407
+0.33091	3.364	1.6462
+0.33355	3.3569	1.653
+0.33623	3.3524	1.661
+0.33896	3.3504	1.67
+0.34173	3.3508	1.6798
+0.34454	3.3536	1.6903
+0.34741	3.3585	1.7014
+0.35032	3.3657	1.7131
+0.35328	3.375	1.7251
+0.35629	3.3863	1.7374
+0.35935	3.3996	1.7501
+0.36246	3.415	1.7629
+0.36563	3.4322	1.7759
+0.36886	3.4515	1.789
+0.37214	3.4726	1.8022
+0.37548	3.4957	1.8155
+0.37888	3.5207	1.8287
+0.38235	3.5477	1.8419
+0.38588	3.5766	1.8551
+0.38947	3.6076	1.8681
+0.39313	3.6406	1.8811
+0.39686	3.6756	1.8939
+0.40066	3.7128	1.9066
+0.40454	3.7521	1.9191
+0.40849	3.7937	1.9314
+0.41252	3.8375	1.9434
+0.41663	3.8837	1.9553
+0.42082	3.9324	1.9668
+0.4251	3.9835	1.9781
+0.42947	4.0372	1.9892
+0.43392	4.0935	2
+0.43847	4.1523	2.0106
+0.44312	4.2137	2.021
+0.44786	4.2774	2.0314
+0.45271	4.3432	2.042
+0.45767	4.4107	2.0528
+0.46273	4.4791	2.0644
+0.46791	4.5475	2.0772
+0.4732	4.6142	2.092
+0.47862	4.6775	2.1094
+0.48416	4.735	2.1306
+0.48983	4.7847	2.1566
+0.49564	4.825	2.188
+0.50158	4.8268	2.1631
+0.50767	4.7112	1.8891
+0.51391	4.6156	1.6652
+0.5203	4.5271	1.4626
+0.52686	4.4426	1.2698
+0.53358	4.3618	1.08
+0.54048	4.2855	0.88924
+0.54756	4.2219	0.73438
+0.55482	4.1859	0.72423
+0.56228	4.1503	0.71363
+0.56994	4.1155	0.70251
+0.57782	4.0817	0.69082
+0.58591	4.0491	0.67853
+0.59424	4.0177	0.66564
+0.60281	3.9875	0.65213
+0.61162	3.9585	0.63802
+0.6207	3.9306	0.62331
+0.63005	3.9039	0.608
+0.63969	3.8782	0.59212
+0.64963	3.8536	0.57567
+0.65988	3.8299	0.55867
+0.67046	3.8072	0.54115
+0.68138	3.7854	0.52312
+0.69267	3.7644	0.5046
+0.70433	3.7443	0.48563
+0.7164	3.7249	0.46622
+0.72889	3.7064	0.44643
+0.74182	3.6886	0.42627
+0.75521	3.6715	0.40579
+0.7691	3.6552	0.38505
+0.78351	3.6395	0.3641
+0.79847	3.6245	0.34299
+0.81402	3.6102	0.3218
+0.83018	3.5965	0.30062
+0.84699	3.5835	0.27953
+0.8645	3.5712	0.25864
+0.88275	3.5594	0.23808
+0.90179	3.5483	0.21797
+0.92166	3.5379	0.19849
+0.94243	3.528	0.17982
+0.96416	3.5187	0.16217
+0.98691	3.5101	0.14578
+1.0108	3.502	0.13093
+1.0358	3.4945	0.11795
+1.0621	3.4876	0.10721
+1.0898	3.4813	0.09914
+1.119	3.4755	0.094251
+1.1497	3.4704	0.093127
+1.1822	3.4659	0.09522
+1.2166	3.4619	0.097538
+1.2531	3.4584	0.099878
+1.2918	3.4556	0.10221
+1.3329	3.4534	0.10449
+1.3768	3.4519	0.10665
+1.4237	3.4511	0.10858
+1.4739	3.4512	0.11009
+1.5277	3.4521	0.1108
+1.5857	3.4541	0.10971
+1.6482	3.4501	0.10283
+1.7158	3.4452	0.10687
+1.7892	3.4438	0.11099
+1.8692	3.4443	0.11519
+1.9566	3.4465	0.11943
+2.0527	3.4504	0.12361
+2.1586	3.4562	0.12756
+2.2761	3.4641	0.13103
+2.4071	3.4748	0.13358
+2.5541	3.4886	0.13448
+2.7203	3.5064	0.13246
+2.9095	3.5292	0.12505
+3.1271	3.5584	0.10659
+3.3798	3.596	0.054338
+3.677	3.5337	0.0020848
+4.0315	3.5098	0.0019108
+4.4616	3.4958	0.0017304
+4.9945	3.4861	0.0015477
+5.6719	3.4788	0.0013638
+6.5619	3.4732	0.0011793
+7.7832	3.4689	0.00099444
+9.5631	3.4655	0.00080944
+12.398	3.463	0.00062436
\ No newline at end of file
diff --git a/nidn/materials/data/zirconium.csv b/nidn/materials/data/zirconium.csv
new file mode 100644
index 0000000..5d77780
--- /dev/null
+++ b/nidn/materials/data/zirconium.csv
@@ -0,0 +1,307 @@
+Wavelength	n	k
+0.22	1.007	0.697
+0.24	0.995	1.145
+0.26	1.091	1.433
+0.28	1.178	1.651
+0.3	1.271	1.845
+0.32	1.36	2.009
+0.34	1.452	2.174
+0.36	1.55	2.308
+0.38	1.636	2.452
+0.4	1.734	2.579
+0.42	1.836	2.708
+0.44	1.935	2.817
+0.46	2.034	2.926
+0.48	2.134	3.033
+0.5	2.245	3.138
+0.52	2.356	3.228
+0.54	2.47	3.319
+0.56	2.593	3.401
+0.58	2.731	3.466
+0.6	2.857	3.503
+0.62	2.968	3.537
+0.64	3.078	3.566
+0.66	3.179	3.586
+0.68	3.274	3.603
+0.7	3.364	3.616
+0.72	3.448	3.623
+0.74	3.526	3.628
+0.76	3.595	3.63
+0.78	3.66	3.631
+0.8	3.724	3.627
+0.82	3.76	3.619
+0.84	3.801	3.627
+0.86	3.83	3.63
+0.88	3.856	3.653
+0.9	3.888	3.685
+0.92	3.931	3.714
+0.94	3.97	3.736
+0.96	4.016	3.761
+0.98	4.061	3.79
+1	4.098	3.804
+1.02	4.138	3.831
+1.04	4.179	3.852
+1.06	4.226	3.88
+1.08	4.275	3.9
+1.1	4.319	3.911
+1.12	4.365	3.921
+1.14	4.402	3.931
+1.16	4.443	3.934
+1.18	4.475	3.94
+1.2	4.51	3.936
+1.22	4.515	3.942
+1.24	4.539	3.959
+1.26	4.558	3.98
+1.28	4.581	4
+1.3	4.603	4.009
+1.32	4.627	4.023
+1.34	4.649	4.049
+1.36	4.68	4.065
+1.38	4.697	4.074
+1.4	4.704	4.091
+1.42	4.734	4.113
+1.44	4.754	4.128
+1.46	4.777	4.15
+1.48	4.8	4.166
+1.5	4.819	4.182
+1.52	4.846	4.192
+1.54	4.846	4.203
+1.56	4.878	4.229
+1.58	4.896	4.238
+1.6	4.914	4.253
+1.62	4.933	4.278
+1.64	4.95	4.282
+1.66	4.958	4.292
+1.68	4.97	4.311
+1.7	4.983	4.328
+1.72	4.997	4.332
+1.74	5.003	4.357
+1.76	5.016	4.371
+1.78	5.027	4.387
+1.8	5.03	4.393
+1.82	5.025	4.433
+1.84	5.047	4.462
+1.86	5.055	4.466
+1.88	5.05	4.521
+1.9	5.097	4.559
+1.92	5.126	4.572
+1.94	5.162	4.565
+1.96	5.174	4.573
+1.98	5.194	4.573
+2	5.183	4.586
+2.02	5.209	4.584
+2.04	5.207	4.597
+2.06	5.212	4.606
+2.08	5.21	4.618
+2.1	5.217	4.637
+2.12	5.223	4.655
+2.14	5.241	4.667
+2.16	5.24	4.666
+2.18	5.236	4.679
+2.2	5.241	4.693
+2.22	5.239	4.702
+2.24	5.239	4.707
+2.26	5.231	4.724
+2.28	5.224	4.739
+2.3	5.221	4.762
+2.32	5.212	4.778
+2.34	5.205	4.796
+2.36	5.212	4.82
+2.38	5.204	4.83
+2.4	5.2	4.853
+2.42	5.196	4.88
+2.44	5.203	4.896
+2.46	5.195	4.912
+2.48	5.209	4.937
+2.5	5.207	4.915
+2.5126	5.189	4.924
+2.5253	5.176	4.936
+2.5381	5.165	4.948
+2.551	5.153	4.962
+2.5641	5.142	4.977
+2.5773	5.131	4.992
+2.5907	5.12	5.009
+2.6042	5.11	5.028
+2.6178	5.101	5.047
+2.6316	5.092	5.069
+2.6455	5.087	5.089
+2.6596	5.08	5.109
+2.6738	5.075	5.129
+2.6882	5.07	5.149
+2.7027	5.064	5.168
+2.7174	5.058	5.188
+2.7322	5.052	5.206
+2.7473	5.045	5.227
+2.7624	5.038	5.246
+2.7778	5.03	5.264
+2.7933	5.022	5.286
+2.809	5.013	5.308
+2.8249	5.002	5.328
+2.8409	4.993	5.353
+2.8571	4.983	5.377
+2.8736	4.974	5.4
+2.8902	4.964	5.427
+2.907	4.954	5.451
+2.924	4.943	5.478
+2.9412	4.93	5.506
+2.9586	4.921	5.534
+2.9762	4.909	5.564
+2.994	4.898	5.596
+3.012	4.888	5.628
+3.0303	4.88	5.659
+3.0488	4.869	5.693
+3.0675	4.86	5.726
+3.0864	4.85	5.759
+3.1056	4.839	5.795
+3.125	4.831	5.832
+3.1447	4.821	5.867
+3.1646	4.811	5.907
+3.1847	4.802	5.945
+3.2051	4.793	5.983
+3.2258	4.784	6.022
+3.2468	4.774	6.064
+3.268	4.766	6.108
+3.2895	4.758	6.15
+3.3113	4.749	6.194
+3.3333	4.744	6.242
+3.3557	4.739	6.286
+3.3764	4.733	6.332
+3.4014	4.728	6.377
+3.4247	4.72	6.423
+3.4483	4.715	6.473
+3.4722	4.71	6.518
+3.4965	4.701	6.568
+3.5211	4.697	6.619
+3.5461	4.693	6.67
+3.5714	4.686	6.721
+3.5971	4.68	6.774
+3.6232	4.674	6.827
+3.6496	4.669	6.883
+3.6765	4.664	6.938
+3.7037	4.657	6.996
+3.7313	4.654	7.056
+3.7594	4.651	7.115
+3.7879	4.647	7.174
+3.8168	4.639	7.236
+3.8462	4.636	7.301
+3.876	4.633	7.366
+3.9063	4.63	7.433
+3.937	4.628	7.502
+3.9683	4.628	7.573
+4	4.63	7.642
+4.0323	4.63	7.711
+4.065	4.627	7.784
+4.0984	4.629	7.86
+4.1322	4.634	7.936
+4.1667	4.634	8.012
+4.2017	4.642	8.09
+4.2373	4.646	8.166
+4.2735	4.654	8.245
+4.3103	4.656	8.324
+4.3478	4.663	8.408
+4.386	4.67	8.491
+4.4248	4.677	8.573
+4.4643	4.684	8.66
+4.5045	4.697	8.744
+4.5455	4.705	8.826
+4.5872	4.711	8.912
+4.6296	4.718	9
+4.6729	4.723	9.093
+4.717	4.726	9.187
+4.7619	4.733	9.285
+4.8077	4.74	9.386
+4.8544	4.748	9.49
+4.902	4.758	9.599
+4.9505	4.772	9.708
+5	4.788	9.819
+5.0505	4.804	9.932
+5.102	4.825	10.039
+5.1546	4.837	10.152
+5.2083	4.856	10.277
+5.2632	4.873	10.388
+5.3191	4.889	10.514
+5.3763	4.91	10.641
+5.4348	4.929	10.779
+5.4945	4.961	10.917
+5.5556	5.001	11.042
+5.618	5.024	11.177
+5.6818	5.051	11.32
+5.7471	5.089	11.453
+5.814	5.115	11.595
+5.8824	5.151	11.746
+5.9524	5.183	11.902
+6.0241	5.23	12.057
+6.0976	5.271	12.212
+6.1728	5.31	12.376
+6.25	5.36	12.543
+6.3291	5.41	12.714
+6.4103	5.47	12.889
+6.4935	5.532	13.06
+6.5789	5.595	13.237
+6.6667	5.661	13.416
+6.7568	5.732	13.596
+6.8493	5.802	13.787
+6.9444	5.887	13.963
+7.0423	5.952	14.15
+7.1429	6.035	14.344
+7.2464	6.127	14.539
+7.3529	6.213	14.727
+7.4627	6.309	14.911
+7.5758	6.383	15.092
+7.6923	6.456	15.31
+7.8125	6.55	15.527
+7.9365	6.632	15.735
+8.0645	6.72	15.97
+8.1967	6.819	16.197
+8.3333	6.924	16.439
+8.4746	7.018	16.674
+8.6207	7.115	16.929
+8.7719	7.218	17.195
+8.9286	7.317	17.476
+9.0909	7.455	17.774
+9.2593	7.584	18.059
+9.434	7.721	18.366
+9.6154	7.864	18.676
+9.8039	8.025	18.992
+10	8.201	19.327
+10.2041	8.37	19.66
+10.4167	8.546	19.986
+10.6383	8.732	20.344
+10.8696	8.937	20.716
+11.1111	9.136	21.086
+11.3636	9.369	21.473
+11.6279	9.595	21.856
+11.9048	9.831	22.265
+12.1951	10.079	22.688
+12.5	10.335	23.123
+12.8205	10.619	23.577
+13.1579	10.911	24.042
+13.5135	11.205	24.5
+13.8889	11.515	25.016
+14.2857	11.814	25.545
+14.7059	12.166	26.097
+15.1515	12.516	26.686
+15.625	12.929	27.32
+16.129	13.352	27.954
+16.6667	13.803	28.636
+17.2414	14.266	29.301
+17.8571	14.769	30.059
+18.5185	15.347	30.829
+19.2308	15.92	31.621
+20	16.515	32.549
+20.8333	17.198	33.469
+21.7391	18.038	34.513
+22.7273	18.944	35.431
+23.8095	20.031	36.348
+25	20.688	37.284
+26.3158	21.445	38.482
+27.7778	22.327	39.897
+29.4118	23.283	41.521
+31.25	24.459	43.439
+33.3333	25.82	45.534
+35.7143	27.455	47.998
+38.4615	29.442	50.816
+41.6667	31.972	54.228
+45.4545	35.375	58.2
+50	39.98	62.499
+55.5556	46.731	67.736
\ No newline at end of file
diff --git a/nidn/materials/layer_builder.py b/nidn/materials/layer_builder.py
index de6d1d4..c3d30bc 100644
--- a/nidn/materials/layer_builder.py
+++ b/nidn/materials/layer_builder.py
@@ -14,9 +14,10 @@ def __init__(self, run_cfg) -> None:
         self.run_cfg = run_cfg
         self.material_collection = MaterialCollection(self.run_cfg.target_frequencies)
 
-    def _setup_grid_and_materials(self,):
-        """Utility function to setup essentials.
-        """
+    def _setup_grid_and_materials(
+        self,
+    ):
+        """Utility function to setup essentials."""
         # Get the grid ticks
         x0 = torch.linspace(0, 1, self.run_cfg.Nx)
         y0 = torch.linspace(0, 1, self.run_cfg.Ny)
diff --git a/nidn/materials/material_collection.py b/nidn/materials/material_collection.py
index 6d1b8a3..1cd8c39 100644
--- a/nidn/materials/material_collection.py
+++ b/nidn/materials/material_collection.py
@@ -22,6 +22,10 @@ def __init__(self, target_frequencies):
         logger.trace("Initializing material collection")
         self.epsilon_matrix = None
         self.material_names = []
+
+        if len(target_frequencies) == 0:
+            raise ValueError("No target frequencies specified.")
+
         self.target_frequencies = target_frequencies
         self.materials_folder = os.path.dirname(__file__) + "/data/"
         self._load_materials_folder()
diff --git a/nidn/plots/plot_material_grid.py b/nidn/plots/plot_material_grid.py
index a296a04..194ea6b 100644
--- a/nidn/plots/plot_material_grid.py
+++ b/nidn/plots/plot_material_grid.py
@@ -7,16 +7,20 @@
 from ..training.model.model_to_eps_grid import model_to_eps_grid
 
 
-def plot_material_grid(run_cfg, save_path=None):
+def plot_material_grid(run_cfg, save_path=None, eps=None, plot_error=False):
     """Plots the materials closest to the used ones for each grid point. Optionally saves it.
 
     Args:
         run_cfg (dict): The run configuration.
         save_path (str, optional): Folder to save the plot in. Defaults to None, then the plot will not be saved.
+        eps (torch.tensor, optional): The epsilon tensor. Defaults to None, then the epsilon tensor will be computed from the run_cfg.
+        plot_error (bool, optional): If True, the error will be plotted. Defaults to False.
     """
     Nx, Ny, N_layers = run_cfg.Nx, run_cfg.Ny, run_cfg.N_layers
-    # Create epsilon grid from the model
-    eps, _ = model_to_eps_grid(run_cfg.model, run_cfg)
+
+    if eps is None:
+        # Create epsilon grid from the model
+        eps, _ = model_to_eps_grid(run_cfg.model, run_cfg)
 
     # Setup grid
     x = torch.linspace(-1, 1, Nx)
@@ -30,12 +34,15 @@ def plot_material_grid(run_cfg, save_path=None):
     # Get closest materials
     errors, material_id = _find_closest_material(eps, run_cfg)
 
-    cmap = plt.get_cmap("rainbow", material_collection.N_materials)
+    cmap = plt.get_cmap("tab20", material_collection.N_materials)
 
     # Here we plot it
     fig = plt.figure(figsize=(10, 5), dpi=150)
     fig.patch.set_facecolor("white")
-    ax = fig.add_subplot(121, projection="3d")
+    if plot_error:
+        ax = fig.add_subplot(121, projection="3d")
+    else:
+        ax = fig.add_subplot(111, projection="3d")
     ax.view_init(elev=25, azim=100)
     p = ax.scatter(
         X.reshape(-1, 1),
@@ -71,31 +78,32 @@ def plot_material_grid(run_cfg, save_path=None):
         z_labels[idx] = "L" + str(idx + 1)
     ax.set_zticklabels(z_labels)  # Where L1 is (seemingly) the bottom one
 
-    ax = fig.add_subplot(122, projection="3d")
-    ax.view_init(elev=25, azim=100)
-    p = ax.scatter(
-        X.reshape(-1, 1),
-        Y.reshape(-1, 1),
-        Z.reshape(-1, 1),
-        marker="s",
-        s=120,
-        linewidths=0,
-        c=errors.detach().cpu().numpy(),
-    )
-    cbar = plt.colorbar(p, ax=ax)
-    cbar.ax.tick_params(labelsize=7)
-    ax.grid(False)  # Hide grid lines
-    ax.set_xlabel("$N_x =$" + str(Nx))
-    ax.set_ylabel("$N_y =$" + str(Ny))
-    # ax.set_zlabel("# of layers", rotation=60)  # TODO Fix rotation
-    ax.set_xticks([])
-    ax.set_yticks([])
-    ax.set_zticks(np.linspace(-1, 1, N_layers))
+    if plot_error:
+        ax = fig.add_subplot(122, projection="3d")
+        ax.view_init(elev=25, azim=100)
+        p = ax.scatter(
+            X.reshape(-1, 1),
+            Y.reshape(-1, 1),
+            Z.reshape(-1, 1),
+            marker="s",
+            s=120,
+            linewidths=0,
+            c=errors.detach().cpu().numpy(),
+        )
+        cbar = plt.colorbar(p, ax=ax)
+        cbar.ax.tick_params(labelsize=7)
+        ax.grid(False)  # Hide grid lines
+        ax.set_xlabel("$N_x =$" + str(Nx))
+        ax.set_ylabel("$N_y =$" + str(Ny))
+        # ax.set_zlabel("# of layers", rotation=60)  # TODO Fix rotation
+        ax.set_xticks([])
+        ax.set_yticks([])
+        ax.set_zticks(np.linspace(-1, 1, N_layers))
 
-    z_labels = [""] * N_layers
-    for idx in range(N_layers):
-        z_labels[idx] = "L" + str(idx + 1)
-    ax.set_zticklabels(z_labels)  # Where L1 is (seemingly) the bottom one
+        z_labels = [""] * N_layers
+        for idx in range(N_layers):
+            z_labels[idx] = "L" + str(idx + 1)
+        ax.set_zticklabels(z_labels)  # Where L1 is (seemingly) the bottom one
 
     if save_path is not None:
         plt.savefig(save_path + "/material_grid.png", dpi=150)
diff --git a/nidn/plots/plot_spectra.py b/nidn/plots/plot_spectra.py
index f67d67d..74b13c8 100644
--- a/nidn/plots/plot_spectra.py
+++ b/nidn/plots/plot_spectra.py
@@ -10,14 +10,21 @@
 def _add_plot(
     fig, target_frequencies, produced_spectrum, target_spectrum, ylimits, nr, type_name
 ):
+    fontsize = 16
+
     ax = fig.add_subplot(nr)
     freqs = wl_to_phys_wl(freq_to_wl(target_frequencies)) * 1e6  # in µm
     ax.plot(freqs, produced_spectrum, marker=6, c="cornflowerblue")
     ax.plot(freqs, target_spectrum, marker=7, c="limegreen")
-    ax.legend([f"Produced {type_name}", f"Target {type_name}"], loc="lower center")
-    ax.set_xlabel("Wavelength [µm]")
-    ax.set_ylabel(f"{type_name}")
+    ax.legend(
+        [f"Produced {type_name}", f"Target {type_name}"],
+        loc="lower center",
+        fontsize=fontsize - 4,
+    )
+    ax.set_xlabel("Wavelength [µm]", fontsize=fontsize)
+    ax.set_ylabel(f"{type_name}", fontsize=fontsize)
     ax.set_xscale("log")
+    ax.tick_params(axis="both", which="major", labelsize=fontsize - 2)
     ax.xaxis.set_major_formatter(FormatStrFormatter("%.1f"))
     # ax.xaxis.set_minor_formatter(FormatStrFormatter("%.1f"))
     ax.axhspan(-6, 0, facecolor="gray", alpha=0.3)
@@ -25,25 +32,37 @@ def _add_plot(
     ax.set_ylim(ylimits)
 
     L1_err = abs(target_spectrum - produced_spectrum).mean()
-    ax.text(freqs[-1] - 0.02, -0.02, f"L1 Error = {L1_err:.4f}", va="top")
+    ax.text(
+        freqs[-1] - 0.02,
+        1.06,
+        f"L1 Error = {L1_err:.4f}",
+        va="top",
+        fontsize=fontsize - 4,
+    )
     return fig
 
 
-def plot_spectra(run_cfg, save_path=None):
+def plot_spectra(
+    run_cfg, save_path=None, prod_R_spectrum=None, prod_T_spectrum=None, filename=None
+):
     """Plots the produced RTA spectra together with the target spectra. Optionally saves it.
 
     Args:
         run_cfg (dict): The run configuration.
         save_path (str, optional): Folder to save the plot in. Defaults to None, then the plot will not be saved.
+        prod_R_spectrum (torch.tensor, optional): The produced reflection spectrum. Defaults to None, then will compute from model.
+        prod_T_spectrum (torch.tensor, optional): The produced transmission spectrum. Defaults to None, then will compute from model.
+        filename (str, optional): Filename to save the plot in. Defaults to None, then the plot will be saved with the name "spectra.png".
     """
     target_R_spectrum = run_cfg.target_reflectance_spectrum
     target_T_spectrum = run_cfg.target_transmittance_spectrum
 
-    # Create epsilon grid from the model
-    eps, _ = model_to_eps_grid(run_cfg.model, run_cfg)
+    if prod_R_spectrum is None or prod_T_spectrum is None:
+        # Create epsilon grid from the model
+        eps, _ = model_to_eps_grid(run_cfg.model, run_cfg)
 
-    # Compute the spectra for the given epsilon values
-    prod_R_spectrum, prod_T_spectrum = compute_spectrum(eps, run_cfg)
+        # Compute the spectra for the given epsilon values
+        prod_R_spectrum, prod_T_spectrum = compute_spectrum(eps, run_cfg)
 
     target_frequencies = run_cfg.target_frequencies
 
@@ -62,7 +81,7 @@ def plot_spectra(run_cfg, save_path=None):
     )
 
     # To align all plots
-    ylimits = [-0.225, 1.05]
+    ylimits = [-0.2, 1.075]
     if (
         (max(prod_A_spectrum) > 1 or min(prod_A_spectrum) < 0)
         or (max(prod_T_spectrum) > 1 or min(prod_T_spectrum) < 0)
@@ -108,4 +127,7 @@ def plot_spectra(run_cfg, save_path=None):
     plt.tight_layout()
 
     if save_path is not None:
-        plt.savefig(save_path + "/spectra_comparison.png", dpi=150)
\ No newline at end of file
+        if filename is None:
+            plt.savefig(save_path + "/spectra_comparison.png", dpi=150)
+        else:
+            plt.savefig(save_path + "/" + filename + ".png", dpi=300)
diff --git a/nidn/plots/plot_spectrum.py b/nidn/plots/plot_spectrum.py
index a6692e0..dcc7e75 100644
--- a/nidn/plots/plot_spectrum.py
+++ b/nidn/plots/plot_spectrum.py
@@ -13,7 +13,7 @@ def _add_plot(fig, target_frequencies, spectrum, ylimits, nr, type_name):
     ax.set_xlabel("Wavelength [µm]")
     ax.set_ylabel(f"{type_name}")
     ax.set_xscale("log")
-    ax.xaxis.set_major_formatter(FormatStrFormatter("%.1f"))
+    # ax.xaxis.set_major_formatter(FormatStrFormatter("%.1f"))
     # ax.xaxis.set_minor_formatter(FormatStrFormatter("%.1f"))
     ax.axhspan(-6, 0, facecolor="gray", alpha=0.3)
     ax.axhspan(1, 5, facecolor="gray", alpha=0.3)
@@ -21,7 +21,7 @@ def _add_plot(fig, target_frequencies, spectrum, ylimits, nr, type_name):
     return fig
 
 
-def plot_spectrum(run_cfg, R_spectrum, T_spectrum, save_path=None):
+def plot_spectrum(run_cfg, R_spectrum, T_spectrum, save_path=None, filename=None):
     """Plots the produced RTA spectra. Optionally saves it.
 
     Args:
@@ -29,6 +29,7 @@ def plot_spectrum(run_cfg, R_spectrum, T_spectrum, save_path=None):
         R_spectrum (torch.tensor): The reflection spectrum.
         T_spectrum (torch.tensor): The transmission spectrum.
         save_path (str, optional): Folder to save the plot in. Defaults to None, then the plot will not be saved.
+        filename (str, optional): Filename to save the plot in. Defaults to None, then the plot will be saved with the name "spectrum.png".
     """
 
     if not "target_frequencies" in run_cfg.keys():
@@ -91,4 +92,7 @@ def plot_spectrum(run_cfg, R_spectrum, T_spectrum, save_path=None):
     plt.tight_layout()
 
     if save_path is not None:
-        plt.savefig(save_path + "/spectrum.png", dpi=150)
+        if filename is None:
+            plt.savefig(save_path + "/spectrum.png", dpi=150)
+        else:
+            plt.savefig(save_path + "/" + filename + ".png", dpi=300)
diff --git a/nidn/training/model/model_to_eps_grid.py b/nidn/training/model/model_to_eps_grid.py
index 4b32cdc..1a8dfb4 100644
--- a/nidn/training/model/model_to_eps_grid.py
+++ b/nidn/training/model/model_to_eps_grid.py
@@ -2,6 +2,38 @@
 from dotmap import DotMap
 
 
+def _get_transformed_grid(Nx_undersampled, Ny_undersampled, N_layers, thicknesses):
+    """Creates x,y,z in the space [-1,1]**3 . Z weighted by thicknesses
+
+    Args:
+          model (torch.model): Trained neural network model. Should map one 4D input.
+        Nx_undersampled (int): Number of grid points in x direction. Potentially unesampled if eps_oversampling > 1.
+        Ny_undersampled (int): Number of grid points in y direction. Potentially unesampled if eps_oversampling > 1.
+        N_layers (int): Number of layers in the model.
+        target_frequencies (list): Target frequencies.
+        freq_distribution (list): Distribution of points in frequency space. Should be "linear" or "log".
+        thicknesses (list): List of thicknesses for each layer or scalar for all.
+    Returns:
+       [torch.tensor,torch.tensor,torch.tensor]: x,y,z
+
+    """
+    # Get the grid ticks
+    x = torch.linspace(-1, 1, Nx_undersampled)
+    y = torch.linspace(-1, 1, Ny_undersampled)
+
+    # Space z uniform for equally thick layers, else weight by thickness
+    if len(thicknesses) == 1:
+        z = torch.linspace(-1, 1, N_layers)
+    else:
+        total_thickness = sum(thicknesses)
+        # normalize to 0 to 1
+        z = torch.tensor(thicknesses) / total_thickness
+        # Transform to -1 to 1
+        z = (z * 2) - 1
+
+    return x, y, z
+
+
 def _avoid_zero_eps(eps, cutoff=1e-2):
     """Clips epsilon values close to zero to either cutoff or -cutoff.
 
@@ -28,6 +60,7 @@ def _eval_model(
     N_layers,
     target_frequencies,
     freq_distribution,
+    thicknesses,
 ):
     """Evaluates the model on the grid.
 
@@ -38,13 +71,13 @@ def _eval_model(
         N_layers (int): Number of layers in the model.
         target_frequencies (list): Target frequencies.
         freq_distribution (list): Distribution of points in frequency space. Should be "linear" or "log".
+        thicknesses (list): List of thicknesses for each layer or scalar for all.
     Returns:
        [torch.tensor]: Resulting 4D [real,imag] epsilon grid
     """
-    # Get the grid ticks
-    x = torch.linspace(-1, 1, Nx_undersampled)
-    y = torch.linspace(-1, 1, Ny_undersampled)
-    z = torch.linspace(-1, 1, N_layers)
+    x, y, z = _get_transformed_grid(
+        Nx_undersampled, Ny_undersampled, N_layers, thicknesses
+    )
 
     # Scales sampling domain of frequencies
     freq_scaling = 32.0
@@ -96,6 +129,7 @@ def _regression_model_to_eps_grid(model, run_cfg: DotMap):
         run_cfg.N_layers,
         run_cfg.target_frequencies,
         run_cfg.freq_distribution,
+        run_cfg.TRCWA_PER_LAYER_THICKNESS,
     )
 
     # Reshape the output to have a 4D tensor again
@@ -177,6 +211,7 @@ def _classification_model_to_eps_grid(model, run_cfg: DotMap):
         run_cfg.N_layers,
         run_cfg.target_frequencies,
         run_cfg.freq_distribution,
+        run_cfg.TRCWA_PER_LAYER_THICKNESS,
     )
 
     # Reshape the output to have a 4D tensor again
diff --git a/nidn/training/utils/validate_config.py b/nidn/training/utils/validate_config.py
index 3f9524b..8b74dfa 100644
--- a/nidn/training/utils/validate_config.py
+++ b/nidn/training/utils/validate_config.py
@@ -73,6 +73,13 @@ def _validate_config(cfg: DotMap):
     ]
     boolean_keys = ["use_regularization_loss", "add_noise", "use_gpu", "avoid_zero_eps"]
     string_keys = ["model_type", "type", "name", "freq_distribution"]
+    list_keys = [
+        "TRCWA_PER_LAYER_THICKNESS",
+        "TRCWA_L_grid",
+        "target_reflectance_spectrum",
+        "target_transmittance_spectrum",
+        "physical_wavelength_range",
+    ]
 
     for key in integer_keys:
         if not isinstance(cfg[key], int):
@@ -90,6 +97,10 @@ def _validate_config(cfg: DotMap):
         if not isinstance(cfg[key], str):
             raise ValueError(f"{key} must be a string")
 
+    for key in list_keys:
+        if not isinstance(cfg[key], list):
+            raise ValueError(f"{key} must be a list")
+
     # Check that all values are within the correct ranges
     if not (cfg.real_min_eps <= cfg.real_max_eps):
         raise ValueError(f"real_min_eps must be less than or equal to real_max_eps")
@@ -146,5 +157,14 @@ def _validate_config(cfg: DotMap):
     if not len(cfg.target_reflectance_spectrum) == cfg.N_freq:
         raise ValueError(f"target_reflectance_spectrum must have length N_freq")
 
+    if not (all(cfg.TRCWA_PER_LAYER_THICKNESS) > 0.0):
+        raise ValueError(f"thickness must a positive number.")
+
+    if not (
+        len(cfg.TRCWA_PER_LAYER_THICKNESS) == cfg.N_layers
+        or len(cfg.TRCWA_PER_LAYER_THICKNESS) == 1
+    ):
+        raise ValueError(f"TRCWA_PER_LAYER_THICKNESS must have length 1 or N_layers")
+
     if not (cfg.freq_distribution == "linear" or cfg.freq_distribution == "log"):
         raise ValueError(f"freq_distribution must be either 'linear' or 'log'")
diff --git a/nidn/trcwa/constants.py b/nidn/trcwa/constants.py
index 6d47897..f6a4fbe 100644
--- a/nidn/trcwa/constants.py
+++ b/nidn/trcwa/constants.py
@@ -15,8 +15,6 @@
 # Dielectric constant for top and bottom layer (vacuum layer)
 TRCWA_VACUUM_EPS = torch.tensor(1.0)
 
-TRCWA_PER_LAYER_THICKNESS = 1.0
-
 # Planewave excitation
 TRCWA_PLANEWAVE = {"p_amp": 0, "s_amp": 1, "p_phase": 0, "s_phase": 0}
 
diff --git a/nidn/trcwa/init_trcwa.py b/nidn/trcwa/init_trcwa.py
index 5062f4f..4481d47 100644
--- a/nidn/trcwa/init_trcwa.py
+++ b/nidn/trcwa/init_trcwa.py
@@ -2,6 +2,7 @@
 
 from .constants import *
 from .trcwa import TRCWA
+from ..materials.material_collection import MaterialCollection
 
 
 def _init_trcwa(eps_grid, target_frequency, run_cfg):
@@ -43,17 +44,27 @@ def _init_trcwa(eps_grid, target_frequency, run_cfg):
     )
 
     # Add vacuum layer at the top
-    trcwa.Add_LayerUniform(TRCWA_PER_LAYER_THICKNESS, TRCWA_VACUUM_EPS)
+    trcwa.Add_LayerUniform(thickness=1.0, epsilon=TRCWA_VACUUM_EPS)
 
     # Add material layers (homogeneous if Nx and Ny are 1)
     for layer in range(N_layers):
+
+        # Set thickness based on config
+        if len(run_cfg.TRCWA_PER_LAYER_THICKNESS) == 1:
+            thickness = run_cfg.TRCWA_PER_LAYER_THICKNESS[0]
+        else:
+            thickness = run_cfg.TRCWA_PER_LAYER_THICKNESS[layer]
+
         if Nx > 1 or Ny > 1:
-            trcwa.Add_LayerGrid(TRCWA_PER_LAYER_THICKNESS, Nx, Ny)
+            trcwa.Add_LayerGrid(thickness, Nx, Ny)
         else:
-            trcwa.Add_LayerUniform(TRCWA_PER_LAYER_THICKNESS, eps_grid[layer])
+            trcwa.Add_LayerUniform(thickness, eps_grid[layer])
+
+    # Add silicon nitride layer
+    # trcwa.Add_LayerUniform(thickness=1.0, epsilon=16.0 + 0.0j)
 
     # Add vacuum layer at the bottom
-    trcwa.Add_LayerUniform(TRCWA_PER_LAYER_THICKNESS, TRCWA_VACUUM_EPS)
+    trcwa.Add_LayerUniform(thickness=1.0, epsilon=TRCWA_VACUUM_EPS)
 
     # Initialize the object properly
     trcwa.Init_Setup()
diff --git a/nidn/utils/resources/default_config.toml b/nidn/utils/resources/default_config.toml
index fc8605d..9465266 100644
--- a/nidn/utils/resources/default_config.toml
+++ b/nidn/utils/resources/default_config.toml
@@ -34,6 +34,8 @@ Ny = 1
 N_layers = 8
 
 # TRCWA parameters
+TRCWA_PER_LAYER_THICKNESS = [1.0] # len 1 for uniform thickness
+# TRCWA_PER_LAYER_THICKNESS = [0.1,0.5,0.4] # optionally list of thicknesses for each layer
 TRCWA_L_grid = [[0.1,0.0],[0.0,0.1]] # grid dimension for TRCWA
 TRCWA_NG = 11 # Truncation order (actual number might be smaller)
 
diff --git a/notebooks/Example Notebook.ipynb b/notebooks/Example Notebook.ipynb
index 5c6a94c..b703aff 100644
--- a/notebooks/Example Notebook.ipynb
+++ b/notebooks/Example Notebook.ipynb
@@ -20,18 +20,6 @@
     "For this notebook, we will showcase one example of how NIDN can be used. Together with our Torch-based Rigorous Coupled-Wave Analysis (TRCWA) simulation tool, which is based on the [GRCWA package](https://github.com/weiliangjinca/grcwa) made by Weiliang Jin, we can find a structure that meets our requirements for reflection, transmission, and absorption, e.g., as for the example shown below."
    ]
   },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "5d179027",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# Picture of an example plot here\n",
-    "### NB: The legend should not say *Produced* Reflectance!\n",
-    "# "
-   ]
-  },
   {
    "attachments": {
     "radiflector_invdesign_explanation_v2.png": {
@@ -126,10 +114,12 @@
    "id": "792a1f25",
    "metadata": {},
    "source": [
-    "### Setting the target spectra\n",
+    "# Examples of how to run NIDN \n",
     "\n",
-    "The goal of using NIDN is to find a structure with reflection, transmission, and reflection spectra as close to you target spectra as possible. We might for instance want a filter that has a high transmission for wavelengths around 1.4 μm and low transmission for other wavelengths. The reflection should be opposite to that of the transmission and the absorption should be minimal for all wavelengths.\n",
-    "The target spectra with these requirements can be set using the following code:"
+    "Now, over to the exciting stuff. In this notebook, we will present three examples. The target spectra in the first and second example have been made using the `Running_TRCWA` notebook, i.e., they serve as ground truths. The structure used is a uniform single-layer made of titanium oxide. \n",
+    "In Example 1, the epsilon is unrestricted, meaning the dielectric constant can take any value within the upper and lower bounds for epsilon for every frequency point. This is what we call regression.\n",
+    "In Example 2, we redo Example 1 but using classification, where the material closest to the suggested epsilon is chosen. \n",
+    "In Example 3, we find the structure that satisfies the requirements outlined under Setting the target spectra, basically an optical filter."
    ]
   },
   {
@@ -137,20 +127,23 @@
    "execution_count": null,
    "id": "579aae8b",
    "metadata": {
-    "scrolled": true
+    "scrolled": false
    },
    "outputs": [],
    "source": [
     "# Load default cfg as starting point\n",
     "cfg = nidn.load_default_cfg()\n",
     "\n",
-    "# Can we here set the wavelength range? \n",
+    "# Specify your desired range of wavelengths\n",
+    "cfg.physical_wavelength_range[0] = 1e-6\n",
+    "cfg.physical_wavelength_range[1] = 1e-5\n",
+    "\n",
+    "# Let's investigate 32 frequency points\n",
+    "cfg.N_freq = 32\n",
     "\n",
-    "# Let's investigate 20 frequency points\n",
-    "cfg.N_freq = 20\n",
     "# Currently, the target spectra is set manually as a list of numbers \n",
-    "cfg.target_reflectance_spectrum =   [1.0]*12 + [0.0]*1 + [1.0]*7 #TODO check that this is correct\n",
-    "cfg.target_transmittance_spectrum = [0.0]*12 + [1.0]*1 + [0.0]*7\n",
+    "cfg.target_reflectance_spectrum =   [0.01990215,0.29430509,0.30827604,0.20568143,0.03479743,0.03237307,0.21794823,0.37803084,0.44122008,0.41114147,0.28422894,0.08763780,0.00471842,0.15989135,0.34718527,0.44319130,0.44568130,0.35408899,0.16817183,0.00585206,0.08819886,0.29369360,0.42720784,0.46166416,0.40164924,0.23886748,0.03722395,0.03982127,0.24579889,0.40972195,0.46816629,0.42871305]\n",
+    "cfg.target_transmittance_spectrum = [0.80566155,0.68022463,0.65655138,0.79343985,0.96515193,0.96756870,0.78199519,0.62191506,0.55872423,0.58879567,0.71569349,0.91226289,0.99516797,0.84000163,0.65271921,0.55671747,0.55422263,0.64579931,0.83168831,0.99398072,0.91163717,0.70616374,0.57266280,0.53820642,0.59820689,0.76095669,0.96255973,0.95995524,0.75400721,0.59010836,0.53166987,0.57111012]\n",
     "# Since R + T + A = 1, we only need to give the reflectance and transmittance (absorptance is implicit)\n",
     "\n",
     "nidn.plot_spectrum(cfg,\n",
@@ -159,11 +152,7 @@
     "\n",
     "physical_wls, normalized_freqs = nidn.get_frequency_points(cfg)\n",
     "print(\"Physical wavelengths are (in meters):\")\n",
-    "print(physical_wls)\n",
-    "\n",
-    "#Delete this:\n",
-    "from matplotlib import pyplot as plt\n",
-    "plt.show()"
+    "print(physical_wls)"
    ]
   },
   {
@@ -179,22 +168,9 @@
    "id": "62213b7b",
    "metadata": {},
    "source": [
-    "What happened in the cell above is that we choose 20 frequency points {logarithmically/linearly} spread between 0.1 and 4 in the frequency domain. In TRCWA, the frequencies are given in relation to the lattice vectors, given in micrometers. A frequency of 0.1 and 4 therefore corresponds to a physical wavelength of (1/0.1) μm = 10 μm and (1/4) μm = 0.25 μm, respectively, as given by nidn.get_frequency_points() function.\n",
-    "\n",
-    "If you want to make sure the design target is obtainable, for instance to use it as a ground truth, then you can do a simulation of the spectrum from some structure using the Running_TRCWA notebook."
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "addad103",
-   "metadata": {},
-   "source": [
-    "# Examples of how to run NIDN \n",
+    "What happened in the cell above is that we choose 32 frequency points {logarithmically/linearly} spread between 0.1 and 4 in the frequency domain. In TRCWA, the frequencies are given in relation to the lattice vectors, given in micrometers. A frequency of 0.1 and 4 therefore corresponds to a physical wavelength of (1/0.1) μm = 10 μm and (1/1) μm = 1.0 μm, respectively, as given by nidn.get_frequency_points() function.\n",
     "\n",
-    "Now, over to the exciting stuff. In this notebook, we will present three examples. The target spectra in the first and second example have been made using the Running_TRCWA notebook, i.e., they serve as ground truths. The structure used is a uniform single-layer made of titanium oxide. \n",
-    "In Example 1, the epsilon is unrestricted, meaning the dielectric constant can take any value within the upper and lower bounds for epsilon for every frequency point. This is what we call regression.\n",
-    "In Example 2, we redo Example 1 but using classification, where the material closest to the suggested epsilon is chosen. \n",
-    "In Example 3, we find the structure that satisfies the requirements outlined under Setting the target spectra, basically an optical filter."
+    "If you want to make sure the design target is obtainable, for instance to use it as a ground truth, then you can do a simulation of the spectrum from some structure using the `Running_TRCWA` notebook."
    ]
   },
   {
@@ -216,9 +192,16 @@
    "source": [
     "cfg.Nx = 1 # Set layer size  to 1x1 (interpreted as uniform)\n",
     "cfg.Ny = 1\n",
-    "cfg.N_layers = 5 # Choose number of layers\n",
+    "# cfg.N_layers = 1 # Choose number of layers\n",
+    "\n",
+    "# Allowed range of epsilon values\n",
+    "cfg.real_min_eps = 0.0\n",
+    "cfg.real_max_eps = 20.0\n",
+    "cfg.imag_min_eps = 0.0\n",
+    "cfg.imag_max_eps = 3.0\n",
+    "\n",
     "cfg.type = \"regression\" # Choose type as described above\n",
-    "cfg.iterations = 2000 # Set number of training iterations (that is forward model evaluations) to perform"
+    "cfg.iterations = 100 # Set number of training iterations (that is forward model evaluations) to perform"
    ]
   },
   {
@@ -246,7 +229,7 @@
    "execution_count": null,
    "id": "3b8c547a",
    "metadata": {
-    "scrolled": true
+    "scrolled": false
    },
    "outputs": [],
    "source": [
@@ -353,12 +336,12 @@
    "outputs": [],
    "source": [
     "cfg.pop(\"model\",None); # Forget the old model\n",
-    "cfg.Nx = 16 # Set layer size  to 16x16 (each of the grid points has its own epsilon now)\n",
-    "cfg.Ny = 16\n",
-    "cfg.eps_oversampling = 4\n",
-    "cfg.N_layers = 2 # Less layer to keep compute managable\n",
-    "cfg.type = \"regression\" # Choose type as described above (for now still regression)\n",
-    "cfg.iterations = 250 # Set number of training iterations (that is forward model evaluations) to perform"
+    "cfg.Nx = 1 # Set layer size  to 1x1 (interpreted as uniform)\n",
+    "cfg.Ny = 1\n",
+    "cfg.N_layers = 1 # Choose number of layers\n",
+    "\n",
+    "cfg.type = \"classification\" # Choose type as described above\n",
+    "cfg.iterations = 100 # Set number of training iterations (that is forward model evaluations) to perform"
    ]
   },
   {
@@ -391,7 +374,7 @@
    "id": "b5855a01",
    "metadata": {},
    "source": [
-    "As can be seen from the plots, the prediction is correct and, unsurprisingly, the loss is even lower."
+    "As can be seen from the plots, the prediction is correct and the loss is even lower."
    ]
   },
   {
@@ -401,10 +384,35 @@
    "source": [
     "## Example 3 - Optical filter with regression\n",
     "\n",
-    "For the third and final example, we will try to find the structure that satisfies the requirements outlined under Setting the target spectra using regression. The structure would work as an optical filter with transmission only for wavelengths around 1.4 micrometers.\n",
+    "The goal of using NIDN is to find a structure with reflection, transmission, and reflection spectra as close to you target spectra as possible. We might for instance want a filter that has a high transmission for wavelengths around 1550 nm and low transmission for other wavelengths. The reflection should be opposite to that of the transmission and the absorption should be minimal for all wavelengths.\n",
+    "The target spectra with these requirements can be set using the following code:\n",
+    "\n",
+    "For the third and final example, we will try to find a structure that satisfies these requirements setting the target spectra using regression. The structure would work as an optical filter with transmission only for wavelengths around 1550 nm.\n",
     "The structure consists of Y layers with X x X grid points per layer. As can be seen in the code below, we make use of oversampling."
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "b601e1b4",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Define target for the filter\n",
+    "cfg = nidn.load_default_cfg()\n",
+    "cfg.N_freq = 20\n",
+    "cfg.target_reflectance_spectrum =   12*[1.0] + [0.0] + 7*[1.0]\n",
+    "cfg.target_transmittance_spectrum = 12*[0.0] + [1.0] + 7*[0.0]\n",
+    "cfg.physical_wavelength_range[0] = 1e-6\n",
+    "cfg.physical_wavelength_range[1] = 1e-5\n",
+    "cfg.freq_distribution = \"linear\"\n",
+    "\n",
+    "\n",
+    "nidn.plot_spectrum(cfg,\n",
+    "                   cfg.target_reflectance_spectrum,\n",
+    "                   cfg.target_transmittance_spectrum)"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
@@ -412,20 +420,27 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "cfg.pop(\"model\",None); # Forget the old model\n",
-    "cfg.Nx = 16 # Set layer size  to 16x16 (each of the grid points has its own epsilon now)\n",
-    "cfg.Ny = 16\n",
-    "cfg.eps_oversampling = 8\n",
-    "cfg.N_layers = 2 # Less layer to keep compute managable\n",
-    "cfg.type = \"classification\" # Choose type as described above (for now still regression)\n",
-    "cfg.iterations = 250 # Set number of training iterations (that is forward model evaluations) to perform"
+    "# Allowed range of epsilon values\n",
+    "cfg.real_min_eps = 0.0\n",
+    "cfg.real_max_eps = 20.0\n",
+    "imag_min_eps = 0.0\n",
+    "imag_max_eps = 3.0\n",
+    "\n",
+    "cfg.Nx = 1 # Set layer size  to 16x16 (each of the grid points has its own epsilon now)\n",
+    "cfg.Ny = 1\n",
+    "cfg.eps_oversampling = 1\n",
+    "cfg.N_layers = 10 # Less layer to keep compute managable\n",
+    "cfg.type = \"regression\" # Choose type as described above (for now still regression)\n",
+    "cfg.iterations = 3000 # Set number of training iterations (that is forward model evaluations) to perform"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
    "id": "7a834af6",
-   "metadata": {},
+   "metadata": {
+    "scrolled": false
+   },
    "outputs": [],
    "source": [
     "nidn.run_training(cfg);"
@@ -491,11 +506,114 @@
     "# You can save all available plots to a single folder using this function\n",
     "nidn.save_all_plots(cfg,save_path=\"/results/example/\")"
    ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "c2de9e9b",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Squared german & tantalum layer\n",
+    "cfg = nidn.load_default_cfg()\n",
+    "cfg.N_freq = 20\n",
+    "cfg.target_reflectance_spectrum =   [0.60248210,0.20808528,0.10825184,0.55990793,0.72659247,0.74876763,0.65817925,0.32626005,0.03080333,0.50414092,0.71607931,0.75605811,0.68509433,0.38961000,0.01012443,0.48532436,0.71720245,0.76067772,0.69521557,0.41321222,]\n",
+    "cfg.target_transmittance_spectrum = [0.38656270,0.77990755,0.88060908,0.43550853,0.27110902,0.24957937,0.33986960,0.67012270,0.96391071,0.49316468,0.28246341,0.24277933,0.31350818,0.60775718,0.98545664,0.51235020,0.28152825,0.23829265,0.30353337,0.58443205,]\n",
+    "cfg.physical_wavelength_range[0] = 2e-6\n",
+    "cfg.physical_wavelength_range[1] = 1e-5\n",
+    "cfg.freq_distribution = \"linear\"\n",
+    "\n",
+    "nidn.plot_spectrum(cfg,\n",
+    "                   cfg.target_reflectance_spectrum,\n",
+    "                   cfg.target_transmittance_spectrum)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "15c5566e",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "cfg.pop(\"model\",None); # Forget the old model\n",
+    "cfg.Nx = 9 # Set layer size  to 1x1 (interpreted as uniform)\n",
+    "cfg.Ny = 9\n",
+    "cfg.eps_oversampling = 3\n",
+    "cfg.N_layers = 1 # Choose number of layers\n",
+    "cfg.type = \"regression\" # Choose type as described above\n",
+    "cfg.iterations = 5000 # Set number of training iterations (that is forward model evaluations) to perform"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "5181f3e4",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "nidn.run_training(cfg);"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "4d05689b",
+   "metadata": {
+    "scrolled": false
+   },
+   "outputs": [],
+   "source": [
+    "nidn.plot_losses(cfg)\n",
+    "nidn.plot_spectra(cfg)\n",
+    "nidn.plot_model_grid(cfg)\n",
+    "nidn.plot_eps_per_point(cfg)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "22683307",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "cfg.pop(\"model\",None); # Forget the old model\n",
+    "cfg.Nx = 9 # Set layer size  to 1x1 (interpreted as uniform)\n",
+    "cfg.Ny = 9\n",
+    "cfg.eps_oversampling = 3\n",
+    "cfg.N_layers = 1 # Choose number of layers\n",
+    "cfg.type = \"classification\" # Choose type as described above\n",
+    "cfg.iterations = 5000 # Set number of training iterations (that is forward model evaluations) to perform"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "a908be60",
+   "metadata": {
+    "scrolled": false
+   },
+   "outputs": [],
+   "source": [
+    "nidn.run_training(cfg);"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "1bb9d3ac",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "nidn.plot_losses(cfg)\n",
+    "nidn.plot_spectra(cfg)\n",
+    "nidn.plot_model_grid(cfg)\n",
+    "nidn.plot_eps_per_point(cfg)"
+   ]
   }
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python 3 (ipykernel)",
    "language": "python",
    "name": "python3"
   },
@@ -509,7 +627,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.3"
+   "version": "3.9.6"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/Running_TRCWA.ipynb b/notebooks/Running_TRCWA.ipynb
index 3f2b908..67d51f2 100644
--- a/notebooks/Running_TRCWA.ipynb
+++ b/notebooks/Running_TRCWA.ipynb
@@ -43,16 +43,20 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "7d2f1747",
+   "id": "15dbc61e",
    "metadata": {},
    "outputs": [],
    "source": [
+    "# Titanium Oxide Uniform\n",
     "# Set grid specifics\n",
     "cfg.Nx = 15\n",
     "cfg.Ny = 15\n",
     "cfg.N_layers = 1\n",
-    "cfg.N_freq = 64\n",
+    "cfg.N_freq = 32\n",
     "cfg.TRCWA_L_grid = [[0.1,0.0],[0.0,0.1]]\n",
+    "cfg.TRCWA_NG = 11\n",
+    "cfg.TRCWA_PER_LAYER_THICKNESS = [1.0]\n",
+    "cfg.freq_distribution = \"linear\"\n",
     "\n",
     "# Specify your desired range of wavelengths\n",
     "cfg.physical_wavelength_range[0] = 1e-6\n",
@@ -63,32 +67,41 @@
     "    cfg.physical_wavelength_range[0],\n",
     "    cfg.physical_wavelength_range[1],\n",
     "    cfg.N_freq,\n",
-    "    cfg.freq_distribution,\n",
+    "    cfg.freq_distribution\n",
     ")"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "6b82281c",
+   "id": "dea2d797",
    "metadata": {},
    "outputs": [],
    "source": [
     "# Init eps_grid\n",
     "eps_grid = torch.zeros(cfg.Nx,cfg.Ny,cfg.N_layers,cfg.N_freq,dtype=torch.cfloat)\n",
     "\n",
-    "# Create a uniform layer, one with a circle, one with a hole\n",
-    "layer_builder = nidn.LayerBuilder(cfg)\n",
-    "# eps_grid[:,:,0,:] = layer_builder.build_uniform_layer(\"titanium_oxide\")\n",
-    "eps_grid[:,:,0,:] = layer_builder.build_squared_layer(\"germanium\",\"tantalum_pentoxide\")\n",
-    "# eps_grid[:,:,1,:] = layer_builder.build_uniform_layer(\"tantalum_pentoxide\")\n",
-    "# eps_grid[:,:,1,:] = layer_builder.build_squared_layer(\"tantalum_pentoxide\",\"titanium_oxide\")"
+    "layer_builder = nidn.LayerBuilder(cfg)"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "fca3fc90",
+   "id": "51cb8542",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Uniform Titanium oxide\n",
+    "eps_grid[:,:,0,:] = layer_builder.build_uniform_layer(\"titanium_oxide\")\n",
+    "eps_grid[:,:,1,:] = layer_builder.build_uniform_layer(\"germanium\")\n",
+    "eps_grid[:,:,2,:] = layer_builder.build_uniform_layer(\"tantalum_pentoxide\")\n",
+    "# eps_grid[:,:,0,:] = layer_builder.build_circle_layer(\"tantalum_pentoxide\",\"titanium_oxide\")"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "171ffae2",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -110,7 +123,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "c5c39ade",
+   "id": "0e34694f",
    "metadata": {},
    "outputs": [],
    "source": [
@@ -146,7 +159,171 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "id": "3f257c45",
+   "id": "c5799f8d",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Set grid specifics\n",
+    "cfg.Nx = 1\n",
+    "cfg.Ny = 1\n",
+    "cfg.N_layers = 25\n",
+    "cfg.N_freq = 40\n",
+    "cfg.TRCWA_L_grid = [[1.,0.0],[0.0,1.]]\n",
+    "cfg.TRCWA_NG = 11\n",
+    "\n",
+    "# Specify your desired range of wavelengths\n",
+    "cfg.physical_wavelength_range[0] = (1.3)*1e-6\n",
+    "cfg.physical_wavelength_range[1] = (1.7)*1e-6\n",
+    "\n",
+    "# Determine target frequencies (in TRCWA units)\n",
+    "cfg.target_frequencies = nidn.compute_target_frequencies(\n",
+    "    cfg.physical_wavelength_range[0],\n",
+    "    cfg.physical_wavelength_range[1],\n",
+    "    cfg.N_freq,\n",
+    "    cfg.freq_distribution\n",
+    ")"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "cf04c733",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Init eps_grid\n",
+    "eps_grid = torch.zeros(cfg.Nx,cfg.Ny,cfg.N_layers,cfg.N_freq,dtype=torch.cfloat)\n",
+    "\n",
+    "layer_builder = nidn.LayerBuilder(cfg)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "3d9a6cdf",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "thicknesses = []\n",
+    "\n",
+    "n_2 = 2.2\n",
+    "n_1 = 1.5\n",
+    "eps_1 = n_1**2\n",
+    "eps_2 = n_2**2\n",
+    "\n",
+    "lam0 = 1.50\n",
+    "d_1 = lam0/(4*n_1)\n",
+    "d_2 = lam0/(4*n_2)\n",
+    "d_defect = lam0/(2*n_1)\n",
+    "\n",
+    "# Top DBR\n",
+    "for i in range(6):\n",
+    "    eps_grid[:,:,2*i,:] = eps_1\n",
+    "    thicknesses.append(d_1)\n",
+    "    eps_grid[:,:,2*i+1,:] = eps_2\n",
+    "    thicknesses.append(d_2)\n",
+    "    \n",
+    "# Defect \n",
+    "eps_grid[:,:,12,:] = eps_1\n",
+    "thicknesses.append(d_defect)\n",
+    "\n",
+    "# Bottom DBR\n",
+    "for i in range(6,12):\n",
+    "    eps_grid[:,:,2*i+1,:] = eps_2\n",
+    "    thicknesses.append(d_2)\n",
+    "    eps_grid[:,:,2*i+2,:] = eps_1\n",
+    "    thicknesses.append(d_1)\n",
+    "\n",
+    "thicknesses.reverse()\n",
+    "cfg.TRCWA_PER_LAYER_THICKNESS = thicknesses\n",
+    "    \n",
+    "# eps_grid[:,:,0,:] = layer_builder.build_uniform_layer(\"titanium_oxide\")\n",
+    "# eps_grid[:,:,0,:] = layer_builder.build_squared_layer(\"germanium\",\"tantalum_pentoxide\")\n",
+    "#eps_grid[:,:,1,:] = layer_builder.build_uniform_layer(\"aluminium_nitride\")\n",
+    "#eps_grid[:,:,2,:] = layer_builder.build_squared_layer(\"titanium_oxide\",\"germanium\")"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "dbac2e63",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "d_1"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "e9e1e5f6",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "d_2"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "bf467d0d",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "d_defect"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "2a503788",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Plot the abs values of the produced grid\n",
+    "nidn.plot_epsilon_grid(eps_grid,cfg)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "8fdeb119",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# Compute spectrum for this configuration\n",
+    "R,T = nidn.compute_spectrum(eps_grid,cfg)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "26b1f85f",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "nidn.plot_spectrum(cfg,R,T)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "4e1c12b3",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "print(\"R = [\")\n",
+    "[print(f\"{r.item():.8f}\",end=\",\") for r in R]\n",
+    "print(\"]\")\n",
+    "print(\"T = [\")\n",
+    "[print(f\"{t.item():.8f}\",end=\",\") for t in T]\n",
+    "print(\"]\")"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "ff06a683",
    "metadata": {},
    "outputs": [],
    "source": []


Test patch:
diff --git a/nidn/tests/trcwa_test.py b/nidn/tests/trcwa_test.py
index 72c3c14..41a8e48 100644
--- a/nidn/tests/trcwa_test.py
+++ b/nidn/tests/trcwa_test.py
@@ -21,6 +21,7 @@ def test_single_layer():
     run_cfg.N_freq = 1
     run_cfg.TRCWA_L_grid = [[1.0, 0.0], [0.0, 1.0]]
     run_cfg.TRCWA_NG = 11
+    run_cfg.TRCWA_PER_LAYER_THICKNESS = [1.0]
 
     # Get eps shape
     shape = [
@@ -31,7 +32,13 @@ def test_single_layer():
     ]
 
     # Get a grid of 1 + 1j
-    eps_grid = torch.ones(shape, dtype=torch.cfloat,) * (1.0 + 1j)
+    eps_grid = (
+        torch.ones(
+            shape,
+            dtype=torch.cfloat,
+        )
+        * (1.0 + 1j)
+    )
 
     logger.debug("Computing spectrum...")
 
@@ -59,6 +66,7 @@ def test_uniform_layer():
     run_cfg.N_freq = 2
     run_cfg.TRCWA_L_grid = [[1.0, 0.0], [0.0, 1.0]]
     run_cfg.TRCWA_NG = 11
+    run_cfg.TRCWA_PER_LAYER_THICKNESS = [1.0]
 
     # Get eps shape
     shape = [
@@ -69,7 +77,10 @@ def test_uniform_layer():
     ]
 
     # Get a grid of 3 + 1.5j
-    eps_grid = torch.ones(shape, dtype=torch.cfloat,)
+    eps_grid = torch.ones(
+        shape,
+        dtype=torch.cfloat,
+    )
 
     eps_grid = eps_grid * (3.0 + 1.5j)
 
@@ -102,6 +113,7 @@ def test_three_layer():
     run_cfg.N_freq = 1
     run_cfg.TRCWA_L_grid = [[1.0, 0.0], [0.0, 1.0]]
     run_cfg.TRCWA_NG = 11
+    run_cfg.TRCWA_PER_LAYER_THICKNESS = [1.0]
 
     # Get eps shape
     shape = [
@@ -112,7 +124,13 @@ def test_three_layer():
     ]
 
     # Get a somewhat interesting grid
-    eps_grid = torch.ones(shape, dtype=torch.cfloat,) * (-4.2 + 0.42j)
+    eps_grid = (
+        torch.ones(
+            shape,
+            dtype=torch.cfloat,
+        )
+        * (-4.2 + 0.42j)
+    )
 
     eps_grid[0:3, 0:3, 0, :] = eps_grid[0:3, 0:3, 0, :] * 1.0
     eps_grid[0:3, 0:3, 1, :] = eps_grid[0:3, 0:3, 1, :] * 2.0