py-pilecore 0.3.4__py3-none-any.whl → 0.4.1__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.3.4
3
+ Version: 0.4.1
4
4
  Summary: Public python SDK for the CEMS PileCore web-API.
5
5
  License: MIT License
6
6
 
@@ -37,6 +37,7 @@ Requires-Dist: matplotlib <4,>=3.8
37
37
  Requires-Dist: tqdm[notebook] <5,>4
38
38
  Requires-Dist: natsort <9,>8
39
39
  Requires-Dist: shapely <3,>=2
40
+ Requires-Dist: scipy <2,>=1
40
41
  Provides-Extra: docs
41
42
  Requires-Dist: Sphinx ==6.1.3 ; extra == 'docs'
42
43
  Requires-Dist: sphinx-autodoc-typehints ==1.22 ; extra == 'docs'
@@ -0,0 +1,24 @@
1
+ pypilecore/__init__.py,sha256=T2Uuao6fboVhrzKI_Sa7jXbcNAUl_PKk9BFdsozOG98,78
2
+ pypilecore/_version.py,sha256=0_HYvCjqXJ8bLPFLe6E2tkYlW15w7EOTtTD9FQ5jQGM,175
3
+ pypilecore/api.py,sha256=dXgjfttEUcQHUCMkTX9eYip0dd3bf_ppE6cdx87ouHY,6822
4
+ pypilecore/exceptions.py,sha256=-MZOfsxyHLCI0k1-wZFfVsMxc1lya5buuhLks5rxlCo,89
5
+ pypilecore/plot_utils.py,sha256=rK5_067-4-x7LzZgt_t6ahcGrZInxNrqHqsy0RzCnq8,954
6
+ pypilecore/utils.py,sha256=ib9LgJBIgWukL7zd_Zk1LP27UTMIZTRJ4RBB6ubn97o,1186
7
+ pypilecore/input/__init__.py,sha256=tlmThdPtO8e6L6pqxuRQ7EOHRxYwuIcaNNGlZyAnzig,606
8
+ pypilecore/input/grouper_properties.py,sha256=qOc-SNYSPdOcZZ9DsRE-sBNVOKHbUD044EWRsWDu_kc,10893
9
+ pypilecore/input/multi_cpt.py,sha256=Ua5IN9-m1jgCwa5xFNAYrMcxkVe2L1LIW907CWLJBW0,19577
10
+ pypilecore/input/pile_properties.py,sha256=6O7iH-f7_G9PZbBsbzSWT_zUF2RtwYLfF5GRtUFvhHk,8404
11
+ pypilecore/input/soil_properties.py,sha256=oqZWeSvhGyIKl4j0ZlGr923qyxkBjYxbVKBckG2rLAw,7687
12
+ pypilecore/results/__init__.py,sha256=ggTI2QzILhX_oNx1YMOih6IVCkBFg8I5-Jyn9Sw3_h0,389
13
+ pypilecore/results/grouper_result.py,sha256=wQxWSJRrgh7aO5pglrCNTPvCNdERBMDXAlm6YZE3v-s,30927
14
+ pypilecore/results/load_settlement.py,sha256=EbfTrSvH_g96KE-x8ZjmO8D0mt5KFaQ_-AR8u4blLsU,9752
15
+ pypilecore/results/multi_cpt_results.py,sha256=dzNpP3hu0Sl00gNPHT37DcQqLbfp8IYci46QLSycyqA,25398
16
+ pypilecore/results/pile_properties.py,sha256=z1R5UNoYjBem2rS8LMJ_ye2J5ejDoSilU5fCjUrNdUg,28592
17
+ pypilecore/results/post_processing.py,sha256=UWXcdff5dhPFDwzKbVIayEIp3HX6pxW8oQR3Z7AHPn0,22262
18
+ pypilecore/results/single_cpt_results.py,sha256=irNqsL_cBKUh-QEmWC216KZjkv9MAZkaiLTvDDlEt20,17448
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
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.3.4"
7
+ __version__ = "0.4.1"
pypilecore/api.py CHANGED
@@ -5,29 +5,67 @@ from nuclei.client import NucleiClient
5
5
  from requests import Response
6
6
 
7
7
 
8
- def wait_until_ticket_is_ready(client: NucleiClient, ticket: Response) -> None:
8
+ def wait_until_ticket_is_ready(
9
+ client: NucleiClient, ticket: Response, verbose: bool = False
10
+ ) -> None:
11
+ if verbose:
12
+ logging.info("Waiting for ticket to be ready")
13
+
9
14
  if ticket.status_code != 200:
10
15
  raise RuntimeError(rf"{ticket.text}")
11
16
 
17
+ if verbose:
18
+ logging.info("Ticket status: OK")
19
+ logging.info(f"Ticket ID: {ticket.json()['id']}")
20
+
12
21
  status = "STARTED"
13
22
  sleep_time = 0.05
23
+
14
24
  while status in ["PENDING", "STARTED", "RETRY"]:
25
+ # Exponential backoff
15
26
  sleep_time = min(sleep_time * 2, 10)
27
+ if verbose:
28
+ logging.info("Sleeping for %s seconds", sleep_time)
16
29
  sleep(sleep_time)
17
- response = client.call_endpoint(
30
+
31
+ # Get the status of the ticket
32
+ if verbose:
33
+ logging.info("Polling ticket status")
34
+ status_response = client.call_endpoint(
18
35
  "PileCore", "/get-task-status", schema=ticket.json(), return_response=True
19
36
  )
20
- if response.status_code != 200:
21
- raise RuntimeError(rf"{response.text}")
22
- status = response.json()["state"]
23
37
 
24
- if status == "FAILURE":
25
- raise RuntimeError(
26
- f'Status: {response.json()["msg"]}. {response.json()["msg"]}'
27
- )
38
+ # Check if the status response is OK
39
+ if status_response.status_code != 200:
40
+ raise RuntimeError(rf"{status_response.text}")
28
41
 
42
+ status = status_response.json()["state"]
43
+ if verbose:
44
+ logging.info("Ticket status: %s", status)
29
45
 
30
- def get_multi_cpt_api_result(client: NucleiClient, payload: dict) -> dict:
46
+ # If the status is FAILURE, raise an error
47
+ if status == "FAILURE":
48
+ # Get the task-status failure message
49
+ failure_message = status_response.json()["msg"]
50
+
51
+ # Try to get the task-result failure message
52
+ try:
53
+ result_response = client.call_endpoint(
54
+ "PileCore",
55
+ "/get-task-result",
56
+ schema=ticket.json(),
57
+ return_response=True,
58
+ )
59
+ failure_message = result_response.text
60
+
61
+ # Raise the obtained failure message
62
+ finally:
63
+ raise RuntimeError(failure_message)
64
+
65
+
66
+ def get_multi_cpt_api_result(
67
+ client: NucleiClient, payload: dict, verbose: bool = False
68
+ ) -> dict:
31
69
  """
32
70
  Wrapper around the PileCore endpoint "/compression/multiple-cpts/results".
33
71
 
@@ -37,6 +75,8 @@ def get_multi_cpt_api_result(client: NucleiClient, payload: dict) -> dict:
37
75
  client object created by [nuclei](https://github.com/cemsbv/nuclei)
38
76
  payload: dict
39
77
  the payload of the request, can be created by calling `create_grouper_payload()`
78
+ verbose: bool
79
+ if True, print additional information to the console
40
80
  """
41
81
  logging.info(
42
82
  "Calculating bearing capacities... \n"
@@ -49,12 +89,14 @@ def get_multi_cpt_api_result(client: NucleiClient, payload: dict) -> dict:
49
89
  return_response=True,
50
90
  )
51
91
 
52
- wait_until_ticket_is_ready(client=client, ticket=ticket)
92
+ wait_until_ticket_is_ready(client=client, ticket=ticket, verbose=verbose)
53
93
 
54
94
  return client.call_endpoint("PileCore", "/get-task-result", schema=ticket.json())
55
95
 
56
96
 
57
- def get_multi_cpt_api_report(client: NucleiClient, payload: dict) -> dict:
97
+ def get_multi_cpt_api_report(
98
+ client: NucleiClient, payload: dict, verbose: bool = False
99
+ ) -> dict:
58
100
  """
59
101
  Wrapper around the PileCore endpoint "/compression/multiple-cpts/report".
60
102
 
@@ -64,6 +106,8 @@ def get_multi_cpt_api_report(client: NucleiClient, payload: dict) -> dict:
64
106
  client object created by [nuclei](https://github.com/cemsbv/nuclei)
65
107
  payload: dict
66
108
  the payload of the request, can be created by calling `create_grouper_payload()`
109
+ verbose: bool
110
+ if True, print additional information to the console
67
111
  """
68
112
  logging.info(
69
113
  "Generate report... \n"
@@ -75,12 +119,14 @@ def get_multi_cpt_api_report(client: NucleiClient, payload: dict) -> dict:
75
119
  schema=payload,
76
120
  return_response=True,
77
121
  )
78
- wait_until_ticket_is_ready(client=client, ticket=ticket)
122
+ wait_until_ticket_is_ready(client=client, ticket=ticket, verbose=verbose)
79
123
 
80
124
  return client.call_endpoint("PileCore", "/get-task-result", schema=ticket.json())
81
125
 
82
126
 
83
- def get_groups_api_result(client: NucleiClient, payload: dict) -> dict:
127
+ def get_groups_api_result(
128
+ client: NucleiClient, payload: dict, verbose: bool = False
129
+ ) -> dict:
84
130
  """
85
131
  Wrapper around the PileCore endpoint "/grouper/group_cpts".
86
132
 
@@ -90,6 +136,8 @@ def get_groups_api_result(client: NucleiClient, payload: dict) -> dict:
90
136
  client object created by [nuclei](https://github.com/cemsbv/nuclei)
91
137
  payload: dict
92
138
  the payload of the request, can be created by calling `create_grouper_payload()`
139
+ verbose: bool
140
+ if True, print additional information to the console
93
141
  """
94
142
  logging.info(
95
143
  "Finding groups... \n"
@@ -102,12 +150,14 @@ def get_groups_api_result(client: NucleiClient, payload: dict) -> dict:
102
150
  return_response=True,
103
151
  )
104
152
 
105
- wait_until_ticket_is_ready(client=client, ticket=ticket)
153
+ wait_until_ticket_is_ready(client=client, ticket=ticket, verbose=verbose)
106
154
 
107
155
  return client.call_endpoint("PileCore", "/get-task-result", schema=ticket.json())
108
156
 
109
157
 
110
- def get_optimize_groups_api_result(client: NucleiClient, payload: dict) -> dict:
158
+ def get_optimize_groups_api_result(
159
+ client: NucleiClient, payload: dict, verbose: bool = False
160
+ ) -> dict:
111
161
  """
112
162
  Wrapper around the PileCore endpoint "/grouper/optimize_groups".
113
163
 
@@ -117,6 +167,8 @@ def get_optimize_groups_api_result(client: NucleiClient, payload: dict) -> dict:
117
167
  client object created by [nuclei](https://github.com/cemsbv/nuclei)
118
168
  payload: dict
119
169
  the payload of the request, can be created by calling `create_grouper_payload()`
170
+ verbose: bool
171
+ if True, print additional information to the console
120
172
  """
121
173
  logging.info(
122
174
  "Optimize groups... \n"
@@ -129,12 +181,14 @@ def get_optimize_groups_api_result(client: NucleiClient, payload: dict) -> dict:
129
181
  return_response=True,
130
182
  )
131
183
 
132
- wait_until_ticket_is_ready(client=client, ticket=ticket)
184
+ wait_until_ticket_is_ready(client=client, ticket=ticket, verbose=verbose)
133
185
 
134
186
  return client.call_endpoint("PileCore", "/get-task-result", schema=ticket.json())
135
187
 
136
188
 
137
- def get_groups_api_report(client: NucleiClient, payload: dict) -> bytes:
189
+ def get_groups_api_report(
190
+ client: NucleiClient, payload: dict, verbose: bool = False
191
+ ) -> bytes:
138
192
  """
139
193
  Wrapper around the PileCore endpoint "/grouper/generate_grouper_report".
140
194
 
@@ -144,6 +198,8 @@ def get_groups_api_report(client: NucleiClient, payload: dict) -> bytes:
144
198
  client object created by [nuclei](https://github.com/cemsbv/nuclei)
145
199
  payload: dict
146
200
  the payload of the request, can be created by calling `create_grouper_report_payload()`
201
+ verbose: bool
202
+ if True, print additional information to the console
147
203
  """
148
204
  logging.info(
149
205
  "Generate report... \n"
@@ -156,6 +212,6 @@ def get_groups_api_report(client: NucleiClient, payload: dict) -> bytes:
156
212
  return_response=True,
157
213
  )
158
214
 
159
- wait_until_ticket_is_ready(client=client, ticket=ticket)
215
+ wait_until_ticket_is_ready(client=client, ticket=ticket, verbose=verbose)
160
216
 
161
217
  return client.call_endpoint("PileCore", "/get-task-result", schema=ticket.json())
@@ -43,7 +43,7 @@ def create_grouper_payload(
43
43
  "/grouper/group_cpts"
44
44
 
45
45
 
46
- Notes
46
+ Note
47
47
  ------
48
48
  The grouper uses pile bearing capacity results calculated by PileCore or other software to
49
49
  form subgroups of the total group of CPT’s belonging to this project.
@@ -56,7 +56,6 @@ def create_grouper_payload(
56
56
  - is spatially coherent, which means there are no other CPTs in between the members
57
57
  of the subgroup. (Spatial check)
58
58
 
59
-
60
59
  Additionally, centre to centre validation (include_centre_to_centre_check; NEN9997-1 3.2.3) can be
61
60
  added to the cluster method. This check adds restrictions to the maximum allowable R;c;cal outliers
62
61
  and makes sure that the suitable data density requirements for the subgroup are met, by checking the
@@ -344,7 +344,7 @@ def create_multi_cpt_payload(
344
344
  pile_head_level_nap=pile_head_level_nap,
345
345
  stiff_construction=stiff_construction,
346
346
  rel_pile_load=relative_pile_load,
347
- soil_load=soil_load_sls,
347
+ soil_load=soil_load_sls if soil_load_sls is not None else 0.0,
348
348
  excavation_param_t=excavation_param_t,
349
349
  use_almere_rules=use_almere_rules,
350
350
  gamma_f_nk=gamma_f_nk,
@@ -29,8 +29,9 @@ def create_pile_properties_payload(
29
29
  Creates a dictionary with the `pile_properties` payload content for the PileCore
30
30
  endpoints.
31
31
 
32
- Note that
33
- the dictionary should be converted to a jsonifyable message before it can be passed
32
+ Note
33
+ ----
34
+ The dictionary should be converted to a jsonifyable message before it can be passed
34
35
  to a `requests` call directly, for instance with
35
36
  `nuclei.client.utils.python_types_to_message()`.
36
37
 
@@ -35,7 +35,7 @@ def create_soil_properties_payload(
35
35
  Creates a dictionary with the `soil_properties` payload content for the PileCore
36
36
  endpoints.
37
37
 
38
- Notes
38
+ Note
39
39
  ------
40
40
  the dictionary should be converted to a jsonifyable message before it can be passed
41
41
  to a `requests` call directly, for instance with
@@ -149,7 +149,7 @@ def create_soil_properties_payload(
149
149
  else cpt.delivered_vertical_position_offset - 1,
150
150
  coordinates=dict(x=cpt.delivered_location.x, y=cpt.delivered_location.y),
151
151
  )
152
-
152
+
153
153
  # Optionally add cpt-specific friction-range parameters
154
154
  if (
155
155
  individual_negative_friction_range_nap is not None