Skip to content
Snippets Groups Projects
Commit d8ec4bf4 authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Update example 'laser_system' to use a ray source in combination with an...

Update example 'laser_system' to use a ray source in combination with an energy analyzer to repeat the error.

Attacking #315
parent d96b3620
No related branches found
No related tags found
1 merge request!205Fix beamsplitter example
use std::path::Path; use std::path::Path;
use num::Zero; use num::Zero;
use opossum::{ use opossum::{
analyzers::{AnalyzerType, RayTraceConfig}, analyzers::{AnalyzerType, RayTraceConfig},
error::OpmResult, error::OpmResult,
joule, millimeter, joule,
lightdata::{DataEnergy, LightData},
millimeter,
nodes::{ nodes::{
round_collimated_ray_source, BeamSplitter, EnergyMeter, IdealFilter, NodeGroup, round_collimated_ray_source, BeamSplitter, EnergyMeter, IdealFilter, NodeGroup, ParaxialSurface, Source, SpotDiagram
ParaxialSurface, SpotDiagram,
}, },
ray::SplittingConfig, ray::SplittingConfig,
spectrum_helper::create_he_ne_spec,
OpmDocument, OpmDocument,
}; };
use uom::si::f64::Length; use uom::si::f64::Length;
...@@ -17,11 +18,15 @@ use uom::si::f64::Length; ...@@ -17,11 +18,15 @@ use uom::si::f64::Length;
fn main() -> OpmResult<()> { fn main() -> OpmResult<()> {
let mut scenery = NodeGroup::new("laser system"); let mut scenery = NodeGroup::new("laser system");
// Main beam line // Main beam line
let i_src = scenery.add_node(round_collimated_ray_source(
millimeter!(1.0), // let source = Source::new(
joule!(1.0), // "Source",
3, // &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_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_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))?)?; let i_bs = scenery.add_node(BeamSplitter::new("1% BS", &SplittingConfig::Ratio(0.99))?)?;
...@@ -79,6 +84,7 @@ fn main() -> OpmResult<()> { ...@@ -79,6 +84,7 @@ fn main() -> OpmResult<()> {
scenery.connect_nodes(i_f, "rear", i_cam_box, "input", Length::zero())?; scenery.connect_nodes(i_f, "rear", i_cam_box, "input", Length::zero())?;
let mut doc = OpmDocument::new(scenery); 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")) doc.save_to_file(Path::new("./opossum/playground/laser_system.opm"))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment