rsoft_cad.lantern package

Submodules

rsoft_cad.lantern.base_lantern module

Base class for photonic lantern implementations with common functionality.

class rsoft_cad.lantern.base_lantern.BaseLantern(**params)[source]

Bases: RSoftCircuit

Base class for photonic lantern implementations with common functionality.

__init__(**params)[source]

Initialize the base lantern with default parameters.

Parameters:

**params – Any parameters to override default fiber properties

set_taper_factor(taper_factor=1)[source]

Set the same taper factor for all fibers in the bundle.

Parameters:

taper_factor – The taper factor to set for all fibers (default: 1). A taper factor of 1 means no tapering.

set_taper_length(taper_length=10000)[source]

Set the same taper length for all fibers in the bundle.

Parameters:

taper_length – The taper length to set for all fibers in microns (default: 10000).

update_bundle_with_core_map(core_map)[source]

Updates the fiber bundle with position information from the core map.

This function assigns spatial coordinates to each fiber in the bundle based on the mode-to-position mapping.

Parameters:

core_map (dict) – Mapping of mode strings to (x,y) coordinate tuples

__str__()[source]

Custom string representation of the BaseLantern object.

Returns:

A formatted string showing all fiber properties in the bundle

Return type:

str

rsoft_cad.lantern.fiber_config module

Module for handling fiber-specific configuration for photonic lanterns.

class rsoft_cad.lantern.fiber_config.FiberConfigurator(bundle)[source]

Bases: object

Handles fiber-specific configuration for photonic lanterns.

__init__(bundle)[source]

Initialize the fiber configurator.

Parameters:

bundle (dict) – The fiber bundle to configure

set_core_dia(core_dict)[source]

Set the core diameter for specified modes in the bundle.

Parameters:

core_dict – Dictionary mapping mode names to core diameters. Example: {“LP01”: 8.2, “LP11a”: 9.5}

set_core_index(core_index_dict)[source]

Set the core refractive index for specified modes in the bundle.

Parameters:

core_index_dict – Dictionary mapping mode names to core refractive indices. Example: {“LP01”: 1.4682, “LP11a”: 1.4685}

set_cladding_dia(cladding_dia_dict)[source]

Set the cladding diameter for specified modes in the bundle.

Parameters:

cladding_dia_dict – Dictionary mapping mode names to cladding diameters in microns. Example: {“LP01”: 125.0, “LP11a”: 125.0}

set_cladding_index(cladding_index_dict)[source]

Set the cladding refractive index for specified modes in the bundle.

Parameters:

cladding_index_dict – Dictionary mapping mode names to cladding refractive indices. Example: {“LP01”: 1.4629, “LP11a”: 1.4630}

set_bg_index(bg_index_dict)[source]

Set the background refractive index for specified modes in the bundle.

Parameters:

bg_index_dict – Dictionary mapping mode names to background refractive indices. Example: {“LP01”: 1.0, “LP11a”: 1.0}

filter_core_diameters(core_diameters)[source]

Filter the core diameters to only include modes that exist in the bundle.

Parameters:

core_diameters (dict) – Dictionary mapping mode names to core diameters

Returns:

Filtered dictionary with only modes that exist in the bundle

Return type:

dict

rsoft_cad.lantern.mode_selective_lantern module

rsoft_cad.lantern.photonic_lantern module

rsoft_cad.lantern.segment_manager module

Module for handling segment creation and management for photonic lanterns.

This module provides functionality to create and manage various segments in photonic lantern structures, including fiber segments, capillary segments, and launching configurations. It interfaces with RSoft CAD to implement the physical structures.

class rsoft_cad.lantern.segment_manager.SegmentManager(circuit_ref)[source]

Bases: object

Handles the creation and management of segments for photonic lanterns.

This class provides methods to add fiber segments (both core and cladding), capillary segments, and configure launch fields for simulation of photonic lantern structures.

__init__(circuit_ref) None[source]

Initialize the segment manager with a reference to the circuit.

Parameters:

circuit_ref – Reference to the RSoftCircuit object that will be used to add segments and pathways.

add_fiber_segment(bundle: Dict[str, Dict[str, float | str]], core_or_clad: str = 'core', monitor_type: MonitorType = 'MONITOR_WGMODE_POWER', taper_type: TaperType = 'TAPER_LINEAR', segment_prop_overrides: Dict[str, Any] | None = None, per_fiber_overrides: Dict[str, Dict[str, Any]] | None = None) bool[source]

Add a fiber segment with core and cladding based on fiber properties.

Creates segments for each fiber in the bundle with appropriate dimensions and refractive index profiles. If adding core segments, also creates pathways and monitors for each segment.

Parameters:
  • bundle – Dictionary mapping LP mode names to fiber properties. Each fiber property dict should contain keys for position (‘pos_x’, ‘pos_y’), dimensions (‘core_dia’, ‘cladding_dia’), refractive indices (‘core_index’, ‘cladding_index’, ‘bg_index’), and taper properties (‘taper_factor’, ‘taper_length’).

  • core_or_clad – Whether to add “core” or “cladding” segments. Defaults to “core”.

  • monitor_type – Type of monitor to add to each pathway. Defaults to FIBER_POWER.

  • taper_type – Taper profile to use if tapering is applied. Defaults to LINEAR.

  • segment_prop_overrides – Dictionary to override default properties for all segments. Keys should match the segment property names (e.g., ‘begin.x’, ‘end.z’).

  • per_fiber_overrides – Dictionary mapping LP mode names to property overrides for specific fibers. Each value should be a dictionary of property name to value mappings.

Returns:

True if the segments were successfully added.

Examples

# Basic usage (existing functionality) manager.add_fiber_segment(bundle)

# Override properties for all fibers manager.add_fiber_segment(bundle, segment_prop_overrides={“begin.z”: 5})

# Override properties for specific fibers manager.add_fiber_segment(

bundle, per_fiber_overrides={

“LP01”: {“comp_name”: “CORE_LP01_SPECIAL”}, “LP11”: {“begin.width”: 12}

}

)

add_capillary_segment(cap_dia: float, taper_factor: float, taper_length: float, taper_type: TaperType = 'TAPER_LINEAR', segment_prop_overrides: Dict[str, Any] | None = None, monitor_type: MonitorType = 'MONITOR_WGMODE_POWER') bool[source]

Add a capillary segment to contain the fibers.

Creates a cylindrical segment centered at the origin that can serve as a container for the fiber bundle. The capillary can be tapered from its initial diameter by the specified taper factor.

Parameters:
  • cap_dia – Capillary diameter in microns

  • taper_factor – Taper factor for the capillary (ratio of input to output diameter)

  • taper_length – Taper length in microns

  • taper_type – Taper profile to use if tapering is applied. Defaults to LINEAR.

  • segment_prop_overrides – Dictionary to override default properties for the capillary segment. Keys should match the segment property names (e.g., ‘begin.x’, ‘end.z’).

  • monitor_type – Type of monitor to add to the pathway. Defaults to FIBER_POWER.

Returns:

True if the capillary segment was successfully added

Examples

# Basic usage (existing functionality) manager.add_capillary_segment(100, 2, 1000)

# Override capillary properties manager.add_capillary_segment(

100, 2, 1000, segment_prop_overrides={“comp_name”: “CAPILLARY_CUSTOM”, “begin.x”: 10}

)

launch_from_fiber(bundle: Dict[str, Dict[str, float | str]], lp_node: str, launch_type: LaunchType = 'LAUNCH_GAUSSIAN', launch_prop_overrides: Dict[str, Any] | None = None) None[source]

Configure launch field from a specific fiber.

Sets up the initial field distribution for simulation, launching from a specified fiber in the bundle with characteristics matching that fiber’s core properties.

Parameters:
  • bundle – Dictionary mapping LP mode names to fiber properties

  • lp_node – The LP mode identifier to launch from (key in the bundle dict)

  • launch_type – Type of field distribution to launch. Defaults to GAUSSIAN.

  • launch_prop_overrides – Dictionary to override default launch properties. Keys should match the launch field parameters (e.g., ‘launch_tilt’, ‘launch_width’).

Returns:

None

Examples

# Basic usage (existing functionality) manager.launch_from_fiber(bundle, “LP01”)

# Override launch properties manager.launch_from_fiber(

bundle, “LP01”, launch_prop_overrides={

“launch_tilt”: 5, “launch_width”: 20

}

)