rsoft_cad package
- rsoft_cad.configure_logging(log_file='simulation.log', log_level=20)[source]
Configure logging for the rsoft_cad package.
Subpackages
- rsoft_cad.beamprop package
- rsoft_cad.femsim package
- rsoft_cad.geometry package
- rsoft_cad.lantern package
- rsoft_cad.layout package
- rsoft_cad.optimisation package
- rsoft_cad.simulations package
- rsoft_cad.utils package
Submodules
rsoft_cad.constants module
Constants and configuration data for the RSoft CAD package.
rsoft_cad.rsoft_circuit module
- class rsoft_cad.rsoft_circuit.RSoftCircuit(params=None, **extra_param)[source]
Bases:
object
- class rsoft_cad.rsoft_circuit.TaperType(taper_type, custom_filename=None)[source]
Bases:
objectA class representing a taper profile with optional custom data file.
- NONE = 'TAPER_NONE'
- LINEAR = 'TAPER_LINEAR'
- QUADRATIC = 'TAPER_QUADRATIC'
- EXPONENTIAL = 'TAPER_EXPONENTIAL'
- USER_PREFIX = 'TAPER_USER_'
- class rsoft_cad.rsoft_circuit.LaunchType[source]
Bases:
object- FILE = 'LAUNCH_FILE'
- COMPUTED_MODE = 'LAUNCH_COMPMODE'
- FIBER_MODE = 'LAUNCH_WGMODE'
- GAUSSIAN = 'LAUNCH_GAUSSIAN'
- RECTANGLE = 'LAUNCH_RECTANGLE'
- MULTIMODE = 'LAUNCH_MULTIMODE'
- PLANE_WAVE = 'LAUNCH_PLANEWAVE'
- class rsoft_cad.rsoft_circuit.MonitorType[source]
Bases:
object- FILE_POWER = 'MONITOR_FILE_POWER'
- FILE_PHASE = 'MONITOR_FILE_PHASE'
- FIBER_POWER = 'MONITOR_WGMODE_POWER'
- FIBER_PHASE = 'MONITOR_WGMODE_PHASE'
- GAUSS_POWER = 'MONITOR_GAUSS_POWER'
- GAUSS_PHASE = 'MONITOR_GAUSS_PHASE'
- LAUNCH_POWER = 'MONITOR_LAUNCH_POWER'
- LAUNCH_PHASE = 'MONITOR_LAUNCH_PHASE'
- PARTIAL_POWER = 'MONITOR_WG_POWER'
- TOTAL_POWER = 'MONITOR_TOTAL_POWER'
- N_EFF = 'MONITOR_FIELD_NEFF'
- FIELD_WIDTH = 'MONITOR_FIELD_WIDTH'
- FIELD_HEIGHT = 'MONITOR_FIELD_HEIGHT'
- FIELD_AREA = 'MONITOR_FIELD_AEFF'
rsoft_cad.rsoft_simulations module
- rsoft_cad.rsoft_simulations.run_simulation(design_filepath: str, design_filename: str, sim_package: str, prefix_name: str, save_folder: str = 'launch_files', hide_sim: bool = True) CompletedProcess[source]
Run simulation for the specified design file and launch mode.
This function executes a simulation for a given photonic lantern design file using the specified simulation package. It creates a target directory for simulation results if it doesn’t exist, changes to that directory to run the simulation, and then returns to the original directory.
- Parameters:
design_filepath (str) – Path to the directory containing the design file
design_filename (str) – Name of the design file to simulate
sim_package (str) – Simulation package to use (e.g., ‘femsim’ or ‘bsimw32’)
prefix_name (str) – Prefix to use for output files
save_folder (str) – Folder name to save simulation results (default: “launch_files”)
hide_sim (bool) – Whether to hide the simulation window (default: True)
- Returns:
Result of the simulation process, containing stdout, stderr, and return code
- Return type:
CompletedProcess
- Raises:
OSError – If there are issues creating directories or changing working directory
subprocess.SubprocessError – If the simulation process fails to execute
- rsoft_cad.rsoft_simulations.rename_component_files(directory, file_prefix='femsim', dry_run=False)[source]
Renames files by moving component indicators (ex, ey, ez, etc.) from the end to the beginning.
- Parameters:
- Returns:
List of tuples containing (old_filename, new_filename) for renamed files
- Return type:
- rsoft_cad.rsoft_simulations.copy_component_files(directory, file_prefix='femsim', output_directory=None, dry_run=False)[source]
Copies files and moves component indicators (ex, ey, ez, etc.) from the end to the beginning. Original files are preserved.
- Parameters:
directory (str) – The directory containing files to process
file_prefix (str) – The prefix of files to process (default: “femsim”)
output_directory (str) – Directory to save new files (default: same as source directory)
dry_run (bool) – If True, only show what would be copied without actually copying
- Returns:
List of tuples containing (old_filename, new_filename) for copied files
- Return type: