pycba.results.Envelopes#
- class Envelopes(vResults)[source]#
Bases:
objectEnvelopes load effects from a vector of BeamResults.
- x#
Coordinates along the beam.
- Type:
np.ndarray
- Vmax, Vmin
Maximum and minimum shear force envelopes.
- Type:
np.ndarray
- Mmax, Mmin
Maximum and minimum bending moment envelopes.
- Type:
np.ndarray
- Vco_Mmax#
Shear coincident with the moment maximum at each point.
- Type:
np.ndarray
- Vco_Mmin#
Shear coincident with the moment minimum at each point.
- Type:
np.ndarray
- Mco_Vmax#
Moment coincident with the shear maximum at each point.
- Type:
np.ndarray
- Mco_Vmin#
Moment coincident with the shear minimum at each point.
- Type:
np.ndarray
- Rmax, Rmin
Reaction history matrices (nsup x nres).
- Type:
np.ndarray
- Rmaxval, Rminval
Maximum and minimum reaction per support.
- Type:
np.ndarray
Constructs the envelope of each load effect given a vector of results for the beam. Also tracks coincident (co-existing) load effects: the value of the other effect (V or M) at the analysis that caused each envelope extreme.
- Parameters:
vResults (
List[MemberResults]) – The vector of results from each analysis that are to be enveloped.- Return type:
None.
Methods
Return envelope values at a global coordinate by interpolation.
Augments this set of envelopes with another compatible set, making this the envelopes of the two sets of envelopes.
Merge several compatible envelopes into a new
Envelopes.Build a single-result
Envelopesfrom one analysed beam.Split a station-indexed envelope array into per-span values.
Plots the envelopes of bending and shear.
Plot each load-effect envelope together with the coincident value of the other effect, grouped by which extreme drives them.
Adds another compatible set of envelopes to this one element-wise.
Write the envelopes (an
xcolumn plus each requested attribute) to a CSV file withnumpy.savetxt()(no pandas needed).Return the envelopes as a
pandas.DataFramewith anxcolumn and one column per requested envelope attribute (default the moment and shear extremes).Returns a zeroed zet of envelopes like the reference
pycba.results.Envelopes.- classmethod zero_like(env)[source]#
Returns a zeroed zet of envelopes like the reference
pycba.results.Envelopes. This is necessary since apycba.results.Envelopesobject stores information about the beam from which it came. This facilitates the creation of an envelope of envelopes.- Parameters:
env (
Envelopes) – Apycba.results.Envelopesto be used as the basis for a zeroedpycba.results.Envelopesobject.- Returns:
A
pycba.results.Envelopesobject of zero-valued envelopes.- Return type:
- classmethod combine(envs, mode='envelope')[source]#
Merge several compatible envelopes into a new
Envelopes.This is a one-call replacement for the
zero_like+ repeatedaugment()/sum()ritual. The input envelopes are left unmutated; a freshEnvelopesis returned.- Parameters:
envs (
Sequence[Envelopes]) – One or more compatiblepycba.results.Envelopesobjects (samenptsandnsup). All must come from the same beam geometry.mode (
str) –"envelope"(default) takes the governing maxima/minima of moment and shear (plus coincident effects and reaction extremes) by callingaugment()for each input."sum"superimposes the envelopes element-wise by callingsum()for each input.
- Returns:
A new merged
pycba.results.Envelopesobject.- Return type:
- Raises:
ValueError – If
envsis empty ormodeis not"envelope"or"sum".
Notes
When the merged envelopes come from analyses with differing numbers of results (
nres), only the reaction extremes (Rmaxval/Rminval) are retained; the per-analysis reaction history is zeroed. This is the pre-existing behaviour ofaugment()/sum().
- classmethod from_beam_analysis(ba)[source]#
Build a single-result
Envelopesfrom one analysed beam.This is the discoverable adapter that lifts an ordinary
pycba.analysis.BeamAnalysisresult (for example the result of apycba.load_cases.LoadCombination.analyze()call) into a first-classpycba.results.Envelopes, so it can be merged withcombine()or the|/+operators and plotted.- Parameters:
ba (BeamAnalysis) – An analysed beam whose
beam_resultsare available.- Returns:
A one-result
pycba.results.Envelopes.- Return type:
- Raises:
ValueError – If
bahas not been analysed (ba.beam_resultsisNone).
- augment(env)[source]#
Augments this set of envelopes with another compatible set, making this the envelopes of the two sets of envelopes. Coincident values are updated to match whichever envelope governs at each point.
All envelopes must be from the same
pycba.bridge.BridgeAnalysisobject.If the envelopes have a different number of analyses (due to differing vehicle lengths, for example), then only the reaction extreme are retained, and not the entire reaction history.
- Parameters:
env (
Envelopes) – A compatiblepycba.results.Envelopesobject.- Raises:
ValueError – All envelopes must be for the same bridge.
- Return type:
None.
- sum(env)[source]#
Adds another compatible set of envelopes to this one element-wise. This is useful for superimposing load effects from different sources, e.g. a patterned UDL envelope with a moving vehicle envelope.
All envelopes must be for the same beam geometry.
If the envelopes have a different number of analyses (due to differing vehicle lengths, for example), then only the reaction extremes are retained, and not the entire reaction history.
- Parameters:
env (
Envelopes) – A compatiblepycba.results.Envelopesobject.- Raises:
ValueError – All envelopes must be for the same beam geometry.
- Return type:
None.
- __add__(other)[source]#
Superposition of
selfandother(non-mutating).a + bis sugar forEnvelopes.combine([a, b], mode="sum")and returns a newEnvelopeswith the two operands summed element-wise. Neither operand is mutated.Note that this differs from
sum(), which mutates in place and returnsNone.- Return type:
- at(x, attrs=('Mmax', 'Mmin', 'Vmax', 'Vmin'))[source]#
Return envelope values at a global coordinate by interpolation.
The station array
self.xrepeats span-boundary coordinates (each span contributes its own start and end), so this method de-duplicates the stations withnumpy.unique()before interpolating. It replaces the manualidx = (np.abs(env.x - x)).argmin()lookup.- Parameters:
x (
float) – Global coordinate measured from the left end of the beam.attrs (
Tuple[str,...]) – Envelope attribute names to evaluate. The default returns the moment and shear extremes.
- Returns:
Mapping from each requested attribute name to its interpolated value at
x.- Return type:
Dict[str,float]
- to_dataframe(attrs=('Mmax', 'Mmin', 'Vmax', 'Vmin'))[source]#
Return the envelopes as a
pandas.DataFramewith anxcolumn and one column per requested envelope attribute (default the moment and shear extremes). Requirespandas.
- to_csv(path, attrs=('Mmax', 'Mmin', 'Vmax', 'Vmin'), **kwargs)[source]#
Write the envelopes (an
xcolumn plus each requested attribute) to a CSV file withnumpy.savetxt()(no pandas needed). Returnspath.
- per_span(attr='Mmax', reduce='auto')[source]#
Split a station-indexed envelope array into per-span values.
The station array concatenates each member’s stations, so this method chunks the requested attribute using the per-member station counts read from
self.vResults[0].vRes(each member’sxlength, i.e.npts + 3) rather than a hard-coded constant. It replaces the manualenv.Vmax[i * (n + 3):(i + 1) * (n + 3)]slicing.- Parameters:
attr (
str) – Envelope attribute name to split (default"Mmax").reduce (
str) – How to reduce each per-span chunk."auto"(default) takes the maximum for*maxattributes and the minimum for*minattributes;"max"/"min"force the reduction;"none"returns the list of raw chunks.
- Returns:
One reduced value per span, or the list of raw chunks when
reduce="none".- Return type:
ndarray- Raises:
ValueError – If
reduceis not one of"auto","max","min","none".
- plot(each=False, units=None, backend=None, **kwargs)[source]#
Plots the envelopes of bending and shear.
- Parameters:
each (Boolean) – Wether or not to show each BMD and SFD in the enveloping. The default is False
units (str or pycba.units.UnitSystem, optional) – Display unit system for the labels (see
pycba.set_units()).backend ({"matplotlib", "plotly"}, optional) – Plotting backend; defaults to the global default (see
pycba.set_backend()). With"plotly"an interactive, hover-to-read envelope figure (aplotly.graph_objects.Figure) is returned, with the max/min band shaded;eachand**kwargsdo not apply.**kwargs (Dict) – Matplotlib keyword arguments for plotting.
- Return type:
None.
- plot_coincidents(units=None, show=True, figsize=(10, 6))[source]#
Plot each load-effect envelope together with the coincident value of the other effect, grouped by which extreme drives them.
For combined-action checks at a section you need not the extreme of one effect but the value of the other effect at the vehicle position that produced it. Two panels share the distance axis, each with dual y-axes (so both quantities are solid lines on their own scale):
the moment panel — the moment envelope
Mmax/Mmin(left axis) and the shear that coexists with those moment extremes,Vco_Mmax/Vco_Mmin(right axis);the shear panel — the shear envelope
Vmax/Vmin(left axis) and the moment that coexists with those shear extremes,Mco_Vmax/Mco_Vmin(right axis).
- Parameters:
units (str or pycba.units.UnitSystem, optional) – Display unit system for the labels (see
pycba.set_units()).show (bool) – Call
matplotlib.pyplot.show()before returning (default True).figsize (tuple(float, float), optional) – Figure size in inches.
- Returns:
matplotlib.figure.Figure
numpy.ndarray of matplotlib.axes.Axes – The two primary (left-axis) panel axes; the coincident (right-axis) twins are reachable via
fig.axes.