diff --git a/opossum/examples/laser_system.rs b/opossum/examples/laser_system.rs index eb23c5b03f2aa21a39e37bdfa7206b0e40d0a20b..44db4d3a36a66843b22f3b32d56fa49db0c1db5d 100644 --- a/opossum/examples/laser_system.rs +++ b/opossum/examples/laser_system.rs @@ -1,15 +1,16 @@ use std::path::Path; - use num::Zero; use opossum::{ analyzers::{AnalyzerType, RayTraceConfig}, error::OpmResult, - joule, millimeter, + joule, + lightdata::{DataEnergy, LightData}, + millimeter, nodes::{ - round_collimated_ray_source, BeamSplitter, EnergyMeter, IdealFilter, NodeGroup, - ParaxialSurface, SpotDiagram, + round_collimated_ray_source, BeamSplitter, EnergyMeter, IdealFilter, NodeGroup, ParaxialSurface, Source, SpotDiagram }, ray::SplittingConfig, + spectrum_helper::create_he_ne_spec, OpmDocument, }; use uom::si::f64::Length; @@ -17,11 +18,15 @@ use uom::si::f64::Length; fn main() -> OpmResult<()> { let mut scenery = NodeGroup::new("laser system"); // Main beam line - let i_src = scenery.add_node(round_collimated_ray_source( - millimeter!(1.0), - joule!(1.0), - 3, - )?)?; + + // let source = Source::new( + // "Source", + // &LightData::Energy(DataEnergy { + // spectrum: create_he_ne_spec(1.0)?, + // }), + // ); + let source = round_collimated_ray_source(millimeter!(1.0), joule!(1.0), 3)?; + let i_src = scenery.add_node(source)?; let i_l1 = scenery.add_node(ParaxialSurface::new("f=100", millimeter!(100.0))?)?; let i_l2 = scenery.add_node(ParaxialSurface::new("f=200", millimeter!(200.0))?)?; let i_bs = scenery.add_node(BeamSplitter::new("1% BS", &SplittingConfig::Ratio(0.99))?)?; @@ -79,6 +84,7 @@ fn main() -> OpmResult<()> { scenery.connect_nodes(i_f, "rear", i_cam_box, "input", Length::zero())?; let mut doc = OpmDocument::new(scenery); - doc.add_analyzer(AnalyzerType::RayTrace(RayTraceConfig::default())); + // doc.add_analyzer(AnalyzerType::RayTrace(RayTraceConfig::default())); + doc.add_analyzer(AnalyzerType::Energy); doc.save_to_file(Path::new("./opossum/playground/laser_system.opm")) }