qpv-research-group / rayflare

Open-source, integrated optical modelling of complex stacks
Other
31 stars 11 forks source link

process_structure doesn't work as expected if non-valid optical method is specified #35

Open phoebe-p opened 2 years ago

phoebe-p commented 2 years ago

Describe the bug Currently, if anything other than the valid optical methods ("RT_Fresnel", "RT_TMM", "RCWA", "TMM", "Mirror", "Lambertian") for the angular redistribution matrix method is specified in an Interface, the matrices for that interface are simply not calculated during process_structure, but no error or warning is given. Obviously, this leads to failure later on when trying to calculate_RAT because the expected files are not found.

To Reproduce Steps to reproduce the behavior:

bad_surface = Interface('Non_existent_method', layers=[],
                                name ='test')
bad_structure = Structure([bad_surface, bulk, bad_surface],
                    incidence=Air, transmission=Air)
process_structure(bad_structure, options)
RAT = calculate_RAT(bad_structure, options)

Expected behavior process_structure should give an error rather than failing silently.