Helper function to deal with an xarray consisting of pd.Intervals. Each interval is replaced with both boundaries. I.e. the length of xarray doubles. yarray is modified so it matches the new shape of xarray.
(
xarray: Iterable[pd.Interval], yarray: Iterable
)
| 579 | |
| 580 | |
| 581 | def _interval_to_double_bound_points( |
| 582 | xarray: Iterable[pd.Interval], yarray: Iterable |
| 583 | ) -> tuple[np.ndarray, np.ndarray]: |
| 584 | """ |
| 585 | Helper function to deal with an xarray consisting of pd.Intervals. Each |
| 586 | interval is replaced with both boundaries. I.e. the length of xarray |
| 587 | doubles. yarray is modified so it matches the new shape of xarray. |
| 588 | """ |
| 589 | |
| 590 | xarray1 = np.array([x.left for x in xarray]) |
| 591 | xarray2 = np.array([x.right for x in xarray]) |
| 592 | |
| 593 | xarray_out = np.array( |
| 594 | list(itertools.chain.from_iterable(zip(xarray1, xarray2, strict=True))) |
| 595 | ) |
| 596 | yarray_out = np.array( |
| 597 | list(itertools.chain.from_iterable(zip(yarray, yarray, strict=True))) |
| 598 | ) |
| 599 | |
| 600 | return xarray_out, yarray_out |
| 601 | |
| 602 | |
| 603 | def _resolve_intervals_1dplot( |
no outgoing calls
no test coverage detected
searching dependent graphs…