compute_lost_power_per_meter module
Convert lost power of one or several patran1.out into lost power per
meter.
Todo
Sometimes the lost power in first row is 1e-10 or something? Check this out when I see it appear again.
Todo
May be included to post-processing from within LightWin directly
- compute(folderpath, full_project=False, z_min=None, z_max=None, definition='running_mean', **kwargs)[source]
Compute the lost power per meter for all given file(s).
- Parameters:
path – Path to a single
partran1.outfile, or to a full LightWin project.full_project (
bool, default:False) – Indicate if the given path is a full project. If True, we take all the LightWin out folders inpathwith a name like000000_refor000032(we look for folders with 6 digits in it). In each one, we treat1_TraceWin/partran1.outfile. If False, we try to findpatran1.outinpath/,path/1_TraceWin(ifpathis not already a file).z_min (
float|None, default:None) – If provided, points outside of this range will be filtered out. The default is None, in which case all points are kept.z_max (
float|None, default:None) – If provided, points outside of this range will be filtered out. The default is None, in which case all points are kept.definitions – How the lost power should be calculated.
definition (
Literal['naive','running_mean','meter_per_meter'], default:'running_mean')
- Return type:
- _treat_single(path, z_min, z_max, **kwargs)[source]
Load the given filepath and compute lost power in W/m.
- _running_mean(position, quantity, window=1.0, sigma=0.5)[source]
Provide running_mean of
quantityover a length ofwindow.
- _meter_per_meter(position, quantity, window=1.0)[source]
Sum lost power between 0 and 1m, between 1 and 2m, etc.
- _treat_full_project(paths, z_min, z_max, save_folder=None, **kwargs)[source]
Load several files and concatenate the lost powers.
- get_partran1_paths(folderpath, full_project, verbose=False, **kwargs)[source]
- Overloads:
folderpath (Path), full_project (Literal[True]), verbose (bool), kwargs (Any) → dict[str, Path]
folderpath (Path), full_project (Literal[False]), verbose (bool), kwargs (Any) → Path
- Parameters:
- Return type:
Gather the file(s) to treat.