py-pilecore 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of py-pilecore might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py-pilecore
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Public python SDK for the CEMS PileCore web-API.
5
5
  License: MIT License
6
6
 
@@ -1,24 +1,24 @@
1
1
  pypilecore/__init__.py,sha256=T2Uuao6fboVhrzKI_Sa7jXbcNAUl_PKk9BFdsozOG98,78
2
- pypilecore/_version.py,sha256=0_HYvCjqXJ8bLPFLe6E2tkYlW15w7EOTtTD9FQ5jQGM,175
2
+ pypilecore/_version.py,sha256=2dffVSzjhtY2kCEG85L-fZD3Xh0WRlG_TJVCqG9EfHc,175
3
3
  pypilecore/api.py,sha256=dXgjfttEUcQHUCMkTX9eYip0dd3bf_ppE6cdx87ouHY,6822
4
4
  pypilecore/exceptions.py,sha256=-MZOfsxyHLCI0k1-wZFfVsMxc1lya5buuhLks5rxlCo,89
5
5
  pypilecore/plot_utils.py,sha256=rK5_067-4-x7LzZgt_t6ahcGrZInxNrqHqsy0RzCnq8,954
6
6
  pypilecore/utils.py,sha256=ib9LgJBIgWukL7zd_Zk1LP27UTMIZTRJ4RBB6ubn97o,1186
7
7
  pypilecore/input/__init__.py,sha256=tlmThdPtO8e6L6pqxuRQ7EOHRxYwuIcaNNGlZyAnzig,606
8
8
  pypilecore/input/grouper_properties.py,sha256=qOc-SNYSPdOcZZ9DsRE-sBNVOKHbUD044EWRsWDu_kc,10893
9
- pypilecore/input/multi_cpt.py,sha256=Ua5IN9-m1jgCwa5xFNAYrMcxkVe2L1LIW907CWLJBW0,19577
9
+ pypilecore/input/multi_cpt.py,sha256=cYwsbxX-BFfDSmhOXiasm5TVQiWt4GQr0Q4jwYmcynI,19592
10
10
  pypilecore/input/pile_properties.py,sha256=6O7iH-f7_G9PZbBsbzSWT_zUF2RtwYLfF5GRtUFvhHk,8404
11
11
  pypilecore/input/soil_properties.py,sha256=oqZWeSvhGyIKl4j0ZlGr923qyxkBjYxbVKBckG2rLAw,7687
12
12
  pypilecore/results/__init__.py,sha256=ggTI2QzILhX_oNx1YMOih6IVCkBFg8I5-Jyn9Sw3_h0,389
13
13
  pypilecore/results/grouper_result.py,sha256=wQxWSJRrgh7aO5pglrCNTPvCNdERBMDXAlm6YZE3v-s,30927
14
14
  pypilecore/results/load_settlement.py,sha256=EbfTrSvH_g96KE-x8ZjmO8D0mt5KFaQ_-AR8u4blLsU,9752
15
- pypilecore/results/multi_cpt_results.py,sha256=dzNpP3hu0Sl00gNPHT37DcQqLbfp8IYci46QLSycyqA,25398
15
+ pypilecore/results/multi_cpt_results.py,sha256=9unVE0sp25khcAhDM_CFRRgqg_SpTQCDW0L0hOtzxSg,30678
16
16
  pypilecore/results/pile_properties.py,sha256=z1R5UNoYjBem2rS8LMJ_ye2J5ejDoSilU5fCjUrNdUg,28592
17
17
  pypilecore/results/post_processing.py,sha256=UWXcdff5dhPFDwzKbVIayEIp3HX6pxW8oQR3Z7AHPn0,22262
18
18
  pypilecore/results/single_cpt_results.py,sha256=irNqsL_cBKUh-QEmWC216KZjkv9MAZkaiLTvDDlEt20,17448
19
19
  pypilecore/results/soil_properties.py,sha256=Mcwz23PcaIW1xKLabMUSfIeKCTBli7ouuZPfT5dfrb4,20722
20
- py_pilecore-0.4.1.dist-info/LICENSE,sha256=3OCAZXffN0Bettjeya8uF_ZYegyvvCfH1WUt6CrHb_0,1061
21
- py_pilecore-0.4.1.dist-info/METADATA,sha256=oQzHxa-c_UofjtUdg5FCaFWsqvanEgxCxuAkn3M_A3g,5834
22
- py_pilecore-0.4.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
- py_pilecore-0.4.1.dist-info/top_level.txt,sha256=7BKIWZuSkbQtJ0ho5P1JvcaEbHzqADCcBuOduZmIaiI,11
24
- py_pilecore-0.4.1.dist-info/RECORD,,
20
+ py_pilecore-0.4.2.dist-info/LICENSE,sha256=3OCAZXffN0Bettjeya8uF_ZYegyvvCfH1WUt6CrHb_0,1061
21
+ py_pilecore-0.4.2.dist-info/METADATA,sha256=zeeDiTfTKJFa3I-TaPIKjFEayHGER0m2uKzd1FLRubM,5834
22
+ py_pilecore-0.4.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
23
+ py_pilecore-0.4.2.dist-info/top_level.txt,sha256=7BKIWZuSkbQtJ0ho5P1JvcaEbHzqADCcBuOduZmIaiI,11
24
+ py_pilecore-0.4.2.dist-info/RECORD,,
pypilecore/_version.py CHANGED
@@ -4,4 +4,4 @@ try:
4
4
  __version__ = version("py-pilecore")
5
5
  # during CI
6
6
  except PackageNotFoundError:
7
- __version__ = "0.4.1"
7
+ __version__ = "0.4.2"
@@ -313,9 +313,9 @@ def create_multi_cpt_payload(
313
313
  individual_ocr=individual_ocr,
314
314
  )
315
315
  pile_properties = create_pile_properties_payload(
316
- pile_type=pile_type,
317
- specification=specification,
318
- installation=installation,
316
+ pile_type=str(pile_type),
317
+ specification=str(specification),
318
+ installation=str(installation),
319
319
  pile_shape=pile_shape,
320
320
  diameter_base=diameter_base,
321
321
  diameter_shaft=diameter_shaft,
@@ -7,6 +7,7 @@ import matplotlib.pyplot as plt
7
7
  import numpy as np
8
8
  import pandas as pd
9
9
  from matplotlib.axes import Axes
10
+ from matplotlib.patches import Patch
10
11
 
11
12
  from pypilecore.exceptions import UserError
12
13
  from pypilecore.results.load_settlement import get_load_settlement_plot
@@ -548,6 +549,166 @@ class MultiCPTBearingResults:
548
549
  """The CPTGroupResultsTable dataclass, containing the group results."""
549
550
  return self._group_results_table
550
551
 
552
+ def boxplot(
553
+ self,
554
+ attribute: str,
555
+ axes: Axes | None = None,
556
+ figsize: Tuple[float, float] = (6.0, 6.0),
557
+ show_sqrt: bool = False,
558
+ **kwargs: Any,
559
+ ) -> Axes:
560
+ """
561
+ Plot a box and whisker plot for a given attribute.
562
+
563
+
564
+ .. code-block:: none
565
+
566
+ MIN Q1 median Q3 MAX
567
+ |-----:-----|
568
+ |--------| : |--------|
569
+ |-----:-----|
570
+
571
+ Parameters
572
+ ----------
573
+ attribute:
574
+ result attribute to create boxplot. Please note that the attribute name must be present in
575
+ the `CPTResultsTable` and `CPTGroupResultsTable` class.
576
+ axes:
577
+ Optional `Axes` object where the boxplot data can be plotted on.
578
+ If not provided, a new `plt.Figure` will be activated and the `Axes`
579
+ object will be created and returned.
580
+ figsize:
581
+ Size of the activate figure, as the `plt.figure()` argument.
582
+ show_sqrt:
583
+ Add sqrt(2) bandwidth to figure
584
+ **kwargs:
585
+ All additional keyword arguments are passed to the `pyplot.subplots()` call.
586
+
587
+ Returns
588
+ -------
589
+ axes:
590
+ The `Axes` object where the settlement curves were plotted on
591
+ """
592
+
593
+ # validate attribute
594
+ if (
595
+ attribute not in self.cpt_results.results[0].table.__dict__.keys()
596
+ or attribute not in self.group_results_table.__dict__.keys()
597
+ ):
598
+ raise ValueError(
599
+ f"""
600
+ {attribute} is not present in CPTResultsTable or CPTGroupResultsTable class.
601
+ Please select on of the following attributes:
602
+ {
603
+ set(self.cpt_results.results[0].table.__dict__.keys())
604
+ & set(self.group_results_table.__dict__.keys())
605
+ }
606
+ """
607
+ )
608
+
609
+ # Create axes objects if not provided
610
+ if axes is not None:
611
+ if not isinstance(axes, Axes):
612
+ raise ValueError(
613
+ "'axes' argument to boxplot() must be a `pyplot.axes.Axes` object or None."
614
+ )
615
+ else:
616
+ kwargs_subplot = {
617
+ "figsize": figsize,
618
+ "tight_layout": True,
619
+ }
620
+
621
+ kwargs_subplot.update(kwargs)
622
+
623
+ _, axes = plt.subplots(
624
+ 1,
625
+ 1,
626
+ **kwargs_subplot,
627
+ )
628
+
629
+ if not isinstance(axes, Axes):
630
+ raise ValueError(
631
+ "Could not create Axes objects. This is probably due to invalid matplotlib keyword arguments. "
632
+ )
633
+
634
+ # Collect data from single calculation
635
+ data = np.array(
636
+ [
637
+ item.table.__getattribute__(attribute)
638
+ for item in self.cpt_results.results
639
+ ]
640
+ )
641
+
642
+ # Draw a box and whisker plot
643
+ axes.boxplot(
644
+ np.flip(data, axis=0),
645
+ labels=np.flip(self.group_results_table.pile_tip_level_nap),
646
+ whis=(0, 100),
647
+ autorange=True,
648
+ vert=False,
649
+ patch_artist=True,
650
+ showmeans=True,
651
+ zorder=0,
652
+ )
653
+
654
+ # ad additional bandwidth of sqrt(2) of the mean value
655
+ if show_sqrt:
656
+ axes.scatter(
657
+ np.flip(data.mean(axis=0)) * np.sqrt(2),
658
+ np.flip(
659
+ np.arange(len(self.group_results_table.pile_tip_level_nap)) + 1
660
+ ),
661
+ marker="^",
662
+ color="tab:purple",
663
+ zorder=1,
664
+ )
665
+ axes.scatter(
666
+ np.flip(data.mean(axis=0)) / np.sqrt(2),
667
+ np.flip(
668
+ np.arange(len(self.group_results_table.pile_tip_level_nap)) + 1
669
+ ),
670
+ marker="^",
671
+ color="tab:purple",
672
+ zorder=1,
673
+ )
674
+
675
+ # Draw group result over single result
676
+ axes.scatter(
677
+ np.flip(self.group_results_table.__getattribute__(attribute)),
678
+ np.flip(np.arange(len(self.group_results_table.pile_tip_level_nap)) + 1),
679
+ marker="o",
680
+ color="tab:red",
681
+ zorder=1,
682
+ )
683
+
684
+ # Draw group result over single result
685
+ for i, x in enumerate(data.mean(axis=0)):
686
+ axes.annotate(f"{x.round(2)}", xy=(x, i + 1))
687
+
688
+ # add legend to figure
689
+ axes.legend(
690
+ handles=[
691
+ Patch(color=clr, label=key)
692
+ for (key, clr) in {
693
+ "Single;min:max": "black",
694
+ "Single;Q25:Q75": "tab:blue",
695
+ "Single;Q50": "tab:orange",
696
+ "Single;mean": "tab:green",
697
+ "Single;mean;sqrt": "tab:purple",
698
+ "Group;normative": "tab:red",
699
+ }.items()
700
+ ],
701
+ loc="upper left",
702
+ bbox_to_anchor=(1, 1),
703
+ title=f"Bandwidth {attribute}",
704
+ )
705
+
706
+ # set label
707
+ axes.set_ylabel("Depth [m NAP]")
708
+ axes.set_xlabel(f"{attribute}")
709
+
710
+ return axes
711
+
551
712
  def plot_load_settlement(
552
713
  self,
553
714
  pile_tip_level_nap: float,