solrat.engine.generators.merge_frame module¶
- solrat.engine.generators.merge_frame.merge(df1, df2, on=None)[source]¶
Merge helper function with overwritten default behavior.
- class solrat.engine.generators.merge_frame.SumLimits[source]¶
Bases:
objectSum limits base class.
The inheriting classes control the limits for the summation indexes such as \(L, J, K, Q,\) etc. We start from the ‘base_frame’ which has some indexes and quantities already pre-merged, like \(L_l, L_u, S\), Einstein coefficients. Then we can determine the boundaries of the summation indexes that follow.
Triangular means from \(|a-b|\) to \(a + b\) (both ends included)
FromTo means from \(a\) to \(b\) (both ends included)
Intersection means including only shared values of 2 or more sets of values.
For further information inspect each Looper individually.
- class solrat.engine.generators.merge_frame.FrameFactor(name: str, factor: Callable | None = None, dependencies: List[str] | None = None, merged: bool = False, elementwise: bool = False)[source]¶
Bases:
objectSingle multiplicand in the frame
- class solrat.engine.generators.merge_frame.Frame(base_frame: DataFrame | None = None, **kwargs: Looper)[source]¶
Bases:
Generic[SumLimitsT]Frame engine for performing multiplication and summation.
Loopers are merged immediately to the base frame. Factors are stored and evaluated+merged when needed.
- construct_sub_frame(columns: List[str]) DataFrame[source]¶
This is used to reduce the evaluations of loopers/factors to minimum: we get all unique dependencies, evaluate on them, then merge back to the frame.
- register_multiplication(*args: Callable, elementwise: bool = False, **kwargs)[source]¶
This just registers the factors. They will be evaluated/merged later on demand.
- merge_factor(factor_name: str)[source]¶
Construct factor frame, evaluate, and merge it to the main frame
- combine_all_merged_factors() str[source]¶
Multiply all merged factors so that the frame has a single combined merged factor.
- get_other_frame_columns(exclude: str) List[str][source]¶
Get looper columns other than the specified one
- reduce_single_index(column: str | Looper)[source]¶
Reduction is Looper-wise (this way it clearly follows the logic of ‘summation’ operation)
- reduce(*args: Looper | str) ndarray | float | complex | Self[source]¶
usage: frame.reduce() to reduce all, frame.reduce(col1, col2, …, col5, col6) to specify first and last columns to reduce
- to_coefficient() Self[source]¶
Merge all registered factors into a single ‘coefficient’ column without reducing any loop columns. Use this when you want the coefficient but still need all loop columns for index lookup.